Move Game.Objects to ::Objects

Also move Game.{Back|Fore}Objects to ::Objects.{Back|Fore}Objects and clean
up DeleteObjects.
stable-5.2
Günther Brammer 2009-06-15 23:47:26 +02:00
parent c6dee6d7c8
commit 078a0ca9e4
43 changed files with 225 additions and 195 deletions

View File

@ -28,6 +28,7 @@
#define INC_C4Effects
#include <C4Constants.h>
#include <C4ValueList.h>
// callback return values
#define C4Fx_OK 0 // generic standard behaviour for all effect callbacks

View File

@ -29,7 +29,6 @@
#include <C4GameParameters.h>
#include <C4PlayerInfo.h>
#include <C4RoundResults.h>
#include <C4GameObjects.h>
#include <C4Scenario.h>
#include <C4GameControl.h>
#include <C4Control.h>
@ -39,6 +38,7 @@
#include <C4Fonts.h>
#include "C4Scoreboard.h"
#include <C4VideoPlayback.h>
#include <C4ScriptHost.h>
class C4Game
{
@ -72,9 +72,6 @@ class C4Game
C4PlayerInfoList &PlayerInfos; // Shortcut
C4PlayerInfoList &RestorePlayerInfos; // Shortcut
C4RoundResults RoundResults;
C4GameObjects Objects;
C4ObjectList BackObjects; // objects in background (C4D_Background)
C4ObjectList ForeObjects; // objects in foreground (C4D_Foreground)
C4Scenario C4S;
C4ComponentHost Info;
C4ComponentHost Title;

View File

@ -40,6 +40,8 @@ class C4GameObjects : public C4NotifyingObjectList
public:
C4LSectors Sectors; // section object lists
C4ObjectList InactiveObjects; // inactive objects (Status=2)
C4ObjectList BackObjects; // objects in background (C4D_Background)
C4ObjectList ForeObjects; // objects in foreground (C4D_Foreground)
C4ObjResort *ResortProc; // current sheduled user resorts
unsigned int LastUsedMarker; // last used value for C4Object::Marker
@ -78,7 +80,7 @@ class C4GameObjects : public C4NotifyingObjectList
void ResortUnsorted(); // resort any objects with unsorted-flag set into lists
void ExecuteResorts(); // execute custom resort procs
void DeleteObjects(); // delete all objects and links
void DeleteObjects(bool fDeleteInactive); // delete all objects and links
void ClearDefPointers(C4Def *pDef); // clear all pointers into definition
void UpdateDefPointers(C4Def *pDef); // restore any cleared pointers after def reload
@ -87,7 +89,7 @@ class C4GameObjects : public C4NotifyingObjectList
bool AssignInfo();
};
class C4AulFunc;
extern C4GameObjects Objects;
// sheduled resort holder
class C4ObjResort

View File

@ -22,6 +22,7 @@
#ifndef INC_C4Prototypes
#define INC_C4Prototypes
class C4AulFunc;
class C4Game;
class C4Record;
class C4Playback;

View File

@ -26,6 +26,7 @@
#include <C4Def.h>
#include <C4Material.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
// ResolveAppends and ResolveIncludes must be called both
@ -303,7 +304,7 @@ void C4AulScriptEngine::ReLink(C4DefList *rDefs)
Link(rDefs);
// update effect pointers
Game.Objects.UpdateScriptPointers();
::Objects.UpdateScriptPointers();
// update material pointers
::MaterialMap.UpdateScriptPointers();

View File

@ -37,6 +37,7 @@
#include <C4Landscape.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
const int32_t MoveToRange=5,LetGoRange1=7,LetGoRange2=30,DigRange=1;
@ -2306,15 +2307,15 @@ void C4Command::CompileFunc(StdCompiler *pComp)
void C4Command::DenumeratePointers()
{
Target = Game.Objects.ObjectPointer((long)Target);
Target2 = Game.Objects.ObjectPointer((long)Target2);
Target = ::Objects.ObjectPointer((long)Target);
Target2 = ::Objects.ObjectPointer((long)Target2);
Tx.DenumeratePointer();
}
void C4Command::EnumeratePointers()
{
Target = (C4Object*) Game.Objects.ObjectNumber(Target);
Target2 = (C4Object*) Game.Objects.ObjectNumber(Target2);
Target = (C4Object*) ::Objects.ObjectNumber(Target);
Target2 = (C4Object*) ::Objects.ObjectNumber(Target2);
}
int32_t C4Command::CallFailed()

View File

