CRoomItem *CPetRemote::getRoom() const { if (_petControl) { CGameManager *gameManager = _petControl->getGameManager(); if (gameManager) return gameManager->getRoom(); } return nullptr; }
void CPetControl::summonBot(const CString &name, int val) { CGameManager *gameManager = getGameManager(); if (gameManager) { CRoomItem *room = gameManager->getRoom(); if (room) { CSummonBotMsg summonMsg(name, val); summonMsg.execute(room); } } }
int CPetControl::canSummonBot(const CString &name) { // If player is the very same view as the NPC, then it's already present if (isBotInView(name)) return SUMMON_CAN; // Get the room CGameManager *gameManager = getGameManager(); if (!gameManager) return SUMMON_CANT; CRoomItem *room = gameManager->getRoom(); if (!room) return SUMMON_CANT; // Query current room to see whether the bot can be summoned to it CSummonBotQueryMsg queryMsg(name); return queryMsg.execute(room) ? SUMMON_CAN : SUMMON_CANT; }
bool CRemoteGotoGlyph::MouseButtonUpMsg(const Point &pt) { if (!_gfxElement || !_gfxElement->MouseButtonUpMsg(pt)) return false; CPetControl *petControl = getPetControl(); if (petControl) { CGameManager *gameManager = petControl->getGameManager(); if (gameManager) { CRoomItem *room = gameManager->getRoom(); if (room) { CTransportMsg msg(g_vm->_roomNames[_roomIndex], 1, 0); msg.execute(room); } } } return true; }