bool Game::placeCreature(Creature* creature, const Position& pos, bool extendedPos /*=false*/, bool forced /*= false*/)
{
if(!internalPlaceCreature(creature, pos, extendedPos, forced)){
return false;
}
SpectatorVec list;
SpectatorVec::iterator it;
getSpectators(list, creature->getPosition(), false, true);
//send to client
Player* tmpPlayer = NULL;
for(it = list.begin(); it != list.end(); ++it) {
if((tmpPlayer = (*it)->getPlayer())){
tmpPlayer->sendCreatureAppear(creature, true);
}
}
//event method
for(it = list.begin(); it != list.end(); ++it) {
(*it)->onCreatureAppear(creature, true);
}
int32_t newStackPos = creature->getParent()->__getIndexOfThing(creature);
creature->getParent()->postAddNotification(creature, newStackPos);
addCreatureCheck(creature);
checkPlayersRecord();
Player* player = creature->getPlayer();
if (player) {
player->setStatus(PLAYERSTATUS_ONLINE);
IOPlayer::instance()->updatePlayerStatus(player);
}
creature->onPlacedCreature();
return true;
}