@ -43,6 +43,7 @@
#include <C4Landscape.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
// *** C4ControlPacket
@ -278,7 +279,7 @@ void C4ControlScript::Execute() const
pScript = &Game.Script;
else if (iTargetObj == SCOPE_Global)
pScript = &::ScriptEngine;
else if (pObj = Game.Objects.SafeObjectPointer(iTargetObj))
else if (pObj = ::Objects.SafeObjectPointer(iTargetObj))
pScript = &(pObj->Def->Script);
else
// default: Fallback to global context
@ -339,7 +340,7 @@ void C4ControlPlayerSelect::Execute() const
C4ObjectList SelectObjs;
int32_t iControlChecksum = 0;
for(int32_t i = 0; i < iObjCnt; i++)
if(pObj = Game.Objects.SafeObjectPointer(pObjNrs[i]))
if(pObj = ::Objects.SafeObjectPointer(pObjNrs[i]))
{
iControlChecksum += pObj->Number * (iControlChecksum+4787821);
// user defined object selection: callback to object
@ -395,7 +396,7 @@ void C4ControlPlayerControl::CompileFunc(StdCompiler *pComp)
C4ControlPlayerCommand::C4ControlPlayerCommand(int32_t iPlr, int32_t iCmd, int32_t iX, int32_t iY,
C4Object *pTarget, C4Object *pTarget2, int32_t iData, int32_t iAddMode)
: iPlr(iPlr), iCmd(iCmd), iX(iX), iY(iY),
iTarget(Game.Objects.ObjectNumber(pTarget)), iTarget2(Game.Objects.ObjectNumber(pTarget2)),
iTarget(::Objects.ObjectNumber(pTarget)), iTarget2(::Objects.ObjectNumber(pTarget2)),
iData(iData), iAddMode(iAddMode)
{
@ -408,9 +409,9 @@ void C4ControlPlayerCommand::Execute() const
{
pPlr->CountControl(C4Player::PCID_Command, iCmd+iX+iY+iTarget+iTarget2);
pPlr->ObjectCommand(iCmd,
Game.Objects.ObjectPointer(iTarget),
::Objects.ObjectPointer(iTarget),
iX,iY,
Game.Objects.ObjectPointer(iTarget2),
::Objects.ObjectPointer(iTarget2),
iData,
iAddMode);
}
@ -445,9 +446,9 @@ void C4ControlSyncCheck::Set()
AllCrewPosX = GetAllCrewPosX();
PXSCount = ::PXS.Count;
MassMoverIndex = ::MassMover.CreatePtr;
ObjectCount = Game.Objects.ObjectCount();
ObjectCount = ::Objects.ObjectCount();
ObjectEnumerationIndex = Game.ObjectEnumerationIndex;
SectShapeSum = Game.Objects.Sectors.getShapeSum();
SectShapeSum = ::Objects.Sectors.getShapeSum();
}
int32_t C4ControlSyncCheck::GetAllCrewPosX()
@ -846,7 +847,7 @@ void C4ControlJoinPlayer::CompileFunc(StdCompiler *pComp)
C4ControlEMMoveObject::C4ControlEMMoveObject(C4ControlEMObjectAction eAction, int32_t tx, int32_t ty, C4Object *pTargetObj,
int32_t iObjectNum, int32_t *pObjects, const char *szScript)
: eAction(eAction), tx(tx), ty(ty), iTargetObj(Game.Objects.ObjectNumber(pTargetObj)),
: eAction(eAction), tx(tx), ty(ty), iTargetObj(::Objects.ObjectNumber(pTargetObj)),
iObjectNum(iObjectNum), pObjects(pObjects), Script(szScript, true)
{
@ -868,7 +869,7 @@ void C4ControlEMMoveObject::Execute() const
// move all given objects
C4Object *pObj;
for (int i=0; i<iObjectNum; ++i)
if (pObj = Game.Objects.SafeObjectPointer(pObjects[i])) if (pObj->Status)
if (pObj = ::Objects.SafeObjectPointer(pObjects[i])) if (pObj->Status)
{
pObj->ForcePosition(pObj->GetX()+tx,pObj->GetY()+ty);
pObj->xdir=pObj->ydir=0;
@ -880,10 +881,10 @@ void C4ControlEMMoveObject::Execute() const
{
if (!pObjects) break;
// enter all given objects into target
C4Object *pObj, *pTarget = Game.Objects.SafeObjectPointer(iTargetObj);
C4Object *pObj, *pTarget = ::Objects.SafeObjectPointer(iTargetObj);
if (pTarget)
for (int i=0; i<iObjectNum; ++i)
if (pObj = Game.Objects.SafeObjectPointer(pObjects[i]))
if (pObj = ::Objects.SafeObjectPointer(pObjects[i]))
pObj->Enter(pTarget);
}
break;
@ -895,7 +896,7 @@ void C4ControlEMMoveObject::Execute() const
// perform duplication
C4Object *pObj;
for (int i=0; i<iObjectNum; ++i)
if (pObj = Game.Objects.SafeObjectPointer(pObjects[i]))
if (pObj = ::Objects.SafeObjectPointer(pObjects[i]))
{
pObj = Game.CreateObject(pObj->id, pObj, pObj->Owner, pObj->GetX(), pObj->GetY());
if (pObj && fLocalCall) Console.EditCursor.GetSelection().Add(pObj, C4ObjectList::stNone);
@ -928,7 +929,7 @@ void C4ControlEMMoveObject::Execute() const
// remove all objects
C4Object *pObj;
for (int i=0; i<iObjectNum; ++i)
if (pObj = Game.Objects.SafeObjectPointer(pObjects[i]))
if (pObj = ::Objects.SafeObjectPointer(pObjects[i]))
pObj->AssignRemoval();
}
break; // Here was fallthrough. Seemed wrong. ck.
@ -938,7 +939,7 @@ void C4ControlEMMoveObject::Execute() const
// exit all objects
C4Object *pObj;
for (int i=0; i<iObjectNum; ++i)
if (pObj = Game.Objects.SafeObjectPointer(pObjects[i]))
if (pObj = ::Objects.SafeObjectPointer(pObjects[i]))
pObj->Exit(pObj->GetX(), pObj->GetY(), pObj->r);
}
break; // Same. ck.

View File

@ -37,6 +37,7 @@
#include <C4ValueList.h>
#include <C4RankSystem.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#ifdef C4ENGINE
#include <C4Object.h>
#include "C4Network2Res.h"
@ -1495,7 +1496,7 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
// GfxBackup-dtor will ensure that upon loading-failure all graphics are reset to default
C4DefGraphicsPtrBackup GfxBackup(&pDef->Graphics);
// clear any pointers into def (name)
Game.Objects.ClearDefPointers(pDef);
::Objects.ClearDefPointers(pDef);
#endif
// Clear def
pDef->Clear(); // Assume filename is being kept
@ -1512,7 +1513,7 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
#endif
#ifdef C4ENGINE
// update definition pointers
Game.Objects.UpdateDefPointers(pDef);
::Objects.UpdateDefPointers(pDef);
// restore graphics
GfxBackup.AssignUpdate(&pDef->Graphics);
#endif

View File

@ -39,6 +39,7 @@
#include <C4Log.h>
#include <C4Material.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
//-------------------------------- C4DefGraphics -----------------------------------------------
@ -373,7 +374,7 @@ void C4DefGraphicsPtrBackup::AssignUpdate(C4DefGraphics *pNewGraphics)
{
// check all objects
C4Object *pObj;
for (C4ObjectLink *pLnk = Game.Objects.First; pLnk; pLnk=pLnk->Next)
for (C4ObjectLink *pLnk = ::Objects.First; pLnk; pLnk=pLnk->Next)
if (pObj=pLnk->Obj) if (pObj->Status)
{
if (pObj->pGraphics == pGraphicsPtr)
@ -439,7 +440,7 @@ void C4DefGraphicsPtrBackup::AssignRemoval()
{
// check all objects
C4Object *pObj;
for (C4ObjectLink *pLnk = Game.Objects.First; pLnk; pLnk=pLnk->Next)
for (C4ObjectLink *pLnk = ::Objects.First; pLnk; pLnk=pLnk->Next)
if (pObj=pLnk->Obj) if (pObj->Status)
{
if (pObj->pGraphics == pGraphicsPtr)
@ -827,12 +828,12 @@ void C4GraphicsOverlay::CompileFunc(StdCompiler *pComp)
void C4GraphicsOverlay::EnumeratePointers()
{
nOverlayObj = Game.Objects.ObjectNumber(pOverlayObj);
nOverlayObj = ::Objects.ObjectNumber(pOverlayObj);
}
void C4GraphicsOverlay::DenumeratePointers()
{
pOverlayObj = Game.Objects.ObjectPointer(nOverlayObj);
pOverlayObj = ::Objects.ObjectPointer(nOverlayObj);
}
void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByPlayer)

View File

@ -36,6 +36,7 @@
#include <C4Texture.h>
#include <C4GraphicsResource.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
#ifdef WITH_DEVELOPER_MODE
@ -466,7 +467,7 @@ void C4EditCursor::FrameSelection()
{
Selection.Clear();
C4Object *cobj; C4ObjectLink *clnk;
for (clnk=Game.Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
if (cobj->Status) if (cobj->OCF & OCF_NotContained)
{
if (Inside(cobj->GetX(),Min(X,X2),Max(X,X2)) && Inside(cobj->GetY(),Min(Y,Y2),Max(Y,Y2)))
@ -662,7 +663,7 @@ void C4EditCursor::UpdateDropTarget(WORD wKeyFlags)
if (wKeyFlags & MK_CONTROL)
if (Selection.GetObject())
for (clnk=Game.Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
if (cobj->Status)
if (!cobj->Contained)
if (Inside<int32_t>(X-(cobj->GetX()+cobj->Shape.x),0,cobj->Shape.Wdt-1))

View File

@ -32,6 +32,7 @@
#include <C4Landscape.h>
#include <C4PXS.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
void C4Effect::AssignCallbackFunctions()
@ -172,7 +173,7 @@ void C4Effect::EnumeratePointers()
do
{
// command target
pEff->nCommandTarget = Game.Objects.ObjectNumber(pEff->pCommandTarget);
pEff->nCommandTarget = ::Objects.ObjectNumber(pEff->pCommandTarget);
// effect var denumeration: not necessary, because this is done while saving
}
while (pEff=pEff->pNext);
@ -185,7 +186,7 @@ void C4Effect::DenumeratePointers()
do
{
// command target
pEff->pCommandTarget = Game.Objects.ObjectPointer(pEff->nCommandTarget);
pEff->pCommandTarget = ::Objects.ObjectPointer(pEff->nCommandTarget);
// variable pointers
pEff->EffectVars.DenumeratePointers();
// assign any callback functions
@ -829,7 +830,7 @@ void BubbleOut(int32_t tx, int32_t ty)
// User-defined smoke level
int32_t SmokeLevel = GetSmokeLevel();
// Enough bubbles out there already
if (Game.Objects.ObjectCount(C4Id("FXU1")) >= SmokeLevel) return;
if (::Objects.ObjectCount(C4Id("FXU1")) >= SmokeLevel) return;
// Create bubble
Game.CreateObject(C4Id("FXU1"),NULL,NO_OWNER,tx,ty);
}
@ -844,7 +845,7 @@ void Smoke(int32_t tx, int32_t ty, int32_t level, DWORD dwClr)
// User-defined smoke level
int32_t SmokeLevel = GetSmokeLevel();
// Enough smoke out there already
if (Game.Objects.ObjectCount(C4Id("FXS1")) >= SmokeLevel) return;
if (::Objects.ObjectCount(C4Id("FXS1")) >= SmokeLevel) return;
// Create smoke
level=BoundBy<int32_t>(level,3,32);
C4Object *pObj;

View File

@ -25,6 +25,7 @@
#include <C4Game.h>
#include <C4Random.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
// *** C4FindObject
@ -236,13 +237,13 @@ int32_t C4FindObject::Count(const C4ObjectList &Objs, const C4LSectors &Sct)
else if (UseShapes())
{
// Get area
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
C4ObjectList *pLst = Area.FirstObjectShapes(&pSct);
// Check if a single-sector check is enough
if(!Area.Next(pSct))
return Count(pSct->ObjectShapes);
// Create marker, count over all areas
unsigned int iMarker = ++Game.Objects.LastUsedMarker;
unsigned int iMarker = ++::Objects.LastUsedMarker;
int32_t iCount = 0;
for (; pLst; pLst=Area.NextObjectShapes(pLst, &pSct))
for(C4ObjectLink *pLnk = pLst->First; pLnk; pLnk = pLnk->Next)
@ -258,7 +259,7 @@ int32_t C4FindObject::Count(const C4ObjectList &Objs, const C4LSectors &Sct)
else
{
// Count objects per area
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
int32_t iCount = 0;
for (C4ObjectList *pLst=Area.FirstObjects(&pSct); pLst; pLst=Area.NextObjects(pLst, &pSct))
iCount += Count(*pLst);
@ -279,7 +280,7 @@ C4Object *C4FindObject::Find(const C4ObjectList &Objs, const C4LSectors &Sct)
// Traverse areas, return first matching object w/o sort or best with sort
else if (UseShapes())
{
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
C4Object *pObj;
for (C4ObjectList *pLst=Area.FirstObjectShapes(&pSct); pLst; pLst=Area.NextObjectShapes(pLst, &pSct))
if(pObj = Find(*pLst))
@ -291,7 +292,7 @@ C4Object *C4FindObject::Find(const C4ObjectList &Objs, const C4LSectors &Sct)
}
else
{
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
C4Object *pObj;
for (C4ObjectList *pLst=Area.FirstObjects(&pSct); pLst; pLst=Area.NextObjects(pLst, &pSct))
if(pObj = Find(*pLst))
@ -318,7 +319,7 @@ C4ValueArray *C4FindObject::FindMany(const C4ObjectList &Objs, const C4LSectors
if (UseShapes())
{
// Get area
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
C4ObjectList *pLst = Area.FirstObjectShapes(&pSct);
// Check if a single-sector check is enough
if(!Area.Next(pSct))
@ -326,7 +327,7 @@ C4ValueArray *C4FindObject::FindMany(const C4ObjectList &Objs, const C4LSectors
// Set up array
pArray = new C4ValueArray(32); iSize = 0;
// Create marker, search all areas
unsigned int iMarker = ++Game.Objects.LastUsedMarker;
unsigned int iMarker = ++::Objects.LastUsedMarker;
for (; pLst; pLst=Area.NextObjectShapes(pLst, &pSct))
for(C4ObjectLink *pLnk = pLst->First; pLnk; pLnk = pLnk->Next)
if(pLnk->Obj->Status)
@ -348,7 +349,7 @@ C4ValueArray *C4FindObject::FindMany(const C4ObjectList &Objs, const C4LSectors
// Set up array
pArray = new C4ValueArray(32); iSize = 0;
// Search
C4LArea Area(&Game.Objects.Sectors, *pBounds); C4LSector *pSct;
C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;
for(C4ObjectList *pLst=Area.FirstObjects(&pSct); pLst; pLst=Area.NextObjects(pLst, &pSct))
for(C4ObjectLink *pLnk = pLst->First; pLnk; pLnk = pLnk->Next)
if(pLnk->Obj->Status)

View File

@ -70,6 +70,7 @@
#include <C4Texture.h>
#include <C4Landscape.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
#include <StdFile.h>
@ -650,7 +651,7 @@ BOOL C4Game::GameOverCheck()
// Count objects, fullsize only
C4ObjectLink *cLnk;
int32_t iCount=0;
for (cLnk=Game.Objects.First; cLnk; cLnk=cLnk->Next)
for (cLnk=::Objects.First; cLnk; cLnk=cLnk->Next)
if (cLnk->Obj->Status)
if (cLnk->Obj->Def->id==c_id)
if (cLnk->Obj->GetCon()>=FullCon)
@ -671,7 +672,7 @@ BOOL C4Game::GameOverCheck()
BOOL alive_only=FALSE;
if (cdef && (cdef->Category & C4D_Living)) alive_only=TRUE;
int32_t iCount=0;
for (cLnk=Game.Objects.First; cLnk; cLnk=cLnk->Next)
for (cLnk=::Objects.First; cLnk; cLnk=cLnk->Next)
if (cLnk->Obj->Status)
if (cLnk->Obj->Def->id==c_id)
if (!alive_only || cLnk->Obj->GetAlive())
@ -948,8 +949,8 @@ void C4Game::ClearObjectPtrs(C4Object *pObj)
void C4Game::ClearPointers(C4Object *pObj)
{
BackObjects.ClearPointers(pObj);
ForeObjects.ClearPointers(pObj);
::Objects.BackObjects.ClearPointers(pObj);
::Objects.ForeObjects.ClearPointers(pObj);
::Messages.ClearPointers(pObj);
ClearObjectPtrs(pObj);
Players.ClearPointers(pObj);
@ -1072,10 +1073,7 @@ C4Object* C4Game::NewObject( C4Def *pDef, C4Object *pCreator,
void C4Game::DeleteObjects(bool fDeleteInactive)
{
// del any objects
Objects.DeleteObjects();
BackObjects.Clear();
ForeObjects.Clear();
if (fDeleteInactive) Objects.InactiveObjects.DeleteObjects();
::Objects.DeleteObjects(fDeleteInactive);
// reset resort flag
fResortAnyObject = FALSE;
}
@ -1244,7 +1242,7 @@ C4Object* C4Game::OverlapObject(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt
C4Object *cObj; C4ObjectLink *clnk;
C4Rect rect1,rect2;
rect1.x=tx; rect1.y=ty; rect1.Wdt=wdt; rect1.Hgt=hgt;
C4LArea Area(&Game.Objects.Sectors, tx, ty, wdt, hgt); C4LSector *pSector;
C4LArea Area(&::Objects.Sectors, tx, ty, wdt, hgt); C4LSector *pSector;
for (C4ObjectList *pObjs = Area.FirstObjectShapes(&pSector); pSector; pObjs = Area.NextObjectShapes(pObjs, &pSector))
for (clnk=pObjs->First; clnk && (cObj=clnk->Obj); clnk=clnk->Next)
if (cObj->Status) if (!cObj->Contained)
@ -1358,7 +1356,7 @@ C4Object *C4Game::FindVisObject(float tx, float ty, int32_t iPlr, const C4Facet
C4Object *pFindNext)
{
// FIXME: Use C4FindObject here for optimization
C4Object *cObj; C4ObjectLink *cLnk; C4ObjectList *pLst = &ForeObjects;
C4Object *cObj; C4ObjectLink *cLnk; C4ObjectList *pLst = &::Objects.ForeObjects;
// scan all object lists seperately
while (pLst)
@ -1418,8 +1416,8 @@ C4Object *C4Game::FindVisObject(float tx, float ty, int32_t iPlr, const C4Facet
}
// next list
if (pLst == &ForeObjects) pLst = &Objects;
else if (pLst == &Objects) pLst = &BackObjects;
if (pLst == &::Objects.ForeObjects) pLst = &Objects;
else if (pLst == &Objects) pLst = &::Objects.BackObjects;
else pLst = NULL;
}
@ -1667,8 +1665,6 @@ void C4Game::Default()
::Definitions.Default();
::MaterialMap.Default();
Objects.Default();
BackObjects.Default();
ForeObjects.Default();
Players.Default();
Weather.Default();
Landscape.Default();

View File

@ -49,6 +49,8 @@ void C4GameObjects::Default()
ResortProc=NULL;
Sectors.Clear();
LastUsedMarker = 0;
BackObjects.Default();
ForeObjects.Default();
}
void C4GameObjects::Init(int32_t iWidth, int32_t iHeight)
@ -64,10 +66,10 @@ BOOL C4GameObjects::Add(C4Object *nObj)
return InactiveObjects.Add(nObj, C4ObjectList::stMain);
// if this is a background object, add it to the list
if (nObj->Category & C4D_Background)
Game.BackObjects.Add(nObj, C4ObjectList::stMain);
::Objects.BackObjects.Add(nObj, C4ObjectList::stMain);
// if this is a foreground object, add it to the list
if (nObj->Category & C4D_Foreground)
Game.ForeObjects.Add(nObj, C4ObjectList::stMain);
::Objects.ForeObjects.Add(nObj, C4ObjectList::stMain);
// manipulate main list
if(!C4ObjectList::Add(nObj, C4ObjectList::stMain))
return FALSE;
@ -84,9 +86,9 @@ BOOL C4GameObjects::Remove(C4Object *pObj)
// remove from sectors
Sectors.Remove(pObj);
// remove from backlist
Game.BackObjects.Remove(pObj);
::Objects.BackObjects.Remove(pObj);
// remove from forelist
Game.ForeObjects.Remove(pObj);
::Objects.ForeObjects.Remove(pObj);
// manipulate main list
return C4ObjectList::Remove(pObj);
}
@ -322,22 +324,17 @@ void C4GameObjects::PutSolidMasks()
cLnk->Obj->UpdateSolidMask(false);
}
void C4GameObjects::DeleteObjects()
void C4GameObjects::DeleteObjects(bool fDeleteInactive)
{
// delete links and objects
while (First)
{
C4Object *pObj = First->Obj;
Remove(pObj);
delete pObj;
}
// reset mass
Mass=0;
C4ObjectList::DeleteObjects();
BackObjects.Clear();
ForeObjects.Clear();
if (fDeleteInactive) InactiveObjects.DeleteObjects();
}
void C4GameObjects::Clear(bool fClearInactive)
{
DeleteObjects();
DeleteObjects(fClearInactive);
if(fClearInactive)
InactiveObjects.Clear();
ResortProc = NULL;
@ -370,9 +367,9 @@ void C4ObjResort::Execute()
if (pSortObj->Status != C4OS_NORMAL || pSortObj->Unsorted) return;
// exchange
if (fSortAfter)
Game.Objects.OrderObjectAfter(pSortObj, pObjBefore);
::Objects.OrderObjectAfter(pSortObj, pObjBefore);
else
Game.Objects.OrderObjectBefore(pSortObj, pObjBefore);
::Objects.OrderObjectBefore(pSortObj, pObjBefore);
// done
return;
}
@ -383,7 +380,7 @@ void C4ObjResort::Execute()
return;
}
// get first link to start sorting
C4ObjectLink *pLnk=Game.Objects.Last; if (!pLnk) return;
C4ObjectLink *pLnk=::Objects.Last; if (!pLnk) return;
// sort all categories given; one by one (sort by category is ensured by C4ObjectList::Add)
for (int iCat=1; iCat<C4D_SortLimit; iCat<<=1)
if (iCat & Category)
@ -404,7 +401,7 @@ void C4ObjResort::Execute()
break;
// get previous link, which is the last in the list of this category
C4ObjectLink *pLastLnk;
if (pNextLnk) pLastLnk=pNextLnk->Next; else pLastLnk=Game.Objects.First;
if (pNextLnk) pLastLnk=pNextLnk->Next; else pLastLnk=::Objects.First;
// get next valid (there must be at least one: pLnk; so this loop should be safe)
while (!pLastLnk->Obj->Status) pLastLnk=pLastLnk->Next;
// now sort this portion of the list
@ -426,7 +423,7 @@ void C4ObjResort::SortObject()
Pars[1].Set(C4VObj(pSortObj));
// first, check forward in list
C4ObjectLink *pMoveLink=NULL;
C4ObjectLink *pLnk = Game.Objects.GetLink(pSortObj);
C4ObjectLink *pLnk = ::Objects.GetLink(pSortObj);
C4ObjectLink *pLnkBck = pLnk;
C4Object *pObj2; int iResult;
if (!pLnk) return;
@ -449,9 +446,9 @@ void C4ObjResort::SortObject()
// move link directly after pMoveLink
// FIXME: Inform C4ObjectList that this is a reorder, not a remove+insert
// move out of current position
Game.Objects.RemoveLink(pLnkBck);
::Objects.RemoveLink(pLnkBck);
// put into new position
Game.Objects.InsertLink(pLnkBck, pMoveLink);
::Objects.InsertLink(pLnkBck, pMoveLink);
}
else
{
@ -475,19 +472,19 @@ void C4ObjResort::SortObject()
if (!pMoveLink) return;
// move link directly before pMoveLink
// move out of current position
Game.Objects.RemoveLink(pLnkBck);
::Objects.RemoveLink(pLnkBck);
// put into new position
Game.Objects.InsertLinkBefore(pLnkBck, pMoveLink);
::Objects.InsertLinkBefore(pLnkBck, pMoveLink);
}
// object has been resorted: resort into area lists, too
Game.Objects.UpdatePosResort(pSortObj);
::Objects.UpdatePosResort(pSortObj);
// done
}
void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
{
#ifdef _DEBUG
assert(Game.Objects.Sectors.CheckSort());
assert(::Objects.Sectors.CheckSort());
#endif
// do a simple insertion-like sort
C4ObjectLink *pCurr; // current link to analyse
@ -529,7 +526,7 @@ void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
pFirst=pNewFirst;
}
#ifdef _DEBUG
assert(Game.Objects.Sectors.CheckSort());
assert(::Objects.Sectors.CheckSort());
#endif
// resort objects in sector lists
for (pCurr=pFirstBck; pCurr!=pLast->Next; pCurr=pCurr->Next)
@ -538,11 +535,11 @@ void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
if (pObj->Status && pObj->Unsorted)
{
pObj->Unsorted=FALSE;
Game.Objects.UpdatePosResort(pObj);
::Objects.UpdatePosResort(pObj);
}
}
#ifdef _DEBUG
assert(Game.Objects.Sectors.CheckSort());
assert(::Objects.Sectors.CheckSort());
#endif
}
@ -551,7 +548,7 @@ void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
int C4GameObjects::Load(C4Group &hGroup, bool fKeepInactive)
{
Clear(!fKeepInactive);
Clear(!fKeepInactive);
// Load data component
StdStrBuf Source;
@ -584,10 +581,10 @@ int C4GameObjects::Load(C4Group &hGroup, bool fKeepInactive)
iMaxObjectNumber = Max<long>(iMaxObjectNumber, pObj->Number);
// add to list of backobjects
if (pObj->Category & C4D_Background)
Game.BackObjects.Add(pObj, C4ObjectList::stMain, this);
::Objects.BackObjects.Add(pObj, C4ObjectList::stMain, this);
// add to list of foreobjects
if (pObj->Category & C4D_Foreground)
Game.ForeObjects.Add(pObj, C4ObjectList::stMain, this);
::Objects.ForeObjects.Add(pObj, C4ObjectList::stMain, this);
// Unterminate end
}
@ -936,3 +933,5 @@ bool C4GameObjects::AssignInfo()
if (!InactiveObjects.AssignInfo()) fSucc = false;
return fSucc;
}
C4GameObjects Objects;

View File

@ -31,6 +31,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <C4PlayerInfo.h>
#include <C4PlayerInfoListBox.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
@ -44,7 +45,7 @@ C4GoalDisplay::GoalPicture::GoalPicture(const C4Rect &rcBounds, C4ID idGoal, boo
SetBounds(rcBounds);
// can't get specialized desc from object at the moment because of potential script callbacks!
StdStrBuf strGoalName, strGoalDesc;
/*C4Object *pGoalObj = Game.Objects.FindInternal(idGoal);
/*C4Object *pGoalObj = ::Objects.FindInternal(idGoal);
if (pGoalObj)
{
pGoalObj->GetInfoString().getData();
@ -72,7 +73,7 @@ C4GoalDisplay::GoalPicture::GoalPicture(const C4Rect &rcBounds, C4ID idGoal, boo
{
Picture.Create(C4PictureSize, C4PictureSize);
// get an object instance to draw (optional; may be zero)
C4Object *pGoalObj = Game.Objects.FindInternal(idGoal);
C4Object *pGoalObj = ::Objects.FindInternal(idGoal);
// draw goal def!
pDrawDef->Draw(Picture, false, 0, pGoalObj);
}

View File

@ -25,6 +25,7 @@
#include "C4Log.h"
#include "C4Components.h"
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
// *** C4GameRes

View File

@ -36,6 +36,7 @@
#include <C4PXS.h>
#include <C4MassMover.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
// *** C4GameSave main class
@ -158,13 +159,13 @@ bool C4GameSave::SaveLandscape()
{
C4DebugRecOff DBGRECOFF;
// Landscape
Game.Objects.RemoveSolidMasks();
::Objects.RemoveSolidMasks();
bool fSuccess;
if(::Landscape.Mode == C4LSC_Exact)
fSuccess = !!::Landscape.Save(*pSaveGroup);
else
fSuccess = !!::Landscape.SaveDiff(*pSaveGroup, !IsSynced());
Game.Objects.PutSolidMasks();
::Objects.PutSolidMasks();
if (!fSuccess) return false;
DBGRECOFF.Clear();
// PXS
@ -208,7 +209,7 @@ bool C4GameSave::SaveRuntimeData()
// landscape
if (!SaveLandscape()) { Log(LoadResStr("IDS_ERR_SAVE_LANDSCAPE")); return false; }
// Objects
if (!Game.Objects.Save((*pSaveGroup),IsExact(),true))
if (!::Objects.Save((*pSaveGroup),IsExact(),true))
{ Log(LoadResStr("IDS_ERR_SAVE_OBJECTS")); return false; }
// Round results
if (GetSaveUserPlayers()) if (!Game.RoundResults.Save(*pSaveGroup))

View File

@ -30,6 +30,7 @@
#include <C4Log.h>
#include <C4Game.h>
#include <C4GraphicsSystem.h>
#include <C4GameObjects.h>
#endif
#include <StdGL.h>

View File

@ -41,6 +41,7 @@
#include <C4Network2.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
#include <StdPNG.h>
@ -189,7 +190,7 @@ void C4GraphicsSystem::Execute()
ScreenTick++; if (ScreenTick>=ScreenRate) ScreenTick=0;
// Reset object audibility
Game.Objects.ResetAudibility();
::Objects.ResetAudibility();
// some hack to ensure the mouse is drawn after a dialog close and before any
// movement messages

View File

@ -30,8 +30,7 @@
#include <C4Group.h>
#include <C4Components.h>
#include <C4Game.h>
#ifdef C4ENGINE
#endif
#include <C4GameObjects.h>
#endif
#include <C4Random.h>

View File

@ -32,6 +32,7 @@
#include <C4GraphicsSystem.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
// -----------------------------------------------------------
@ -378,7 +379,7 @@ bool C4MainMenu::ActivateRules(int32_t iPlayer)
SetPermanent(false);
// Items
int32_t cnt; C4ID idGoal; C4Def *pDef;
for (cnt=0; idGoal=Game.Objects.ObjectsInt().GetListID(C4D_Rule,cnt); cnt++)
for (cnt=0; idGoal=::Objects.ObjectsInt().GetListID(C4D_Rule,cnt); cnt++)
if (pDef=C4Id2Def(idGoal))
{
fctSymbol.Create(C4SymbolSize,C4SymbolSize); pDef->Draw(fctSymbol);
@ -852,7 +853,7 @@ bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
Close(true);
// TODO!
C4Object *pObj; C4ID idItem = C4Id(szCommand+12);
if (pObj = Game.Objects.FindInternal(idItem))
if (pObj = ::Objects.FindInternal(idItem))
Game.Control.DoInput(CID_Script, new C4ControlScript(FormatString("Activate(%d)", Player).getData(), pObj->Number), CDT_Queue);
else
return false;

View File

@ -34,6 +34,7 @@
#include <C4GraphicsSystem.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
const int32_t C4MN_DefInfoWdt = 270, // default width of info windows
@ -918,7 +919,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
int32_t iUseExtraData = 0;
if (Extra == C4MN_Extra_LiveMagicValue || Extra == C4MN_Extra_ComponentsLiveMagic)
{
C4Object *pMagicSourceObj = Game.Objects.SafeObjectPointer(ExtraData);
C4Object *pMagicSourceObj = ::Objects.SafeObjectPointer(ExtraData);
if (pMagicSourceObj) iUseExtraData = pMagicSourceObj->MagicEnergy/MagicPhysicalFactor;
}
else

View File

@ -39,6 +39,7 @@
#include <C4GraphicsResource.h>
#include <C4GraphicsSystem.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
const int32_t C4MC_Drag_None = 0,
@ -655,7 +656,7 @@ int32_t C4MouseControl::UpdateObjectSelection()
Selection.Clear();
// Add all collectible objects in drag frame to Selection
C4Object *cObj; C4ObjectLink *cLnk;
for (cLnk=Game.Objects.First; cLnk && (cObj=cLnk->Obj); cLnk=cLnk->Next)
for (cLnk=::Objects.First; cLnk && (cObj=cLnk->Obj); cLnk=cLnk->Next)
if (cObj->Status)
if (cObj->OCF & OCF_Carryable)
if (!cObj->Contained)

View File

@ -26,6 +26,7 @@
#include <C4Game.h>
#include <C4Player.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
C4Graph::C4Graph()
@ -338,7 +339,7 @@ C4Network2Stats::~C4Network2Stats()
void C4Network2Stats::ExecuteFrame()
{
statObjCount.RecordValue(C4Graph::ValueType(Game.Objects.ObjectCount()));
statObjCount.RecordValue(C4Graph::ValueType(::Objects.ObjectCount()));
}
void C4Network2Stats::ExecuteSecond()

View File

@ -52,6 +52,7 @@
#include <C4GraphicsSystem.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_t contact)
@ -244,9 +245,9 @@ C4Object::~C4Object()
#if defined(_DEBUG)
// debug: mustn't be listed in any list now
assert(!Game.Objects.ObjectNumber(this));
assert(!Game.Objects.InactiveObjects.ObjectNumber(this));
Game.Objects.Sectors.AssertObjectNotInList(this);
assert(!::Objects.ObjectNumber(this));
assert(!::Objects.InactiveObjects.ObjectNumber(this));
::Objects.Sectors.AssertObjectNotInList(this);
#endif
}
@ -294,9 +295,9 @@ void C4Object::AssignRemoval(BOOL fExitContents)
if (Status == C4OS_INACTIVE)
{
// object was inactive: activate first, then delete
Game.Objects.InactiveObjects.Remove(this);
::Objects.InactiveObjects.Remove(this);
Status = C4OS_NORMAL;
Game.Objects.Add(this);
::Objects.Add(this);
}
Status=0;
// count decrease
@ -370,7 +371,7 @@ void C4Object::UpdatePos()
// get new area covered
// do *NOT* do this while initializing, because object cannot be sorted by main list
if (!Initializing && Status == C4OS_NORMAL)
Game.Objects.UpdatePos(this);
::Objects.UpdatePos(this);
}
void C4Object::UpdateFace(bool bUpdateShape, bool fTemp)
@ -616,7 +617,7 @@ void C4Object::SetOCF()
// Update the object character flag according to the object's current situation
FIXED cspeed=GetSpeed();
#ifdef _DEBUG
if(Contained && !Game.Objects.ObjectNumber(Contained))
if(Contained && !::Objects.ObjectNumber(Contained))
{ LogF("Warning: contained in wild object %p!", Contained); }
else if(Contained && !Contained->Status)
{ LogF("Warning: contained in deleted object %p (%s)!", Contained, Contained->GetName()); }
@ -652,7 +653,7 @@ void C4Object::SetOCF()
DWORD cocf = OCF_Exclusive;
if (Def->Chopable)
if (Category & C4D_StaticBack) // Must be static back: this excludes trees that have already been chopped
if (!Game.Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
if (!::Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
OCF|=OCF_Chop;
// OCF_Rotate: Can be rotated
if (Def->Rotateable)
@ -755,7 +756,7 @@ void C4Object::UpdateOCF()
// Update the object character flag according to the object's current situation
FIXED cspeed=GetSpeed();
#ifdef _DEBUG
if(Contained && !Game.Objects.ObjectNumber(Contained))
if(Contained && !::Objects.ObjectNumber(Contained))
{ LogF("Warning: contained in wild object %p!", Contained); }
else if(Contained && !Contained->Status)
{ LogF("Warning: contained in deleted object %p (%s)!", Contained, Contained->GetName()); }
@ -782,7 +783,7 @@ void C4Object::UpdateOCF()
DWORD cocf = OCF_Exclusive;
if (Def->Chopable)
if (Category & C4D_StaticBack) // Must be static back: this excludes trees that have already been chopped
if (!Game.Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
if (!::Objects.AtObject(GetX(), GetY(), cocf)) // Can only be chopped if the center is not blocked by an exclusive object
OCF|=OCF_Chop;
// HitSpeeds
if (cspeed>=HitSpeed1) OCF|=OCF_HitSpeed1;
@ -1282,7 +1283,7 @@ BOOL C4Object::ChangeDef(C4ID idNew)
// Any effect callbacks to this object might need to reinitialize their target functions
// This is ugly, because every effect there is must be updated...
if (Game.pGlobalEffects) Game.pGlobalEffects->OnObjectChangedDef(this);
for (C4ObjectLink *pLnk = Game.Objects.First; pLnk; pLnk = pLnk->Next)
for (C4ObjectLink *pLnk = ::Objects.First; pLnk; pLnk = pLnk->Next)
if (pLnk->Obj->pEffects) pLnk->Obj->pEffects->OnObjectChangedDef(this);
// Containment (no Entrance)
if (pContainer) Enter(pContainer,FALSE);
@ -2832,10 +2833,10 @@ void C4Object::EnumeratePointers()
{
// Standard enumerated pointers
nContained = Game.Objects.ObjectNumber(Contained);
nActionTarget1 = Game.Objects.ObjectNumber(Action.Target);
nActionTarget2 = Game.Objects.ObjectNumber(Action.Target2);
nLayer = Game.Objects.ObjectNumber(pLayer);
nContained = ::Objects.ObjectNumber(Contained);
nActionTarget1 = ::Objects.ObjectNumber(Action.Target);
nActionTarget2 = ::Objects.ObjectNumber(Action.Target2);
nLayer = ::Objects.ObjectNumber(pLayer);
// Info by name
//if (Info) SCopy(Info->Name,nInfo,C4MaxName);
@ -2858,10 +2859,10 @@ void C4Object::DenumeratePointers()
{
// Standard enumerated pointers
Contained = Game.Objects.ObjectPointer(nContained);
Action.Target = Game.Objects.ObjectPointer(nActionTarget1);
Action.Target2 = Game.Objects.ObjectPointer(nActionTarget2);
pLayer = Game.Objects.ObjectPointer(nLayer);
Contained = ::Objects.ObjectPointer(nContained);
Action.Target = ::Objects.ObjectPointer(nActionTarget1);
Action.Target2 = ::Objects.ObjectPointer(nActionTarget2);
pLayer = ::Objects.ObjectPointer(nLayer);
// Post-compile object list
Contents.DenumerateRead();
@ -2914,7 +2915,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList *
if (Menu && Menu->IsActive()) return;
DWORD ocf = OCF_Construct;
if(Action.ComDir == COMD_Stop && iDFA == DFA_WALK && (tObj = Game.Objects.AtObject(GetX(), GetY(), ocf, this)))
if(Action.ComDir == COMD_Stop && iDFA == DFA_WALK && (tObj = ::Objects.AtObject(GetX(), GetY(), ocf, this)))
{
int32_t com = COM_Down_D;
if(::Players.Get(Controller)->PrefControlStyle) com = COM_Down;
@ -3334,7 +3335,7 @@ void C4Object::DirectCom(BYTE byCom, int32_t iData) // By player ObjectCom
// contents shift must always be done to container object, which is not necessarily this
if (byCom==COM_Contents)
{
C4Object *pTarget = Game.Objects.SafeObjectPointer(iData);
C4Object *pTarget = ::Objects.SafeObjectPointer(iData);
if (pTarget && pTarget->Contained)
pTarget->Contained->DirectComContents(pTarget, true);
return;
@ -5831,9 +5832,9 @@ bool C4Object::HasGraphicsOverlayRecursion(const C4Object *pCheckObj) const
bool C4Object::StatusActivate()
{
// readd to main list
Game.Objects.InactiveObjects.Remove(this);
::Objects.InactiveObjects.Remove(this);
Status = C4OS_NORMAL;
Game.Objects.Add(this);
::Objects.Add(this);
// update some values
UpdateGraphics(false);
UpdateFace(true);
@ -5849,9 +5850,9 @@ bool C4Object::StatusDeactivate(bool fClearPointers)
if (FrontParticles) FrontParticles.Clear();
if (BackParticles) BackParticles.Clear();
// put into inactive list
Game.Objects.Remove(this);
::Objects.Remove(this);
Status = C4OS_INACTIVE;
Game.Objects.InactiveObjects.Add(this, C4ObjectList::stMain);
::Objects.InactiveObjects.Add(this, C4ObjectList::stMain);
// if desired, clear game pointers
if (fClearPointers)
{

View File

@ -39,6 +39,7 @@
#include <C4Material.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
BOOL SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir);
@ -342,7 +343,7 @@ BOOL ObjectComEnter(C4Object *cObj) // by pusher
// Check object entrance, try command enter
C4Object *pTarget;
DWORD ocf=OCF_Entrance;
if ((pTarget=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_Entrance)
{ cObj->SetCommand(C4CMD_Enter,pTarget); return TRUE; }
@ -357,7 +358,7 @@ BOOL ObjectComUp(C4Object *cObj) // by DFA_WALK or DFA_SWIM
// Check object entrance, try command enter
C4Object *pTarget;
DWORD ocf=OCF_Entrance;
if ((pTarget=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_Entrance)
return PlayerObjectCommand(cObj->Owner,C4CMD_Enter,pTarget);
@ -416,7 +417,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
if (cObj->Def->CollectionLimit && (cObj->Contents.ObjectCount()>=cObj->Def->CollectionLimit) ) return FALSE;
// Check line pickup
ocf=OCF_LineConstruct;
tstruct=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
if (!tstruct || !(ocf & OCF_LineConstruct)) return FALSE;
if (!(cline=Game.FindObject(C4ID_None,0,0,0,0,OCF_All,"Connect",tstruct))) return FALSE;
// Check line connected to linekit at other end
@ -452,7 +453,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
// Check for structure connection
ocf=OCF_LineConstruct;
tstruct=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
// No structure
if (!tstruct || !(ocf & OCF_LineConstruct))
{
@ -508,7 +509,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
// Check for new structure connection
ocf=OCF_LineConstruct;
tstruct=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
tstruct=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj);
if (!tstruct || !(ocf & OCF_LineConstruct))
{
StartSoundEffect("Error",false,100,cObj);
@ -570,7 +571,7 @@ void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DF
ocf=OCF_Chop;
if (phys->CanChop)
if (cObj->GetProcedure()!=DFA_SWIM)
if ((pTarget=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_Chop)
{
PlayerObjectCommand(cObj->Owner,C4CMD_Chop,pTarget);
@ -581,7 +582,7 @@ void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DF
ocf=OCF_LineConstruct;
if (phys->CanConstruct)
if (!cObj->Contents.GetObject())
if ((pTarget=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if (ocf & OCF_LineConstruct)
if (ObjectComLineConstruction(cObj))
return;
@ -595,7 +596,7 @@ BOOL ObjectComDownDouble(C4Object *cObj) // by DFA_WALK
{
C4Object *pTarget;
DWORD ocf= OCF_Construct | OCF_Grab;
if ((pTarget=Game.Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
{
if (ocf & OCF_Construct)
{ PlayerObjectCommand(cObj->Owner,C4CMD_Build,pTarget); return TRUE; }

View File

@ -30,6 +30,7 @@
#include <C4Game.h>
#include <C4RankSystem.h>
#include <C4Config.h>
#include <C4GameObjects.h>
#endif
C4ObjectInfoList::C4ObjectInfoList()
@ -225,7 +226,7 @@ void C4ObjectInfoList::DetachFromObjects()
{
C4ObjectInfo *cinf;
for (cinf=First; cinf; cinf=cinf->Next)
Game.Objects.ClearInfo(cinf);
::Objects.ClearInfo(cinf);
}
C4ObjectInfo* C4ObjectInfoList::GetLast()

View File

@ -31,6 +31,7 @@
#include <C4Region.h>
#include <C4GraphicsResource.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
C4ObjectList::C4ObjectList(): FirstIter(0)
@ -499,7 +500,7 @@ BOOL C4ObjectList::DenumerateRead()
if(!pEnumerated) return FALSE;
// Denumerate all object pointers
for(std::list<int32_t>::const_iterator pNum = pEnumerated->begin(); pNum != pEnumerated->end(); ++pNum)
Add(Game.Objects.ObjectPointer(*pNum), stNone); // Add to tail, unsorted
Add(::Objects.ObjectPointer(*pNum), stNone); // Add to tail, unsorted
// Delete old list
delete pEnumerated; pEnumerated = NULL;
return TRUE;

View File

@ -25,6 +25,7 @@
#include <C4Object.h>
#include <C4Language.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#ifdef WITH_DEVELOPER_MODE
@ -79,7 +80,7 @@ GType c4_list_get_type (void);
static void
c4_list_init (C4List *c4_list)
{
c4_list->data = &Game.Objects;
c4_list->data = &::Objects;
c4_list->stamp = g_random_int(); /* Random int to check whether iters belong to this model */
}

View File

@ -30,6 +30,7 @@
#include <C4GraphicsResource.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
@ -118,7 +119,7 @@ void C4ObjectMenu::ClearPointers(C4Object *pObj)
C4Object* C4ObjectMenu::GetParentObject()
{
C4Object *cObj; C4ObjectLink *cLnk;
for (cLnk=Game.Objects.First; cLnk && (cObj=cLnk->Obj); cLnk=cLnk->Next)
for (cLnk=::Objects.First; cLnk && (cObj=cLnk->Obj); cLnk=cLnk->Next)
if ( cObj->Menu == this )
return cObj;
return NULL;
@ -557,7 +558,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
}
// Script context functions of any objects attached to target (search global list, because attachment objects might be moved just about anywhere...)
for (clnk=Game.Objects.First; clnk && (cObj=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cObj=clnk->Obj); clnk=clnk->Next)
if (cObj->Status && cObj->Action.Target == pTarget)
if (cObj->Action.Act > ActIdle)
if (cObj->Def->ActMap[cObj->Action.Act].Procedure == DFA_ATTACH)

View File

@ -31,6 +31,7 @@
#include <C4Components.h>
#include <C4Log.h>
#include <C4Weather.h>
#include <C4GameObjects.h>
#endif
void C4ParticleDefCore::CompileFunc(StdCompiler * pComp)
@ -379,9 +380,9 @@ void C4ParticleSystem::ClearParticles()
{
// clear particle lists
C4ObjectLink *pLnk;
for (pLnk = Game.Objects.First; pLnk; pLnk = pLnk->Next)
for (pLnk = ::Objects.First; pLnk; pLnk = pLnk->Next)
pLnk->Obj->FrontParticles.pFirst = pLnk->Obj->BackParticles.pFirst = NULL;
for (pLnk = Game.Objects.InactiveObjects.First; pLnk; pLnk = pLnk->Next)
for (pLnk = ::Objects.InactiveObjects.First; pLnk; pLnk = pLnk->Next)
pLnk->Obj->FrontParticles.pFirst = pLnk->Obj->BackParticles.pFirst = NULL;
GlobalParticles.pFirst = NULL;
// reset chunks

View File

@ -47,6 +47,7 @@
#include <C4Landscape.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
#define C4FOW_Def_View_RangeX 500
@ -110,7 +111,7 @@ void C4Player::UpdateValue()
// Asset all owned objects
C4Object *cobj; C4ObjectLink *clnk;
for (clnk=Game.Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
if (cobj->Owner==Number && cobj->Status)
{
ObjectsOwned++;
@ -405,7 +406,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
GameJoinTime = Game.Time;
// Init FoW-viewobjects: NO_OWNER-FoW-repellers might need to be added
for (C4ObjectLink *pLnk = Game.Objects.First; pLnk; pLnk = pLnk->Next)
for (C4ObjectLink *pLnk = ::Objects.First; pLnk; pLnk = pLnk->Next)
{
C4Object *pObj = pLnk->Obj;
if (pObj->PlrViewRange && pObj->Owner == NO_OWNER)
@ -606,7 +607,7 @@ void C4Player::PlaceReadyBase(int32_t &tx, int32_t &ty, C4Object **pFirstBase)
C4ObjectLink *clnk; C4Object *cobj;
if (Game.Rules & C4RULE_StructuresNeedEnergy)
if (fpower)
for (clnk=Game.Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
if (cobj->Owner==Number)
if (cobj->Def->LineConnect & C4D_Power_Consumer)
CreatePowerConnection(fpower,cobj);
@ -755,7 +756,7 @@ BOOL C4Player::ScenarioInit()
{
fFogOfWarInitialized = TRUE;
// reset view objects
Game.Objects.AssignPlrViewRange();
::Objects.AssignPlrViewRange();
}
// Scenario script initialization
@ -785,7 +786,7 @@ BOOL C4Player::FinalInit(BOOL fInitialValue)
if (!Cursor) AdjustCursorCommand();
// Assign Captain
if (Game.Objects.Find(C4Id("KILC")))
if (::Objects.Find(C4Id("KILC")))
if (!Captain) Captain=GetHiRankActiveCrew(false);
// Update counts, pointers, views, value
@ -797,7 +798,7 @@ BOOL C4Player::FinalInit(BOOL fInitialValue)
{
fFogOfWarInitialized = TRUE;
// reset view objects
Game.Objects.AssignPlrViewRange();
::Objects.AssignPlrViewRange();
}
return TRUE;
@ -807,7 +808,7 @@ void C4Player::SetFoW(bool fEnable)
{
// enable FoW
if (fEnable && !fFogOfWarInitialized)
Game.Objects.AssignPlrViewRange();
::Objects.AssignPlrViewRange();
// set flag
fFogOfWar = fFogOfWarInitialized = fEnable;
}
@ -925,7 +926,7 @@ void C4Player::Evaluate()
time(reinterpret_cast<time_t *>(&LastRound.Date));
LastRound.Duration = Game.Time;
LastRound.Won = !Eliminated;
// Melee: personal value gain score ...check Game.Objects(C4D_Goal)
// Melee: personal value gain score ...check ::Objects(C4D_Goal)
if (Game.C4S.Game.IsMelee()) LastRound.Score = Max<int32_t>(ValueGain,0);
// Cooperative: shared score
else LastRound.Score = Max(::Players.AverageValueGain(),0);
@ -1743,14 +1744,14 @@ void C4Player::DoTeamSelection(int32_t idTeam)
void C4Player::EnumeratePointers()
{
// Cursor
Cursor = Game.Objects.Enumerated(Cursor);
Cursor = ::Objects.Enumerated(Cursor);
// ViewCursor
ViewCursor = Game.Objects.Enumerated(ViewCursor);
ViewCursor = ::Objects.Enumerated(ViewCursor);
// Captain
Captain = Game.Objects.Enumerated(Captain);
Captain = ::Objects.Enumerated(Captain);
// messageboard-queries
for (C4MessageBoardQuery *pCheck = pMsgBoardQuery; pCheck; pCheck = pCheck->pNext)
pCheck->nCallbackObj = pCheck->pCallbackObj ? Game.Objects.ObjectNumber(pCheck->pCallbackObj) : 0;
pCheck->nCallbackObj = pCheck->pCallbackObj ? ::Objects.ObjectNumber(pCheck->pCallbackObj) : 0;
}
void C4Player::DenumeratePointers()
@ -1758,14 +1759,14 @@ void C4Player::DenumeratePointers()
// Crew
Crew.DenumerateRead();
// Cursor
Cursor = Game.Objects.Denumerated(Cursor);
Cursor = ::Objects.Denumerated(Cursor);
// ViewCursor
ViewCursor = Game.Objects.Denumerated(ViewCursor);
ViewCursor = ::Objects.Denumerated(ViewCursor);
// Captain
Captain = Game.Objects.Denumerated(Captain);
Captain = ::Objects.Denumerated(Captain);
// messageboard-queries
for (C4MessageBoardQuery *pCheck = pMsgBoardQuery; pCheck; pCheck = pCheck->pNext)
pCheck->pCallbackObj = pCheck->nCallbackObj ? Game.Objects.ObjectPointer(pCheck->nCallbackObj) : NULL;
pCheck->pCallbackObj = pCheck->nCallbackObj ? ::Objects.ObjectPointer(pCheck->nCallbackObj) : NULL;
}
void C4Player::RemoveCrewObjects()
@ -1781,7 +1782,7 @@ void C4Player::NotifyOwnedObjects()
C4Object *cobj; C4ObjectLink *clnk;
// notify objects in all object lists
for (C4ObjectList *pList = &Game.Objects; pList; pList = ((pList == &Game.Objects) ? &Game.Objects.InactiveObjects : NULL))
for (C4ObjectList *pList = &::Objects; pList; pList = ((pList == &::Objects) ? &::Objects.InactiveObjects : NULL))
for (clnk = pList->First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
if (cobj->Status)
if (cobj->Owner == Number)
@ -2260,7 +2261,7 @@ void C4Player::SetPlayerColor(uint32_t dwNewClr)
uint32_t dwOldClr = ColorDw;
ColorDw = dwNewClr;
C4Object *pObj;
for (C4ObjectLink *pLnk = Game.Objects.First; pLnk; pLnk = pLnk->Next)
for (C4ObjectLink *pLnk = ::Objects.First; pLnk; pLnk = pLnk->Next)
if (pObj = pLnk->Obj)
if (pObj->Status)
if (pObj->Owner == Number)

View File

@ -34,6 +34,7 @@
#include <C4Object.h>
#include <C4Game.h>
#include <C4GraphicsSystem.h>
#include <C4GameObjects.h>
#endif
C4PlayerList::C4PlayerList()
@ -244,7 +245,7 @@ bool C4PlayerList::RemoveUnjoined(int32_t iPlayer)
{
// Savegame resume missing player: Remove player objects only
C4Object *pObj;
for (C4ObjectLink *clnk=Game.Objects.First; clnk && (pObj=clnk->Obj); clnk=clnk->Next)
for (C4ObjectLink *clnk=::Objects.First; clnk && (pObj=clnk->Obj); clnk=clnk->Next)
if (pObj->Status)
if (pObj->IsPlayerObject(iPlayer))
pObj->AssignRemoval(TRUE);
@ -298,7 +299,7 @@ BOOL C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
delete pPlr;
// Validate object owners
Game.Objects.ValidateOwners();
::Objects.ValidateOwners();
// Update console
Console.UpdateMenus();

View File

@ -33,6 +33,7 @@
#include <C4Player.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
#include <StdRegistry.h>
@ -177,7 +178,7 @@ BOOL C4PropertyDlg::Update(C4ObjectList &rSelection)
BOOL IsObjectPointer(int iValue)
{
for (C4ObjectLink *cLnk=Game.Objects.First; cLnk; cLnk=cLnk->Next)
for (C4ObjectLink *cLnk=::Objects.First; cLnk; cLnk=cLnk->Next)
if (cLnk->Obj == (C4Object*) iValue)
return TRUE;
return FALSE;

View File

@ -27,6 +27,7 @@
#include <C4Game.h>
#include <C4Object.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
// *** C4RoundResultsPlayer
@ -274,12 +275,12 @@ void C4RoundResults::EvaluateGoals(C4IDList &GoalList, C4IDList &FulfilledGoalLi
// Items
bool fRivalvry = !!Game.ObjectCount(C4Id("RVLR"));
int32_t cnt; C4ID idGoal;
for (cnt=0; idGoal=Game.Objects.GetListID(C4D_Goal,cnt); cnt++)
for (cnt=0; idGoal=::Objects.GetListID(C4D_Goal,cnt); cnt++)
{
// determine if the goal is fulfilled - do the calls even if the menu is not to be opened to ensure synchronization
bool fFulfilled = false;;
C4Object *pObj;
if (pObj = Game.Objects.Find(idGoal))
if (pObj = ::Objects.Find(idGoal))
{
if (fRivalvry)
{

View File

@ -51,6 +51,7 @@
#include <C4Texture.h>
#include <C4PlayerList.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
//========================== Some Support Functions =======================================
@ -171,7 +172,7 @@ bool CheckEnergyNeedChain(C4Object *pObj, C4ObjectList &rEnergyChainChecked)
// Check all power line connected structures
C4Object *cline; C4ObjectLink *clnk;
for (clnk=Game.Objects.First; clnk && (cline=clnk->Obj); clnk=clnk->Next)
for (clnk=::Objects.First; clnk && (cline=clnk->Obj); clnk=clnk->Next)
if (cline->Status) if (cline->Def->id==C4ID_PowerLine)
if (cline->Action.Target==pObj)
if (CheckEnergyNeedChain(cline->Action.Target2,rEnergyChainChecked))
@ -2096,7 +2097,7 @@ static C4Value FnObjectCount2(C4AulContext *cthr, C4Value *pPars)
if(!pFO)
throw new C4AulExecError(cthr->Obj, "ObjectCount: No valid search criterions supplied!");
// Search
int32_t iCnt = pFO->Count(Game.Objects, Game.Objects.Sectors);
int32_t iCnt = pFO->Count(::Objects, ::Objects.Sectors);
// Free
delete pFO;
// Return
@ -2113,7 +2114,7 @@ static C4Value FnFindObject2(C4AulContext *cthr, C4Value *pPars)
if(!pFO)
throw new C4AulExecError(cthr->Obj, "FindObject: No valid search criterions supplied!");
// Search
C4Object *pObj = pFO->Find(Game.Objects, Game.Objects.Sectors);
C4Object *pObj = pFO->Find(::Objects, ::Objects.Sectors);
// Free
delete pFO;
// Return
@ -2130,7 +2131,7 @@ static C4Value FnFindObjects(C4AulContext *cthr, C4Value *pPars)
if(!pFO)
throw new C4AulExecError(cthr->Obj, "FindObjects: No valid search criterions supplied!");
// Search
C4ValueArray *pResult = pFO->FindMany(Game.Objects, Game.Objects.Sectors);
C4ValueArray *pResult = pFO->FindMany(::Objects, ::Objects.Sectors);
// Free
delete pFO;
// Return
@ -3431,7 +3432,7 @@ static long FnObjectNumber(C4AulContext *cthr, C4Object *pObj)
C4Object* FnObject(C4AulContext *cthr, long iNumber)
{
return Game.Objects.SafeObjectPointer(iNumber);
return ::Objects.SafeObjectPointer(iNumber);
}
static long FnShowInfo(C4AulContext *cthr, C4Object *pObj)
@ -3666,7 +3667,7 @@ static bool FnResort(C4AulContext *cthr, C4Object *pObj)
pObj->Resort();
// Resort object list
else
Game.Objects.SortByCategory();
::Objects.SortByCategory();
return TRUE;
}
@ -4479,8 +4480,8 @@ static bool FnResortObjects(C4AulContext* cthr, C4String *szFunc, long Category)
pObjRes->Category=Category;
pObjRes->OrderFunc=pFn;
// insert into game resort proc list
pObjRes->Next = Game.Objects.ResortProc;
Game.Objects.ResortProc = pObjRes;
pObjRes->Next = ::Objects.ResortProc;
::Objects.ResortProc = pObjRes;
// success, so far
return TRUE;
}
@ -4500,8 +4501,8 @@ static bool FnResortObject(C4AulContext* cthr, C4String *szFunc, C4Object *pObj)
pObjRes->OrderFunc=pFn;
pObjRes->pSortObj=pObj;
// insert into game resort proc list
pObjRes->Next = Game.Objects.ResortProc;
Game.Objects.ResortProc = pObjRes;
pObjRes->Next = ::Objects.ResortProc;
::Objects.ResortProc = pObjRes;
// success, so far
return TRUE;
}
@ -5350,8 +5351,8 @@ static bool FnSetObjectOrder(C4AulContext* ctx, C4Object *pObjBeforeOrAfter, C4O
pObjRes->pObjBefore = pObjBeforeOrAfter;
pObjRes->fSortAfter = fSortAfter;
// insert into game resort proc list
pObjRes->Next = Game.Objects.ResortProc;
Game.Objects.ResortProc = pObjRes;
pObjRes->Next = ::Objects.ResortProc;
::Objects.ResortProc = pObjRes;
// done, success so far
return TRUE;
}

View File

@ -30,6 +30,7 @@
#include <C4ObjectCom.h>
#include <C4Object.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
/*--- C4ScriptHost ---*/
@ -262,7 +263,7 @@ C4Value C4GameScriptHost::GRBroadcast(const char *szFunction, C4AulParSet *pPars
{
// call objects first - scenario script might overwrite hostility, etc...
C4Object *pObj;
for (C4ObjectLink *clnk=Game.Objects.ObjectsInt().First; clnk; clnk=clnk->Next) if (pObj=clnk->Obj)
for (C4ObjectLink *clnk=::Objects.ObjectsInt().First; clnk; clnk=clnk->Next) if (pObj=clnk->Obj)
if (pObj->Category & (C4D_Goal | C4D_Rule | C4D_Environment))
if (pObj->Status)
{

View File

@ -27,6 +27,7 @@
#include <C4Object.h>
#include <C4Log.h>
#include <C4Record.h>
#include <C4GameObjects.h>
#endif
/* sector */
@ -217,9 +218,9 @@ void C4LSectors::Dump()
bool C4LSectors::CheckSort()
{
for (int cnt=0; cnt<Size; cnt++)
if (!Sectors[cnt].Objects.CheckSort(&Game.Objects))
if (!Sectors[cnt].Objects.CheckSort(&::Objects))
return false;
if (!SectorOut.Objects.CheckSort(&Game.Objects)) return false;
if (!SectorOut.Objects.CheckSort(&::Objects)) return false;
return true;
}

View File

@ -27,6 +27,7 @@
#include <C4Object.h>
#include <C4Landscape.h>
#include <C4Game.h>
#include <C4GameObjects.h>
#endif
@ -279,7 +280,7 @@ void C4SolidMask::Remove(bool fCauseInstability, bool fBackupAttachment)
MaskRemovalX = pForObject->GetX();
MaskRemovalY = pForObject->GetY();
iAttachingObjectsCount = 0;
C4LArea SolidArea(&Game.Objects.Sectors, MaskPutRect.x-1, MaskPutRect.y-1, MaskPutRect.Wdt+2, MaskPutRect.Hgt+2);
C4LArea SolidArea(&::Objects.Sectors, MaskPutRect.x-1, MaskPutRect.y-1, MaskPutRect.Wdt+2, MaskPutRect.Hgt+2);
C4LSector *pSct; C4Object *pObj;
for (C4ObjectList *pLst=SolidArea.FirstObjectShapes(&pSct); pLst; pLst=SolidArea.NextObjectShapes(pLst, &pSct))
for (C4ObjectLink *clnk=pLst->First; clnk; clnk=clnk->Next)

View File

@ -36,7 +36,7 @@
#ifdef _DEBUG
C4Surface::~C4Surface()
{
/* for (C4ObjectLink *lnk = Game.Objects.First; lnk; lnk=lnk->Next)
/* for (C4ObjectLink *lnk = ::Objects.First; lnk; lnk=lnk->Next)
if (lnk->Obj->Menu)
lnk->Obj->Menu->AssertSurfaceNotUsed(this);*/
}

View File

@ -27,6 +27,7 @@
#include <C4Game.h>
#include <C4FacetEx.h>
#include <C4Landscape.h>
#include <C4GameObjects.h>
#endif
C4TransferZone::C4TransferZone()
@ -119,7 +120,7 @@ BOOL C4TransferZones::Add(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, C4
void C4TransferZones::Synchronize()
{
Clear();
Game.Objects.UpdateTransferZones();
::Objects.UpdateTransferZones();
}
C4TransferZone* C4TransferZones::Find(int32_t iX, int32_t iY)

View File

@ -26,6 +26,7 @@
#ifndef BIG_C4INCLUDE
#include <C4Game.h>
#include <C4GameObjects.h>
#ifdef C4ENGINE
#include <C4Object.h>
#include <C4Log.h>
@ -70,7 +71,7 @@ void C4Value::AddDataRef()
Data.Obj->AddRef(this);
#ifdef _DEBUG
// check if the object actually exists
if(!Game.Objects.ObjectNumber(Data.Obj))
if(!::Objects.ObjectNumber(Data.Obj))
{ LogF("Warning: using wild object ptr %p!", Data.Obj); }
else if(!Data.Obj->Status)
{ LogF("Warning: using ptr on deleted object %p (%s)!", Data.Obj, Data.Obj->GetName()); }
@ -263,7 +264,7 @@ C4V_Type C4Value::GuessType()
#ifdef C4ENGINE
// object?
if (Game.Objects.ObjectNumber(Data.Obj))
if (::Objects.ObjectNumber(Data.Obj))
{
Type = C4V_C4Object;
// With the type now known, the destructor will clean up the reference
@ -535,7 +536,7 @@ StdStrBuf C4Value::GetDataString()
case C4V_C4Object:
{
// obj exists?
if(!Game.Objects.ObjectNumber(Data.Obj) && !Game.Objects.InactiveObjects.ObjectNumber(Data.Obj))
if(!::Objects.ObjectNumber(Data.Obj) && !::Objects.InactiveObjects.ObjectNumber(Data.Obj))
return FormatString("%ld", Data.Int);
else
if (Data.Obj)
@ -603,9 +604,9 @@ void C4Value::DenumeratePointer()
if(Type != C4V_C4ObjectEnum && !Inside(Data.Int, C4EnumPointer1, C4EnumPointer2)) return;
// get obj id, search object
int iObjID = (Data.Int >= C4EnumPointer1 ? Data.Int - C4EnumPointer1 : Data.Int);
C4Object *pObj = Game.Objects.ObjectPointer(iObjID);
C4Object *pObj = ::Objects.ObjectPointer(iObjID);
if (!pObj)
pObj = Game.Objects.InactiveObjects.ObjectPointer(iObjID);
pObj = ::Objects.InactiveObjects.ObjectPointer(iObjID);
if(pObj)
// set
SetObject(pObj);
@ -693,7 +694,7 @@ void C4Value::CompileFunc(StdCompiler *pComp)
case C4V_C4Object:
#ifdef C4ENGINE
if(!fCompiler)
iTmp = Game.Objects.ObjectNumber(getObj());
iTmp = ::Objects.ObjectNumber(getObj());
#else
if(!fCompiler) iTmp = 0;
#endif

View File

@ -48,6 +48,7 @@
#include <C4Landscape.h>
#include <C4Game.h>
#include <C4PlayerList.h>
#include <C4GameObjects.h>
#endif
#include <StdGL.h>
@ -1074,7 +1075,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
C4ST_STARTNEW(SkyStat, "C4Viewport::Draw: Sky")
::Landscape.Sky.Draw(cgo);
C4ST_STOP(SkyStat)
Game.BackObjects.DrawAll(cgo, Player);
::Objects.BackObjects.DrawAll(cgo, Player);
// Draw Landscape
C4ST_STARTNEW(LandStat, "C4Viewport::Draw: Landscape")
@ -1088,7 +1089,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
// draw objects
C4ST_STARTNEW(ObjStat, "C4Viewport::Draw: Objects")
Game.Objects.Draw(cgo, Player);
::Objects.Draw(cgo, Player);
C4ST_STOP(ObjStat)
// draw global particles
@ -1097,7 +1098,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
C4ST_STOP(PartStat)
// draw foreground objects
Game.ForeObjects.DrawIfCategory(cgo, Player, C4D_Parallax, true);
::Objects.ForeObjects.DrawIfCategory(cgo, Player, C4D_Parallax, true);
// Draw PathFinder
if (::GraphicsSystem.ShowPathfinder) Game.PathFinder.Draw(cgo);
@ -1118,7 +1119,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
cgo.Set(Application.DDraw->lpBack,DrawX,DrawY,int(float(ViewWdt)/fGUIZoom),int(float(ViewHgt)/fGUIZoom),ViewX,ViewY);
// draw custom GUI objects
Game.ForeObjects.DrawIfCategory(cgo, Player, C4D_Parallax, false);
::Objects.ForeObjects.DrawIfCategory(cgo, Player, C4D_Parallax, false);
// Draw overlay
C4ST_STARTNEW(OvrStat, "C4Viewport::Draw: Overlay")