CvGame::ReviveActivePlayer()
- Defined in
- CvGame.cpp, line 4310
- Class
- CvGame
- Hook name
CivHooks::CvGame_ReviveActivePlayer
Hooks
static bool BeforeCvGame_ReviveActivePlayer(CvGame* self);static void AfterCvGame_ReviveActivePlayer(CvGame* self);static void ReplaceCvGame_ReviveActivePlayer(void (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_ReviveActivePlayer>(host, &BeforeCvGame_ReviveActivePlayer);CivRegisterAfter<CivHooks::CvGame_ReviveActivePlayer>(host, &AfterCvGame_ReviveActivePlayer);CivRegisterReplace<CivHooks::CvGame_ReviveActivePlayer>(host, &ReplaceCvGame_ReviveActivePlayer);
Code
4309/// Return control to the user after an autoplay4310void CvGame::ReviveActivePlayer()4311{4312 if(!(GET_PLAYER(getActivePlayer()).isAlive()))4313 {4314 setAIAutoPlay(0, m_eAIAutoPlayReturnPlayer);43154316 // If no player specified, returning as an observer4317 if(m_eAIAutoPlayReturnPlayer == NO_PLAYER)4318 {4319 CvPreGame::setSlotClaim(getActivePlayer(), SLOTCLAIM_ASSIGNED);4320 CvPreGame::setSlotStatus(getActivePlayer(), SS_OBSERVER);4321 }43224323 // Want to return as a specific player4324 else4325 {4326 // Reset observer slot4327 CvPreGame::setSlotClaim(getActivePlayer(), SLOTCLAIM_UNASSIGNED);4328 CvPreGame::setSlotStatus(getActivePlayer(), SS_OBSERVER);43294330 // Move the active player to the desired slot4331 CvPreGame::setSlotStatus(m_eAIAutoPlayReturnPlayer, SS_TAKEN);4332 setActivePlayer(m_eAIAutoPlayReturnPlayer, false /*bForceHotSeat*/, true /*bAutoplaySwitch*/);4333 }4334 }4335}