OpenClonk
C4Game.cpp File Reference
#include "C4Include.h"
#include "C4ForbidLibraryCompilation.h"
#include "game/C4Game.h"
#include "C4Version.h"
#include "control/C4GameControl.h"
#include "control/C4GameParameters.h"
#include "control/C4GameSave.h"
#include "control/C4PlayerControl.h"
#include "control/C4PlayerInfo.h"
#include "control/C4Record.h"
#include "control/C4RoundResults.h"
#include "editor/C4Console.h"
#include "game/C4Application.h"
#include "game/C4FullScreen.h"
#include "game/C4GraphicsSystem.h"
#include "game/C4Viewport.h"
#include "graphics/C4GraphicsResource.h"
#include "gui/C4ChatDlg.h"
#include "gui/C4GameLobby.h"
#include "gui/C4GameMessage.h"
#include "gui/C4GameOverDlg.h"
#include "gui/C4LoaderScreen.h"
#include "gui/C4MessageInput.h"
#include "gui/C4MouseControl.h"
#include "gui/C4ScriptGuiWindow.h"
#include "gui/C4Startup.h"
#include "landscape/C4Landscape.h"
#include "landscape/C4MapScript.h"
#include "landscape/C4MassMover.h"
#include "landscape/C4Material.h"
#include "landscape/C4PXS.h"
#include "landscape/C4Particles.h"
#include "landscape/C4Sky.h"
#include "landscape/C4SolidMask.h"
#include "landscape/C4Texture.h"
#include "landscape/C4Weather.h"
#include "landscape/fow/C4FoW.h"
#include "lib/C4Random.h"
#include "lib/C4Stat.h"
#include "lib/StdMesh.h"
#include "network/C4League.h"
#include "network/C4Network2Dialogs.h"
#include "network/C4Network2Reference.h"
#include "network/C4Network2Stats.h"
#include "object/C4Command.h"
#include "object/C4Def.h"
#include "object/C4DefList.h"
#include "object/C4GameObjects.h"
#include "object/C4Object.h"
#include "object/C4ObjectCom.h"
#include "object/C4ObjectInfo.h"
#include "object/C4ObjectMenu.h"
#include "platform/C4FileMonitor.h"
#include "player/C4Player.h"
#include "player/C4PlayerList.h"
#include "player/C4RankSystem.h"
#include "script/C4AulDebug.h"
#include "script/C4AulExec.h"
#include "script/C4Effect.h"
#include <unordered_map>
Include dependency graph for C4Game.cpp:

Go to the source code of this file.

Classes

class  C4GameSec1Timer
 

Macros

#define EXEC_S(Expressions, Stat)    { C4ST_START(Stat) Expressions C4ST_STOP(Stat) }
 
#define EXEC_S_DR(Expressions, Stat, DebugRecName)   { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); EXEC_S(Expressions, Stat) }
 
#define EXEC_DR(Expressions, DebugRecName)   { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); Expressions }
 

Functions

C4ID DefFileGetID (const char *filename)
 
bool LandscapeFree (int32_t x, int32_t y)
 
int32_t ListExpandValids (C4IDList &rlist, C4ID *idlist, int32_t maxidlist)
 
bool GetTextSpecFacet (const char *spec, C4Facet &facet)
 

Macro Definition Documentation

◆ EXEC_DR

#define EXEC_DR (   Expressions,
  DebugRecName 
)    { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); Expressions }

Definition at line 866 of file C4Game.cpp.

◆ EXEC_S

#define EXEC_S (   Expressions,
  Stat 
)     { C4ST_START(Stat) Expressions C4ST_STOP(Stat) }

Definition at line 862 of file C4Game.cpp.

◆ EXEC_S_DR

#define EXEC_S_DR (   Expressions,
  Stat,
  DebugRecName 
)    { if (Config.General.DebugRec) AddDbgRec(RCT_Block, DebugRecName, 6); EXEC_S(Expressions, Stat) }

