Follow up to ba9314cba590f831c88b7a6a69afb62f4d51fe59
* Now mob_get_spawn does not add empty vectors to mob_spawn_data, when the mobid does not exist in mob_spawn_data * Saves a bit more memory space * Thanks to @Lemongrass3110 for the suggestion
This commit is contained in:
parent
ba9314cba5
commit
e148bd3a63
@ -3129,12 +3129,15 @@ int mob_random_class(int *value, size_t count)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SpawnInfos of the mob_db entry
|
||||
* Returns the SpawnInfos of the mob_db entry (mob_spawn_data[mobid])
|
||||
* if mobid is not in mob_spawn_data returns empty spawn_info vector
|
||||
*/
|
||||
const std::vector<spawn_info> mob_db::get_spawns() const
|
||||
{
|
||||
// Returns an empty std::vector<spawn_info> if mob_id is not in mob_spawn_data
|
||||
return mob_spawn_data[this->get_mobid()];
|
||||
auto mob_spawn_it = mob_spawn_data.find(this->get_mobid());
|
||||
if ( mob_spawn_it != mob_spawn_data.end() )
|
||||
return mob_spawn_it->second;
|
||||
return std::vector<spawn_info>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user