This commit is contained in:
aozhiwei 2019-08-28 14:14:20 +08:00
parent b8a837e126
commit a8534e4aeb

View File

@ -335,13 +335,24 @@ void Room::CreateThings()
if (thing_tpl.i->weight() >= rand() % 10000) {
int thing_id = thing_tpl.RandThing();
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(thing_id);
assert(thing_meta);
if (thing_meta) {
if (thing_meta->i->is_house()) {
CreateBuilding(thing_id, thing_tpl.i->x(), thing_tpl.i->y());
} else {
CreateObstacle(thing_id, thing_tpl.i->x(), thing_tpl.i->y());
}
} else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(thing_id);
if (equip_meta) {
CreateLoot(equip_meta->i->id(),
a8::Vec2(
thing_tpl.i->x(),
thing_tpl.i->y()
),
1,
1
);
}
}
}
}