Definition at line 865 of file C4Game.cpp.

Function Documentation

◆ DefFileGetID()

C4ID DefFileGetID ( const char *  filename)

Definition at line 1705 of file C4Game.cpp.

1706 {
1707  C4Group group;
1708  if (!group.Open(filename))
1709  {
1710  return C4ID::None;
1711  }
1712  C4Def DefCore;
1713  if (!DefCore.LoadDefCore(group))
1714  {
1715  group.Close();
1716  return C4ID::None;
1717  }
1718  group.Close();
1719  return DefCore.id;
1720 }
Definition: C4Def.h:99
C4ID id
Definition: C4Def.h:101
bool LoadDefCore(C4Group &hGroup)
Definition: C4Def.cpp:141
bool Close()
Definition: C4Group.cpp:971
bool Open(const char *group_name, bool do_create=false)
Definition: C4Group.cpp:660
static const C4ID None
Definition: C4Id.h:39

References C4Group::Close(), C4Def::id, C4Def::LoadDefCore(), C4ID::None, and C4Group::Open().

Referenced by C4Game::DropFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTextSpecFacet()

bool GetTextSpecFacet ( const char *  spec,
C4Facet facet 
)

Definition at line 4603 of file C4Game.cpp.

4604 {
4605  // safety
4606  assert(spec && *spec);
4607  if (!spec)
4608  {
4609  return false;
4610  }
4611  // Special icon?
4612  if (SEqual2(spec, "@Ico:"))
4613  {
4614  spec += 5;
4615  auto it = str_to_icon.find(spec);
4616  if (it != str_to_icon.end())
4617  {
4618  facet = C4GUI::Icon::GetIconFacet(it->second);
4619  return true;
4620  }
4621  }
4622 
4623  return false;
4624 }
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:204
static C4Facet GetIconFacet(Icons icoIconIndex)

References SEqual2().

Referenced by C4Game::DrawTextSpecImage(), and C4Game::GetTextSpecImageAspect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LandscapeFree()

bool LandscapeFree ( int32_t  x,
int32_t  y 
)

Definition at line 2451 of file C4Game.cpp.

2452 {
2453  if (!Inside<int32_t>(x, 0,::Landscape.GetWidth()-1) || !Inside<int32_t>(y, 0,::Landscape.GetHeight()-1))
2454  {
2455  return false;
2456  }
2457  return !DensitySolid(GBackDensity(x, y));
2458 }
C4Landscape Landscape
bool DensitySolid(int32_t dens)
Definition: C4Landscape.h:196
int32_t GBackDensity(int32_t x, int32_t y)
Definition: C4Landscape.h:224
int32_t GetWidth() const
int32_t GetHeight() const

References DensitySolid(), GBackDensity(), C4Landscape::GetHeight(), C4Landscape::GetWidth(), and Landscape.

Here is the call graph for this function:

◆ ListExpandValids()

int32_t ListExpandValids ( C4IDList rlist,
C4ID idlist,
int32_t  maxidlist 
)

Definition at line 3250 of file C4Game.cpp.

3252 {
3253  int32_t cnt, cnt2, ccount, cpos;
3254  for (cpos = 0, cnt = 0; rlist.GetID(cnt); cnt++)
3255  {
3256  if (C4Id2Def(rlist.GetID(cnt,&ccount)))
3257  {
3258  for (cnt2 = 0; cnt2 < ccount; cnt2++)
3259  {
3260  if (cpos < maxidlist)
3261  {
3262  idlist[cpos] = rlist.GetID(cnt);
3263  cpos++;
3264  }
3265  }
3266  }
3267  }
3268  return cpos;
3269 }
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:103

References C4Id2Def(), and C4IDList::GetID().

Referenced by C4Game::InitInEarth(), and C4Game::InitVegetation().

Here is the call graph for this function:
Here is the caller graph for this function: