• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help with this function (C++) - cleanTile()

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,619
Solutions
6
Reaction score
539
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
How to make the code do not delete the items, corpses loaded directly from the map?
Only delete the items, corpses placed in game

Code:
uint32_t Tile::cleanTile()
{
    uint32_t itemsCleaned = 0;

    if(hasFlag(TILESTATE_HOUSE))
		return itemsCleaned;
	
	if(hasFlag(TILESTATE_PROTECTIONZONE) && !g_config.getBool(ConfigManager::CLEAN_PZ)){
        if(g_game.getGameState() != GAME_STATE_CLOSED || !g_config.getBool(ConfigManager::CLEAN_PZ_SAVE))
            return itemsCleaned;
    }
	
	ItemVector toRemove;
	toRemove.clear();
	
	ItemVector::iterator it = downItems.begin();
	while(it != downItems.end())
	{
        if((*it)->isCleanable())
		{
            toRemove.push_back((*it));
		}
		++it;
	}
	
	it = toRemove.begin();
	while(it != toRemove.end())
	{
		g_game.internalRemoveItem((*it), (*it)->getItemCount());
		++itemsCleaned;
		++it;
	}
	
	return itemsCleaned;
}
 
Back
Top