1
This commit is contained in:
parent
532838ebca
commit
39b4def85c
@ -355,18 +355,20 @@ 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;
|
break;
|
||||||
case kMOT_SpawnPoint:
|
case kMOT_SpawnPoint:
|
||||||
{
|
{
|
||||||
CreateMapSpawnPoint(thing_tpl);
|
spawn_points.push_back(&thing_tpl);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -374,6 +376,9 @@ void Room::CreateThings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::random_shuffle(spawn_points.begin(), spawn_points.end());
|
||||||
|
for (auto& thing_tpl : spawn_points) {
|
||||||
|
CreateMapSpawnPoint(*thing_tpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user