Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Spawn::idle(int32_t t)
- {
- SpawnedMap::iterator it;
- for(it = spawnedmap.begin(); it != spawnedmap.end();)
- {
- if (it->second->isRemoved == true /*it->second->health <= 0*/)
- {
- if(it->first != 0)
- {
- spawnmap[it->first].lastspawn = OTSYS_TIME();
- }
- it->second->releaseThing();
- //delete it->second;
- spawnedmap.erase(it++);
- }
- else if(!isInSpawnRange(it->second->pos) && it->first != 0)
- {
- spawnedmap.insert(spawned_pair(0, it->second));
- spawnedmap.erase(it++);
- }
- else
- ++it; // LINIA 445 CRASH
- }
- for(SpawnMap::iterator sit = spawnmap.begin(); sit != spawnmap.end(); ++sit)
- {
- if(spawnedmap.count(sit->first) == 0)
- {
- if((OTSYS_TIME() - sit->second.lastspawn) >= sit->second.spawntime)
- {
- SpectatorVec list;
- SpectatorVec::iterator it;
- //game->getSpectators(Range(sit->second.pos, false), list); // bylo true FIX
- game->getSpectators(Range(sit->second.pos, false), list, true, false);
- bool playerFound = false;
- for(it = list.begin(); it != list.end(); ++it)
- {
- Player *player = dynamic_cast<Player*>(*it);
- if(player && player->access < g_config.ACCESS_PROTECT)
- {
- playerFound = true;
- break;
- }
- }
- if(playerFound)
- {
- sit->second.lastspawn = OTSYS_TIME();
- continue;
- }
- respawn(sit->first, sit->second.pos, sit->second.name, sit->second.dir);
- }
- }
- }
- }
- void SpawnManager::checkSpawns(int32_t t)
- {
- for(spawnsList::iterator it = spawns.begin(); it != spawns.end(); ++it)
- {
- (*it)->idle(t);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement