1
This commit is contained in:
parent
532838ebca
commit
39b4def85c
@ -355,26 +355,31 @@ void Room::CreateThings()
|
|||||||
{
|
{
|
||||||
map_tpl_name = map_meta->RandTemplate();
|
map_tpl_name = map_meta->RandTemplate();
|
||||||
std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name);
|
std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name);
|
||||||
|
std::vector<MetaData::MapTplThing*> spawn_points;
|
||||||
if (things) {
|
if (things) {
|
||||||
for (auto& thing_tpl : *things) {
|
for (auto& thing_tpl : *things) {
|
||||||
if (thing_tpl.i->weight() >= rand() % 10000) {
|
switch (thing_tpl.i->_object_type()) {
|
||||||
switch (thing_tpl.i->_object_type()) {
|
case kMOT_Object:
|
||||||
case kMOT_Object:
|
{
|
||||||
{
|
if (thing_tpl.i->weight() >= rand() % 10000) {
|
||||||
CreateMapObject(thing_tpl);
|
CreateMapObject(thing_tpl);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case kMOT_SpawnPoint:
|
|
||||||
{
|
|
||||||
CreateMapSpawnPoint(thing_tpl);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case kMOT_SpawnPoint:
|
||||||
|
{
|
||||||
|
spawn_points.push_back(&thing_tpl);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::random_shuffle(spawn_points.begin(), spawn_points.end());
|
||||||
|
for (auto& thing_tpl : spawn_points) {
|
||||||
|
CreateMapSpawnPoint(*thing_tpl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::DropItem(a8::Vec2 pos, int item_id, int item_count, int item_lv)
|
void Room::DropItem(a8::Vec2 pos, int item_id, int item_count, int item_lv)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user