a guest Dec 11th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- void ProtocolGame::checkCreatureAsKnown(uint32_t id, bool& known, uint32_t& removedKnown)
- // loop through the known creature list and check if the given creature is in
- for(std::list<uint32_t>::iterator it = knownCreatureList.begin(); it != knownCreatureList.end(); ++it)
- if((*it) != id)
- // know... make the creature even more known...
- known = true;
- // ok, he is unknown...
- known = false;
- // ... but not in future
- // too many known creatures?
- if(knownCreatureList.size() > 250)
- // lets try to remove one from the end of the list
- Creature* c = NULL;
- for(int32_t n = 0; n < 250; n++)
- removedKnown = knownCreatureList.front();
- if(!(c = g_game.getCreatureByID(removedKnown)) || !canSee(c))
- // this creature we can't remove, still in sight, so back to the end
- // hopefully we found someone to remove :S, we got only 250 tries
- // if not... lets kick some players with debug errors :)
- else // we can cache without problems :)
- removedKnown = 0;
RAW Paste Data