This commit is contained in:
aozhiwei 2023-05-25 17:25:29 +08:00
parent 988a130204
commit f39707b7ee
4 changed files with 39 additions and 22 deletions

View File

@ -242,28 +242,26 @@ namespace mt
auto group = root.At("group"); auto group = root.At("group");
for (int i = 0; i < group->Size(); ++i) { for (int i = 0; i < group->Size(); ++i) {
auto group_obj = group->At(i); auto group_obj = group->At(i);
for (int ii = 0; ii < group_obj->Size(); ++ii) { std::vector<std::string> keys;
std::vector<std::string> keys; group_obj->GetKeys(keys);
group_obj->GetKeys(keys); for (auto key : keys) {
for (auto key : keys) { int ikey = a8::XValue(key);
int ikey = a8::XValue(key); if (_group_world_objects.find(ikey) != _group_world_objects.end()) {
if (_group_world_objects.find(ikey) != _group_world_objects.end()) { abort();
abort();
}
std::vector<std::shared_ptr<WorldObject>> objects;
auto items = group_obj->At(key);
for (int iii = 0; iii < items->Size(); ++iii) {
auto item_obj = items->At(iii);
auto obj = std::make_shared<WorldObject>();
{
obj->pos.x = item_obj->At("x")->AsXValue().GetDouble();
obj->pos.y = item_obj->At("y")->AsXValue().GetDouble();
obj->pos.z = item_obj->At("z")->AsXValue().GetDouble();
}
objects.push_back(obj);
}
_group_world_objects[ikey] = objects;
} }
std::vector<std::shared_ptr<WorldObject>> objects;
auto items = group_obj->At(key);
for (int iii = 0; iii < items->Size(); ++iii) {
auto item_obj = items->At(iii);
auto obj = std::make_shared<WorldObject>();
{
obj->pos.x = item_obj->At("x")->AsXValue().GetDouble();
obj->pos.y = item_obj->At("y")->AsXValue().GetDouble();
obj->pos.z = item_obj->At("z")->AsXValue().GetDouble();
}
objects.push_back(obj);
}
_group_world_objects[ikey] = objects;
} }
} }
} }

View File

@ -838,7 +838,7 @@ namespace mtb
{ {
a8::reflect::Class* meta_class = nullptr; a8::reflect::Class* meta_class = nullptr;
if (!meta_class) { if (!meta_class) {
meta_class = new a8::reflect::Class("MapThingGroup", 3, 0); meta_class = new a8::reflect::Class("MapThingGroup", 4, 0);
meta_class->SetSimpleField(0, "mtGroupId", a8::reflect::ET_INT32, my_offsetof2(MapThingGroup, mtGroupId_)); meta_class->SetSimpleField(0, "mtGroupId", a8::reflect::ET_INT32, my_offsetof2(MapThingGroup, mtGroupId_));
meta_class->SetSimpleField(1, "rule", a8::reflect::ET_STRING, my_offsetof2(MapThingGroup, rule_)); meta_class->SetSimpleField(1, "rule", a8::reflect::ET_STRING, my_offsetof2(MapThingGroup, rule_));
meta_class->SetSimpleField(2, "mapThings", a8::reflect::ET_STRING, my_offsetof2(MapThingGroup, mapThings_)); meta_class->SetSimpleField(2, "mapThings", a8::reflect::ET_STRING, my_offsetof2(MapThingGroup, mapThings_));

View File

@ -3719,7 +3719,20 @@ void Room::CreateWorldObjects()
} }
} }
if (born_point_hash_.size() < 10) { if (born_point_hash_.size() < 10) {
#if 1
while (born_point_hash_.size() < 10) {
int uniid = AllocUniid();
std::shared_ptr<BornPoint> born_point = std::make_shared<BornPoint>();
std::shared_ptr<mt::WorldObject> wo_meta = std::make_shared<mt::WorldObject>();
wo_meta->pos.x = (60 + rand() % ((int)GetMapMeta()->map_width() - 100));
wo_meta->pos.y = 6.250846862793;
wo_meta->pos.z = (60 + rand() % ((int)GetMapMeta()->map_height() - 100));
born_point->wo_meta = wo_meta;
born_point_hash_[uniid] = born_point;
}
#else
abort(); abort();
#endif
} }
} }

View File

@ -7,6 +7,9 @@
SandTable::SandTable(Room* room): room_(room) SandTable::SandTable(Room* room): room_(room)
{ {
if (room_->IsNewBieRoom()) {
return;
}
room->OpenRoomSwitch(kRoomSwitchDisableUseSkill); room->OpenRoomSwitch(kRoomSwitchDisableUseSkill);
room->OpenRoomSwitch(kRoomSwitchDisableUseItem); room->OpenRoomSwitch(kRoomSwitchDisableUseItem);
room->OpenRoomSwitch(kRoomSwitchDisableShot); room->OpenRoomSwitch(kRoomSwitchDisableShot);
@ -26,6 +29,9 @@ SandTable::SandTable(Room* room): room_(room)
void SandTable::OnGameStart() void SandTable::OnGameStart()
{ {
if (room_->IsNewBieRoom()) {
return;
}
room_->OpenRoomSwitch(kRoomSwitchDisableMove); room_->OpenRoomSwitch(kRoomSwitchDisableMove);
room_->OpenRoomSwitch(kRoomSwitchDisableUseSkill); room_->OpenRoomSwitch(kRoomSwitchDisableUseSkill);
room_->OpenRoomSwitch(kRoomSwitchDisableUseItem); room_->OpenRoomSwitch(kRoomSwitchDisableUseItem);