CvGame::ActivateObserverSlot()
- Defined in
- CvGame.cpp, line 4366
- Class
- CvGame
- Hook name
CivHooks::CvGame_ActivateObserverSlot
Hooks
static bool BeforeCvGame_ActivateObserverSlot(CvGame* self);static void AfterCvGame_ActivateObserverSlot(CvGame* self);static void ReplaceCvGame_ActivateObserverSlot(void (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_ActivateObserverSlot>(host, &BeforeCvGame_ActivateObserverSlot);CivRegisterAfter<CivHooks::CvGame_ActivateObserverSlot>(host, &AfterCvGame_ActivateObserverSlot);CivRegisterReplace<CivHooks::CvGame_ActivateObserverSlot>(host, &ReplaceCvGame_ActivateObserverSlot);
Code
4365/// Turn on the observer slot (for use by the human to watch autoplays)4366void CvGame::ActivateObserverSlot()4367{4368 for(int iI = 0; iI < MAX_MAJOR_CIVS; iI++)4369 {4370 if(CvPreGame::slotStatus((PlayerTypes)iI) == SS_OBSERVER && (CvPreGame::slotClaim((PlayerTypes)iI) == SLOTCLAIM_UNASSIGNED || CvPreGame::slotClaim((PlayerTypes)iI) == SLOTCLAIM_RESERVED))4371 {4372 // Set current active player to a computer player4373 CvPreGame::setSlotStatus(CvPreGame::activePlayer(), SS_COMPUTER);43744375 // Move the active player to the observer slot4376 CvPreGame::setSlotClaim((PlayerTypes)iI, SLOTCLAIM_ASSIGNED);4377// CvPreGame::setActivePlayer((PlayerTypes)iI);4378 setActivePlayer((PlayerTypes)iI, false /*bForceHotSeat*/, true /*bAutoplaySwitch*/);43794380 break;4381 }4382 }4383}