OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Game Class Reference

#include <C4Game.h>

Collaboration diagram for C4Game:
[legend]

Public Types

enum  InitMode { IM_Normal = 0, IM_Section = 1, IM_ReInit = 2 }
 

Public Member Functions

 C4Game ()
 
 ~C4Game ()
 
void Clear ()
 
void Abort (bool fApproved=false)
 
void Evaluate ()
 
void ShowGameOverDlg ()
 
bool DoKeyboardInput (C4KeyCode vk_code, C4KeyEventType eEventType, bool fAlt, bool fCtrl, bool fShift, bool fRepeated, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
 
bool DoKeyboardInput (C4KeyCodeEx Key, C4KeyEventType eEventType, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
 
void DrawCrewOverheadText (C4TargetFacet &cgo, int32_t iPlayer)
 
void FixRandom (uint64_t iSeed)
 
bool Init ()
 
bool PreInit ()
 
void SetScenarioFilename (const char *)
 
bool HasScenario ()
 
bool Execute ()
 
C4PlayerJoinPlayer (const char *szFilename, int32_t iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo)
 
void OnPlayerJoinFinished ()
 
bool DoGameOver ()
 
bool CanQuickSave ()
 
bool QuickSave (const char *strFilename, const char *strTitle, bool fForceSave=false)
 
void SetInitProgress (float fToProgress)
 
void OnResolutionChanged (unsigned int iXRes, unsigned int iYRes)
 
void OnKeyboardLayoutChanged ()
 
void InitFullscreenComponents (bool fRunning)
 
bool ToggleChat ()
 
bool TogglePause ()
 
bool Pause ()
 
bool Unpause ()
 
bool IsPaused ()
 
void Synchronize (bool fSavePlayerFiles)
 
void SyncClearance ()
 
bool DropFile (const char *szFilename, float iX, float iY)
 
bool DropDef (C4ID id, float iX, float iY)
 
bool ReloadFile (const char *szPath)
 
bool ReloadDef (C4ID id)
 
bool ReloadParticle (const char *szName)
 
void ClearPointers (C4Object *cobj)
 
C4ObjectCreateObject (C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
 
C4ObjectCreateObject (C4ID type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
 
C4ObjectCreateObjectConstruction (C4PropList *type, C4Object *pCreator, int32_t owner, int32_t ctx=0, int32_t bty=0, int32_t con=1, bool terrain=false)
 
C4ObjectCreateInfoObject (C4ObjectInfo *cinf, int32_t owner, int32_t tx=50, int32_t ty=50)
 
C4ObjectFindConstuctionSiteBlock (int32_t tx, int32_t ty, int32_t wdt, int32_t hgt)
 
C4ObjectFindObject (C4Def *pDef, int32_t iX=0, int32_t iY=0, int32_t iWdt=0, int32_t iHgt=0, DWORD ocf=OCF_All, C4Object *pFindNext=nullptr)
 
C4ObjectFindVisObject (float tx, float ty, int32_t iPlr, const C4Facet &fctViewportGame, const C4Facet &fctViewportGUI, float iX, float iY, DWORD category, float gui_x, float gui_y)
 
int32_t ObjectCount (C4ID id)
 
void CastObjects (C4ID id, C4Object *pCreator, int32_t num, int32_t level, int32_t tx, int32_t ty, int32_t iOwner=NO_OWNER, int32_t iController=NO_OWNER, C4ValueArray *out_objects=nullptr)
 
C4ObjectPlaceVegetation (C4PropList *def, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iGrowth, C4PropList *shape_proplist, C4PropList *out_pos_proplist)
 
C4ObjectPlaceAnimal (C4PropList *def)
 
C4Value GRBroadcast (const char *szFunction, C4AulParSet *pPars=0, bool fPassError=false, bool fRejectTest=false)
 
bool LoadScenarioSection (const char *szSection, DWORD dwFlags)
 
bool CreateSectionFromTempFile (const char *section_name, const char *temp_filename)
 
bool DrawTextSpecImage (C4Facet &fctTarget, const char *szSpec, class C4DrawTransform *pTransform, uint32_t dwClr=0xff)
 
float GetTextSpecImageAspect (const char *szSpec)
 
bool DrawPropListSpecImage (C4Facet &fctTarget, C4PropList *pSpec)
 
bool SpeedUp ()
 
bool SlowDown ()
 
bool InitKeyboard ()
 
void UpdateLanguage ()
 
bool InitPlayerControlSettings ()
 
bool InitPlayerControlUserSettings ()
 
void SetDefaultGamma ()
 
bool LoadAdditionalSystemGroup (class C4Group &parent_group)
 
bool SaveGameTitle (C4Group &hGroup)
 
void CompileFunc (StdCompiler *pComp, CompileSettings comp, C4ValueNumbers *)
 
bool SaveData (C4Group &hGroup, bool fSaveSection, bool fSaveExact, bool fSaveSync, C4ValueNumbers *)
 
bool ToggleChart ()
 
void SetGlobalSoundModifier (C4PropList *modifier_props)
 

Public Attributes

C4GameParametersParameters
 
class C4ScenarioParametersStartupScenarioParameters
 
C4ClientListClients
 
C4TeamListTeams
 
C4PlayerInfoListPlayerInfos
 
C4PlayerInfoListRestorePlayerInfos
 
C4RoundResultsRoundResults
 
C4Scenario C4S
 
class C4ScenarioParameterDefsScenarioParameterDefs
 
C4ComponentHost Info
 
C4ComponentHost Title
 
C4ComponentHost Names
 
C4ComponentHost GameText
 
C4LangStringTable MainSysLangStringTable
 
C4LangStringTable ScenarioLangStringTable
 
StdStrBuf PlayerNames
 
C4ControlInput
 
C4PathFinder PathFinder
 
C4TransferZones TransferZones
 
C4Group ScenarioFile
 
C4GroupSet GroupSet
 
C4GrouppParentGroup
 
C4Extra Extra
 
class C4ScenarioObjectsScriptHostpScenarioObjectsScript
 
C4ScenarioSectionpScenarioSections
 
C4ScenarioSectionpCurrentScenarioSection
 
C4PlayerControlDefs PlayerControlDefs
 
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
 
C4PlayerControlAssignmentSets PlayerControlDefaultAssignmentSets
 
C4Scoreboard Scoreboard
 
std::unique_ptr< C4Network2StatspNetworkStatistics
 
C4KeyboardInputKeyboardInput
 
std::unique_ptr< C4FileMonitorpFileMonitor
 
std::unique_ptr< C4GameSec1TimerpSec1Timer
 
C4ValueGlobalSoundModifier
 
char CurrentScenarioSection [C4MaxName+1]
 
char ScenarioFilename [_MAX_PATH+1]
 
StdCopyStrBuf ScenarioTitle
 
char PlayerFilenames [20 *_MAX_PATH+1]
 
char DefinitionFilenames [20 *_MAX_PATH+1]
 
char DirectJoinAddress [_MAX_PATH+1]
 
char DirectJoinTempFilename [_MAX_PATH+1]
 
std::unique_ptr
< C4Network2Reference
pJoinReference
 
int32_t StartupPlayerCount
 
int32_t StartupTeamCount
 
int32_t FPS
 
int32_t cFPS
 
int32_t HaltCount
 
bool InitialPlayersJoined
 
bool GameOver
 
bool Evaluated
 
bool GameOverDlgShown
 
bool fScriptCreatedObjects
 
bool fLobby
 
int32_t iLobbyTimeout
 
bool fObserve
 
bool fReferenceDefinitionOverride
 
bool NetworkActive
 
bool Record
 
StdStrBuf RecordDumpFile
 
StdStrBuf RecordStream
 
StdStrBuf TempScenarioFile
 
bool fPreinited
 
int32_t FrameCounter
 
int32_t iTick2
 
int32_t iTick3
 
int32_t iTick5
 
int32_t iTick10
 
int32_t iTick35
 
int32_t iTick255
 
int32_t iTick1000
 
bool TimeGo
 
int32_t Time
 
int32_t StartTime
 
int32_t InitProgress
 
int32_t LastInitProgress
 
int32_t LastInitProgressShowTime
 
int32_t RandomSeed
 
bool GameGo
 
bool FullSpeed
 
int32_t FrameSkip
 
bool DoSkipFrame
 
bool fResortAnyObject
 
bool IsRunning
 
bool PointersDenumerated
 
size_t StartupLogPos
 
size_t QuitLogPos
 
bool fQuitWithError
 
bool DebugMode
 
StdCopyStrBuf NextMission
 
StdCopyStrBuf NextMissionText
 
StdCopyStrBuf NextMissionDesc
 
uint16_t DebugPort
 
StdStrBuf DebugPassword
 
StdStrBuf DebugHost
 
int DebugWait
 
std::unique_ptr
< C4ScriptGuiWindow
ScriptGuiRoot
 

Static Public Attributes

static constexpr const char * DirectJoinFilePrefix = "file:"
 

Protected Member Functions

void Default ()
 
void InitInEarth ()
 
void InitVegetation ()
 
void InitAnimals ()
 
void InitGoals ()
 
void InitRules ()
 
void InitValueOverloads ()
 
void InitEnvironment ()
 
void CloseScenario ()
 
void DeleteObjects (bool fDeleteInactive)
 
void ExecObjects ()
 
void Ticks ()
 
bool CheckObjectEnumeration ()
 
bool LoadScenarioComponents ()
 
bool InitGame (C4Group &hGroup, InitMode init_mode, bool fLoadSky, C4ValueNumbers *)
 
bool InitGameFinal (InitMode init_mode)
 
bool InitNetworkFromAddress (const char *szAddress)
 
bool InitNetworkFromReferenceFile (const char *temp_filename)
 
bool InitNetworkFromReference (const C4Network2Reference &Reference)
 
bool InitNetworkHost ()
 
bool InitControl ()
 
bool InitScriptEngine ()
 
bool LinkScriptEngine ()
 
bool ReLinkScriptEngine ()
 
bool InitPlayers (C4ValueNumbers *)
 
bool OpenScenario ()
 
bool InitDefs ()
 
bool InitMaterialTexture ()
 
bool GameOverCheck ()
 
bool PlaceInEarth (C4ID id)
 
bool CompileRuntimeData (C4Group &hGroup, InitMode init_mode, bool exact, bool sync, C4ValueNumbers *)
 
C4ObjectNewObject (C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
 
void ClearObjectPtrs (C4Object *tptr)
 
void ObjectRemovalCheck ()
 
bool ToggleDebugMode ()
 
bool ActivateMenu (const char *szCommand)
 

Detailed Description

Definition at line 34 of file C4Game.h.

Member Enumeration Documentation

Enumerator
IM_Normal 
IM_Section 
IM_ReInit 

Definition at line 38 of file C4Game.h.

39  {
40  IM_Normal = 0,
41  IM_Section = 1,
42  IM_ReInit = 2
43  };

Constructor & Destructor Documentation

C4Game::C4Game ( )

Definition at line 99 of file C4Game.cpp.

References Default().

99  :
100  ScenarioParameterDefs(GameScenarioParameterDefs),
101  Parameters(GameParameters),
102  StartupScenarioParameters(GameStartupScenarioParameters),
107  RoundResults(GameRoundResults),
111  fPreinited(false), StartupLogPos(0), QuitLogPos(0),
112  fQuitWithError(false),
113  GlobalSoundModifier(GameGlobalSoundModifier)
114 {
115  Default();
116 }
C4PlayerInfoList & RestorePlayerInfos
Definition: C4Game.h:74
C4Value & GlobalSoundModifier
Definition: C4Game.h:101
C4ClientList Clients
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:77
C4GameParameters & Parameters
Definition: C4Game.h:69
C4TeamList & Teams
Definition: C4Game.h:72
size_t StartupLogPos
Definition: C4Game.h:143
bool fPreinited
Definition: C4Game.h:129
C4GameControl Control
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:98
C4Control Input
Definition: C4GameControl.h:66
void Default()
Definition: C4Game.cpp:1448
bool fQuitWithError
Definition: C4Game.h:144
C4RoundResults & RoundResults
Definition: C4Game.h:75
C4PlayerInfoList RestorePlayerInfos
C4KeyboardInput & C4KeyboardInput_Init()
C4Control & Input
Definition: C4Game.h:84
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:73
size_t QuitLogPos
Definition: C4Game.h:143
class C4ScenarioParameters & StartupScenarioParameters
Definition: C4Game.h:70
C4PlayerInfoList PlayerInfos
C4ClientList & Clients
Definition: C4Game.h:71
std::unique_ptr< C4GameSec1Timer > pSec1Timer
Definition: C4Game.h:100

Here is the call graph for this function:

C4Game::~C4Game ( )

Definition at line 118 of file C4Game.cpp.

References C4Startup::Unload().

119 {
120  // make sure no startup gfx remain loaded
122 }
static void Unload()
Definition: C4Startup.cpp:303

Here is the call graph for this function:

Member Function Documentation

void C4Game::Abort ( bool  fApproved = false)

Definition at line 3670 of file C4Game.cpp.

References Application, C4GameControl::ClientID(), Control, Game, GameOver, C4PlayerList::GetLocalByIndex(), C4GameControl::isCtrlHost(), C4Network2::isEnabled(), C4GameParameters::isLeague(), Network, Parameters, Players, C4Application::QuitGame(), C4PlayerList::RemoveAtRemoteClient(), C4PlayerList::RemoveLocal(), C4Network2::Vote(), VT_Cancel, and VT_Kick.

Referenced by C4AbortGameDialog::OnClosed().

3671 {
3672  // league needs approval
3673  if (Network.isEnabled() && Parameters.isLeague() && !fApproved)
3674  {
3675  if (Control.isCtrlHost() && !Game.GameOver)
3676  {
3678  return;
3679  }
3681  {
3682  Network.Vote(VT_Kick, true, Control.ClientID());
3683  return;
3684  }
3685  }
3686  // hard-abort: eval league and quit
3687  // manually evaluate league
3688  Players.RemoveLocal(true, true);
3689  Players.RemoveAtRemoteClient(true, true);
3690  // normal quit
3692 }
bool isCtrlHost() const
Definition: C4GameControl.h:99
C4Game Game
Definition: C4Globals.cpp:52
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
void Vote(C4ControlVoteType eType, bool fApprove=true, int32_t iData=0)
bool RemoveLocal(bool fDisonnected, bool fNoCalls)
C4GameParameters & Parameters
Definition: C4Game.h:69
C4Network2 Network
Definition: C4Globals.cpp:53
bool GameOver
Definition: C4Game.h:116
C4GameControl Control
C4PlayerList Players
C4Player * GetLocalByIndex(int iIndex) const
bool isEnabled() const
Definition: C4Network2.h:203
int32_t ClientID() const
bool isLeague() const
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::ActivateMenu ( const char *  szCommand)
protected

Definition at line 3653 of file C4Game.cpp.

References C4MainMenu::ActivateCommand(), C4PlayerList::GetLocalByIndex(), C4GameOverDlg::IsShown(), C4Player::Menu, C4Player::Number, and Players.

3654 {
3655  // no new menu during round evaluation
3656  if (C4GameOverDlg::IsShown()) return false;
3657  // forward to primary player
3659  if (!pPlr) return false;
3660  pPlr->Menu.ActivateCommand(pPlr->Number, szCommand);
3661  return true;
3662 }
C4MainMenu Menu
Definition: C4Player.h:105
int32_t Number
Definition: C4Player.h:88
bool ActivateCommand(int32_t iPlayer, const char *szCommand)
Definition: C4MainMenu.cpp:866
static bool IsShown()
Definition: C4GameOverDlg.h:92
C4PlayerList Players
C4Player * GetLocalByIndex(int iIndex) const

Here is the call graph for this function:

bool C4Game::CanQuickSave ( )

Definition at line 1934 of file C4Game.cpp.

References C4Network2::isEnabled(), C4Network2::isHost(), LoadResStr(), Log(), and Network.

Referenced by C4MainMenu::ActivateSavegame(), and QuickSave().

1935 {
1936  // Network hosts only
1937  if (Network.isEnabled() && !Network.isHost())
1938  { Log(LoadResStr("IDS_GAME_NOCLIENTSAVE")); return false; }
1939 
1940  return true;
1941 }
bool isHost() const
Definition: C4Network2.h:209
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Network2 Network
Definition: C4Globals.cpp:53
bool isEnabled() const
Definition: C4Network2.h:203
bool Log(const char *szMessage)
Definition: C4Log.cpp:195

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CastObjects ( C4ID  id,
C4Object pCreator,
int32_t  num,
int32_t  level,
int32_t  tx,
int32_t  ty,
int32_t  iOwner = NO_OWNER,
int32_t  iController = NO_OWNER,
C4ValueArray out_objects = nullptr 
)

Definition at line 1415 of file C4Game.cpp.

References C4REAL10(), C4VObj(), CreateObject(), C4ValueArray::GetSize(), itofix(), Random(), C4ValueArray::SetSize(), and C4PropList::Status.

Referenced by C4Landscape::P::BlastMaterial2Objects().

1416 {
1417  int32_t cnt, out_obj_size=0;
1418  if (out_objects)
1419  {
1420  out_obj_size = out_objects->GetSize();
1421  out_objects->SetSize(out_obj_size + num);
1422  }
1423  for (cnt=0; cnt<num; cnt++)
1424  {
1425  // Must do these calculation steps separately, because the order of
1426  // invokations of Random() is not defined if they're used as parameters
1427  int32_t angle = Random(360);
1428  C4Real xdir = C4REAL10(Random(2*level+1)-level);
1429  C4Real ydir = C4REAL10(Random(2*level+1)-level);
1430  C4Real rdir = itofix(Random(3)+1);
1431  C4Object *obj = CreateObject(id,pCreator,iOwner,
1432  tx,ty,angle,
1433  false,
1434  xdir,
1435  ydir,
1436  rdir, iController);
1437  if (obj && obj->Status && out_objects) (*out_objects)[out_obj_size+cnt] = C4VObj(obj);
1438  }
1439 }
uint32_t Random()
Definition: C4Random.cpp:43
C4Value C4VObj(C4Object *pObj)
Definition: C4Value.cpp:90
Definition: C4Real.h:58
C4Real C4REAL10(int x)
Definition: C4Real.h:269
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
void SetSize(int32_t inSize)
int32_t Status
Definition: C4PropList.h:170
int32_t GetSize() const
Definition: C4ValueArray.h:36
C4Object * CreateObject(C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
Definition: C4Game.cpp:1076

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::CheckObjectEnumeration ( )
protected

Definition at line 3301 of file C4Game.cpp.

References FormatString(), C4PropList::GetName(), C4Object::GetX(), C4Object::id, LogFatal(), C4PropListNumbered::Number, Objects, C4PropListNumbered::SetEnumerationIndex(), and C4ID::ToString().

Referenced by InitGame().

3302 {
3303 
3304  struct Check
3305  {
3306  int32_t maxNumber;
3307  Check() : maxNumber(0) {}
3308  // Check valid & maximum number & duplicate numbers
3309  bool that(C4Object* cObj)
3310  {
3311  // Invalid number
3312  if (cObj->Number<1)
3313  {
3314  LogFatal(FormatString("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, cObj->id.ToString(), cObj->GetX()).getData()); return false;
3315  }
3316  // Max
3317  if (cObj->Number>maxNumber) maxNumber=cObj->Number;
3318  // Duplicate
3319  for (C4Object *cObj2 : Objects)
3320  if (cObj2!=cObj)
3321  if (cObj->Number==cObj2->Number)
3322  { LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s)",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return false; }
3323  for (C4Object *cObj2 : Objects.InactiveObjects)
3324  if (cObj2!=cObj)
3325  if (cObj->Number==cObj2->Number)
3326  { LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s(i))",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return false; }
3327  return true;
3328  }
3329  };
3330 
3331  Check check;
3332  for (C4Object *cObj : Objects)
3333  {
3334  if (!check.that(cObj))
3335  return false;
3336  }
3337 
3338  for (C4Object *cObj : Objects.InactiveObjects)
3339  {
3340  if (!check.that(cObj))
3341  return false;
3342  }
3343 
3344  // Adjust enumeration index
3345  C4PropListNumbered::SetEnumerationIndex(check.maxNumber);
3346  // Done
3347  return true;
3348 }
C4ID id
Definition: C4Object.h:108
static void SetEnumerationIndex(int32_t iMaxObjectNumber)
Definition: C4PropList.cpp:93
virtual const char * GetName() const
Definition: C4PropList.cpp:626
int32_t GetX() const
Definition: C4Object.h:286
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
const char * ToString() const
Definition: C4Id.h:62
C4GameObjects Objects
Definition: C4Globals.cpp:48
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::Clear ( )

Definition at line 541 of file C4Game.cpp.

References C4AulProfiler::Abort(), Application, C4S, C4ST_SHOWSTAT, C4ComponentHost::Clear(), C4PlayerList::Clear(), C4Weather::Clear(), C4PathFinder::Clear(), C4DefList::Clear(), C4SoundSystem::Clear(), C4GraphicsSystem::Clear(), C4TransferZones::Clear(), C4PXSSystem::Clear(), C4Landscape::Clear(), C4FontLoader::Clear(), C4Scoreboard::Clear(), C4EditCursor::Clear(), C4GroupSet::Clear(), C4TextureMap::Clear(), C4GameMessageList::Clear(), C4ScenarioParameterDefs::Clear(), C4MessageInput::Clear(), C4GameControl::Clear(), C4PlayerControlDefs::Clear(), C4ScenarioParameters::Clear(), C4SoundModifierList::Clear(), C4MouseControl::Clear(), C4AulScriptEngine::Clear(), C4GameParameters::Clear(), C4RoundResults::Clear(), C4GameScriptHost::Clear(), C4MaterialMap::Clear(), C4Scenario::Clear(), C4Network2::Clear(), C4PlayerControlAssignmentSets::Clear(), C4MapScriptHost::Clear(), StdStrBuf::Clear(), C4ParticleSystem::Clear(), C4KeyboardInput::Clear(), StdMeshMatManager::Clear(), C4GUI::Screen::Clear(), C4MusicSystem::ClearGame(), C4PropListNumbered::ClearNumberedPropLists(), C4PropListScript::ClearScriptPropLists(), C4PropListNumbered::ClearShelve(), C4Console::CloseGame(), C4FullScreen::CloseMenu(), CloseScenario(), Console, Control, Default(), DefinitionFilenames, Definitions, DeleteObjects(), DirectJoinAddress, C4Console::EditCursor, Evaluate(), Evaluated, C4MusicSystem::FadeOut(), FontLoader, fPreinited, FullScreen, GameOver, GameScript, GameText, GetLogPos(), GraphicsSystem, GroupSet, C4Language::HasStringTable(), Info, IsRunning, KeyboardInput, Landscape, Languages, LoadResStr(), Log(), MainSysLangStringTable, MapScript, MaterialMap, MeshMaterialManager, MessageInput, Messages, C4SoundSystem::Modifiers, MouseControl, C4Application::MusicSystem, Names, Network, NextMission, NextMissionDesc, NextMissionText, Parameters, Particles, PathFinder, pFileMonitor, pGUI, pJoinReference, PlayerControlDefaultAssignmentSets, PlayerControlDefs, PlayerControlUserAssignmentSets, PlayerFilenames, Players, pNetworkStatistics, PointersDenumerated, pScenarioObjectsScript, PXS, QuitLogPos, RecordDumpFile, RecordStream, C4PropListNumbered::ResetEnumerationIndex(), RoundResults, ScenarioFilename, ScenarioLangStringTable, ScenarioParameterDefs, Scoreboard, ScriptEngine, ScriptGuiRoot, SetGlobalSoundModifier(), C4Application::SoundSystem, StartupScenarioParameters, TextureMap, Title, TransferZones, and Weather.

Referenced by C4Application::Clear(), and C4Application::GameTick().

542 {
543  pFileMonitor.reset();
544  // fade out music
546  // game no longer running
547  IsRunning = false;
548  PointersDenumerated = false;
549 
551  // C4ST_RESET
552 
553  // Evaluation
554  if (GameOver)
555  {
556  if (!Evaluated) Evaluate();
557  }
558 
559  // stop statistics
560  pNetworkStatistics.reset();
562 
563  // next mission (shoud have been transferred to C4Application now if next mission was desired)
565 
566  // Clear control
567  Network.Clear();
568  Control.Clear();
574 
575  // Clear game info
576  Scoreboard.Clear();
577  Players.Clear();
578  Parameters.Clear();
580  C4S.Clear();
583  Info.Clear();
584  Title.Clear();
585  Names.Clear();
586  GameText.Clear();
589 
590 #ifdef WITH_QT_EDITOR
591  // clear console pointers held into script engine
593  ::Console.ClearGamePointers();
594 #endif
595  // notify editor
596  Console.CloseGame();
597 
598  // Clear the particles before cleaning up the objects.
599  Particles.Clear();
600  DeleteObjects(true);
601 
602  // exit gui
603  pGUI->Clear();
604  ScriptGuiRoot.reset();
605 
606  // Clear landscape
607  Weather.Clear();
608  Landscape.Clear();
609  PXS.Clear();
611  TextureMap.Clear(); // texture map *MUST* be cleared after the materials, because of the patterns!
612  PathFinder.Clear();
614 
615  ::Messages.Clear();
617  SetGlobalSoundModifier(nullptr); // must be called before script engine clear
618  Application.SoundSystem.Modifiers.Clear(); // free some prop list pointers
619 
620  // Clear script engine
621  ::MapScript.Clear();
624  C4PropListNumbered::ClearShelve(); // may be nonempty if there was a fatal error during section load
626  pScenarioObjectsScript = nullptr;
627  // delete any remaining prop lists from circular chains
630 
631  // Clear translation tables
634 
635  // Cleanup remaining open scenario files
636  CloseScenario();
637  GroupSet.Clear();
639  Application.SoundSystem.Clear(); // will be re-inited by application pre-init if running from startup system
640 
641  // Clear remaining graphics
642 #ifndef USE_CONSOLE
644 #endif
647 
648  // global fullscreen class is not cleared, because it holds the carrier window
649  // but the menu must be cleared (maybe move Fullscreen.Menu somewhere else?)
651 
652  // Message
653  // avoid double message by not printing it if no restbl is loaded
654  // this would log an "[Undefined]" only, anyway
655  // (could abort the whole clear-procedure here, btw?)
656  if (::Languages.HasStringTable()) Log(LoadResStr("IDS_CNS_GAMECLOSED"));
657 
658  // clear game starting parameters
660 
661  // join reference
662  pJoinReference.reset();
663 
664  // okay, game cleared now. Remember log section
665  QuitLogPos = GetLogPos();
666 
667  fPreinited = false;
669 
670  // FIXME: remove this
671  Default();
672 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4EditCursor EditCursor
Definition: C4Console.h:90
bool IsRunning
Definition: C4Game.h:141
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:104
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:110
StdStrBuf RecordDumpFile
Definition: C4Game.h:126
StdCopyStrBuf NextMission
Definition: C4Game.h:148
C4Console Console
Definition: C4Globals.cpp:45
C4GameScriptHost GameScript
C4LangStringTable MainSysLangStringTable
Definition: C4Game.h:82
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4Scenario C4S
Definition: C4Game.h:76
C4GroupSet GroupSet
Definition: C4Game.h:89
void Clear()
Definition: StdBuf.h:474
C4ParticleSystem Particles
static void ResetEnumerationIndex()
Definition: C4PropList.cpp:99
void Clear()
Definition: C4Scenario.cpp:408
void Clear()
Definition: C4Texture.cpp:176
C4ComponentHost GameText
Definition: C4Game.h:81
bool HasStringTable() const
Definition: C4Language.h:70
static void ClearNumberedPropLists()
Definition: C4PropList.cpp:137
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4TextureMap TextureMap
Definition: C4Texture.cpp:580
C4MessageInput MessageInput
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:92
C4Scoreboard Scoreboard
Definition: C4Game.h:96
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:77
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
C4ComponentHost Names
Definition: C4Game.h:80
C4GameParameters & Parameters
Definition: C4Game.h:69
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
StdCopyStrBuf NextMissionDesc
Definition: C4Game.h:148
C4LangStringTable ScenarioLangStringTable
Definition: C4Game.h:82
C4MapScriptHost MapScript
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
std::unique_ptr< C4FileMonitor > pFileMonitor
Definition: C4Game.h:99
C4SoundModifierList Modifiers
Definition: C4SoundSystem.h:54
void Clear()
Definition: C4Gui.cpp:591
C4Network2 Network
Definition: C4Globals.cpp:53
void Clear()
Definition: C4PXS.cpp:176
bool fPreinited
Definition: C4Game.h:129
bool GameOver
Definition: C4Game.h:116
void Clear()
Definition: C4Weather.cpp:90
C4Language Languages
Definition: C4Language.cpp:45
static void ClearScriptPropLists()
Definition: C4PropList.cpp:207
C4GameControl Control
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:98
C4Landscape Landscape
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
static void ClearShelve()
Definition: C4PropList.cpp:131
C4PlayerList Players
void Default()
Definition: C4Game.cpp:1448
C4TransferZones TransferZones
Definition: C4Game.h:87
StdCopyStrBuf NextMissionText
Definition: C4Game.h:148
void Clear()
Definition: C4Network2.cpp:734
void SetGlobalSoundModifier(C4PropList *modifier_props)
Definition: C4Game.cpp:3877
C4Weather Weather
Definition: C4Weather.cpp:207
C4PXSSystem PXS
Definition: C4PXS.cpp:532
void Clear()
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:94
size_t GetLogPos()
Definition: C4Log.cpp:289
C4RoundResults & RoundResults
Definition: C4Game.h:75
void FadeOut(int fadeout_ms)
void Clear()
Definition: C4GroupSet.cpp:52
size_t QuitLogPos
Definition: C4Game.h:143
bool PointersDenumerated
Definition: C4Game.h:142
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:106
bool Evaluated
Definition: C4Game.h:117
C4FontLoader FontLoader
class C4ScenarioParameters & StartupScenarioParameters
Definition: C4Game.h:70
C4PathFinder PathFinder
Definition: C4Game.h:86
#define C4ST_SHOWSTAT
Definition: C4Stat.h:154
void DeleteObjects(bool fDeleteInactive)
Definition: C4Game.cpp:1053
C4MaterialMap MaterialMap
Definition: C4Material.cpp:970
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
void Clear(bool fClearMapCreator=true, bool fClearSky=true, bool fClearRenderer=true)
StdStrBuf RecordStream
Definition: C4Game.h:127
char DefinitionFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:107
void CloseGame()
Definition: C4Console.cpp:614
C4ComponentHost Info
Definition: C4Game.h:78
C4DefList Definitions
Definition: C4Globals.cpp:49
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:235
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:108
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:97
static void Abort()
Definition: C4AulExec.h:257
C4PlayerControlAssignmentSets PlayerControlDefaultAssignmentSets
Definition: C4Game.h:95
void CloseScenario()
Definition: C4Game.cpp:267
StdMeshMatManager MeshMaterialManager
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
Definition: C4Game.h:95
C4Application Application
Definition: C4Globals.cpp:44
void Evaluate()
Definition: C4Game.cpp:1507
C4ComponentHost Title
Definition: C4Game.h:79
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ClearObjectPtrs ( C4Object tptr)
protected

Definition at line 909 of file C4Game.cpp.

References C4Object::ClearPointers(), and Objects.

Referenced by ClearPointers().

910 {
911  // May not call Objects.ClearPointers() because that would
912  // remove pObj from primary list and pObj is to be kept
913  // until CheckObjectRemoval().
914  for (C4Object *cObj : Objects)
915  {
916  cObj->ClearPointers(pObj);
917  }
918  // check in inactive objects as well
919  for (C4Object *cObj : Objects.InactiveObjects)
920  {
921  cObj->ClearPointers(pObj);
922  }
923 }
void ClearPointers(C4Object *ptr)
Definition: C4Object.cpp:1750
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ClearPointers ( C4Object cobj)

Definition at line 925 of file C4Game.cpp.

References Application, AulExec, ClearObjectPtrs(), C4PlayerList::ClearPointers(), C4SoundSystem::ClearPointers(), C4Console::ClearPointers(), C4TransferZones::ClearPointers(), C4AulExec::ClearPointers(), C4GameMessageList::ClearPointers(), C4Effect::ClearPointers(), C4MouseControl::ClearPointers(), C4ObjectList::ClearPointers(), C4MessageInput::ClearPointers(), C4ViewportList::ClearPointers(), C4Landscape::ClearPointers(), Console, C4GameObjects::ForeObjects, GameScript, Landscape, MessageInput, Messages, MouseControl, Objects, C4AulScriptEngine::pGlobalEffects, Players, C4GameScriptHost::pScenarioEffects, ScriptEngine, ScriptGuiRoot, C4Application::SoundSystem, TransferZones, and Viewports.

Referenced by C4Object::AssignRemoval(), C4ObjectList::DeleteObjects(), LoadScenarioSection(), C4GameObjects::ResortUnsorted(), and C4Object::StatusDeactivate().

926 {
927  ::AulExec.ClearPointers(pObj);
930  ClearObjectPtrs(pObj);
932  ::Players.ClearPointers(pObj);
935  ::Console.ClearPointers(pObj);
937  ScriptGuiRoot->ClearPointers(pObj);
944 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *pObj)
C4Console Console
Definition: C4Globals.cpp:45
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
void ClearPointers(C4Object *pObj)
C4MessageInput MessageInput
C4AulExec AulExec
Definition: C4AulExec.cpp:33
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
C4Landscape Landscape
C4PlayerList Players
C4TransferZones TransferZones
Definition: C4Game.h:87
void ClearPointers(C4Object *pObj)
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
C4ObjectList ForeObjects
Definition: C4GameObjects.h:44
void ClearPointers(C4Object *pObj)
Definition: C4Console.cpp:410
C4Effect * pScenarioEffects
Definition: C4ScriptHost.h:165
void ClearPointers(C4Object *pObj)
Definition: C4Viewport.cpp:959
int ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *)
Definition: C4AulExec.cpp:140
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:235
void ClearObjectPtrs(C4Object *tptr)
Definition: C4Game.cpp:909
void ClearPointers(C4Object *pObj)
void ClearPointers(C4PropList *pObj)
Definition: C4Effect.cpp:191
void ClearPointers(C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44
C4Effect * pGlobalEffects
Definition: C4Aul.h:146
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CloseScenario ( )
protected

Definition at line 267 of file C4Game.cpp.

References StdStrBuf::Clear(), C4Group::Close(), C4GroupSet::CloseFolders(), EraseItem(), StdStrBuf::getData(), GroupSet, pCurrentScenarioSection, pParentGroup, pScenarioSections, ScenarioFile, and TempScenarioFile.

Referenced by Clear().

268 {
269  // close scenario
272  pParentGroup = nullptr;
273  // remove if temporary
274  if (TempScenarioFile)
275  {
278  }
279  // clear scenario section
280  // this removes any temp files, which may yet need to be used by any future features
281  // so better don't do this too early (like, in C4Game::Clear)
283 }
const char * getData() const
Definition: StdBuf.h:450
C4Group * pParentGroup
Definition: C4Game.h:90
StdStrBuf TempScenarioFile
Definition: C4Game.h:128
void Clear()
Definition: StdBuf.h:474
C4GroupSet GroupSet
Definition: C4Game.h:89
C4Group ScenarioFile
Definition: C4Game.h:88
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:93
bool Close()
Definition: C4Group.cpp:755
bool EraseItem(const char *szItemName)
Definition: StdFile.cpp:819
bool CloseFolders()
Definition: C4GroupSet.cpp:237
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:93

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CompileFunc ( StdCompiler pComp,
CompileSettings  comp,
C4ValueNumbers numbers 
)

Definition at line 1664 of file C4Game.cpp.

References C4Value::_getInt(), Application, C4SyncCheckRate, C4V_Enum, C4VNull, Control, C4GameControl::ControlTick, CurrentScenarioSection, C4PropListNumbered::EnumerationIndex, C4PlayerList::First, FormatString(), FrameCounter, fResortAnyObject, StdStrBuf::getData(), C4Landscape::GetSky(), C4Value::GetType(), GlobalSoundModifier, IM_Normal, IM_Section, InitialPlayersJoined, StdCompiler::isDeserializer(), StdCompiler::isSerializer(), iTick10, iTick1000, iTick2, iTick255, iTick3, iTick35, iTick5, Landscape, mkNamingAdapt(), mkParAdapt(), mkStringAdaptMA, C4Application::MusicSystem, StdCompiler::Name(), StdCompiler::NameEnd(), C4Player::Next, NextMission, NextMissionDesc, NextMissionText, Objects, Players, Scoreboard, ScriptEngine, ScriptGuiRoot, C4PropListNumbered::ShelveNumberedPropLists(), StartupPlayerCount, StartupTeamCount, C4GameControl::SyncRate, Time, StdCompiler::Value(), and Weather.

1665 {
1666  if (comp.init_mode == IM_Normal && comp.fExact)
1667  {
1668  pComp->Name("Game");
1669  pComp->Value(mkNamingAdapt(Time, "Time", 0));
1670  pComp->Value(mkNamingAdapt(FrameCounter, "Frame", 0));
1671  if (comp.fSync)
1672  {
1673  pComp->Value(mkNamingAdapt(Control.ControlTick, "ControlTick", 0));
1674  pComp->Value(mkNamingAdapt(Control.SyncRate, "SyncRate", C4SyncCheckRate));
1675  }
1676  pComp->Value(mkNamingAdapt(iTick2, "Tick2", 0));
1677  pComp->Value(mkNamingAdapt(iTick3, "Tick3", 0));
1678  pComp->Value(mkNamingAdapt(iTick5, "Tick5", 0));
1679  pComp->Value(mkNamingAdapt(iTick10, "Tick10", 0));
1680  pComp->Value(mkNamingAdapt(iTick35, "Tick35", 0));
1681  pComp->Value(mkNamingAdapt(iTick255, "Tick255", 0));
1682  pComp->Value(mkNamingAdapt(iTick1000, "Tick1000", 0));
1683  pComp->Value(mkNamingAdapt(InitialPlayersJoined, "InitialPlayersJoined", false));
1684  pComp->Value(mkNamingAdapt(StartupPlayerCount, "StartupPlayerCount", 0));
1685  pComp->Value(mkNamingAdapt(StartupTeamCount, "StartupTeamCount", 0));
1686  pComp->Value(mkNamingAdapt(C4PropListNumbered::EnumerationIndex,"ObjectEnumerationIndex",0));
1687  pComp->Value(mkNamingAdapt(mkStringAdaptMA(CurrentScenarioSection), "CurrentScenarioSection", ""));
1688  pComp->Value(mkNamingAdapt(fResortAnyObject, "ResortAnyObj", false));
1689  pComp->Value(mkNamingAdapt(mkParAdapt(GlobalSoundModifier, numbers), "GlobalSoundModifier", C4Value()));
1690  pComp->Value(mkNamingAdapt(NextMission, "NextMission", StdCopyStrBuf()));
1691  pComp->Value(mkNamingAdapt(NextMissionText, "NextMissionText", StdCopyStrBuf()));
1692  pComp->Value(mkNamingAdapt(NextMissionDesc, "NextMissionDesc", StdCopyStrBuf()));
1693  pComp->NameEnd();
1694 
1695  // Music settings
1696  pComp->Value(mkNamingAdapt(::Application.MusicSystem, "Music"));
1697 
1698  // scoreboard compiles into main level [Scoreboard]
1699  pComp->Value(mkNamingAdapt(Scoreboard, "Scoreboard"));
1700  // Keyboard status of global keys synchronized for exact (runtime join) only; not for savegames,
1701  // as keys might be released between a savegame save and its resume
1702  }
1703 
1704  if (comp.fExact)
1705  {
1706  pComp->Value(mkNamingAdapt(Weather, "Weather"));
1707  pComp->Value(mkNamingAdapt(Landscape, "Landscape"));
1708  pComp->Value(mkNamingAdapt(Landscape.GetSky(), "Sky"));
1709 
1710  // save custom GUIs only if a real savegame and not for editor-scenario-saves or section changes
1711  if (comp.init_mode == IM_Normal)
1712  {
1713  pComp->Name("GUI");
1714  if (pComp->isDeserializer())
1715  {
1716  C4Value val;
1717  pComp->Value(mkNamingAdapt(mkParAdapt(val, numbers), "ScriptGUIs", C4VNull));
1718  // if loading, assume
1719  assert(ScriptGuiRoot->GetID() == 0); // ID of 0 means "had no subwindows ever" aka "is fresh" for root
1720  // we will need to denumerate and create the actual GUI post-loading
1721  // for now, just remember our enumerated ID
1722  if (val.GetType() == C4V_Enum)
1723  {
1724  int enumID = val._getInt();
1725  ScriptGuiRoot->SetEnumeratedID(enumID);
1726  }
1727  }
1728  else
1729  {
1730  C4Value *val = new C4Value(ScriptGuiRoot->ToC4Value());
1731  pComp->Value(mkNamingAdapt(mkParAdapt(*val, numbers), "ScriptGUIs", C4VNull));
1732  }
1733  pComp->NameEnd();
1734  }
1735  }
1736 
1737  if (comp.fPlayers)
1738  {
1739  assert(pComp->isSerializer());
1740  // player parsing: Parse all players
1741  // This doesn't create any players, but just parses existing by their ID
1742  // Primary player ininitialization (also setting ID) is done by player info list
1743  // Won't work this way for binary mode!
1744  for (C4Player *pPlr=Players.First; pPlr; pPlr=pPlr->Next)
1745  pComp->Value(mkNamingAdapt(mkParAdapt(*pPlr, numbers), FormatString("Player%d", pPlr->ID).getData()));
1746  }
1747 
1748  // Section load: Clear existing prop list numbering to make room for the new objects
1749  // Numbers will be re-acquired in C4GameObjects::PostLoad
1751 
1752  pComp->Value(mkParAdapt(Objects, !comp.fExact, numbers));
1753 
1754  pComp->Value(mkNamingAdapt(mkParAdapt(ScriptEngine, comp.init_mode == IM_Section, numbers), "Script"));
1755 }
const char * getData() const
Definition: StdBuf.h:450
int32_t iTick255
Definition: C4Game.h:131
int32_t ControlTick
Definition: C4GameControl.h:89
C4Value & GlobalSoundModifier
Definition: C4Game.h:101
StdCopyStrBuf NextMission
Definition: C4Game.h:148
int32_t iTick5
Definition: C4Game.h:131
int32_t iTick35
Definition: C4Game.h:131
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
const int32_t C4SyncCheckRate
Definition: C4GameControl.h:53
C4Player * First
Definition: C4PlayerList.h:31
virtual bool Name(const char *szName)
Definition: StdCompiler.h:87
C4Scoreboard Scoreboard
Definition: C4Game.h:96
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
StdCopyStrBuf NextMissionDesc
Definition: C4Game.h:148
bool isSerializer()
Definition: StdCompiler.h:64
int32_t FrameCounter
Definition: C4Game.h:130
int32_t iTick1000
Definition: C4Game.h:131
C4V_Type GetType() const
Definition: C4Value.h:161
C4GameControl Control
C4Landscape Landscape
C4PlayerList Players
bool InitialPlayersJoined
Definition: C4Game.h:115
int32_t Time
Definition: C4Game.h:133
class C4Sky & GetSky()
int32_t _getInt() const
Definition: C4Value.h:122
StdCopyStrBuf NextMissionText
Definition: C4Game.h:148
C4Weather Weather
Definition: C4Weather.cpp:207
int32_t iTick3
Definition: C4Game.h:131
void Value(const T &rStruct)
Definition: StdCompiler.h:171
static void ShelveNumberedPropLists()
Definition: C4PropList.cpp:105
int32_t iTick10
Definition: C4Game.h:131
virtual bool isDeserializer()
Definition: StdCompiler.h:63
bool fResortAnyObject
Definition: C4Game.h:140
const C4Value C4VNull
Definition: C4Value.cpp:32
int32_t StartupPlayerCount
Definition: C4Game.h:111
C4Player * Next
Definition: C4Player.h:144
#define mkStringAdaptMA(szString)
Definition: StdAdaptors.h:191
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
int32_t SyncRate
Definition: C4GameControl.h:90
int32_t StartupTeamCount
Definition: C4Game.h:112
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:235
static int32_t EnumerationIndex
Definition: C4PropList.h:240
char CurrentScenarioSection[C4MaxName+1]
Definition: C4Game.h:103
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:88
C4Application Application
Definition: C4Globals.cpp:44
C4GameObjects Objects
Definition: C4Globals.cpp:48
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277
int32_t iTick2
Definition: C4Game.h:131
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

bool C4Game::CompileRuntimeData ( C4Group hGroup,
InitMode  init_mode,
bool  exact,
bool  sync,
C4ValueNumbers numbers 
)
protected

Definition at line 1757 of file C4Game.cpp.

References C4CFN_Game, C4GameObjects::Clear(), GameText, C4ComponentHost::GetData(), C4ComponentHost::GetDataBuf(), IM_Section, C4ComponentHost::Load(), LoadResStr(), LogF(), mkParAdapt(), C4ObjectList::ObjectCount(), and Objects.

Referenced by InitGame().

1758 {
1759  ::Objects.Clear(init_mode != IM_Section);
1760  GameText.Load(hGroup,C4CFN_Game);
1761  CompileSettings Settings(init_mode, false, exact, sync);
1762  // C4Game is not defaulted on compilation.
1763  // Loading of runtime data overrides only certain values.
1764  // Doesn't compile players; those will be done later
1765  if (GameText.GetData())
1766  {
1767  if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
1768  mkParAdapt(*this, Settings, numbers),
1770  return false;
1771  // Objects
1772  int32_t iObjects = Objects.ObjectCount();
1773  if (iObjects) { LogF(LoadResStr("IDS_PRC_OBJECTSLOADED"),iObjects); }
1774  }
1775  // Success
1776  return true;
1777 }
bool Load(C4Group &hGroup, const char *szFilename, const char *szLanguage=nullptr)
const char * GetData() const
C4ComponentHost GameText
Definition: C4Game.h:81
const StdStrBuf & GetDataBuf() const
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
#define C4CFN_Game
Definition: C4Components.h:73
int ObjectCount(C4ID id=C4ID::None) const
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
void Clear(bool fClearInactive)
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:253
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateInfoObject ( C4ObjectInfo cinf,
int32_t  owner,
int32_t  tx = 50,
int32_t  ty = 50 
)

Definition at line 1090 of file C4Game.cpp.

References C4Id2Def(), Fix0, FullCon, C4ObjectInfoCore::id, NewObject(), and NO_OWNER.

Referenced by C4Player::PlaceReadyCrew().

1092 {
1093  C4Def *def;
1094  // Valid check
1095  if (!cinf) return nullptr;
1096  // Get def
1097  if (!(def=C4Id2Def(cinf->id))) return nullptr;
1098  // Create object
1099  return NewObject( def,nullptr,
1100  iOwner,cinf,
1101  tx,ty,0,
1102  Fix0,Fix0,Fix0,
1103  FullCon, NO_OWNER, false);
1104 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1015
const int32_t FullCon
Definition: C4Constants.h:182
Definition: C4Def.h:100
const int NO_OWNER
Definition: C4Constants.h:138
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
const C4Real Fix0
Definition: C4Real.h:312

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateObject ( C4PropList type,
C4Object pCreator,
int32_t  owner = NO_OWNER,
int32_t  x = 50,
int32_t  y = 50,
int32_t  r = 0,
bool  grow_from_center = false,
C4Real  xdir = Fix0,
C4Real  ydir = Fix0,
C4Real  rdir = Fix0,
int32_t  iController = NO_OWNER 
)

Definition at line 1076 of file C4Game.cpp.

References FullCon, C4PropList::GetDef(), and NewObject().

Referenced by CastObjects(), C4Object::CreateContents(), C4Landscape::P::DigMaterial2Objects(), InitEnvironment(), InitGoals(), InitRules(), C4EditCursor::PerformDuplicationLegacy(), PlaceAnimal(), PlaceInEarth(), C4Player::PlaceReadyMaterial(), and C4Player::PlaceReadyVehic().

1079 {
1080  // check Definition
1081  if (!PropList || !PropList->GetDef()) return nullptr;
1082  // Create object
1083  return NewObject(PropList,pCreator,
1084  iOwner,nullptr,
1085  x,y,r,
1086  xdir,ydir,rdir,
1087  FullCon, iController, grow_from_center);
1088 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1015
const int32_t FullCon
Definition: C4Constants.h:182

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateObject ( C4ID  type,
C4Object pCreator,
int32_t  owner = NO_OWNER,
int32_t  x = 50,
int32_t  y = 50,
int32_t  r = 0,
bool  grow_from_center = false,
C4Real  xdir = Fix0,
C4Real  ydir = Fix0,
C4Real  rdir = Fix0,
int32_t  iController = NO_OWNER 
)

Definition at line 1061 of file C4Game.cpp.

References C4Id2Def(), FullCon, and NewObject().

1064 {
1065  C4Def *pDef;
1066  // Get pDef
1067  if (!(pDef=C4Id2Def(id))) return nullptr;
1068  // Create object
1069  return NewObject(pDef,pCreator,
1070  iOwner,nullptr,
1071  x,y,r,
1072  xdir,ydir,rdir,
1073  FullCon, iController, grow_from_center);
1074 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1015
const int32_t FullCon
Definition: C4Constants.h:182
Definition: C4Def.h:100
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80

Here is the call graph for this function:

C4Object * C4Game::CreateObjectConstruction ( C4PropList type,
C4Object pCreator,
int32_t  owner,
int32_t  ctx = 0,
int32_t  bty = 0,
int32_t  con = 1,
bool  terrain = false 
)

Definition at line 1106 of file C4Game.cpp.

References C4Object::Controller, C4Landscape::DigFreeRect(), Fix0, C4PropList::GetDef(), C4Rect::Hgt, Landscape, NewObject(), NO_OWNER, C4Landscape::RaiseTerrain(), C4Def::Shape, and C4Rect::Wdt.

Referenced by C4Player::PlaceReadyBase(), and PlaceVegetation().

1112 {
1113  C4Def *pDef;
1114  C4Object *pObj;
1115 
1116  // Get def
1117  if (!PropList) return nullptr;
1118  if (!(pDef=PropList->GetDef())) return nullptr;
1119 
1120  int32_t dx,dy,dwdt,dhgt;
1121  dwdt=pDef->Shape.Wdt; dhgt=pDef->Shape.Hgt;
1122  dx=iX-dwdt/2; dy=iBY-dhgt;
1123 
1124  // Terrain
1125  if (fTerrain)
1126  {
1127  // Clear site background (ignored for ultra-large structures)
1128  if (dwdt*dhgt<12000)
1129  Landscape.DigFreeRect(dx,dy,dwdt,dhgt);
1130  // Raise Terrain
1131  Landscape.RaiseTerrain(dx,dy+dhgt,dwdt);
1132  }
1133 
1134  // Create object
1135  if (!(pObj=NewObject(PropList,
1136  pCreator,
1137  iOwner,nullptr,
1138  iX,iBY,0,
1139  Fix0,Fix0,Fix0,
1140  iCon, pCreator ? pCreator->Controller : NO_OWNER, false))) return nullptr;
1141 
1142  return pObj;
1143 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1015
void RaiseTerrain(int32_t tx, int32_t ty, int32_t wdt)
int32_t DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, C4Object *by_object=nullptr, bool no_dig2objects=false, bool no_instability_check=false)
int32_t Wdt
Definition: C4Rect.h:32
C4Shape Shape
Definition: C4Def.h:106
C4Landscape Landscape
Definition: C4Def.h:100
const int NO_OWNER
Definition: C4Constants.h:138
virtual C4Def const * GetDef() const
Definition: C4Def.h:217
int32_t Hgt
Definition: C4Rect.h:32
int32_t Controller
Definition: C4Object.h:111
const C4Real Fix0
Definition: C4Real.h:312

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::CreateSectionFromTempFile ( const char *  section_name,
const char *  temp_filename 
)

Definition at line 3429 of file C4Game.cpp.

References StdStrBuf::getData(), C4ScenarioSection::name, pCurrentScenarioSection, C4ScenarioSection::pNext, C4ScenarioSection::pObjectScripts, pScenarioObjectsScript, pScenarioSections, ReLinkScriptEngine(), C4ScenarioSection::ScenarioLoad(), and SEqualNoCase().

3430 {
3431  // Remove existing (temp) section of same name
3432  C4ScenarioSection *existing_section = pScenarioSections, *prev = nullptr;
3433  while (existing_section) if (SEqualNoCase(existing_section->name.getData(), section_name)) break; else existing_section = (prev = existing_section)->pNext;
3434  bool deleted_current_section = false;
3435  if (existing_section)
3436  {
3437  deleted_current_section = (existing_section == pCurrentScenarioSection);
3438  if (deleted_current_section)
3439  {
3440  pCurrentScenarioSection = nullptr;
3441  pScenarioObjectsScript = nullptr;
3442  }
3443  if (existing_section->pObjectScripts)
3444  {
3445  delete existing_section->pObjectScripts;
3446  }
3447  if (prev) prev->pNext = existing_section->pNext; else pScenarioSections = existing_section->pNext;
3448  existing_section->pNext = nullptr;
3449  delete existing_section;
3450  }
3451  // Create new (temp) section
3452  C4ScenarioSection *new_section = new C4ScenarioSection(section_name);
3453  if (!new_section->ScenarioLoad(temp_filename, true))
3454  {
3455  pScenarioSections = new_section->pNext;
3456  new_section->pNext = nullptr;
3457  delete new_section;
3458  return false;
3459  }
3460  // Re-Link current section into newly created section
3461  if (deleted_current_section)
3462  {
3463  pCurrentScenarioSection = new_section;
3464  pScenarioObjectsScript = new_section->pObjectScripts;
3465  }
3466  // Link new Objects.c (or re-link because old Objects.c was removed)
3468  return !!new_section;
3469 }
const char * getData() const
Definition: StdBuf.h:450
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:177
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:92
bool ReLinkScriptEngine()
Definition: C4Game.cpp:2439
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:93
bool ScenarioLoad(const char *szFilename, bool is_temp_file)
StdCopyStrBuf name
Definition: C4Scenario.h:258
class C4ScenarioObjectsScriptHost * pObjectScripts
Definition: C4Scenario.h:262
C4ScenarioSection * pNext
Definition: C4Scenario.h:264
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:93

Here is the call graph for this function:

void C4Game::Default ( )
protected

Definition at line 1448 of file C4Game.cpp.

References Application, C4S, cFPS, StdStrBuf::Clear(), C4MusicSystem::ClearGame(), CurrentScenarioSection, DebugHost, DebugPassword, DebugPort, DebugWait, C4GameObjects::Default(), C4PlayerList::Default(), C4Weather::Default(), C4DefList::Default(), C4PathFinder::Default(), C4RankSystem::Default(), C4GraphicsSystem::Default(), C4TransferZones::Default(), C4MassMoverSet::Default(), C4PXSSystem::Default(), C4Landscape::Default(), C4GroupSet::Default(), C4GameMessageList::Default(), C4MessageInput::Default(), C4MouseControl::Default(), C4MaterialMap::Default(), C4Scenario::Default(), DefaultRanks, DefinitionFilenames, Definitions, DirectJoinAddress, DoSkipFrame, Evaluated, fLobby, fObserve, FPS, FrameCounter, FrameSkip, fReferenceDefinitionOverride, fResortAnyObject, fScriptCreatedObjects, FullSpeed, GameOver, GameOverDlgShown, GraphicsSystem, GroupSet, HaltCount, iLobbyTimeout, InitialPlayersJoined, InitProgress, IsRunning, iTick10, iTick1000, iTick2, iTick255, iTick3, iTick35, iTick5, Landscape, LastInitProgress, MassMover, MaterialMap, MessageInput, Messages, MouseControl, C4Application::MusicSystem, Objects, PathFinder, pCurrentScenarioSection, pJoinReference, PlayerFilenames, Players, pNetworkStatistics, PointersDenumerated, pParentGroup, pScenarioSections, PXS, StdStrBuf::Ref(), ScenarioFilename, ScenarioTitle, ScriptGuiRoot, StartTime, StartupPlayerCount, StartupTeamCount, Time, TimeGo, TransferZones, and Weather.

Referenced by C4Game(), and Clear().

1449 {
1450  PointersDenumerated = false;
1451  IsRunning = false;
1452  FrameCounter=0;
1454  ScenarioFilename[0]=0;
1455  PlayerFilenames[0]=0;
1456  DefinitionFilenames[0]=0;
1457  DirectJoinAddress[0]=0;
1458  pJoinReference=nullptr;
1460  StartupTeamCount = 0;
1461  ScenarioTitle.Ref("");
1462  HaltCount=0;
1464  Evaluated=false;
1465  TimeGo=false;
1466  Time=0;
1467  StartTime=0;
1469  FPS=cFPS=0;
1470  fScriptCreatedObjects=false;
1471  fLobby=fObserve=false;
1472  iLobbyTimeout=0;
1474  FullSpeed=false;
1475  FrameSkip=1; DoSkipFrame=false;
1478  Objects.Default();
1479  Players.Default();
1480  Weather.Default();
1481  Landscape.Default();
1483  MassMover.Default();
1484  PXS.Default();
1486  C4S.Default();
1487  ::Messages.Default();
1490  PathFinder.Default();
1492  GroupSet.Default();
1493  pParentGroup=nullptr;
1496  fResortAnyObject=false;
1497  pNetworkStatistics.reset();
1499  DebugPort = 0;
1500  DebugPassword.Clear();
1501  DebugHost.Clear();
1502  DebugWait = false;
1503  assert(!ScriptGuiRoot);
1504  ScriptGuiRoot.reset();
1505 }
C4Group * pParentGroup
Definition: C4Game.h:90
bool IsRunning
Definition: C4Game.h:141
int32_t iLobbyTimeout
Definition: C4Game.h:121
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:104
void Default()
Definition: C4GroupSet.cpp:59
int32_t iTick255
Definition: C4Game.h:131
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:110
int32_t iTick5
Definition: C4Game.h:131
int32_t iTick35
Definition: C4Game.h:131
C4Scenario C4S
Definition: C4Game.h:76
void Clear()
Definition: StdBuf.h:474
C4GroupSet GroupSet
Definition: C4Game.h:89
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:105
bool GameOverDlgShown
Definition: C4Game.h:118
void Default()
Definition: C4PXS.cpp:166
StdStrBuf DebugHost
Definition: C4Game.h:150
C4RankSystem DefaultRanks
C4MessageInput MessageInput
int32_t LastInitProgress
Definition: C4Game.h:135
bool DoSkipFrame
Definition: C4Game.h:139
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
void Default()
Definition: C4Scenario.cpp:78
StdStrBuf DebugPassword
Definition: C4Game.h:150
int32_t InitProgress
Definition: C4Game.h:135
uint16_t DebugPort
Definition: C4Game.h:150
int32_t FrameCounter
Definition: C4Game.h:130
int32_t StartTime
Definition: C4Game.h:134
int32_t FrameSkip
Definition: C4Game.h:139
int32_t iTick1000
Definition: C4Game.h:131
bool GameOver
Definition: C4Game.h:116
int32_t FPS
Definition: C4Game.h:113
C4Landscape Landscape
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4PlayerList Players
bool InitialPlayersJoined
Definition: C4Game.h:115
int32_t Time
Definition: C4Game.h:133
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:93
C4TransferZones TransferZones
Definition: C4Game.h:87
C4Weather Weather
Definition: C4Weather.cpp:207
C4PXSSystem PXS
Definition: C4PXS.cpp:532
int32_t iTick3
Definition: C4Game.h:131
int32_t iTick10
Definition: C4Game.h:131
bool fObserve
Definition: C4Game.h:122
void Default()
Definition: C4DefList.cpp:399
bool fResortAnyObject
Definition: C4Game.h:140
void Ref(const char *pnData)
Definition: StdBuf.h:463
C4MassMoverSet MassMover
int32_t StartupPlayerCount
Definition: C4Game.h:111
bool FullSpeed
Definition: C4Game.h:138
bool PointersDenumerated
Definition: C4Game.h:142
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:106
bool Evaluated
Definition: C4Game.h:117
C4PathFinder PathFinder
Definition: C4Game.h:86
C4MaterialMap MaterialMap
Definition: C4Material.cpp:970
char DefinitionFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:107
int32_t StartupTeamCount
Definition: C4Game.h:112
C4DefList Definitions
Definition: C4Globals.cpp:49
bool fReferenceDefinitionOverride
Definition: C4Game.h:123
int32_t HaltCount
Definition: C4Game.h:114
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:235
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:108
int32_t cFPS
Definition: C4Game.h:113
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:97
bool fScriptCreatedObjects
Definition: C4Game.h:119
bool fLobby
Definition: C4Game.h:120
char CurrentScenarioSection[C4MaxName+1]
Definition: C4Game.h:103
C4Application Application
Definition: C4Globals.cpp:44
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:93
bool TimeGo
Definition: C4Game.h:132
C4GameObjects Objects
Definition: C4Globals.cpp:48
void Default()
Definition: C4Weather.cpp:106
int DebugWait
Definition: C4Game.h:150
int32_t iTick2
Definition: C4Game.h:131
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::DeleteObjects ( bool  fDeleteInactive)
protected

Definition at line 1053 of file C4Game.cpp.

References C4GameObjects::DeleteObjects(), fResortAnyObject, and Objects.

Referenced by Clear(), and LoadScenarioSection().

1054 {
1055  // del any objects
1056  ::Objects.DeleteObjects(fDeleteInactive);
1057  // reset resort flag
1058  fResortAnyObject = false;
1059 }
void DeleteObjects(bool fDeleteInactive)
bool fResortAnyObject
Definition: C4Game.h:140
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DoGameOver ( )

Definition at line 3099 of file C4Game.cpp.

References Config, C4PlayerList::First, GameOver, GRBroadcast(), LoadResStr(), Log(), C4Player::Next, Players, PSF_OnGameOver, and C4Config::Save().

Referenced by GameOverCheck().

3100 {
3101  // Duplication safety
3102  if (GameOver) return false;
3103  // Flag, log, call
3104  GameOver=true;
3105  Log(LoadResStr("IDS_PRC_GAMEOVER"));
3107  // Flag all surviving players as winners
3108  for (C4Player *pPlayer = Players.First; pPlayer; pPlayer = pPlayer->Next)
3109  if (!pPlayer->Eliminated)
3110  pPlayer->EvaluateLeague(false, true);
3111  // Immediately save config so mission access gained by this round is stored if the game crashes during shutdown
3112  // or in a following round
3113  Config.Save();
3114  return true;
3115 }
C4Config Config
Definition: C4Config.cpp:837
C4Player * First
Definition: C4PlayerList.h:31
#define PSF_OnGameOver
Definition: C4GameScript.h:138
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool GameOver
Definition: C4Game.h:116
C4PlayerList Players
C4Value GRBroadcast(const char *szFunction, C4AulParSet *pPars=0, bool fPassError=false, bool fRejectTest=false)
Definition: C4Game.cpp:3850
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
C4Player * Next
Definition: C4Player.h:144
bool Save()
Definition: C4Config.cpp:404

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DoKeyboardInput ( C4KeyCode  vk_code,
C4KeyEventType  eEventType,
bool  fAlt,
bool  fCtrl,
bool  fShift,
bool  fRepeated,
class C4GUI::Dialog pForDialog = nullptr,
bool  fPlrCtrlOnly = false,
int32_t  iStrength = -1 
)

Definition at line 1869 of file C4Game.cpp.

References KEYS_Alt, KEYS_Control, and KEYS_Shift.

Referenced by ConsoleHandleWin32KeyboardMessage(), DialogWinProc(), FullScreenWinProc(), C4StartupMainDlg::KeyEnterDown(), C4StartupMainDlg::KeyEnterUp(), C4AppDelegate::simulateKeyPressed:, and ViewportWinProc().

1870 {
1871  // compose key
1872  C4KeyCodeEx Key(vk_code, C4KeyShiftState(fAlt*KEYS_Alt + fCtrl*KEYS_Control + fShift*KEYS_Shift), fRepeated);
1873  return DoKeyboardInput(Key, eEventType, pForDialog, fPlrCtrlOnly, iStrength);
1874 }
C4KeyShiftState
bool DoKeyboardInput(C4KeyCode vk_code, C4KeyEventType eEventType, bool fAlt, bool fCtrl, bool fShift, bool fRepeated, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
Definition: C4Game.cpp:1869

Here is the caller graph for this function:

bool C4Game::DoKeyboardInput ( C4KeyCodeEx  Key,
C4KeyEventType  eEventType,
class C4GUI::Dialog pForDialog = nullptr,
bool  fPlrCtrlOnly = false,
int32_t  iStrength = -1 
)

Definition at line 1877 of file C4Game.cpp.

References C4GUI::Screen::ActivateDialog(), C4Window::Active, Application, C4S, Console, C4KeyboardInput::DoInput(), C4SHead::Film, C4KeyCodeEx::FixShiftKeys(), FullScreen, Game, C4ViewportList::GetViewport(), C4GUI::Screen::HasKeyboardFocus(), C4Scenario::Head, C4Menu::IsActive(), C4Application::isEditor, IsRunning, C4GameOverDlg::IsShown(), C4GUI::Screen::KeyAny(), KeyboardInput, KEYSCOPE_Console, KEYSCOPE_Control, KEYSCOPE_FilmView, KEYSCOPE_FreeView, KEYSCOPE_Fullscreen, KEYSCOPE_FullSMenu, KEYSCOPE_FullSView, KEYSCOPE_Generic, KEYSCOPE_Gui, NO_OWNER, pGUI, C4FullScreen::pMenu, C4SHead::Replay, and Viewports.

1878 {
1879  Key.FixShiftKeys();
1880  // compose keyboard scope
1881  DWORD InScope = 0;
1882  if (fPlrCtrlOnly)
1883  InScope = KEYSCOPE_Control;
1884  else
1885  {
1886  if (IsRunning) InScope = KEYSCOPE_Generic;
1887  // if GUI has keyfocus, this overrides regular controls
1888  if (pGUI->HasKeyboardFocus() || pForDialog)
1889  {
1890  InScope |= KEYSCOPE_Gui;
1891  // control to console mode dialog: Make current keyboard target the active dlg,
1892  // so it can process input
1893  if (pForDialog) pGUI->ActivateDialog(pForDialog);
1894  // any keystroke in GUI resets tooltip times
1895  pGUI->KeyAny();
1896  }
1897  else
1898  {
1899  if (!Application.isEditor)
1900  {
1901  if (FullScreen.pMenu && FullScreen.pMenu->IsActive()) // fullscreen menu
1902  InScope |= KEYSCOPE_FullSMenu;
1903  else if (Game.C4S.Head.Replay && C4S.Head.Film) // film view only
1904  InScope |= KEYSCOPE_FilmView;
1905  else if (::Viewports.GetViewport(NO_OWNER)) // NO_OWNER-viewport-controls
1906  InScope |= KEYSCOPE_FreeView;
1907  else
1908  {
1909  // regular player viewport controls
1910  InScope |= KEYSCOPE_FullSView;
1911  // player controls disabled during round over dlg
1912  if (!C4GameOverDlg::IsShown()) InScope |= KEYSCOPE_Control;
1913  }
1914  }
1915  else
1916  // regular player viewport controls
1917  InScope |= KEYSCOPE_Control;
1918  }
1919  // fullscreen/console (in running game)
1920  if (IsRunning)
1921  {
1922  if (FullScreen.Active) InScope |= KEYSCOPE_Fullscreen;
1923  if (Console.Active) InScope |= KEYSCOPE_Console;
1924  }
1925  }
1926  // okay; do input
1927  if (KeyboardInput.DoInput(Key, eEventType, InScope, iStrength))
1928  return true;
1929 
1930  // unprocessed key
1931  return false;
1932 }
bool HasKeyboardFocus()
Definition: C4Gui.h:2668
bool IsRunning
Definition: C4Game.h:141
C4Console Console
Definition: C4Globals.cpp:45
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:76
bool Replay
Definition: C4Scenario.h:72
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4Viewport * GetViewport(int32_t iPlayer, C4Viewport *pPrev=nullptr)
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:98
static bool IsShown()
Definition: C4GameOverDlg.h:92
const int NO_OWNER
Definition: C4Constants.h:138
bool IsActive()
Definition: C4Menu.cpp:483
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
bool DoInput(const C4KeyCodeEx &InKey, C4KeyEventType InEvent, DWORD InScope, int32_t iStrength)
bool Active
Definition: C4Window.h:278
C4SHead Head
Definition: C4Scenario.h:230
uint32_t DWORD
C4Application Application
Definition: C4Globals.cpp:44
int32_t Film
Definition: C4Scenario.h:73
void ActivateDialog(Dialog *pDlg)
Definition: C4Gui.cpp:650
bool KeyAny()
Definition: C4Gui.cpp:774

Here is the call graph for this function:

void C4Game::DrawCrewOverheadText ( C4TargetFacet cgo,
int32_t  iPlayer 
)

Definition at line 1536 of file C4Game.cpp.

References ACenter, C4GM_MaxText, Config, C4Object::Contained, C4Object::Def, C4GraphicsResource::fctMouseCursor, C4PlayerList::First, fixtof(), C4GraphicsResource::FontRegular, StdStrBuf::Format(), StdStrBuf::getData(), CStdFont::GetLineHeight(), C4PropList::GetName(), CStdFont::GetTextExtent(), C4Draw::GetZoom(), C4Config::Graphics, GraphicsResource, Hostile(), C4Object::Info, C4Object::IsVisible(), C4Player::Next, NO_OWNER, C4Object::OCF, OCF_CrewMember, pDraw, Players, C4ObjectInfoCore::Rank, SCopy(), C4Draw::SetZoom(), C4ConfigGraphics::ShowCrewCNames, C4ConfigGraphics::ShowCrewNames, sprintf, C4ObjectInfoCore::sRankName, C4PropList::Status, C4Facet::Surface, SWordWrap(), C4Draw::TextOut(), C4Facet::Wdt, C4Facet::X, C4Facet::Y, ZoomData::Zoom, and C4TargetFacet::Zoom.

Referenced by C4Viewport::Draw().

1537 {
1538 
1539  // All drawing in this function must not be affected by zoom; but remember zoom and reset later.
1540  ZoomData r;
1541  pDraw->GetZoom(&r);
1542  const float zoom = r.Zoom;
1543  r.Zoom = 1.0;
1544  pDraw->SetZoom(r);
1545  // Offset for all text/objects
1546  const float fixedOffsetX = -cgo.X * cgo.Zoom + cgo.X;
1547  const float fixedOffsetY = (-cgo.Y - 10.0f) * cgo.Zoom + cgo.Y;
1548  // Draw cursor mark arrow & cursor object name
1550  for (C4Player *pPlr = Players.First; pPlr; pPlr = pPlr->Next)
1551  {
1552  // Draw a small selector & name above the cursor? F.e. after switching crew.
1553  const bool drawCursorInfo = (pPlr->Number == iPlayer || iPlayer == NO_OWNER) // only for the viewport's player..
1554  && (pPlr->CursorFlash && pPlr->Cursor); // ..and if the player wants to show their cursor.
1555  // Otherwise, for allied players we might want to draw player & crew names.
1556  // Note that these two conditions are generally mutually-exclusive.
1557  const bool drawPlayerAndCursorNames = (pPlr->Number != iPlayer) // Never for own player..
1558  && (Config.Graphics.ShowCrewNames || Config.Graphics.ShowCrewCNames) // ..and if the settings allow it..
1559  && !Hostile(iPlayer, pPlr->Number) && !pPlr->IsInvisible(); // ..and of course only if applicable.
1560 
1561  if (!drawPlayerAndCursorNames && !drawCursorInfo) continue;
1562 
1563  // Lambda to calculate correct drawing position of object, (re-)adjusted by zoom.
1564  float drawX, drawY, drawZoom;
1565  auto calculateObjectTextPosition = [&](C4Object *obj)
1566  {
1567  obj->GetDrawPosition(cgo, fixtof(obj->fix_x), fixtof(obj->fix_y), 1.0, drawX, drawY, drawZoom);
1568  drawX = drawX * cgo.Zoom + fixedOffsetX;
1569  drawY = drawY * cgo.Zoom - static_cast<float>(obj->Def->Shape.Hgt) / 2.0 + fixedOffsetY;
1570  };
1571 
1572  // Actual text output!
1573  if (drawPlayerAndCursorNames)
1574  {
1575  // We need to show crew names for that player, we do so for every crew-member.
1576  for (C4Object * const & crew : pPlr->Crew)
1577  {
1578  if (!crew->Status || !crew->Def) continue;
1579  if (crew->Contained) continue;
1580  if ((crew->OCF & OCF_CrewMember) == 0) continue;
1581  if (!crew->IsVisible(iPlayer, false)) continue;
1582 
1583  calculateObjectTextPosition(crew);
1584  drawY -= 5.0f; // aesthetical offset
1585 
1586  // compose string
1587  char szText[C4GM_MaxText + 1];
1590  sprintf(szText, "%s (%s)", crew->GetName(), pPlr->GetName());
1591  else
1592  SCopy(pPlr->GetName(), szText);
1593  else
1594  SCopy(crew->GetName(), szText);
1595  // Word wrap to cgo width
1596  int32_t iCharWdt, dummy;
1597  ::GraphicsResource.FontRegular.GetTextExtent("m", iCharWdt, dummy, false);
1598  int32_t iMaxLine = std::max<int32_t>(cgo.Wdt / std::max<int32_t>(1, iCharWdt), 20);
1599  SWordWrap(szText, ' ', '|', iMaxLine);
1600  // Center text vertically, too
1601  int textWidth, textHeight;
1602  ::GraphicsResource.FontRegular.GetTextExtent(szText, textWidth, textHeight, true);
1603  // Draw
1604  pDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, drawX, drawY - static_cast<float>(textHeight) / 2.0,
1605  pPlr->ColorDw | 0x7f000000, ACenter);
1606  }
1607  }
1608  else if (drawCursorInfo)
1609  {
1610  C4Object * const cursor = pPlr->Cursor;
1611  calculateObjectTextPosition(cursor);
1612  // Draw a down-arrow above the Clonk's head
1613  drawY += -fctCursor.Hgt;
1614  fctCursor.Draw(cgo.Surface, drawX - static_cast<float>(fctCursor.Wdt) / 2.0, drawY, 4);
1615  // And possibly draw some info text, too
1616  if (cursor->Info)
1617  {
1618  int32_t texthgt = ::GraphicsResource.FontRegular.GetLineHeight();
1619  StdStrBuf str;
1620  if (cursor->Info->Rank > 0)
1621  {
1622  str.Format("%s|%s", cursor->Info->sRankName.getData(), cursor->GetName());
1623  texthgt += texthgt;
1624  }
1625  else str = cursor->GetName();
1626 
1628  drawX,
1629  drawY - static_cast<float>(texthgt) / 2.0,
1630  0xffff0000, ACenter);
1631 
1632  }
1633  }
1634  }
1635  // Reset zoom
1636  r.Zoom = zoom;
1637  pDraw->SetZoom(r);
1638 }
const char * getData() const
Definition: StdBuf.h:450
C4Config Config
Definition: C4Config.cpp:837
int GetLineHeight() const
Definition: C4FontLoader.h:132
float Y
Definition: C4Facet.h:120
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:122
float Zoom
Definition: C4Facet.h:167
#define sprintf
Definition: Standard.h:171
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:570
StdStrBuf sRankName
Definition: C4InfoCore.h:41
const uint32_t OCF_CrewMember
Definition: C4Constants.h:98
int32_t ShowCrewNames
Definition: C4Config.h:108
C4Player * First
Definition: C4PlayerList.h:31
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:181
C4GraphicsResource GraphicsResource
C4ObjectInfo * Info
Definition: C4Object.h:145
C4ConfigGraphics Graphics
Definition: C4Config.h:254
void SWordWrap(char *szText, char cSpace, char cSepa, int iMaxLine)
Definition: Standard.cpp:363
C4Def * Def
Definition: C4Object.h:143
int32_t ShowCrewCNames
Definition: C4Config.h:109
const int ACenter
Definition: C4Surface.h:43
virtual const char * GetName() const
Definition: C4PropList.cpp:626
C4PlayerList Players
const int NO_OWNER
Definition: C4Constants.h:138
int32_t Hostile(int32_t plr1, int32_t plr2)
C4Draw * pDraw
Definition: C4Draw.cpp:45
int32_t Status
Definition: C4PropList.h:170
void GetZoom(ZoomData *r)
Definition: C4Draw.h:197
const int32_t C4GM_MaxText
Definition: C4GameMessage.h:26
C4Player * Next
Definition: C4Player.h:144
float fixtof(const C4Fixed &x)
Definition: C4Real.h:257
C4ObjectPtr Contained
Definition: C4Object.h:144
C4Surface * Surface
Definition: C4Facet.h:119
uint32_t OCF
Definition: C4Object.h:134
float Wdt
Definition: C4Facet.h:120
void SetZoom(float X, float Y, float Zoom)
Definition: C4Draw.cpp:782
float X
Definition: C4Facet.h:120
float Zoom
Definition: C4Draw.h:70
bool IsVisible(int32_t iForPlr, bool fAsOverlay) const
Definition: C4Object.cpp:4062

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DrawPropListSpecImage ( C4Facet fctTarget,
C4PropList pSpec 
)

Definition at line 3795 of file C4Game.cpp.

References C4DefGraphics::Draw(), C4Def::Draw(), C4DefGraphics::Get(), C4String::GetCStr(), C4PropList::GetDef(), C4PropList::GetPropertyInt(), C4PropList::GetPropertyPropList(), C4PropList::GetPropertyStr(), C4Def::Graphics, P_Color, P_Name, and P_Source.

Referenced by C4GameMessage::Draw().

3796 {
3797  // safety
3798  assert(pSpec);
3799  if (!pSpec) return false;
3800 
3801  // get source definition
3802  C4PropList *source_def_proplist = pSpec->GetPropertyPropList(P_Source);
3803  if (!source_def_proplist) return false;
3804  C4Def *source_def = source_def_proplist->GetDef();
3805  if (!source_def) return false;
3806 
3807  // get custom color
3808  uint32_t color = (uint32_t)pSpec->GetPropertyInt(P_Color);
3809 
3810  C4String *source_name = pSpec->GetPropertyStr(P_Name);
3811  if (!source_name)
3812  {
3813  // Base graphics
3814  source_def->Draw(fctTarget, false, color);
3815  }
3816  else
3817  {
3818  // Alternative named graphics
3819  C4DefGraphics *source_graphics = source_def->Graphics.Get(source_name->GetCStr());
3820  if (!source_graphics) return false;
3821  source_graphics->Draw(fctTarget, color, nullptr, 0,0, nullptr);
3822  }
3823  return true;
3824 }
const char * GetCStr() const
Definition: C4StringTable.h:49
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:662
C4DefGraphics * Get(const char *szGrpName)
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
Definition: C4Def.cpp:601
Definition: C4Def.h:100
void Draw(C4Facet &cgo, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *trans)
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:863
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:752
C4DefGraphics Graphics
Definition: C4Def.h:194
C4PropList * GetPropertyPropList(C4PropertyName k) const
Definition: C4PropList.cpp:877

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DrawTextSpecImage ( C4Facet fctTarget,
const char *  szSpec,
class C4DrawTransform pTransform,
uint32_t  dwClr = 0xff 
)

Definition at line 3741 of file C4Game.cpp.

References C4Id2Def(), C4Def::Draw(), C4Facet::DrawXT(), GetTextSpecFacet(), C4Facet::Hgt, C4Facet::Surface, C4Facet::Wdt, C4Facet::X, and C4Facet::Y.

Referenced by C4MainMenu::DoRefillInternal().

3742 {
3743  // safety
3744  assert(szSpec && *szSpec);
3745  if (!szSpec) return false;
3746 
3747  C4Facet fctSource;
3748  if(GetTextSpecFacet(szSpec, fctSource))
3749  {
3750  fctSource.DrawXT(fctTarget.Surface, fctTarget.X, fctTarget.Y, fctTarget.Wdt, fctTarget.Hgt, 0, 0, pTransform);
3751  return true;
3752  }
3753  else
3754  {
3755  C4Def *pDef = C4Id2Def(C4ID(szSpec));
3756  if (!pDef) return false;
3757 
3758  pDef->Draw(fctTarget, false, dwClr, nullptr, 0, 0, pTransform);
3759  return true;
3760  }
3761 }
float Y
Definition: C4Facet.h:120
bool GetTextSpecFacet(const char *szSpec, C4Facet &fct)
Definition: C4Game.cpp:3721
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
Definition: C4Def.cpp:601
Definition: C4Def.h:100
Definition: C4Id.h:28
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
float Hgt
Definition: C4Facet.h:120
void DrawXT(C4Surface *sfcTarget, float iX, float iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
Definition: C4Facet.cpp:392
C4Surface * Surface
Definition: C4Facet.h:119
float Wdt
Definition: C4Facet.h:120
float X
Definition: C4Facet.h:120

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DropDef ( C4ID  id,
float  iX,
float  iY 
)

Definition at line 1398 of file C4Game.cpp.

References C4Id2Def(), CDT_Decide, CID_EMMoveObj, Console, Control, C4ControlEMMoveObject::CreateObject(), C4GameControl::DoInput(), FormatString(), ftofix(), LoadResStr(), and C4ConsoleGUI::Out().

Referenced by DropFile(), and ViewportWinProc().

1399 {
1400  // Get def
1401  C4Def *pDef;
1402  if ((pDef=C4Id2Def(id)))
1403  {
1405  return true;
1406  }
1407  else
1408  {
1409  // Failure
1410  Console.Out(FormatString(LoadResStr("IDS_CNS_DROPNODEF"),id.ToString()).getData());
1411  }
1412  return false;
1413 }
C4Console Console
Definition: C4Globals.cpp:45
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4GameControl Control
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
Definition: C4Def.h:100
void Out(const char *message)
Definition: C4Console.cpp:689
C4Fixed ftofix(float x)
Definition: C4Real.h:258
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
static C4ControlEMMoveObject * CreateObject(const C4ID &id, C4Real x, C4Real y, C4Object *container)
Definition: C4Control.cpp:1226
#define X(sdl, oc)
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DropFile ( const char *  szFilename,
float  iX,
float  iY 
)

Definition at line 1377 of file C4Game.cpp.

References Application, C4D_Load_RX, C4Id2Def(), Config, Console, DefFileGetID(), Definitions, DropDef(), FormatString(), C4Config::General, GetExtension(), GetFilename(), C4ConfigGeneral::LanguageEx, C4DefList::Load(), LoadResStr(), C4ConsoleGUI::Out(), SEqualNoCase(), and C4Application::SoundSystem.

Referenced by C4Viewport::DropFile().

1378 {
1379  C4ID c_id; C4Def *cdef;
1380  // Drop def to create object
1381  if (SEqualNoCase(GetExtension(szFilename),"ocd"))
1382  {
1383  // Get id from file
1384  if ((c_id=DefFileGetID(szFilename)))
1385  // Get loaded def or try to load def from file
1386  if ( (cdef=C4Id2Def(c_id))
1387  || (::Definitions.Load(szFilename,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem) && (cdef=C4Id2Def(c_id))) )
1388  {
1389  return DropDef(c_id, iX, iY);
1390  }
1391  // Failure
1392  Console.Out(FormatString(LoadResStr("IDS_CNS_DROPNODEF"),GetFilename(szFilename)).getData());
1393  return false;
1394  }
1395  return false;
1396 }
char * GetFilename(char *szPath)
Definition: StdFile.cpp:55
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Config Config
Definition: C4Config.cpp:837
C4Console Console
Definition: C4Globals.cpp:45
C4ConfigGeneral General
Definition: C4Config.h:252
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:177
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const DWORD C4D_Load_RX
Definition: C4Def.h:93
Definition: C4Def.h:100
void Out(const char *message)
Definition: C4Console.cpp:689
bool DropDef(C4ID id, float iX, float iY)
Definition: C4Game.cpp:1398
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:131
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:38
Definition: C4Id.h:28
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
Definition: C4DefList.cpp:74
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
C4DefList Definitions
Definition: C4Globals.cpp:49
C4Application Application
Definition: C4Globals.cpp:44
C4ID DefFileGetID(const char *szFilename)
Definition: C4Game.cpp:1367
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::Evaluate ( )

Definition at line 1507 of file C4Game.cpp.

References Control, C4PlayerList::Evaluate(), Evaluated, C4RoundResults::EvaluateGame(), StdStrBuf::getData(), C4Network2::isEnabled(), C4Network2::isHost(), C4GameParameters::isLeague(), C4GameControl::isRecord(), C4Network2::LeagueGameEvaluate(), LoadResStr(), Log(), Network, Parameters, Players, RoundResults, C4PlayerList::Save(), SHA_DIGEST_LENGTH, and C4GameControl::StopRecord().

Referenced by Clear(), and Execute().

1508 {
1509 
1510  // League game?
1511  bool fLeague = Network.isEnabled() && Network.isHost() && Parameters.isLeague();
1512 
1513  // Stop record
1514  StdStrBuf RecordName; BYTE RecordSHA[SHA_DIGEST_LENGTH];
1515  if (Control.isRecord())
1516  Control.StopRecord(&RecordName, fLeague ? RecordSHA : nullptr);
1517 
1518  // Send league result
1519  if (fLeague)
1520  Network.LeagueGameEvaluate(RecordName.getData(), RecordSHA);
1521 
1522  // Players
1523  // saving local players only, because remote players will probably not rejoin after evaluation anyway)
1524  Players.Evaluate();
1525  Players.Save(true);
1526 
1527  // Round results
1529 
1530  // Set game flag
1531  Log(LoadResStr("IDS_PRC_EVALUATED"));
1532  Evaluated=true;
1533 
1534 }
const char * getData() const
Definition: StdBuf.h:450
#define SHA_DIGEST_LENGTH
void StopRecord(StdStrBuf *pRecordName=nullptr, BYTE *pRecordSHA1=nullptr)
bool isHost() const
Definition: C4Network2.h:209
bool isRecord() const
uint8_t BYTE
C4GameParameters & Parameters
Definition: C4Game.h:69
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Network2 Network
Definition: C4Globals.cpp:53
C4GameControl Control
C4PlayerList Players
bool isEnabled() const
Definition: C4Network2.h:203
C4RoundResults & RoundResults
Definition: C4Game.h:75
bool Evaluated
Definition: C4Game.h:117
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
bool isLeague() const
void LeagueGameEvaluate(const char *szRecordName=nullptr, const BYTE *pRecordSHA=nullptr)
bool Save(bool fSaveLocalOnly)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ExecObjects ( )
protected

Definition at line 1325 of file C4Game.cpp.

References AddDbgRec(), Config, C4GameObjects::CrossCheck(), C4ConfigGeneral::DebugRec, fResortAnyObject, Game, C4Config::General, iTick255, ObjectRemovalCheck(), Objects, RCT_Block, C4GameObjects::ResortUnsorted(), and C4ObjectList::reverse().

Referenced by Execute().

1326 {
1327  if (Config.General.DebugRec)
1328  AddDbgRec(RCT_Block, "ObjEx", 6);
1329 
1330  // Execute objects - reverse order to ensure
1331  for (C4Object *cObj : Objects.reverse())
1332  {
1333  if (cObj)
1334  {
1335  if (cObj->Status)
1336  // Execute object
1337  cObj->Execute();
1338  else
1339  // Status reset: process removal delay
1340  if (cObj->RemovalDelay>0) cObj->RemovalDelay--;
1341  }
1342  }
1343 
1344  if (Config.General.DebugRec)
1345  AddDbgRec(RCT_Block, "ObjCC", 6);
1346 
1347  // Cross check objects
1348  Objects.CrossCheck();
1349 
1350  if (Config.General.DebugRec)
1351  AddDbgRec(RCT_Block, "ObjRs", 6);
1352 
1353  // Resort
1354  if (fResortAnyObject)
1355  {
1356  fResortAnyObject = false;
1358  }
1359 
1360  if (Config.General.DebugRec)
1361  AddDbgRec(RCT_Block, "ObjRm", 6);
1362 
1363  // Removal
1364  if (!::Game.iTick255) ObjectRemovalCheck();
1365 }
C4Config Config
Definition: C4Config.cpp:837
int32_t iTick255
Definition: C4Game.h:131
C4Game Game
Definition: C4Globals.cpp:52
C4ConfigGeneral General
Definition: C4Config.h:252
void ObjectRemovalCheck()
Definition: C4Game.cpp:1313
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:36
const ReverseView reverse() const
Definition: C4ObjectList.h:104
bool fResortAnyObject
Definition: C4Game.h:140
int32_t DebugRec
Definition: C4Config.h:61
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::Execute ( )

Definition at line 713 of file C4Game.cpp.

References AddDbgRec(), C4ST_RESETPART, C4ST_SHOWPARTSTAT, C4ParticleSystem::CalculateNextStep(), Config, Control, C4ConfigGeneral::DebugRec, C4Landscape::DoRelights(), C4GameControl::DoSyncCheck(), Evaluate(), Evaluated, EXEC_DR, EXEC_S, EXEC_S_DR, ExecObjects(), C4PlayerList::Execute(), C4Weather::Execute(), C4MassMoverSet::Execute(), C4PXSSystem::Execute(), C4Landscape::Execute(), C4GameMessageList::Execute(), C4Effect::Execute(), C4MouseControl::Execute(), C4GameControl::Execute(), C4Network2::Execute(), FrameCounter, GameGo, GameOver, GameOverCheck(), GameOverDlgShown, GameScript, C4Config::General, HaltCount, IsRunning, Landscape, MassMover, Messages, MouseControl, Network, Particles, C4AulScriptEngine::pGlobalEffects, Players, C4GameControl::Prepare(), C4GameScriptHost::pScenarioEffects, PXS, RCT_Block, RCT_DbgFrame, ScriptEngine, ShowGameOverDlg(), Ticks(), and Weather.

Referenced by C4Application::GameTick().

714 {
715 
716  // Let's go
717  GameGo = true;
718 
719  // Network
720  Network.Execute();
721 
722  // Prepare control
723  bool fControl;
724  EXEC_S( fControl = Control.Prepare(); , ControlStat )
725  if (!fControl) return false; // not ready yet: wait
726 
727  // Halt
728  if (HaltCount) return false;
729 
730  if (Config.General.DebugRec)
731  Landscape.DoRelights();
732 
733  // Execute the control
734  Control.Execute();
735  if (!IsRunning) return false;
736 
737  // Ticks
738  EXEC_DR( Ticks(); , "Ticks")
739 
740  if (Config.General.DebugRec)
741  // debugrec
742  AddDbgRec(RCT_DbgFrame, &FrameCounter, sizeof(int32_t));
743 
744  // allow the particle system to execute the next frame BEFORE the other game stuff is calculated since it will run in parallel to the main thread
745  Particles.CalculateNextStep();
746 
747  // Game
748 
749  EXEC_S( ExecObjects(); , ExecObjectsStat )
750  EXEC_S_DR( C4Effect::Execute(&ScriptEngine.pGlobalEffects);
751  C4Effect::Execute(&GameScript.pScenarioEffects);
752  , GEStats , "GEEx\0");
753  EXEC_S_DR( PXS.Execute(); , PXSStat , "PXSEx")
754  EXEC_S_DR( MassMover.Execute(); , MassMoverStat , "MMvEx")
755  EXEC_S_DR( Weather.Execute(); , WeatherStat , "WtrEx")
756  EXEC_S_DR( Landscape.Execute(); , LandscapeStat , "LdsEx")
757  EXEC_S_DR( Players.Execute(); , PlayersStat , "PlrEx")
758  EXEC_S_DR( ::Messages.Execute(); , MessagesStat , "MsgEx")
759 
760  EXEC_DR( MouseControl.Execute(); , "Input")
761 
762  EXEC_DR( GameOverCheck(); , "Misc\0")
763 
764  Control.DoSyncCheck();
765 
766  // Evaluation; Game over dlg
767  if (GameOver)
768  {
769  if (!Evaluated) Evaluate();
771  }
772 
773  // show stat each 1000 ticks
774  if (!(FrameCounter % 1000))
775  {
776  C4ST_SHOWPARTSTAT(FrameCounter)
778  }
779 
780  if (Config.General.DebugRec)
781  {
782  AddDbgRec(RCT_Block, "eGame", 6);
784  }
785 
786  return true;
787 }
bool IsRunning
Definition: C4Game.h:141
C4Config Config
Definition: C4Config.cpp:837
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4ParticleSystem Particles
#define C4ST_RESETPART
Definition: C4Stat.h:157
bool GameOverDlgShown
Definition: C4Game.h:118
bool Execute()
Definition: C4Game.cpp:713
void Execute()
Definition: C4Network2.cpp:671
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
void ShowGameOverDlg()
Definition: C4Game.cpp:3117
int32_t FrameCounter
Definition: C4Game.h:130
#define EXEC_S_DR(Expressions, Stat, DebugRecName)
Definition: C4Game.cpp:710
void Ticks()
Definition: C4Game.cpp:1640
C4Network2 Network
Definition: C4Globals.cpp:53
bool GameOverCheck()
Definition: C4Game.cpp:674
bool GameOver
Definition: C4Game.h:116
C4GameControl Control
C4Landscape Landscape
C4PlayerList Players
#define EXEC_S(Expressions, Stat)
Definition: C4Game.cpp:707
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:36
#define EXEC_DR(Expressions, DebugRecName)
Definition: C4Game.cpp:711
C4Weather Weather
Definition: C4Weather.cpp:207
C4PXSSystem PXS
Definition: C4PXS.cpp:532
C4Control & Input
Definition: C4Game.h:84
C4MassMoverSet MassMover
#define C4ST_SHOWPARTSTAT(FrameCounter)
Definition: C4Stat.h:155
bool Evaluated
Definition: C4Game.h:117
void ExecObjects()
Definition: C4Game.cpp:1325
bool GameGo
Definition: C4Game.h:137
bool DoRelights()
int32_t HaltCount
Definition: C4Game.h:114
C4GameMessageList Messages
void Evaluate()
Definition: C4Game.cpp:1507

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindConstuctionSiteBlock ( int32_t  tx,
int32_t  ty,
int32_t  wdt,
int32_t  hgt 
)

Definition at line 1146 of file C4Game.cpp.

References C4LArea::FirstObjectShapes(), C4Rect::Hgt, C4LArea::NextObjectShapes(), Objects, OCF_Exclusive, C4Rect::Overlap(), C4GameObjects::Sectors, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by ConstructionCheck(), and FindConSiteSpot().

1147 {
1148  C4Rect rect1,rect2;
1149  rect1.x=tx; rect1.y=ty; rect1.Wdt=wdt; rect1.Hgt=hgt;
1150  C4LArea Area(&::Objects.Sectors, tx, ty, wdt, hgt); C4LSector *pSector;
1151  for (C4ObjectList *pObjs = Area.FirstObjectShapes(&pSector); pSector; pObjs = Area.NextObjectShapes(pObjs, &pSector))
1152  for (C4Object *cObj : *pObjs)
1153  if (cObj->Status && !cObj->Contained)
1154  if (cObj->OCF & OCF_Exclusive)
1155  {
1156  rect2=cObj->Shape; rect2.x+=cObj->GetX(); rect2.y+=cObj->GetY();
1157  if (rect1.Overlap(rect2)) return cObj;
1158  }
1159  return nullptr;
1160 }
Definition: C4Rect.h:29
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
const uint32_t OCF_Exclusive
Definition: C4Constants.h:89
C4LSectors Sectors
Definition: C4GameObjects.h:42
int32_t x
Definition: C4Rect.h:32
bool Overlap(C4Rect &rTarget)
Definition: C4Rect.cpp:91
int32_t Hgt
Definition: C4Rect.h:32
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindObject ( C4Def pDef,
int32_t  iX = 0,
int32_t  iY = 0,
int32_t  iWdt = 0,
int32_t  iHgt = 0,
DWORD  ocf = OCF_All,
C4Object pFindNext = nullptr 
)

Definition at line 1162 of file C4Game.cpp.

References C4Def::Count, C4Object::GetX(), C4Object::GetY(), and Objects.

Referenced by C4Command::Acquire(), and C4EditCursor::Move().

1166 {
1167 
1168  C4Object *pClosest=nullptr;
1169  int32_t iClosest = 0,iDistance,iFartherThan=-1;
1170  C4Object *pFindNextCpy=pFindNext;
1171 
1172  // check the easy case first: no instances at all?
1173  if (pDef && !pDef->Count) return nullptr;
1174 
1175  // Finding next closest: find closest but further away than last closest
1176  if (pFindNext && (iWdt==-1) && (iHgt==-1))
1177  {
1178  iFartherThan = (pFindNext->GetX()-iX)*(pFindNext->GetX()-iX)+(pFindNext->GetY()-iY)*(pFindNext->GetY()-iY);
1179  pFindNext = nullptr;
1180  }
1181 
1182  // Scan all objects
1183  for (C4Object *cObj : Objects)
1184  {
1185  // Not skipping to find next
1186  if (!pFindNext)
1187  // Status
1188  if (cObj->Status)
1189  // ID
1190  if (!pDef || (cObj->Def == pDef))
1191  // OCF (match any specified)
1192  if (cObj->OCF & ocf)
1193  // Area
1194  {
1195  // Point
1196  if ((iWdt==0) && (iHgt==0))
1197  {
1198  if (Inside<int32_t>(iX-(cObj->GetX()+cObj->Shape.x),0,cObj->Shape.Wdt-1))
1199  if (Inside<int32_t>(iY-(cObj->GetY()+cObj->Shape.y),0,cObj->Shape.Hgt-1))
1200  return cObj;
1201  continue;
1202  }
1203  // Closest
1204  if ((iWdt==-1) && (iHgt==-1))
1205  {
1206  iDistance = (cObj->GetX()-iX)*(cObj->GetX()-iX)+(cObj->GetY()-iY)*(cObj->GetY()-iY);
1207  // same distance?
1208  if ((iDistance == iFartherThan) && !pFindNextCpy)
1209  return cObj;
1210  // nearer than/first closest?
1211  if (!pClosest || (iDistance < iClosest))
1212  if (iDistance > iFartherThan)
1213  { pClosest=cObj; iClosest=iDistance; }
1214  }
1215  // Range
1216  else if (Inside<int32_t>(cObj->GetX()-iX,0,iWdt-1) && Inside<int32_t>(cObj->GetY()-iY,0,iHgt-1))
1217  return cObj;
1218  }
1219 
1220  // Find next mark reached
1221  if (cObj == pFindNextCpy) pFindNext = pFindNextCpy = nullptr;
1222 
1223  }
1224 
1225  return pClosest;
1226 
1227 }
int32_t GetY() const
Definition: C4Object.h:287
int32_t Count
Definition: C4Def.h:182
int32_t GetX() const
Definition: C4Object.h:286
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindVisObject ( float  tx,
float  ty,
int32_t  iPlr,
const C4Facet fctViewportGame,
const C4Facet fctViewportGUI,
float  iX,
float  iY,
DWORD  category,
float  gui_x,
float  gui_y 
)

Definition at line 1229 of file C4Game.cpp.

References C4D_Foreground, C4D_MouseIgnore, C4OS_NORMAL, C4Player::Cursor, C4GameObjects::ForeObjects, C4PlayerList::Get(), C4Object::Layer, Objects, Players, C4Facet::X, and C4Facet::Y.

Referenced by C4MouseControl::GetTargetObject().

1231 {
1232  // FIXME: Use C4FindObject here for optimization
1233  // -- can't really do that, since sectors ignore parallaxity, etc.
1234  // determine layer to search in
1235  C4Object *layer_object = nullptr;
1236  C4Player *plr = ::Players.Get(iPlr);
1237  if (plr && plr->Cursor) layer_object = plr->Cursor->Layer;
1238  // scan all object lists separately
1240  while (pLst)
1241  {
1242  // Scan all objects in list
1243  for (C4Object *cObj : *pLst)
1244  {
1245  // Status
1246  if (cObj->Status == C4OS_NORMAL)
1247  // exclude fore-objects from main list
1248  if ((pLst != &Objects) || (~cObj->Category & C4D_Foreground))
1249  // exclude MouseIgnore-objects
1250  if (~cObj->Category & C4D_MouseIgnore)
1251  // Category (match any specified)
1252  if (cObj->Category & category)
1253  // Container
1254  if (!cObj->Contained)
1255  // Visibility
1256  if (cObj->IsVisible(iPlr, false))
1257  // Layer check: Layered objects are invisible to players whose cursor is in another layer
1258  // except for GUI: GUI always visible
1259  {
1260  if (cObj->Layer != layer_object)
1261  if (pLst != &::Objects.ForeObjects)
1262  continue;
1263  // Area
1264  // get object position
1265  float iObjX, iObjY, check_x, check_y;
1266  if (pLst == &::Objects.ForeObjects)
1267  {
1268  // object position for HUD object
1269  check_x = gui_x; check_y = gui_y;
1270  cObj->GetViewPos(iObjX, iObjY, -fctViewportGUI.X, -fctViewportGUI.Y, fctViewportGUI);
1271  }
1272  else
1273  {
1274  // object position for game object
1275  check_x = game_x; check_y = game_y;
1276  cObj->GetViewPos(iObjX, iObjY, tx, ty, fctViewportGame);
1277  }
1278  // Point search
1279  if (Inside<float>(check_x-(iObjX+cObj->Shape.x),0,float(cObj->Shape.Wdt)-1))
1280  if (Inside<float>(check_y-(iObjY+cObj->Shape.y-cObj->addtop()),0,float(cObj->Shape.Hgt+cObj->addtop()-1)))
1281  return cObj;
1282  }
1283  }
1284  // next list
1285  if (pLst == &::Objects.ForeObjects) pLst = &Objects;
1286  else pLst = nullptr;
1287  }
1288 
1289  // none found
1290  return nullptr;
1291 }
float Y
Definition: C4Facet.h:120
C4ObjectPtr Cursor
Definition: C4Player.h:132
#define C4OS_NORMAL
Definition: C4Object.h:35
C4ObjectPtr Layer
Definition: C4Object.h:136
C4Player * Get(int iPlayer) const
C4PlayerList Players
const int32_t C4D_MouseIgnore
Definition: C4Def.h:56
C4ObjectList ForeObjects
Definition: C4GameObjects.h:44
float X
Definition: C4Facet.h:120
const int32_t C4D_Foreground
Definition: C4Def.h:55
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::FixRandom ( uint64_t  iSeed)

Definition at line 3094 of file C4Game.cpp.

References FixedRandom().

Referenced by C4Landscape::Init(), InitControl(), LoadScenarioSection(), PreInit(), and Synchronize().

3095 {
3096  FixedRandom(iSeed);
3097 }
void FixedRandom(uint64_t seed)
Definition: C4Random.cpp:37

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::GameOverCheck ( )
protected

Definition at line 674 of file C4Game.cpp.

References Control, DoGameOver(), Game, GameOver, C4PlayerList::GetCountNotEliminated(), C4GameControl::isReplay(), iTick35, and Players.

Referenced by Execute().

675 {
676  bool fDoGameOver = false;
677 
678  // Only every 35 ticks
679  if (::Game.iTick35) return false;
680 
681  // do not GameOver in replay
682  if (Control.isReplay()) return false;
683 
684  // All players eliminated: game over
686  fDoGameOver=true;
687 
688  // Message
689  if (fDoGameOver) DoGameOver();
690 
691  return GameOver;
692 }
bool DoGameOver()
Definition: C4Game.cpp:3099
C4Game Game
Definition: C4Globals.cpp:52
int32_t iTick35
Definition: C4Game.h:131
int GetCountNotEliminated() const
bool GameOver
Definition: C4Game.h:116
C4GameControl Control
C4PlayerList Players
bool isReplay() const
Definition: C4GameControl.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

float C4Game::GetTextSpecImageAspect ( const char *  szSpec)

Definition at line 3763 of file C4Game.cpp.

References C4Id2Def(), StdMesh::GetBoundingBox(), GetTextSpecFacet(), C4Def::Graphics, C4Rect::Hgt, C4Facet::Hgt, C4Def::PictureRect, C4DefGraphics::Type, C4DefGraphics::TYPE_Bitmap, C4DefGraphics::TYPE_Mesh, C4Rect::Wdt, C4Facet::Wdt, StdMeshBox::x1, StdMeshBox::x2, StdMeshBox::y1, and StdMeshBox::y2.

3764 {
3765  // safety
3766  assert(szSpec && *szSpec);
3767  if (!szSpec) return -1.0f;
3768 
3769  C4Facet fctSource;
3770  if(GetTextSpecFacet(szSpec, fctSource))
3771  {
3772  return static_cast<float>(fctSource.Wdt) / static_cast<float>(fctSource.Hgt);
3773  }
3774  else
3775  {
3776  C4Def *pDef = C4Id2Def(C4ID(szSpec));
3777  if (!pDef) return -1.0f;
3778 
3779  C4DefGraphics* pGfx = &pDef->Graphics;
3780  if(pGfx->Type == C4DefGraphics::TYPE_Bitmap)
3781  {
3782  return static_cast<float>(pDef->PictureRect.Wdt) / static_cast<float>(pDef->PictureRect.Hgt);
3783  }
3784  else if (pGfx->Type == C4DefGraphics::TYPE_Mesh)
3785  {
3786  const StdMesh& mesh = *pGfx->Mesh;
3787  const StdMeshBox& box = mesh.GetBoundingBox();
3788  return (box.x2 - box.x1) / (box.y2 - box.y1);
3789  }
3790 
3791  return -1.0f;
3792  }
3793 }
float y2
Definition: StdMesh.h:149
C4Rect PictureRect
Definition: C4Def.h:109
float x2
Definition: StdMesh.h:149
bool GetTextSpecFacet(const char *szSpec, C4Facet &fct)
Definition: C4Game.cpp:3721
int32_t Wdt
Definition: C4Rect.h:32
float y1
Definition: StdMesh.h:148
Definition: C4Def.h:100
Definition: C4Id.h:28
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
float Hgt
Definition: C4Facet.h:120
GraphicsType Type
Definition: C4DefGraphics.h:48
float x1
Definition: StdMesh.h:148
int32_t Hgt
Definition: C4Rect.h:32
float Wdt
Definition: C4Facet.h:120
const StdMeshBox & GetBoundingBox() const
Definition: StdMesh.h:208
C4DefGraphics Graphics
Definition: C4Def.h:194

Here is the call graph for this function:

C4Value C4Game::GRBroadcast ( const char *  szFunction,
C4AulParSet pPars = 0,
bool  fPassError = false,
bool  fRejectTest = false 
)

Definition at line 3850 of file C4Game.cpp.

References C4GameScriptHost::Call(), GameScript, C4GameObjects::GRBroadcast(), and Objects.

Referenced by C4Object::AssignDeath(), DoGameOver(), C4Player::Init(), LoadScenarioSection(), OnPlayerJoinFinished(), C4PlayerList::Remove(), C4Player::ScenarioInit(), and C4Player::SetWealth().

3851 {
3852  std::string func{ szFunction };
3853  if (func[0] != '~')
3854  func.insert(0, 1, '~');
3855 
3856  // call objects first - scenario script might overwrite hostility, etc...
3857  C4Value vResult = ::Objects.GRBroadcast(func.c_str(), pPars, fPassError, fRejectTest);
3858  // rejection tests abort on first nonzero result
3859  if (fRejectTest) if (!!vResult) return vResult;
3860  // scenario script call
3861  return ::GameScript.Call(func.c_str(), pPars, fPassError);
3862 }
C4GameScriptHost GameScript
C4Value GRBroadcast(const char *szFunction, C4AulParSet *pPars, bool fPassError, bool fRejectTest)
C4Value Call(const char *szFunction, C4AulParSet *pPars=0, bool fPassError=false)
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::HasScenario ( )
inline

Definition at line 164 of file C4Game.h.

References StdStrBuf::getSize().

Referenced by C4Application::ParseCommandLine(), and C4Application::PreInit().

char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:104
size_t getSize() const
Definition: StdBuf.h:452
StdStrBuf RecordStream
Definition: C4Game.h:127
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:108

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::Init ( )

Definition at line 332 of file C4Game.cpp.

References C4Value::_getPropList(), _MAX_PATH, C4GameParameters::AllowDebug, C4ConfigGeneral::AlwaysDebug, Application, C4S, C4FullScreen::CloseMenu(), Config, Console, StdStrBuf::Copy(), DebugMode, DirectJoinAddress, DirectJoinFilePrefix, C4Scoreboard::DoDlgShow(), C4Network2::DoLobby(), Extra, C4Network2::FinalInit(), fQuitWithError, FullScreen, C4GameParameters::GameRes, C4Config::General, GetLogPos(), GlobalSoundModifier, GraphicsSystem, C4Scenario::Head, IM_Normal, C4Extra::Init(), InitFullscreenComponents(), C4Console::InitGame(), InitGame(), InitGameFinal(), InitKeyboard(), C4GraphicsSystem::InitLoaderScreen(), InitNetworkFromAddress(), InitNetworkFromReference(), InitNetworkFromReferenceFile(), InitNetworkHost(), InitPlayers(), InitProgress, C4GraphicsSystem::InvalidateBg(), C4Application::isEditor, C4Network2::isEnabled(), C4Network2::isLobbyActive(), IsRunning, LastInitProgress, C4SHead::Loader, LoadResStr(), Log(), LogFatal(), Network, C4SHead::NetworkGame, OpenScenario(), Parameters, C4ConfigGeneral::Participants, pGUI, pJoinReference, PlayerFilenames, C4GraphicsSystem::pLoaderScreen, pNetworkStatistics, C4GameResList::RetrieveFiles(), C4Network2::RetrieveScenario(), C4SHead::SaveGame, ScenarioFile, ScenarioFilename, SCopy(), Scoreboard, SEqual2(), C4GUI::Screen::SetExclusive(), SetGlobalSoundModifier(), SetInitProgress(), StartTime, StartupLogPos, SyncClearance(), Synchronize(), TempScenarioFile, C4Startup::Unload(), and C4GameLobby::UserAbort.

Referenced by C4Application::GameTick().

333 {
334  C4ValueNumbers numbers;
335  IsRunning = false;
336 
338  SetInitProgress(0);
339 
340  // reinit keyboard to reflect any config changes that might have been done
341  // this is a good time to do it, because no GUI dialogs are opened
342  if (!InitKeyboard()) LogFatal(LoadResStr("IDS_ERR_NOKEYBOARD"));
343 
344  // start log pos (used by startup)
346  fQuitWithError = false;
347  C4GameLobby::UserAbort = false;
348 
349  // Store a start time that identifies this game on this host
350  StartTime = time(nullptr);
351 
352  // Get PlayerFilenames from Config, if ParseCommandLine did not fill some in
353  // Must be done here, because InitGame calls PlayerInfos.InitLocal
354  if (!*PlayerFilenames)
355  {
357  }
358 
359  // Join a game?
361  {
362 
364  {
365  // init extra; needed for loader screen
366  Log(LoadResStr("IDS_PRC_INITEXTRA"));
367  if (!Extra.Init())
368  { LogFatal(LoadResStr("IDS_PRC_ERREXTRA")); return false; }
369 
370  // init loader
372  { LogFatal(LoadResStr("IDS_PRC_ERRLOADER")); return false; }
373  }
374 
375  SetInitProgress(5);
376 
377  // Initialize network
378  if (pJoinReference)
379  {
380  // By reference
381  bool fSuccess = InitNetworkFromReference(*pJoinReference);
382  pJoinReference.reset();
383  if (!fSuccess)
384  return false;
385  }
387  {
388  // By reference serialized to temp file
390  return false;
391  }
392  else
393  {
394  // By address
396  return false;
397  }
398 
399  // check wether console mode is allowed
401  { LogFatal(LoadResStr("IDS_TEXT_JOININCONSOLEMODENOTALLOW")); return false; }
402 
403  // do lobby (if desired)
404  if (Network.isLobbyActive())
405  if (!Network.DoLobby())
406  return false;
407 
408  // get scenario
409  char szScenario[_MAX_PATH+1];
410  SetInitProgress(6);
411  if (!Network.RetrieveScenario(szScenario)) return false;
412 
413  // open new scenario
414  SCopy(szScenario, ScenarioFilename, _MAX_PATH);
415  if (!OpenScenario()) return false;
417 
418  // get everything else
419  if (!Parameters.GameRes.RetrieveFiles()) return false;
420 
421  // Check network game data scenario type (safety)
422  if (!C4S.Head.NetworkGame)
423  { LogFatal(LoadResStr("IDS_NET_NONETGAME")); return false; }
424 
425  SetInitProgress(7);
426 
427  }
428 
429  // Local game or host?
430  else
431  {
432 
433  // Open scenario
434  if (!OpenScenario())
435  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
436 
437  // init extra; needed for loader screen
438  Log(LoadResStr("IDS_PRC_INITEXTRA"));
439  if (!Extra.Init())
440  { LogFatal(LoadResStr("IDS_PRC_ERREXTRA")); return false; }
441 
442  // init loader
444  { LogFatal(LoadResStr("IDS_PRC_ERRLOADER")); return false; }
445 
446  // Init network
447  if (!InitNetworkHost()) return false;
448  SetInitProgress(7);
449 
450  }
451 
452  // now free all startup gfx to make room for game gfx
454 
455  // Init debugmode
458  DebugMode = true;
459  if (!Parameters.AllowDebug)
460  DebugMode = false;
461 
462  // Init game
463  if (!InitGame(ScenarioFile, IM_Normal, true, &numbers)) return false;
464 
465  // Network final init
466  if (Network.isEnabled())
467  {
468  if (!Network.FinalInit()) return false;
469  }
470  // non-net may have to synchronize now to keep in sync with replays
471  // also needs to synchronize to update transfer zones
472  else
473  {
474  // - would kill DebugRec-sync for runtime debugrec starts
475  C4DebugRecOff DBGRECOFF(!!C4S.Head.SaveGame);
476  SyncClearance();
477  Synchronize(false);
478  }
479 
480  // Init players
481  if (!InitPlayers(&numbers)) return false;
482  SetInitProgress(98);
483 
484  // Final init
485  if (!InitGameFinal(IM_Normal)) return false;
486  SetInitProgress(99);
487 
488  // Sound modifier from savegames
490 
491  // Message board and upper board
492  if (!Application.isEditor)
493  {
495  }
496 
497  // Default fullscreen menu, in case any old surfaces are left (extra safety)
499 
500  // start statistics (always for now. Make this a config?)
502 
503  // clear loader screen
505  {
508  }
509 
510  // game running now!
511  IsRunning = true;
512 
513  // Start message
514  Log(LoadResStr(C4S.Head.NetworkGame ? "IDS_PRC_JOIN" : C4S.Head.SaveGame ? "IDS_PRC_RESUME" : "IDS_PRC_START"));
515 
516  // set non-exclusive GUI
517  pGUI->SetExclusive(false);
518 
519  // after GUI is made non-exclusive, recheck the scoreboard
520  Scoreboard.DoDlgShow(0, false);
521  SetInitProgress(100);
522 
523  // and redraw background
525 
526  // Notify editor
527  Console.InitGame();
528 
529  return true;
530 }
void SetInitProgress(float fToProgress)
Definition: C4Game.cpp:3389
bool IsRunning
Definition: C4Game.h:141
bool InitGame(C4Group &hGroup, InitMode init_mode, bool fLoadSky, C4ValueNumbers *)
Definition: C4Game.cpp:2104
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:104
StdStrBuf TempScenarioFile
Definition: C4Game.h:128
C4Config Config
Definition: C4Config.cpp:837
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:122
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:110
C4Value & GlobalSoundModifier
Definition: C4Game.h:101
C4Console Console
Definition: C4Globals.cpp:45
void SyncClearance()
Definition: C4Game.cpp:3133
std::string Loader
Definition: C4Scenario.h:65
C4Scenario C4S
Definition: C4Game.h:76
bool FinalInit()
Definition: C4Network2.cpp:560
C4ConfigGeneral General
Definition: C4Config.h:252
bool isLobbyActive() const
Definition: C4Network2.h:204
static constexpr const char * DirectJoinFilePrefix
Definition: C4Game.h:293
void DoDlgShow(int32_t iChange, bool fUserToggle)
static void Unload()
Definition: C4Startup.cpp:303
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
int32_t LastInitProgress
Definition: C4Game.h:135
C4Scoreboard Scoreboard
Definition: C4Game.h:96
#define _MAX_PATH
bool InitPlayers(C4ValueNumbers *)
Definition: C4Game.cpp:2452
C4GameParameters & Parameters
Definition: C4Game.h:69
bool InitNetworkFromReferenceFile(const char *temp_filename)
Definition: C4Game.cpp:3217
bool OpenScenario()
Definition: C4Game.cpp:169
bool InitNetworkHost()
Definition: C4Game.cpp:3260
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
size_t StartupLogPos
Definition: C4Game.h:143
int32_t InitProgress
Definition: C4Game.h:135
bool SaveGame
Definition: C4Scenario.h:71
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
C4Network2 Network
Definition: C4Globals.cpp:53
int32_t StartTime
Definition: C4Game.h:134
bool InitLoaderScreen(const char *szLoaderSpec)
char Participants[CFG_MaxString+1]
Definition: C4Config.h:39
bool Init()
Definition: C4Extra.cpp:48
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4GameResList GameRes
C4Group ScenarioFile
Definition: C4Game.h:88
bool NetworkGame
Definition: C4Scenario.h:78
void SetExclusive(bool fToState)
Definition: C4Gui.h:2666
bool fQuitWithError
Definition: C4Game.h:144
void SetGlobalSoundModifier(C4PropList *modifier_props)
Definition: C4Game.cpp:3877
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
bool InitNetworkFromReference(const C4Network2Reference &Reference)
Definition: C4Game.cpp:3235
C4LoaderScreen * pLoaderScreen
size_t GetLogPos()
Definition: C4Log.cpp:289
bool isEnabled() const
Definition: C4Network2.h:203
bool InitNetworkFromAddress(const char *szAddress)
Definition: C4Game.cpp:3164
void InitFullscreenComponents(bool fRunning)
Definition: C4Game.cpp:789
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:106
void InitGame()
Definition: C4Console.cpp:595
bool InitKeyboard()
Definition: C4Game.cpp:2934
int32_t AlwaysDebug
Definition: C4Config.h:40
bool RetrieveScenario(char *szScenario)
Definition: C4Network2.cpp:612
void Synchronize(bool fSavePlayerFiles)
Definition: C4Game.cpp:3139
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
bool DoLobby()
Definition: C4Network2.cpp:455
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:168
C4SHead Head
Definition: C4Scenario.h:230
bool InitGameFinal(InitMode init_mode)
Definition: C4Game.cpp:2331
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:108
C4PropList * _getPropList() const
Definition: C4Value.h:129
C4Extra Extra
Definition: C4Game.h:91
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:97
void Copy()
Definition: StdBuf.h:475
C4Application Application
Definition: C4Globals.cpp:44
bool DebugMode
Definition: C4Game.h:146

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitAnimals ( )
protected

Definition at line 2842 of file C4Game.cpp.

References C4Scenario::Animals, C4Id2Def(), C4S, C4SAnimals::EarthNest, C4SAnimals::FreeLife, C4IDList::GetID(), PlaceAnimal(), and PlaceInEarth().

Referenced by InitGame().

2843 {
2844  int32_t cnt,cnt2;
2845  C4ID idAnimal; int32_t iCount;
2846  // Place animals
2847  for (cnt=0; (idAnimal=C4S.Animals.FreeLife.GetID(cnt,&iCount)); cnt++)
2848  for (cnt2=0; cnt2<iCount; cnt2++)
2849  PlaceAnimal(C4Id2Def(idAnimal));
2850  // Place nests
2851  for (cnt=0; (idAnimal=C4S.Animals.EarthNest.GetID(cnt,&iCount)); cnt++)
2852  for (cnt2=0; cnt2<iCount; cnt2++)
2853  PlaceInEarth(idAnimal);
2854 }
C4Scenario C4S
Definition: C4Game.h:76
bool PlaceInEarth(C4ID id)
Definition: C4Game.cpp:2606
C4Object * PlaceAnimal(C4PropList *def)
Definition: C4Game.cpp:2776
Definition: C4Id.h:28
C4SAnimals Animals
Definition: C4Scenario.h:235
C4IDList EarthNest
Definition: C4Scenario.h:210
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:80
C4IDList FreeLife
Definition: C4Scenario.h:209
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitControl ( )
protected

Definition at line 2537 of file C4Game.cpp.

References C4S, Clients, Control, C4GameParameters::doStreaming(), FixRandom(), C4ClientList::getLocal(), C4Scenario::Head, C4GameControl::InitLocal(), C4GameControl::InitNetwork(), C4GameControl::InitReplay(), C4Network2::isEnabled(), C4Network2::isHost(), C4GameParameters::isLeague(), LoadResStr(), Log(), LogFatal(), Network, C4SHead::NetworkGame, Parameters, PlayerFilenames, C4SHead::RandomSeed, RandomSeed, Record, C4SHead::Replay, ScenarioFile, and C4GameControl::StartRecord().

Referenced by InitGame().

2538 {
2539  // update random seed
2540  if (C4S.Head.NetworkGame || C4S.Head.Replay)
2541  {
2543  }
2544  // Randomize
2546 
2547  // Replay?
2548  if (C4S.Head.Replay)
2549  {
2550  // no joins
2551  PlayerFilenames[0]=0;
2552  // start playback
2554  return false;
2555  // no record!
2556  Record = false;
2557  }
2558  else if (Network.isEnabled())
2559  {
2560  // initialize
2562  return false;
2563  // league? always record
2564  if (Parameters.isLeague())
2565  Record = true;
2566  }
2567  // Otherwise: local game
2568  else
2569  {
2570  // init
2572  return false;
2573  }
2574 
2575  // record?
2576  if (Record)
2577  if (!Control.StartRecord(true, Parameters.doStreaming()))
2578  {
2579  // Special: If this happens for a league host, the game must not start.
2581  {
2582  LogFatal(LoadResStr("IDS_ERR_NORECORD"));
2583  return false;
2584  }
2585  else
2586  {
2587  Log(LoadResStr("IDS_ERR_NORECORD"));
2588  }
2589  }
2590 
2591  return true;
2592 }
C4Client * getLocal() const
Definition: C4Client.h:161
int32_t RandomSeed
Definition: C4Game.h:136
bool isHost() const
Definition: C4Network2.h:209
C4Scenario C4S
Definition: C4Game.h:76
bool Replay
Definition: C4Scenario.h:72
bool InitNetwork(C4Client *pLocal)
bool InitLocal(C4Client *pLocal)
bool InitReplay(C4Group &rGroup)
C4GameParameters & Parameters
Definition: C4Game.h:69
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void FixRandom(uint64_t iSeed)
Definition: C4Game.cpp:3094
C4Network2 Network
Definition: C4Globals.cpp:53
C4GameControl Control
C4Group ScenarioFile
Definition: C4Game.h:88
bool NetworkGame
Definition: C4Scenario.h:78
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
bool isEnabled() const
Definition: C4Network2.h:203
bool doStreaming() const
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:106
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
C4ClientList & Clients
Definition: C4Game.h:71
bool Record
Definition: C4Game.h:125
bool isLeague() const
bool StartRecord(bool fInitial, bool fStreaming)
C4SHead Head
Definition: C4Scenario.h:230
int32_t RandomSeed
Definition: C4Scenario.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitDefs ( )
protected

Definition at line 124 of file C4Game.cpp.

References C4DefList::AppendAndIncludeSkeletons(), Application, C4DefList::BuildTable(), C4D_Load_RX, C4DefList::CheckEngineVersion(), C4DefList::CheckRequireDef(), Config, Definitions, C4GameParameters::GameRes, C4Config::General, C4GameRes::getFile(), C4GameResList::iterRes(), C4ConfigGeneral::LanguageEx, C4DefList::Load(), C4DefList::LoadFailure, LoadResStr(), Log(), LogF(), LogFatal(), NRT_Definitions, Parameters, ScenarioFile, and C4Application::SoundSystem.

Referenced by InitGame().

125 {
126  int32_t iDefs=0;
127  Log(LoadResStr("IDS_PRC_INITDEFS"));
128  int iDefResCount = 0;
129  C4GameRes *pDef;
130  for (pDef = Parameters.GameRes.iterRes(nullptr, NRT_Definitions); pDef; pDef = Parameters.GameRes.iterRes(pDef, NRT_Definitions))
131  ++iDefResCount;
132  int i = 0;
133  // Load specified defs
134  for (pDef = Parameters.GameRes.iterRes(nullptr, NRT_Definitions); pDef; pDef = Parameters.GameRes.iterRes(pDef, NRT_Definitions))
135  {
136  int iMinProgress = 25 + (25 * i) / iDefResCount;
137  int iMaxProgress = 25 + (25 * (i + 1)) / iDefResCount;
138  ++i;
139  iDefs+=::Definitions.Load(pDef->getFile(),C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,true,iMinProgress,iMaxProgress);
140 
141  // Def load failure
142  if (::Definitions.LoadFailure) return false;
143  }
144 
145  // Load for scenario file - ignore sys group here, because it has been loaded already
147 
148  // Absolutely no defs: we don't like that
149  if (!iDefs) { LogFatal(LoadResStr("IDS_PRC_NODEFS")); return false; }
150 
151  // Check def engine version (should be done immediately on def load)
152  iDefs=::Definitions.CheckEngineVersion(C4XVER1,C4XVER2);
153  if (iDefs>0) { LogF(LoadResStr("IDS_PRC_DEFSINVC4X"),iDefs); }
154 
155  // Check for unmet requirements
157 
158  // build quick access table
160 
161  // handle skeleton appends and includes
163 
164  // Done
165  return true;
166 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Config Config
Definition: C4Config.cpp:837
C4GameRes * iterRes(C4GameRes *pLast, C4Network2ResType eType=NRT_Null)
C4ConfigGeneral General
Definition: C4Config.h:252
void BuildTable()
Definition: C4DefList.cpp:500
C4GameParameters & Parameters
Definition: C4Game.h:69
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const DWORD C4D_Load_RX
Definition: C4Def.h:93
void AppendAndIncludeSkeletons()
Definition: C4DefList.cpp:507
int32_t CheckRequireDef()
Definition: C4DefList.cpp:370
C4GameResList GameRes
C4Group ScenarioFile
Definition: C4Game.h:88
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:38
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
Definition: C4DefList.cpp:74
bool LoadFailure
Definition: C4DefList.h:31
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2)
Definition: C4DefList.cpp:351
const char * getFile() const
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
C4DefList Definitions
Definition: C4Globals.cpp:49
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:253
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitEnvironment ( )
protected

Definition at line 3359 of file C4Game.cpp.

References C4S, CreateObject(), C4Scenario::Environment, C4IDList::GetID(), and C4SEnvironment::Objects.

Referenced by InitGame().

3360 {
3361  // Place environment objects
3362  int32_t cnt,cnt2;
3363  C4ID idType; int32_t iCount;
3364  for (cnt=0; (idType=C4S.Environment.Objects.GetID(cnt,&iCount)); cnt++)
3365  for (cnt2=0; cnt2<iCount; cnt2++)
3366  CreateObject(idType,nullptr);
3367 }
C4IDList Objects
Definition: C4Scenario.h:219
C4SEnvironment Environment
Definition: C4Scenario.h:237
C4Scenario C4S
Definition: C4Game.h:76
Definition: C4Id.h:28
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99
C4Object * CreateObject(C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
Definition: C4Game.cpp:1076

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitFullscreenComponents ( bool  fRunning)

Definition at line 789 of file C4Game.cpp.

References C4UpperBoardHeight, FullScreen, C4GUI::GetScreenHgt(), C4GUI::GetScreenWdt(), GraphicsResource, GraphicsSystem, C4UpperBoard::Init(), C4GraphicsResource::IsInitialized(), C4GraphicsSystem::MessageBoard, C4Window::pSurface, C4ViewportList::RecalculateViewports(), C4Facet::Set(), C4GraphicsSystem::UpperBoard, and Viewports.

Referenced by Init(), and OnResolutionChanged().

790 {
791  // It can happen that this is called before graphics are loaded due to
792  // an early OnResolutionChanged() call. Ignore it, the message board,
793  // upper board and viewports will be initialized within the regular
794  // startup sequence then.
795  if(!GraphicsResource.IsInitialized()) return;
796 
797  // fullscreen message board
798  C4Facet cgo;
800  GraphicsSystem.MessageBoard->Init(cgo, !fRunning);
801  if (fRunning)
802  {
803  // running game: Message board upper board and viewports
804  C4Facet cgo2;
808  }
809 }
void RecalculateViewports()
Definition: C4Viewport.cpp:992
C4Surface * pSurface
Definition: C4Window.h:279
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
int32_t GetScreenWdt()
Definition: C4Gui.h:2821
const int C4UpperBoardHeight
Definition: C4Constants.h:59
void Set(C4Surface &rSfc)
Definition: C4Facet.cpp:459
C4GraphicsResource GraphicsResource
C4UpperBoard UpperBoard
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
int32_t GetScreenHgt()
Definition: C4Gui.h:2822
void Init(C4Facet &cgo)
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
std::unique_ptr< C4MessageBoard > MessageBoard

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitGame ( C4Group hGroup,
InitMode  init_mode,
bool  fLoadSky,
C4ValueNumbers numbers 
)
protected

Definition at line 2104 of file C4Game.cpp.

References Application, C4ConfigDeveloper::AutoFileReload, C4CFN_MapScript, C4CFN_MassMover, C4CFN_PXS, C4CFN_RoundResults, C4CFN_ScenarioObjectsScript, C4CFN_Script, C4S, C4PropList::Call(), CheckObjectEnumeration(), C4MassMoverSet::Clear(), C4PXSSystem::Clear(), C4GraphicsResource::CloseFiles(), CompileRuntimeData(), Config, DebugHost, DebugPassword, DebugPort, C4AulScriptEngine::Denumerate(), C4Value::Denumerate(), C4ValueNumbers::Denumerate(), C4Config::Developer, C4MusicSystem::FadeOut(), C4PlayerControlDefs::FinalInit(), C4Group::FindEntry(), FrameCounter, GameScript, GameText, C4Config::General, C4ComponentHost::GetData(), StdStrBuf::getData(), C4Landscape::GetHeight(), C4ExtraScriptHost::GetPropList(), C4PlayerInfoList::GetStartupCount(), C4TeamList::GetStartupTeamCount(), C4Landscape::GetWidth(), GlobalSoundModifier, GraphicsResource, C4Scenario::Head, IM_Normal, IM_Section, C4GameObjects::Init(), C4PathFinder::Init(), C4Weather::Init(), C4Landscape::Init(), C4GraphicsResource::Init(), C4RoundResults::Init(), InitAnimals(), InitControl(), C4AulDebug::InitDebug(), InitDefs(), InitEnvironment(), C4MusicSystem::InitForScenario(), InitGoals(), InitInEarth(), C4PlayerInfoList::InitLocal(), InitMaterialTexture(), InitPlayerControlUserSettings(), InitRules(), InitScriptEngine(), InitValueOverloads(), InitVegetation(), C4Application::isEditor, C4Network2::isEnabled(), C4GameParameters::isLeague(), Landscape, LandscapeFree(), C4ConfigGeneral::LanguageEx, LinkScriptEngine(), C4ScriptHost::Load(), C4MassMoverSet::Load(), C4PXSSystem::Load(), C4GameScriptHost::Load(), C4RoundResults::Load(), C4MapScriptHost::Load(), LoadAdditionalSystemGroup(), C4SoundSystem::LoadEffects(), LoadResStr(), LoadScenarioComponents(), Log(), LogFatal(), MapScript, MassMover, C4Application::MusicSystem, Network, C4SHead::NetworkGame, C4SHead::NoInitialize, Objects, Parameters, PathFinder, pFileMonitor, C4MusicSystem::Play(), PlayerControlDefs, PlayerControlUserAssignmentSets, PlayerInfos, PointersDenumerated, C4Landscape::PostInitMap(), C4GameObjects::PostLoad(), pScenarioObjectsScript, PSF_InitializeObjects, PXS, C4PlayerInfoList::RecheckAutoGeneratedTeams(), C4TeamList::RecheckPlayers(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4SHead::Replay, RoundResults, C4ConfigSound::RXMusic, C4SHead::SaveGame, ScenarioFile, C4Landscape::ScenarioInit(), ScenarioLangStringTable, ScenarioParameterDefs, C4GameParameters::ScenarioParameters, ScriptEngine, ScriptGuiRoot, SetInitProgress(), C4PlayerControlAssignmentSets::SortAssignments(), C4Config::Sound, C4Application::SoundSystem, StartupPlayerCount, StartupTeamCount, C4MusicSystem::Stop(), Teams, TransferZones, C4MusicSystem::UpdateVolume(), and Weather.

Referenced by Init(), and LoadScenarioSection().

2105 {
2106  // Activate debugger if requested
2107  // needs to happen before any scripts are compiled to bytecode so AB_DEBUG chunks will be inserted
2108  if (DebugPort)
2109  {
2110  if (Parameters.isLeague())
2111  Log("Debugger disabled. Not allowed in league.");
2112  else
2114  return false;
2115  }
2116 
2117  if (init_mode == IM_Normal)
2118  {
2119 
2120  // file monitor
2122  pFileMonitor.reset(new C4FileMonitor(FileMonitorCallback));
2123 
2124  // system scripts
2125  if (!InitScriptEngine())
2126  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2127  SetInitProgress(8);
2128 
2129  // Scenario components
2130  if (!LoadScenarioComponents())
2131  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2132  SetInitProgress(9);
2133 
2134  // join local players for regular games
2135  // should be done before record/replay is initialized, so the players are stored in PlayerInfos.txt
2136  // for local savegame resumes, players are joined into PlayerInfos and later associated in InitPlayers
2137  if (!::Network.isEnabled())
2138  if (!PlayerInfos.InitLocal())
2139  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2140 
2141  // for replays, make sure teams are assigned correctly
2142  if (C4S.Head.Replay)
2143  {
2144  PlayerInfos.RecheckAutoGeneratedTeams(); // checks that all teams used in playerinfos exist
2145  Teams.RecheckPlayers(); // syncs player list of teams with teams set in PlayerInfos
2146  }
2147 
2148  // set up control (inits Record/Replay)
2149  if (!InitControl()) return false;
2150 
2151  // Graphics and fonts (may reinit main font, too)
2152  // redundant call in NETWORK2; but it may do scenario local overloads
2153  Log(LoadResStr("IDS_PRC_GFXRES"));
2154  if (!GraphicsResource.Init())
2155  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2156  SetInitProgress(25);
2157 
2158  // Definitions
2159  if (!InitDefs()) return false;
2160  SetInitProgress(55);
2161 
2162  // Scenario scripts (and local system.ocg)
2164  // Map scripts
2166  // Scenario objects
2168  // After defs to get overloading priority
2170  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2171  SetInitProgress(57);
2172 
2173  // Final init for loaded player commands. Before linking scripts, so CON_* constants are registered
2175 
2176  // Register constants for scenario options
2178 
2179  // Now that all controls and assignments are known, resolve user overloads on control assignments
2180  if (!InitPlayerControlUserSettings()) return false;
2181  // Sort assignments by priority. Should be done last, because the user should not see this order in the control config dialog
2183  // (Theoretically, PlayerControlDefaultAssignmentSets could be cleared now. However, the amount of memory used is negligible)
2184 
2185  // Link scripts
2186  if (!LinkScriptEngine()) return false;
2187  SetInitProgress(58);
2188 
2189  // Materials
2190  if (!InitMaterialTexture())
2191  { LogFatal(LoadResStr("IDS_PRC_MATERROR")); return false; }
2192  SetInitProgress(60);
2193 
2194  // prepare script menus
2195  assert(!ScriptGuiRoot);
2196  ScriptGuiRoot.reset(new C4ScriptGuiWindow);
2197  }
2198  else if (fLoadSky)
2199  {
2200  // Sky needs graphics loaded, for shaders
2201  if (!GraphicsResource.Init())
2202  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2203  }
2204 
2205  // Load section sounds
2206  Application.SoundSystem.LoadEffects(hGroup, nullptr, true);
2207 
2208  // determine startup player and team count, which may be used for initial map generation
2209  if (!FrameCounter)
2210  {
2213  }
2214 
2215  // The Landscape is the last long chunk of loading time, so it's a good place to start the music fadeout
2216  if (init_mode == IM_Normal) Application.MusicSystem.FadeOut(2000);
2217  // Landscape
2218  Log(LoadResStr("IDS_PRC_LANDSCAPE"));
2219  bool fLandscapeLoaded = false;
2220  if (!Landscape.Init(hGroup, init_mode != IM_Normal, fLoadSky, fLandscapeLoaded, !!C4S.Head.SaveGame))
2221  { LogFatal(LoadResStr("IDS_ERR_GBACK")); return false; }
2222  SetInitProgress(88);
2223  // the savegame flag is set if runtime data is present, in which case this is to be used
2224  // except for scenario sections
2225  if (fLandscapeLoaded && (!C4S.Head.SaveGame || init_mode == IM_Section))
2227  // clear old landscape data
2228  if (init_mode != IM_Normal && fLandscapeLoaded) { PXS.Clear(); MassMover.Clear(); }
2229  SetInitProgress(89);
2230  // Init main object list
2232 
2233  // Pathfinder
2234  if (init_mode == IM_Normal) PathFinder.Init( &LandscapeFree, &TransferZones );
2235  SetInitProgress(90);
2236 
2237  // PXS
2238  if (hGroup.FindEntry(C4CFN_PXS))
2239  if (!PXS.Load(hGroup))
2240  { LogFatal(LoadResStr("IDS_ERR_PXS")); return false; }
2241  SetInitProgress(91);
2242 
2243  // MassMover
2244  if (hGroup.FindEntry(C4CFN_MassMover))
2245  if (!MassMover.Load(hGroup))
2246  { LogFatal(LoadResStr("IDS_ERR_MOVER")); return false; }
2247  SetInitProgress(92);
2248 
2249  // definition value overloads
2250  // TODO: Remove this function? We could move value to script and allow it through regular overloads
2251  if (init_mode == IM_Normal) InitValueOverloads();
2252 
2253  // runtime data
2254  if (!CompileRuntimeData(hGroup, init_mode, C4S.Head.SaveGame, C4S.Head.NetworkGame, numbers))
2255  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2256 
2257  SetInitProgress(93);
2258 
2259  // Load round results
2260  if (init_mode == IM_Normal)
2261  {
2262  if (hGroup.FindEntry(C4CFN_RoundResults))
2263  {
2264  if (!RoundResults.Load(hGroup, C4CFN_RoundResults))
2265  { LogFatal(LoadResStr("IDS_ERR_ERRORLOADINGROUNDRESULTS")); return false; }
2266  }
2267  else
2268  {
2269  RoundResults.Init();
2270  }
2271  }
2272 
2273  // Denumerate game data pointers
2274  if (init_mode == IM_Normal) ScriptEngine.Denumerate(numbers);
2275  if (init_mode == IM_Normal) GlobalSoundModifier.Denumerate(numbers);
2276  numbers->Denumerate();
2277  if (init_mode == IM_Normal) ScriptGuiRoot->Denumerate(numbers);
2278  // Object.PostLoad must happen after number->Denumerate(), becuase UpdateFace() will access Action proplist,
2279  // which might have a non-denumerated prototype otherwise
2280  Objects.PostLoad(init_mode == IM_Section, numbers);
2281 
2282  // Check object enumeration
2283  if (!CheckObjectEnumeration()) return false;
2284 
2285  // Okay; everything in denumerated state from now on
2286  PointersDenumerated = true;
2287 
2288  // scenario objects script
2291 
2292  // Environment
2293  if (!C4S.Head.NoInitialize && fLandscapeLoaded)
2294  {
2295  Log(LoadResStr("IDS_PRC_ENVIRONMENT"));
2296  InitVegetation();
2297  InitInEarth();
2298  InitAnimals();
2299  InitEnvironment();
2300  InitRules();
2301  InitGoals();
2303  }
2304  SetInitProgress(94);
2305 
2306  // Weather
2307  if (fLandscapeLoaded) Weather.Init(!C4S.Head.SaveGame);
2308  SetInitProgress(96);
2309 
2310  // close any gfx groups, because they are no longer needed (after sky is initialized)
2312 
2313  if (init_mode == IM_Normal) // reload doesn't affect the music (takes too long)
2314  {
2315  // Music
2318  if (::Config.Sound.RXMusic)
2319  {
2320  // Play something that is not Frontend.mid
2322  }
2323  else
2325  SetInitProgress(97);
2326  }
2327 
2328  return true;
2329 }
#define C4CFN_MassMover
Definition: C4Components.h:76
const char * getData() const
Definition: StdBuf.h:450
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void SetInitProgress(float fToProgress)
Definition: C4Game.cpp:3389
void InitValueOverloads()
Definition: C4Game.cpp:3350
bool FindEntry(const char *szWildCard, StdStrBuf *sFileName=nullptr, size_t *iSize=nullptr)
Definition: C4Group.cpp:1774
void RecheckPlayers()
Definition: C4Teams.cpp:664
void Denumerate()
Definition: C4Value.cpp:283
bool InitMaterialTexture()
Definition: C4Game.cpp:811
C4Config Config
Definition: C4Config.cpp:837
bool Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bool &rfLoaded, bool fSavegame)
void InitEnvironment()
Definition: C4Game.cpp:3359
C4Value & GlobalSoundModifier
Definition: C4Game.h:101
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4Scenario C4S
Definition: C4Game.h:76
C4ConfigGeneral General
Definition: C4Config.h:252
const char * GetData() const
#define C4CFN_Script
Definition: C4Components.h:66
void InitGoals()
Definition: C4Game.cpp:3379
bool Replay
Definition: C4Scenario.h:72
C4ComponentHost GameText
Definition: C4Game.h:81
int32_t LoadEffects(C4Group &hGroup, const char *namespace_prefix, bool group_is_root)
#define C4CFN_RoundResults
Definition: C4Components.h:129
bool PostInitMap()
void RecheckAutoGeneratedTeams()
StdStrBuf DebugHost
Definition: C4Game.h:150
void Init(PointFreeFn fnPointFree, C4TransferZones *pTransferZones=nullptr)
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:92
bool Load(C4Group &hGroup, const char *szFilename=C4CFN_RoundResults)
virtual C4PropListStatic * GetPropList()
bool LandscapeFree(int32_t x, int32_t y)
Definition: C4Game.cpp:1991
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:77
virtual bool Load(C4Group &, const char *, const char *, C4LangStringTable *)
void ScenarioInit()
C4GraphicsResource GraphicsResource
StdStrBuf DebugPassword
Definition: C4Game.h:150
C4GameParameters & Parameters
Definition: C4Game.h:69
C4TeamList & Teams
Definition: C4Game.h:72
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4LangStringTable ScenarioLangStringTable
Definition: C4Game.h:82
bool InitControl()
Definition: C4Game.cpp:2537
C4MapScriptHost MapScript
uint16_t DebugPort
Definition: C4Game.h:150
bool SaveGame
Definition: C4Scenario.h:71
int32_t FrameCounter
Definition: C4Game.h:130
bool LoadScenarioComponents()
Definition: C4Game.cpp:2857
void Denumerate(C4ValueNumbers *)
Definition: C4Value.cpp:253
std::unique_ptr< C4FileMonitor > pFileMonitor
Definition: C4Game.h:99
C4Network2 Network
Definition: C4Globals.cpp:53
#define C4CFN_ScenarioObjectsScript
Definition: C4Components.h:74
void Clear()
Definition: C4PXS.cpp:176
bool CheckObjectEnumeration()
Definition: C4Game.cpp:3301
C4ScenarioParameters ScenarioParameters
bool Load(C4Group &hGroup)
Definition: C4PXS.cpp:421
bool CompileRuntimeData(C4Group &hGroup, InitMode init_mode, bool exact, bool sync, C4ValueNumbers *)
Definition: C4Game.cpp:1757
C4Landscape Landscape
int32_t AutoFileReload
Definition: C4Config.h:84
C4Group ScenarioFile
Definition: C4Game.h:88
bool NetworkGame
Definition: C4Scenario.h:78
C4ConfigDeveloper Developer
Definition: C4Config.h:253
C4TransferZones TransferZones
Definition: C4Game.h:87
bool InitDefs()
Definition: C4Game.cpp:124
void Init(bool fScenario)
Definition: C4Weather.cpp:40
C4Weather Weather
Definition: C4Weather.cpp:207
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:230
C4PXSSystem PXS
Definition: C4PXS.cpp:532
void InitInEarth()
Definition: C4Game.cpp:2811
static bool InitDebug(const char *szPassword, const char *szHost)
Definition: C4AulDebug.cpp:45
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:94
bool isEnabled() const
Definition: C4Network2.h:203
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:38
C4RoundResults & RoundResults
Definition: C4Game.h:75
bool InitForScenario(C4Group &hGroup)
#define C4CFN_MapScript
Definition: C4Components.h:67
void FadeOut(int fadeout_ms)
int32_t GetStartupCount()
int32_t GetHeight() const
C4MassMoverSet MassMover
int32_t StartupPlayerCount
Definition: C4Game.h:111
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:73
bool PointersDenumerated
Definition: C4Game.h:142
bool LinkScriptEngine()
Definition: C4Game.cpp:2418
void InitRules()
Definition: C4Game.cpp:3369
C4PathFinder PathFinder
Definition: C4Game.h:86
bool InitPlayerControlUserSettings()
Definition: C4Game.cpp:3050
virtual bool Load(C4Group &, const char *, const char *, C4LangStringTable *)
bool Log(const char *szMessage)
Definition: C4Log.cpp:195
bool isLeague() const
void InitAnimals()
Definition: C4Game.cpp:2842
void InitVegetation()
Definition: C4Game.cpp:2827
#define C4CFN_PXS
Definition: C4Components.h:75
int32_t StartupTeamCount
Definition: C4Game.h:112
bool LoadAdditionalSystemGroup(class C4Group &parent_group)
Definition: C4Game.cpp:2888
bool InitScriptEngine()
Definition: C4Game.cpp:2377
C4SHead Head
Definition: C4Scenario.h:230
void Init(int32_t iWidth, int32_t iHeight)
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:235
void RegisterScriptConstants(const class C4ScenarioParameters &values)
int PostLoad(bool fKeepInactive, C4ValueNumbers *)
C4Value Call(C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
Definition: C4PropList.h:112
bool Load(C4Group &hGroup)
C4ConfigSound Sound
Definition: C4Config.h:255
void Denumerate(C4ValueNumbers *)
virtual bool Load(C4Group &hGroup, const char *szFilename, const char *szLanguage, C4LangStringTable *pLocalTable)
bool NoInitialize
Definition: C4Scenario.h:69
int32_t GetStartupTeamCount(int32_t startup_player_count)
Definition: C4Teams.cpp:901
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
Definition: C4Game.h:95
C4Application Application
Definition: C4Globals.cpp:44
int32_t GetWidth() const
C4GameObjects Objects
Definition: C4Globals.cpp:48
#define PSF_InitializeObjects
Definition: C4GameScript.h:45
int32_t RXMusic
Definition: C4Config.h:128
bool Play(const char *szSongname=nullptr, bool fLoop=false, int fadetime_ms=0, double max_resume_time=0.0, bool allow_break=false)
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitGameFinal ( InitMode  init_mode)
protected

Definition at line 2331 of file C4Game.cpp.

References C4GameObjects::AssignInfo(), C4GameObjects::AssignLightRange(), C4Player::AtClient, C4S, C4GameScriptHost::Call(), Console, C4ViewportList::CreateViewport(), C4Player::FinalInit(), C4PlayerList::First, fScriptCreatedObjects, FullScreen, GameScript, C4PlayerList::GetByIndex(), C4PlayerList::GetCount(), HaltCount, C4Scenario::Head, IM_Normal, IM_ReInit, C4Network2::isEnabled(), C4Network2::isHost(), C4Player::LocalControl, Network, C4Player::Next, C4Player::Number, C4ObjectList::ObjectCount(), Objects, pFileMonitor, Players, PSF_Initialize, PSF_InitializeAmbience, C4PlayerList::Remove(), C4SHead::SaveGame, C4Player::ScenarioInit(), C4ConsoleGUI::UpdateHaltCtrls(), C4GameObjects::ValidateOwners(), C4FullScreen::ViewportCheck(), and Viewports.

Referenced by Init(), and LoadScenarioSection().

2332 {
2333  // Validate object owners & assign loaded info objects
2335  Objects.AssignInfo();
2336  Objects.AssignLightRange(); // update FoW-repellers
2337 
2338  // Ambience init (before scenario construction, so the scenario can easily modify ambience in Initialize)
2340 
2341  // Script constructor call
2342  int32_t iObjCount = Objects.ObjectCount();
2344  if (Objects.ObjectCount()!=iObjCount) fScriptCreatedObjects=true;
2345 
2346  // Player final init
2347  C4Player *pPlr;
2348  for (pPlr = Players.First; pPlr; pPlr = pPlr->Next)
2349  {
2350  if (init_mode == IM_ReInit) pPlr->ScenarioInit();
2351  pPlr->FinalInit(!C4S.Head.SaveGame);
2352  }
2353 
2354  // Create viewports
2355  if (init_mode == IM_Normal)
2356  {
2357  for (pPlr = Players.First; pPlr; pPlr = pPlr->Next)
2358  if (pPlr->LocalControl)
2360  // Check fullscreen viewports
2362  // update halt state
2364 
2365  // Host: players without connected clients: remove via control queue
2366  if (Network.isEnabled() && Network.isHost())
2367  for (int32_t cnt = 0; cnt < Players.GetCount(); cnt++)
2368  if (Players.GetByIndex(cnt)->AtClient < 0)
2369  Players.Remove(Players.GetByIndex(cnt), true, false);
2370 
2371  // It should be safe now to reload stuff
2372  if (pFileMonitor) pFileMonitor->StartMonitoring();
2373  }
2374  return true;
2375 }
C4Console Console
Definition: C4Globals.cpp:45
bool isHost() const
Definition: C4Network2.h:209
int32_t Number
Definition: C4Player.h:88
C4GameScriptHost GameScript
C4Scenario C4S
Definition: C4Game.h:76
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4Value Call(const char *szFunction, C4AulParSet *pPars=0, bool fPassError=false)
#define PSF_InitializeAmbience
Definition: C4GameScript.h:36
C4Player * First
Definition: C4PlayerList.h:31
int GetCount() const
bool FinalInit(bool fInitialScore)
Definition: C4Player.cpp:703
bool SaveGame
Definition: C4Scenario.h:71
#define PSF_Initialize
Definition: C4GameScript.h:34
std::unique_ptr< C4FileMonitor > pFileMonitor
Definition: C4Game.h:99
C4Network2 Network
Definition: C4Globals.cpp:53
C4Player * GetByIndex(int iIndex) const
C4PlayerList Players
bool isEnabled() const
Definition: C4Network2.h:203
bool CreateViewport(int32_t iPlayer, bool fSilent=false)
Definition: C4Viewport.cpp:920
bool ScenarioInit()
Definition: C4Player.cpp:605
int32_t AtClient
Definition: C4Player.h:99
bool ViewportCheck()
int ObjectCount(C4ID id=C4ID::None) const
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
bool UpdateHaltCtrls(bool fHalt)
Definition: C4ConsoleGUI.h:153
C4Player * Next
Definition: C4Player.h:144
int32_t HaltCount
Definition: C4Game.h:114
C4SHead Head
Definition: C4Scenario.h:230
void AssignLightRange()
bool fScriptCreatedObjects
Definition: C4Game.h:119
bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls)
C4GameObjects Objects
Definition: C4Globals.cpp:48
bool LocalControl
Definition: C4Player.h:101

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitGoals ( )
protected

Definition at line 3379 of file <