forked from Mirrors/openclonk
Reduce #includes so that C4Include.h doesn't include C4Value.h
This should avoid many complete rebuilds.
parent
4e75f2a134
commit
6d3feabe69
|
@ -29,10 +29,8 @@
|
|||
|
||||
#include <C4Include.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Version.h>
|
||||
#include <C4Network2Reference.h>
|
||||
#include <C4FileMonitor.h>
|
||||
|
||||
#include <C4FileMonitor.h>
|
||||
#include <C4GameSave.h>
|
||||
#include <C4Record.h>
|
||||
#include <C4Application.h>
|
||||
|
@ -66,6 +64,7 @@
|
|||
#include <C4RankSystem.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Network2Reference.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
|
@ -75,6 +74,7 @@
|
|||
#include <C4GameObjects.h>
|
||||
#include <C4GameControl.h>
|
||||
#include <C4Fonts.h>
|
||||
#include <C4Version.h>
|
||||
|
||||
#include <StdFile.h>
|
||||
|
||||
|
@ -598,7 +598,7 @@ void C4Game::Clear()
|
|||
MessageInput.Clear();
|
||||
Info.Clear();
|
||||
Title.Clear();
|
||||
Script.Clear();
|
||||
::GameScript.Clear();
|
||||
Names.Clear();
|
||||
GameText.Clear();
|
||||
RecordDumpFile.Clear();
|
||||
|
@ -621,7 +621,7 @@ void C4Game::Clear()
|
|||
PlayList.Clear();
|
||||
PlayerControlAssignmentSets.Clear();
|
||||
PlayerControlDefs.Clear();
|
||||
MaterialManager.Clear();
|
||||
::MeshMaterialManager.Clear();
|
||||
|
||||
// global fullscreen class is not cleared, because it holds the carrier window
|
||||
// but the menu must be cleared (maybe move Fullscreen.Menu somewhere else?)
|
||||
|
@ -684,7 +684,7 @@ C4ST_NEW(PlayersStat, "C4Game::Execute Players.Execute")
|
|||
C4ST_NEW(LandscapeStat, "C4Game::Execute Landscape.Execute")
|
||||
C4ST_NEW(MusicSystemStat, "C4Game::Execute MusicSystem.Execute")
|
||||
C4ST_NEW(MessagesStat, "C4Game::Execute Messages.Execute")
|
||||
C4ST_NEW(ScriptStat, "C4Game::Execute Script.Execute")
|
||||
C4ST_NEW(ScriptStat, "C4Game::Execute ::GameScript.Execute")
|
||||
|
||||
#define EXEC_S(Expressions, Stat) \
|
||||
{ C4ST_START(Stat) Expressions C4ST_STOP(Stat) }
|
||||
|
@ -744,7 +744,7 @@ bool C4Game::Execute() // Returns true if the game is over
|
|||
//FIXME: C4Application::Execute should do this, but what about the stats?
|
||||
EXEC_S_DR( Application.MusicSystem.Execute(); , MusicSystemStat , "Music")
|
||||
EXEC_S_DR( ::Messages.Execute(); , MessagesStat , "MsgEx")
|
||||
EXEC_S_DR( Script.Execute(); , ScriptStat , "Scrpt")
|
||||
EXEC_S_DR( ::GameScript.Execute(); , ScriptStat , "Scrpt")
|
||||
|
||||
EXEC_DR( MouseControl.Execute(); , "Input")
|
||||
|
||||
|
@ -1502,7 +1502,7 @@ void C4Game::Default()
|
|||
MainSysLangStringTable.Default();
|
||||
ScenarioLangStringTable.Default();
|
||||
ScenarioSysLangStringTable.Default();
|
||||
Script.Default();
|
||||
::GameScript.Default();
|
||||
//GraphicsResource.Default();
|
||||
//Control.Default();
|
||||
MouseControl.Default();
|
||||
|
@ -1661,7 +1661,7 @@ void C4Game::CompileFunc(StdCompiler *pComp, CompileSettings comp)
|
|||
pComp->NameEnd();
|
||||
}
|
||||
|
||||
pComp->Value(mkNamingAdapt(mkInsertAdapt(Script, ScriptEngine), "Script"));
|
||||
pComp->Value(mkNamingAdapt(mkInsertAdapt(::GameScript, ScriptEngine), "Script"));
|
||||
|
||||
if (comp.fExact)
|
||||
{
|
||||
|
@ -2218,7 +2218,7 @@ bool C4Game::InitGameFinal()
|
|||
|
||||
// Script constructor call
|
||||
int32_t iObjCount = Objects.ObjectCount();
|
||||
if (!C4S.Head.SaveGame) Script.Call(PSF_Initialize);
|
||||
if (!C4S.Head.SaveGame) ::GameScript.Call(PSF_Initialize);
|
||||
if (Objects.ObjectCount()!=iObjCount) fScriptCreatedObjects=true;
|
||||
|
||||
// Player final init
|
||||
|
@ -2648,8 +2648,8 @@ bool C4Game::LoadScenarioComponents()
|
|||
bool C4Game::LoadScenarioScripts()
|
||||
{
|
||||
// Script
|
||||
Script.Reg2List(&ScriptEngine, &ScriptEngine);
|
||||
Script.Load(LoadResStr("IDS_CNS_SCRIPT"),ScenarioFile,C4CFN_Script,Config.General.LanguageEx,NULL,&ScenarioLangStringTable);
|
||||
::GameScript.Reg2List(&ScriptEngine, &ScriptEngine);
|
||||
::GameScript.Load(LoadResStr("IDS_CNS_SCRIPT"),ScenarioFile,C4CFN_Script,Config.General.LanguageEx,NULL,&ScenarioLangStringTable);
|
||||
// additional system scripts?
|
||||
C4Group SysGroup;
|
||||
char fn[_MAX_FNAME+1] = { 0 };
|
||||
|
@ -2886,7 +2886,7 @@ bool C4Game::DoGameOver()
|
|||
// Flag, log, call
|
||||
GameOver=true;
|
||||
Log(LoadResStr("IDS_PRC_GAMEOVER"));
|
||||
Script.GRBroadcast(PSF_OnGameOver);
|
||||
::GameScript.GRBroadcast(PSF_OnGameOver);
|
||||
// Flag all surviving players as winners
|
||||
for (C4Player *pPlayer = Players.First; pPlayer; pPlayer = pPlayer->Next)
|
||||
if (!pPlayer->Eliminated)
|
||||
|
@ -2944,32 +2944,6 @@ void C4Game::Synchronize(bool fSavePlayerFiles)
|
|||
TransferZones.Synchronize();
|
||||
}
|
||||
|
||||
C4Object* C4Game::FindObjectByCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy, C4Object *pTarget2, C4Object *pFindNext)
|
||||
{
|
||||
C4Object *cObj; C4ObjectLink *clnk;
|
||||
for (clnk=Objects.First; clnk && (cObj=clnk->Obj); clnk=clnk->Next)
|
||||
{
|
||||
// find next
|
||||
if (pFindNext) { if (cObj==pFindNext) pFindNext=NULL; continue; }
|
||||
// Status
|
||||
if (cObj->Status)
|
||||
// Check commands
|
||||
for (C4Command *pCommand=cObj->Command; pCommand; pCommand=pCommand->Next)
|
||||
// Command
|
||||
if (pCommand->Command==iCommand)
|
||||
// Target
|
||||
if (!pTarget || (pCommand->Target==pTarget))
|
||||
// Position
|
||||
if ((!iTx && !iTy) || ((pCommand->Tx==iTx) && (pCommand->Ty==iTy)))
|
||||
// Target2
|
||||
if (!pTarget2 || (pCommand->Target2==pTarget2))
|
||||
// Found
|
||||
return cObj;
|
||||
}
|
||||
// Not found
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool C4Game::InitNetworkFromAddress(const char *szAddress)
|
||||
{
|
||||
StdCopyStrBuf strRefQueryFailed(LoadResStr("IDS_NET_REFQUERY_FAILED"));
|
||||
|
|
|
@ -24,20 +24,15 @@
|
|||
#ifndef INC_C4Game
|
||||
#define INC_C4Game
|
||||
|
||||
#include <StdMeshMaterial.h>
|
||||
#include <C4GameParameters.h>
|
||||
#include <C4PlayerInfo.h>
|
||||
#include <C4RoundResults.h>
|
||||
#include <C4Scenario.h>
|
||||
#include <C4Control.h>
|
||||
#include <C4PathFinder.h>
|
||||
#include <C4Extra.h>
|
||||
#include <C4Effects.h>
|
||||
#include "C4Scoreboard.h"
|
||||
#include <C4VideoPlayback.h>
|
||||
#include <C4ScriptHost.h>
|
||||
#include <C4PlayerControl.h>
|
||||
class C4ObjectInfo;
|
||||
|
||||
class C4Game
|
||||
{
|
||||
|
@ -76,7 +71,6 @@ public:
|
|||
C4ComponentHost Title;
|
||||
C4ComponentHost Names;
|
||||
C4ComponentHost GameText;
|
||||
C4GameScriptHost Script;
|
||||
C4LangStringTable MainSysLangStringTable, ScenarioLangStringTable, ScenarioSysLangStringTable;
|
||||
StdStrBuf PlayerNames;
|
||||
C4Control &Input; // shortcut
|
||||
|
@ -93,7 +87,6 @@ public:
|
|||
C4PlayerControlAssignmentSets PlayerControlAssignmentSets;
|
||||
C4Scoreboard Scoreboard;
|
||||
C4VideoPlayer VideoPlayer;
|
||||
StdMeshMatManager MaterialManager;
|
||||
class C4Network2Stats *pNetworkStatistics; // may be NULL if no statistics are recorded
|
||||
class C4KeyboardInput &KeyboardInput;
|
||||
class C4FileMonitor *pFileMonitor;
|
||||
|
@ -225,7 +218,6 @@ public:
|
|||
C4Object *pContainer=NULL,
|
||||
int32_t iOwner=ANY_OWNER);*/
|
||||
int32_t ObjectCount(C4ID id);
|
||||
C4Object *FindObjectByCommand(int32_t iCommand, C4Object *pTarget=NULL, C4Value iTx=C4VNull, int32_t iTy=0, C4Object *pTarget2=NULL, C4Object *pFindNext=NULL);
|
||||
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);
|
||||
void BlastCastObjects(C4ID id, C4Object *pCreator, int32_t num, int32_t tx, int32_t ty, int32_t iController=NO_OWNER);
|
||||
C4Object *PlaceVegetation(C4ID id, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iGrowth);
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
#ifndef INC_C4Include
|
||||
#define INC_C4Include
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Get non-standard <cmath> constants (M_PI etc.)
|
||||
# define _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
#include "PlatformAbstraction.h"
|
||||
|
||||
// boost headers - after PlatformAbstraction to prevent redefines of stdint
|
||||
|
@ -45,8 +40,6 @@
|
|||
#include "C4Log.h"
|
||||
#include "C4Reloc.h"
|
||||
|
||||
#include "C4PlayerControl.h"
|
||||
|
||||
#include "C4Game.h"
|
||||
|
||||
#ifdef DEBUGREC
|
||||
|
|
|
@ -27,17 +27,20 @@
|
|||
// class declarations
|
||||
class C4Action;
|
||||
class C4AList;
|
||||
struct C4AulContext;
|
||||
class C4AulDefFunc;
|
||||
class C4AulFunc;
|
||||
class C4AulScript;
|
||||
class C4AulScriptEngine;
|
||||
class C4AulScriptFunc;
|
||||
struct C4AulParSet;
|
||||
class C4ClientPlayerInfos;
|
||||
class C4Command;
|
||||
class C4Config;
|
||||
class C4Console;
|
||||
class C4Def;
|
||||
class C4DefList;
|
||||
class C4DefGraphics;
|
||||
class C4Effect;
|
||||
class C4Facet;
|
||||
class C4FacetSurface;
|
||||
|
|
|
@ -239,7 +239,7 @@ void C4ControlScript::Execute() const
|
|||
C4Object *pObj = NULL;
|
||||
C4AulScript *pScript;
|
||||
if (iTargetObj == SCOPE_Console)
|
||||
pScript = &Game.Script;
|
||||
pScript = &::GameScript;
|
||||
else if (iTargetObj == SCOPE_Global)
|
||||
pScript = &::ScriptEngine;
|
||||
else if ((pObj = ::Objects.SafeObjectPointer(iTargetObj)))
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "C4Log.h"
|
||||
#include "C4Components.h"
|
||||
#include "C4Def.h"
|
||||
#include <C4Game.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4Network2.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <C4Include.h>
|
||||
#include <C4GameSave.h>
|
||||
#include <C4Version.h>
|
||||
|
||||
#include <C4Components.h>
|
||||
#include <C4Game.h>
|
||||
|
@ -34,9 +33,11 @@
|
|||
#include <C4Landscape.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4MassMover.h>
|
||||
#include <C4ScriptHost.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4Record.h>
|
||||
#include <C4Version.h>
|
||||
|
||||
// *** C4GameSave main class
|
||||
|
||||
|
@ -211,7 +212,7 @@ bool C4GameSave::SaveRuntimeData()
|
|||
// such modifications cannot possibly be done before game start
|
||||
// so it's runtime data
|
||||
// Script
|
||||
if (!Game.Script.Save((*pSaveGroup))) Log(LoadResStr("IDS_ERR_SAVE_SCRIPT")); /* nofail */
|
||||
if (!::GameScript.Save((*pSaveGroup))) Log(LoadResStr("IDS_ERR_SAVE_SCRIPT")); /* nofail */
|
||||
// Title - unexact only, because in savegames, the title will be set in core
|
||||
if (!IsExact()) if (!Game.Title.Save((*pSaveGroup))) Log(LoadResStr("IDS_ERR_SAVE_TITLE")); /* nofail */
|
||||
// Info
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
|
||||
#include <C4Include.h>
|
||||
#include <C4Console.h>
|
||||
#include <C4Application.h>
|
||||
|
||||
#include <C4Application.h>
|
||||
#include <C4Def.h>
|
||||
#include <C4GameSave.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4MessageInput.h>
|
||||
|
@ -39,6 +40,7 @@
|
|||
#include <C4Landscape.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4ScriptHost.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameControl.h>
|
||||
|
||||
|
@ -141,9 +143,9 @@ void C4Console::UpdateStatusBars()
|
|||
C4ConsoleGUI::DisplayInfoText(CONSOLE_FrameCounter, str);
|
||||
}
|
||||
// Script counter
|
||||
if (Game.Script.Counter!=ScriptCounter)
|
||||
if (::GameScript.Counter!=ScriptCounter)
|
||||
{
|
||||
ScriptCounter=Game.Script.Counter;
|
||||
ScriptCounter=::GameScript.Counter;
|
||||
StdStrBuf str;
|
||||
str.Format("Script: %i",ScriptCounter);
|
||||
C4ConsoleGUI::DisplayInfoText(CONSOLE_ScriptCounter, str);
|
||||
|
@ -417,7 +419,7 @@ void C4Console::EditTitle()
|
|||
void C4Console::EditScript()
|
||||
{
|
||||
if (::Network.isEnabled()) return;
|
||||
Game.Script.Open();
|
||||
::GameScript.Open();
|
||||
::ScriptEngine.ReLink(&::Definitions);
|
||||
}
|
||||
|
||||
|
@ -448,9 +450,9 @@ void C4Console::UpdateInputCtrl()
|
|||
}
|
||||
}
|
||||
// Add scenario script functions
|
||||
if (pRef=Game.Script.GetSFunc(0))
|
||||
if (pRef=::GameScript.GetSFunc(0))
|
||||
functions.push_back((char*)C4ConsoleGUI::LIST_DIVIDER);
|
||||
for (cnt=0; (pRef=Game.Script.GetSFunc(cnt)); cnt++)
|
||||
for (cnt=0; (pRef=::GameScript.GetSFunc(cnt)); cnt++)
|
||||
{
|
||||
functions.push_back(pRef->Name);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4Aul.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4ScriptHost.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4Record.h>
|
||||
|
||||
|
@ -427,7 +428,7 @@ bool C4MCOverlay::SetField(C4MCParser *pParser, const char *szField, const char
|
|||
case C4MCV_ScriptFunc:
|
||||
{
|
||||
// get script func of main script
|
||||
C4AulFunc *pSFunc = Game.Script.GetSFunc(StrPar, AA_PROTECTED);
|
||||
C4AulFunc *pSFunc = ::GameScript.GetSFunc(StrPar, AA_PROTECTED);
|
||||
if (!pSFunc) throw C4MCParserErr(pParser, C4MCErr_SFuncNotFound, StrPar);
|
||||
// add to main
|
||||
Target.As<C4MCCallbackArray*>() = new C4MCCallbackArray(pSFunc, MapCreator);
|
||||
|
@ -1608,7 +1609,7 @@ bool AlgoGradient(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
|
|||
bool AlgoScript(C4MCOverlay *pOvrl, int32_t iX, int32_t iY)
|
||||
{
|
||||
// get script function
|
||||
C4AulFunc *pFunc = Game.Script.GetSFunc(FormatString("ScriptAlgo%s", pOvrl->Name).getData());
|
||||
C4AulFunc *pFunc = ::GameScript.GetSFunc(FormatString("ScriptAlgo%s", pOvrl->Name).getData());
|
||||
// failsafe
|
||||
if (!pFunc) return false;
|
||||
// ok, call func
|
||||
|
|
|
@ -173,9 +173,9 @@ bool C4DefGraphics::LoadMesh(C4Group &hGroup, StdMeshSkeletonLoader& loader)
|
|||
try
|
||||
{
|
||||
if (hGroup.LoadEntry(C4CFN_DefMesh, &buf, &size, 1))
|
||||
Mesh = StdMeshLoader::LoadMeshBinary(buf, size, Game.MaterialManager, loader);
|
||||
Mesh = StdMeshLoader::LoadMeshBinary(buf, size, ::MeshMaterialManager, loader);
|
||||
else if (hGroup.LoadEntry(C4CFN_DefMeshXml, &buf, &size, 1))
|
||||
Mesh = StdMeshLoader::LoadMeshXml(buf, size, Game.MaterialManager, loader);
|
||||
Mesh = StdMeshLoader::LoadMeshXml(buf, size, ::MeshMaterialManager, loader);
|
||||
else
|
||||
return false;
|
||||
delete[] buf;
|
||||
|
@ -208,7 +208,7 @@ bool C4DefGraphics::Load(C4Group &hGroup, bool fColorByOwner)
|
|||
{
|
||||
try
|
||||
{
|
||||
Game.MaterialManager.Parse(material.getData(), Filename, loader);
|
||||
::MeshMaterialManager.Parse(material.getData(), Filename, loader);
|
||||
}
|
||||
catch (const StdMeshMaterialError& ex)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <C4Include.h>
|
||||
#include <C4InfoCore.h>
|
||||
|
||||
#include <C4Def.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4Group.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "C4Facet.h"
|
||||
#include "C4Id.h"
|
||||
#include "C4Def.h"
|
||||
#include "C4Sector.h"
|
||||
#include "C4Value.h"
|
||||
#include "C4Effects.h"
|
||||
|
|
|
@ -330,15 +330,13 @@ C4ObjectLink* C4ObjectList::GetLink(C4Object *pObj)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int C4ObjectList::ObjectCount(C4ID id, int32_t dwCategory) const
|
||||
int C4ObjectList::ObjectCount(C4ID id) const
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
int iCount=0;
|
||||
for (cLnk=First; cLnk; cLnk=cLnk->Next)
|
||||
if (cLnk->Obj->Status)
|
||||
if ( (id==C4ID::None) || (cLnk->Obj->Def->id==id) )
|
||||
if ( (dwCategory==C4D_All) || (cLnk->Obj->Category & dwCategory) )
|
||||
iCount++;
|
||||
if (cLnk->Obj->Status && (id==C4ID::None || cLnk->Obj->Def->id==id))
|
||||
iCount++;
|
||||
return iCount;
|
||||
}
|
||||
|
||||
|
@ -579,13 +577,13 @@ void C4ObjectList::CompileFunc(StdCompiler *pComp, bool fSaveRefs, bool fSkipPla
|
|||
}
|
||||
}
|
||||
|
||||
StdStrBuf C4ObjectList::GetNameList(C4DefList &rDefs, DWORD dwCategory)
|
||||
StdStrBuf C4ObjectList::GetNameList(C4DefList &rDefs)
|
||||
{
|
||||
int cpos,idcount;
|
||||
C4ID c_id;
|
||||
C4Def *cdef;
|
||||
StdStrBuf Buf;
|
||||
for (cpos=0; (c_id=GetListID(dwCategory,cpos)); cpos++)
|
||||
for (cpos=0; (c_id=GetListID(C4D_All,cpos)); cpos++)
|
||||
if ((cdef=rDefs.ID2Def(c_id)))
|
||||
{
|
||||
idcount=ObjectCount(c_id);
|
||||
|
@ -624,26 +622,6 @@ void C4ObjectList::ClearInfo(C4ObjectInfo *pInfo)
|
|||
cLnk->Obj->ClearInfo(pInfo);
|
||||
}
|
||||
|
||||
void C4ObjectList::DrawList(C4Facet &cgo, int iSelection, DWORD dwCategory)
|
||||
{
|
||||
int iSections = cgo.GetSectionCount();
|
||||
int iObjects = ObjectCount(C4ID::None,dwCategory);
|
||||
int iFirstVisible = BoundBy(iSelection-iSections/2,0,Max(iObjects-iSections,0));
|
||||
C4Facet cgo2;
|
||||
int iObj=0,iSec=0;
|
||||
C4ObjectLink *cLnk; C4Object *cObj;
|
||||
for (cLnk=First; cLnk && (cObj=cLnk->Obj); cLnk=cLnk->Next)
|
||||
if (cObj->Status && (cObj->Category && dwCategory))
|
||||
{
|
||||
if (Inside(iObj,iFirstVisible,iFirstVisible+iSections-1))
|
||||
{
|
||||
cgo2 = cgo.GetSection(iSec++);
|
||||
cObj->DrawPicture(cgo2,(iObj==iSelection));
|
||||
}
|
||||
iObj++;
|
||||
}
|
||||
}
|
||||
|
||||
void C4ObjectList::Sort()
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define INC_C4ObjectList
|
||||
|
||||
#include <C4Id.h>
|
||||
#include <C4Def.h>
|
||||
|
||||
class C4Object;
|
||||
class C4ObjectList;
|
||||
|
@ -99,7 +98,6 @@ public:
|
|||
void DrawAll(C4TargetFacet &cgo, int iPlayer = -1); // draw all objects, including bg
|
||||
void DrawIfCategory(C4TargetFacet &cgo, int iPlayer, uint32_t dwCat, bool fInvert); // draw all objects that match dwCat (or don't match if fInvert)
|
||||
void Draw(C4TargetFacet &cgo, int iPlayer = -1); // draw all objects
|
||||
void DrawList(C4Facet &cgo, int iSelection=-1, DWORD dwCategory=C4D_All);
|
||||
void DrawIDList(C4Facet &cgo, int iSelection, C4DefList &rDefs, int32_t dwCategory, C4RegionList *pRegions=NULL, int iRegionCom=COM_None, bool fDrawOneCounts=true);
|
||||
void DrawSelectMark(C4TargetFacet &cgo);
|
||||
void CloseMenus();
|
||||
|
@ -115,7 +113,7 @@ public:
|
|||
|
||||
virtual bool AssignInfo();
|
||||
virtual bool ValidateOwners();
|
||||
StdStrBuf GetNameList(C4DefList &rDefs, DWORD dwCategory=C4D_All);
|
||||
StdStrBuf GetNameList(C4DefList &rDefs);
|
||||
bool IsClear() const;
|
||||
bool DenumerateRead();
|
||||
bool Write(char *szTarget);
|
||||
|
@ -123,7 +121,7 @@ public:
|
|||
|
||||
bool IsContained(C4Object *pObj);
|
||||
int ClearPointers(C4Object *pObj);
|
||||
int ObjectCount(C4ID id=C4ID::None, int32_t dwCategory=C4D_All) const;
|
||||
int ObjectCount(C4ID id=C4ID::None) const;
|
||||
int MassCount();
|
||||
int ListIDCount(int32_t dwCategory);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ bool C4ObjectMenu::IsCloseDenied()
|
|||
if (Object) fResult = !!Object->Call(PSF_MenuQueryCancel, &pars);
|
||||
}
|
||||
else if (eCallbackType == CB_Scenario)
|
||||
fResult = !!Game.Script.Call(PSF_MenuQueryCancel, 0, &pars);
|
||||
fResult = !!::GameScript.Call(PSF_MenuQueryCancel, 0, &pars);
|
||||
CloseQuerying = false;
|
||||
if (fResult) return true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void C4ObjectMenu::OnSelectionChanged(int32_t iNewSelection)
|
|||
if (eCallbackType == CB_Object && Object)
|
||||
Object->Call(PSF_MenuSelection, &pars);
|
||||
else if (eCallbackType == CB_Scenario)
|
||||
Game.Script.Call(PSF_MenuSelection, 0, &pars);
|
||||
::GameScript.Call(PSF_MenuSelection, 0, &pars);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ bool C4ObjectMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
|||
|
||||
case CB_Scenario:
|
||||
// Object menu with scenario script callback
|
||||
Game.Script.DirectExec(NULL, szCommand, "MenuCommand");
|
||||
::GameScript.DirectExec(NULL, szCommand, "MenuCommand");
|
||||
break;
|
||||
|
||||
case CB_None:
|
||||
|
|
|
@ -325,7 +325,7 @@ bool C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
{
|
||||
// player preinit: In case a team needs to be chosen first, no InitializePlayer-broadcast is done
|
||||
// this callback shall give scripters a chance to do stuff like starting an intro or enabling FoW, which might need to be done
|
||||
Game.Script.GRBroadcast(PSF_PreInitializePlayer, &C4AulParSet(C4VInt(Number)));
|
||||
::GameScript.GRBroadcast(PSF_PreInitializePlayer, &C4AulParSet(C4VInt(Number)));
|
||||
// direct init
|
||||
if (Status != PS_TeamSelection) if (!ScenarioInit()) return false;
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ bool C4Player::ScenarioInit()
|
|||
}
|
||||
|
||||
// Scenario script initialization
|
||||
Game.Script.GRBroadcast(PSF_InitializePlayer, &C4AulParSet(C4VInt(Number),
|
||||
::GameScript.GRBroadcast(PSF_InitializePlayer, &C4AulParSet(C4VInt(Number),
|
||||
C4VInt(ptx),
|
||||
C4VInt(pty),
|
||||
C4VObj(FirstBase),
|
||||
|
@ -757,7 +757,7 @@ bool C4Player::SetWealth(int32_t iVal)
|
|||
|
||||
Wealth=BoundBy<int32_t>(iVal,0,10000);
|
||||
|
||||
Game.Script.GRBroadcast(PSF_OnWealthChanged,&C4AulParSet(C4VInt(Number)));
|
||||
::GameScript.GRBroadcast(PSF_OnWealthChanged,&C4AulParSet(C4VInt(Number)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ bool C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
|
|||
|
||||
// inform script
|
||||
if (!fNoCalls)
|
||||
Game.Script.GRBroadcast(PSF_RemovePlayer, &C4AulParSet(C4VInt(pPlr->Number), C4VInt(pPlr->Team)));
|
||||
::GameScript.GRBroadcast(PSF_RemovePlayer, &C4AulParSet(C4VInt(pPlr->Number), C4VInt(pPlr->Team)));
|
||||
|
||||
// Transfer ownership of other objects to team members
|
||||
if (!fNoCalls) pPlr->NotifyOwnedObjects();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <C4Constants.h>
|
||||
#include <C4ObjectPtr.h>
|
||||
#include <C4PropList.h>
|
||||
|
||||
// callback return values
|
||||
#define C4Fx_OK 0 // generic standard behaviour for all effect callbacks
|
||||
|
|
|
@ -292,7 +292,7 @@ static C4Object *Fn_this(C4AulContext *cthr)
|
|||
|
||||
static C4Void Fn_goto(C4AulContext *cthr, long iCounter)
|
||||
{
|
||||
Game.Script.Counter=iCounter;
|
||||
::GameScript.Counter=iCounter;
|
||||
return C4VNull;
|
||||
}
|
||||
|
||||
|
@ -2093,7 +2093,7 @@ static C4Value FnAddMessage_C4V(C4AulContext *cthr, C4Value *c4vMessage, C4Value
|
|||
|
||||
static bool FnScriptGo(C4AulContext *cthr, bool go)
|
||||
{
|
||||
Game.Script.Go=!!go;
|
||||
::GameScript.Go=!!go;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2132,14 +2132,14 @@ static bool FnSetHostility(C4AulContext *cthr, long iPlr, long iPlr2, bool fHost
|
|||
// do rejection test first
|
||||
if (!fNoCalls)
|
||||
{
|
||||
if (!!Game.Script.GRBroadcast(PSF_RejectHostilityChange, &C4AulParSet(C4VInt(iPlr), C4VInt(iPlr2), C4VBool(fHostile)), true, true))
|
||||
if (!!::GameScript.GRBroadcast(PSF_RejectHostilityChange, &C4AulParSet(C4VInt(iPlr), C4VInt(iPlr2), C4VBool(fHostile)), true, true))
|
||||
return false;
|
||||
}
|
||||
// OK; set hostility
|
||||
bool fOldHostility = ::Players.HostilityDeclared(iPlr, iPlr2);
|
||||
if (!pPlr->SetHostility(iPlr2,fHostile, fSilent)) return false;
|
||||
// calls afterwards
|
||||
Game.Script.GRBroadcast(PSF_OnHostilityChange, &C4AulParSet(C4VInt(iPlr), C4VInt(iPlr2), C4VBool(fHostile), C4VBool(fOldHostility)), true);
|
||||
::GameScript.GRBroadcast(PSF_OnHostilityChange, &C4AulParSet(C4VInt(iPlr), C4VInt(iPlr2), C4VBool(fHostile), C4VBool(fOldHostility)), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2833,7 +2833,7 @@ static C4Value FnGameCall_C4V(C4AulContext *cthr,
|
|||
C4AulParSet Pars;
|
||||
Copy2ParSet9(Pars, *par);
|
||||
// Call
|
||||
return Game.Script.Call(szFunc2, 0, &Pars, true);
|
||||
return ::GameScript.Call(szFunc2, 0, &Pars, true);
|
||||
}
|
||||
|
||||
static C4Value FnGameCallEx_C4V(C4AulContext *cthr,
|
||||
|
@ -2850,7 +2850,7 @@ static C4Value FnGameCallEx_C4V(C4AulContext *cthr,
|
|||
C4AulParSet Pars;
|
||||
Copy2ParSet9(Pars, *par);
|
||||
// Call
|
||||
return Game.Script.GRBroadcast(szFunc2,&Pars, true);
|
||||
return ::GameScript.GRBroadcast(szFunc2,&Pars, true);
|
||||
}
|
||||
|
||||
static C4Value FnProtectedCall_C4V(C4AulContext *cthr,
|
||||
|
@ -2957,14 +2957,14 @@ static bool FnOnMessageBoardAnswer(C4AulContext *cthr, C4Object *pObj, long iFor
|
|||
if (!szAnswerString || !szAnswerString->GetCStr()) return true;
|
||||
// get script
|
||||
C4ScriptHost *scr;
|
||||
if (pObj) scr = &pObj->Def->Script; else scr = &Game.Script;
|
||||
if (pObj) scr = &pObj->Def->Script; else scr = &::GameScript;
|
||||
// exec func
|
||||
return !!scr->Call(PSF_InputCallback, pObj, &C4AulParSet(C4VString(FnStringPar(szAnswerString)), C4VInt(iForPlr)));
|
||||
}
|
||||
|
||||
static long FnScriptCounter(C4AulContext *cthr)
|
||||
{
|
||||
return Game.Script.Counter;
|
||||
return ::GameScript.Counter;
|
||||
}
|
||||
|
||||
static C4Void FnSetMass(C4AulObjectContext *cthr, long iValue)
|
||||
|
@ -3577,7 +3577,7 @@ static C4Value FnEval(C4AulContext *cthr, C4Value *strScript_C4V)
|
|||
else if (cthr->Def)
|
||||
return cthr->Def->Script.DirectExec(0, FnStringPar(strScript_C4V->getStr()), "eval", true, Strict);
|
||||
else
|
||||
return Game.Script.DirectExec(0, FnStringPar(strScript_C4V->getStr()), "eval", true, Strict);
|
||||
return ::GameScript.DirectExec(0, FnStringPar(strScript_C4V->getStr()), "eval", true, Strict);
|
||||
}
|
||||
|
||||
static bool FnLocateFunc(C4AulContext *cthr, C4String *funcname, C4Object *pObj, C4ID idDef)
|
||||
|
@ -4625,7 +4625,7 @@ static bool FnSetPlayerTeam(C4AulContext *cthr, long iPlayer, long idNewTeam, bo
|
|||
// ask script if it's allowed
|
||||
if (!fNoCalls)
|
||||
{
|
||||
if (!!Game.Script.GRBroadcast(PSF_RejectTeamSwitch, &C4AulParSet(C4VInt(iPlayer), C4VInt(idNewTeam)), true, true))
|
||||
if (!!::GameScript.GRBroadcast(PSF_RejectTeamSwitch, &C4AulParSet(C4VInt(iPlayer), C4VInt(idNewTeam)), true, true))
|
||||
return false;
|
||||
}
|
||||
// exit previous team
|
||||
|
@ -4658,7 +4658,7 @@ static bool FnSetPlayerTeam(C4AulContext *cthr, long iPlayer, long idNewTeam, bo
|
|||
}
|
||||
// do callback to reflect change in scenario
|
||||
if (!fNoCalls)
|
||||
Game.Script.GRBroadcast(PSF_OnTeamSwitch, &C4AulParSet(C4VInt(iPlayer), C4VInt(idNewTeam), C4VInt(idOldTeam)), true);
|
||||
::GameScript.GRBroadcast(PSF_OnTeamSwitch, &C4AulParSet(C4VInt(iPlayer), C4VInt(idNewTeam), C4VInt(idOldTeam)), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5367,7 +5367,7 @@ static bool FnSetMeshMaterial(C4AulObjectContext* ctx, C4String* Material, int i
|
|||
if (iSubMesh < 0 || (unsigned int)iSubMesh >= ctx->Obj->pMeshInstance->GetNumSubMeshes()) return false;
|
||||
if (!Material) return false;
|
||||
|
||||
const StdMeshMaterial* material = Game.MaterialManager.GetMaterial(Material->GetData().getData());
|
||||
const StdMeshMaterial* material = ::MeshMaterialManager.GetMaterial(Material->GetData().getData());
|
||||
if (!material) return false;
|
||||
|
||||
StdSubMeshInstance& submesh = ctx->Obj->pMeshInstance->GetSubMesh(iSubMesh);
|
||||
|
|
|
@ -25,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <C4Include.h>
|
||||
#include <C4GameOverDlg.h>
|
||||
|
||||
#include <C4Def.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4FullScreen.h>
|
||||
#include <C4Player.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <utility>
|
||||
#include "C4Gui.h"
|
||||
#include "C4StringTable.h"
|
||||
|
||||
class C4Scoreboard
|
||||
{
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
#pragma warning(disable : 4786) // long symbol names
|
||||
#pragma warning(disable: 4706)
|
||||
#pragma warning(disable: 4239)
|
||||
// Get non-standard <cmath> constants (M_PI etc.)
|
||||
# define _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1036,3 +1036,5 @@ const StdMeshMaterial* StdMeshMatManager::GetMaterial(const char* material_name)
|
|||
if (iter == Materials.end()) return NULL;
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
StdMeshMatManager MeshMaterialManager;
|
||||
|
|
|
@ -337,4 +337,6 @@ private:
|
|||
std::map<StdCopyStrBuf, StdMeshMaterial> Materials;
|
||||
};
|
||||
|
||||
extern StdMeshMatManager MeshMaterialManager;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -293,7 +293,7 @@ void C4AulScriptEngine::ReLink(C4DefList *rDefs)
|
|||
if (rDefs) rDefs->ResetIncludeDependencies();
|
||||
|
||||
// clear string table
|
||||
Game.Script.UnLink();
|
||||
::GameScript.UnLink();
|
||||
|
||||
// re-link
|
||||
Link(rDefs);
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
/* Property lists */
|
||||
|
||||
#ifndef C4PROPLIST_H
|
||||
#define C4PROPLIST_H
|
||||
|
||||
#include "C4Value.h"
|
||||
#include "C4StringTable.h"
|
||||
|
||||
#ifndef C4PROPLIST_H
|
||||
#define C4PROPLIST_H
|
||||
|
||||
class C4Def;
|
||||
|
||||
class C4Property
|
||||
|
|
|
@ -254,3 +254,5 @@ void C4GameScriptHost::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(Go, "Go", false));
|
||||
pComp->Value(mkNamingAdapt(Counter, "Counter", 0));
|
||||
}
|
||||
|
||||
C4GameScriptHost GameScript;
|
||||
|
|
|
@ -97,4 +97,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
extern C4GameScriptHost GameScript;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
#include "C4Value.h"
|
||||
|
||||
#ifndef INC_C4ValueList
|
||||
#define INC_C4ValueList
|
||||
|
||||
#include "C4Value.h"
|
||||
|
||||
// reference counted array of C4Values
|
||||
class C4ValueArray
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue