Move Game.Defs to ::Definitions

stable-5.2
Günther Brammer 2009-06-05 18:46:37 +02:00
parent a05e53c1bc
commit 96080bd839
20 changed files with 72 additions and 69 deletions

View File

@ -429,6 +429,8 @@ class C4DefList
void SortByID(); // sorts list by quick access table
};
extern C4DefList Definitions;
// Default Action Procedures
#define DFA_NONE -1

View File

@ -89,7 +89,6 @@ class C4Game
C4Game();
~C4Game();
public:
C4DefList Defs;
C4ClientList &Clients; // Shortcut
C4GameParameters Parameters;
C4TeamList &Teams; // Shortcut

View File

@ -37,7 +37,7 @@
inline C4Def *C4Id2Def(C4ID id)
{
return Game.Defs.ID2Def(id);
return ::Definitions.ID2Def(id);
}
//=============================== Sound ==================================================

View File

@ -2092,7 +2092,7 @@ void C4Command::Fail(const char *szFailMessage)
if (szFailMessage) break;
// Fail message with name of target type
SCopy(LoadResStr(CommandNameID(Command)), szCommandName);
C4Def *pDef; pDef = Game.Defs.ID2Def(Data);
C4Def *pDef; pDef = ::Definitions.ID2Def(Data);
SCopy(pDef ? pDef->GetName() : LoadResStr("IDS_OBJ_UNKNOWN"), szObjectName);
str.Format(LoadResStr("IDS_CON_FAILUREOF"), szCommandName, szObjectName);
break;

View File

@ -1339,7 +1339,7 @@ void C4Console::EditScript()
{
if (::Network.isEnabled()) return;
Game.Script.Open();
::ScriptEngine.ReLink(&Game.Defs);
::ScriptEngine.ReLink(&::Definitions);
}
void C4Console::EditInfo()

View File

@ -226,9 +226,9 @@ void C4ControlSet::Execute() const
if (Game.IsRunning)
{
// invalidate fair crew physicals
const int iDefCount = Game.Defs.GetDefCount();
const int iDefCount = ::Definitions.GetDefCount();
for(int i = 0; i < iDefCount; i++)
Game.Defs.GetDef(i)->ClearFairCrewPhysicals();
::Definitions.GetDef(i)->ClearFairCrewPhysicals();
// show msg
if(Game.Parameters.UseFairCrew)
{

View File

@ -1765,3 +1765,5 @@ void C4DefList::ResetIncludeDependencies()
for (pDef=FirstDef; pDef; pDef=pDef->Next)
pDef->ResetIncludeDependencies();
}
C4DefList Definitions;

View File

@ -312,7 +312,7 @@ void C4DefGraphicsAdapt::CompileFunc(StdCompiler *pComp)
if(fCompiler)
{
// search definition, throw expection if not found
C4Def *pDef = Game.Defs.ID2Def(id);
C4Def *pDef = ::Definitions.ID2Def(id);
// search def-graphics
if(!pDef || !( pDefGraphics = pDef->Graphics.Get(Name.getData()) ))
pComp->excCorrupt("DefGraphics: could not find graphics \"%s\" in %s(%s)!", Name.getData(), C4IdText(id), pDef ? pDef->Name.getData() : "def not found");
@ -706,7 +706,7 @@ void C4GraphicsOverlay::Read(const char **ppInput)
}
// get ID
char id[5]; SCopy(szReadFrom, id, 4); szReadFrom += 6;
C4Def *pSrcDef = Game.Defs.ID2Def(C4Id(id)); // defaults to NULL for unloaded def
C4Def *pSrcDef = ::Definitions.ID2Def(C4Id(id)); // defaults to NULL for unloaded def
if (pSrcDef)
{
char GfxName[C4MaxName+1];

View File

@ -54,7 +54,7 @@ C4AulScript *C4Effect::GetCallbackScript()
// overwrite ID for sync safety in runtime join
idCommandTarget = pCommandTarget->id;
}
else if (idCommandTarget && (pDef=Game.Defs.ID2Def(idCommandTarget)))
else if (idCommandTarget && (pDef=::Definitions.ID2Def(idCommandTarget)))
pSrcScript = &pDef->Script;
else
pSrcScript = &::ScriptEngine;
@ -426,7 +426,7 @@ C4Value C4Effect::DoCall(C4Object *pObj, const char *szFn, C4Value &rVal1, C4Val
// overwrite ID for sync safety in runtime join
idCommandTarget = pCommandTarget->id;
}
else if (idCommandTarget && (pDef=Game.Defs.ID2Def(idCommandTarget)))
else if (idCommandTarget && (pDef=::Definitions.ID2Def(idCommandTarget)))
pSrcScript = &pDef->Script;
else
pSrcScript = &::ScriptEngine;

View File

@ -104,27 +104,27 @@ BOOL C4Game::InitDefs()
int iMinProgress = 10 + (25 * i) / iDefResCount;
int iMaxProgress = 10 + (25 * (i + 1)) / iDefResCount;
++i;
iDefs+=Defs.Load(pDef->getFile(),C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,TRUE,iMinProgress,iMaxProgress);
iDefs+=::Definitions.Load(pDef->getFile(),C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,TRUE,iMinProgress,iMaxProgress);
// Def load failure
if (Defs.LoadFailure) return FALSE;
if (::Definitions.LoadFailure) return FALSE;
}
// Load for scenario file - ignore sys group here, because it has been loaded already
iDefs+=Defs.Load(ScenarioFile,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,TRUE,TRUE,35,40, false);
iDefs+=::Definitions.Load(ScenarioFile,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,TRUE,TRUE,35,40, false);
// Absolutely no defs: we don't like that
if (!iDefs) { LogFatal(LoadResStr("IDS_PRC_NODEFS")); return FALSE; }
// Check def engine version (should be done immediately on def load)
iDefs=Defs.CheckEngineVersion(C4XVER1,C4XVER2,C4XVER3,C4XVER4);
iDefs=::Definitions.CheckEngineVersion(C4XVER1,C4XVER2,C4XVER3,C4XVER4);
if (iDefs>0) { LogF(LoadResStr("IDS_PRC_DEFSINVC4X"),iDefs); }
// Check for unmet requirements
Defs.CheckRequireDef();
::Definitions.CheckRequireDef();
// build quick access table
Defs.BuildTable();
::Definitions.BuildTable();
// get default particles
Particles.SetDefParticles();
@ -547,7 +547,7 @@ void C4Game::Clear()
Weather.Clear();
GraphicsSystem.Clear();
DeleteObjects(true);
Defs.Clear();
::Definitions.Clear();
Landscape.Clear();
PXS.Clear();
if (pGlobalEffects) { delete pGlobalEffects; pGlobalEffects=NULL; }
@ -1561,7 +1561,7 @@ BOOL C4Game::DropFile(const char *szFilename, float iX, float iY)
if (c_id=DefFileGetID(szFilename))
// Get loaded def or try to load def from file
if ( (cdef=C4Id2Def(c_id))
|| (Defs.Load(szFilename,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem) && (cdef=C4Id2Def(c_id))) )
|| (::Definitions.Load(szFilename,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem) && (cdef=C4Id2Def(c_id))) )
{
return DropDef(c_id, iX, iY);
}
@ -1675,7 +1675,7 @@ void C4Game::Default()
ObjectEnumerationIndex=0;
FullSpeed=FALSE;
FrameSkip=1; DoSkipFrame=false;
Defs.Default();
::Definitions.Default();
Material.Default();
Objects.Default();
BackObjects.Default();
@ -2137,10 +2137,10 @@ BOOL C4Game::ReloadFile(const char *szFile)
const char *szRelativePath = Config.AtRelativePath(szFile);
// a definition? or part of a definition?
C4Def *pDef;
if(pDef = Defs.GetByPath(szRelativePath))
if(pDef = ::Definitions.GetByPath(szRelativePath))
return ReloadDef(pDef->id);
// script?
if(ScriptEngine.ReloadScript(szRelativePath, &Defs))
if(ScriptEngine.ReloadScript(szRelativePath, &::Definitions))
{
return TRUE;
}
@ -2157,12 +2157,12 @@ BOOL C4Game::ReloadDef(C4ID id)
Synchronize(FALSE);
// reload def
C4ObjectLink *clnk;
C4Def *pDef = Defs.ID2Def(id);
C4Def *pDef = ::Definitions.ID2Def(id);
if (!pDef) return FALSE;
// Message
LogF("Reloading %s from %s",C4IdText(pDef->id),GetFilename(pDef->Filename));
// Reload def
if (Defs.Reload(pDef,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem))
if (::Definitions.Reload(pDef,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem))
{
// Success, update all concerned object faces
// may have been done by graphics-update already - but not for objects using graphics of another def
@ -2183,7 +2183,7 @@ BOOL C4Game::ReloadDef(C4ID id)
// safety: If a removed def is being profiled, profiling must stop
C4AulProfiler::Abort();
// Kill def
Defs.Remove(pDef);
::Definitions.Remove(pDef);
// Log
Log("Reloading failure. All objects of this type removed.");
fSucc = false;
@ -2284,7 +2284,7 @@ BOOL C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky)
SetInitProgress(58);
// Colorize defs by material
Defs.ColorizeByMaterial(Material,GBM);
::Definitions.ColorizeByMaterial(Material,GBM);
SetInitProgress(59);
// Videos
@ -2474,7 +2474,7 @@ BOOL C4Game::InitScriptEngine()
BOOL C4Game::LinkScriptEngine()
{
// Link script engine (resolve includes/appends, generate code)
ScriptEngine.Link(&Defs);
ScriptEngine.Link(&::Definitions);
// Set name list for globals
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
@ -3437,7 +3437,7 @@ void C4Game::Synchronize(BOOL fSavePlayerFiles)
// Fix random
FixRandom(RandomSeed);
// Synchronize members
Defs.Synchronize();
::Definitions.Synchronize();
Landscape.Synchronize();
MassMover.Synchronize();
PXS.Synchronize();
@ -3711,7 +3711,7 @@ void C4Game::InitValueOverloads()
C4ID idOvrl; C4Def *pDef;
// set new values
for (int32_t cnt=0; idOvrl=C4S.Game.Realism.ValueOverloads.GetID(cnt); cnt++)
if (pDef=Defs.ID2Def(idOvrl))
if (pDef=::Definitions.ID2Def(idOvrl))
pDef->Value=C4S.Game.Realism.ValueOverloads.GetIDCount(idOvrl);
}
@ -4018,7 +4018,7 @@ bool C4Game::DrawTextSpecImage(C4FacetSurface &fctTarget, const char *szSpec, ui
C4ID idPortrait;
const char *szPortraitName = C4Portrait::EvaluatePortraitString(szSpec, idPortrait, C4ID_None, &dwClr);
if (idPortrait == C4ID_None) return false;
C4Def *pPortraitDef = Game.Defs.ID2Def(idPortrait);
C4Def *pPortraitDef = ::Definitions.ID2Def(idPortrait);
if (!pPortraitDef || !pPortraitDef->Portraits) return false;
C4DefGraphics *pDefPortraitGfx = pPortraitDef->Portraits->Get(szPortraitName);
if (!pDefPortraitGfx) return false;

View File

@ -51,7 +51,7 @@ C4GoalDisplay::GoalPicture::GoalPicture(const C4Rect &rcBounds, C4ID idGoal, boo
else*/
{
// just get desc from def
C4Def *pGoalDef = Game.Defs.ID2Def(idGoal);
C4Def *pGoalDef = ::Definitions.ID2Def(idGoal);
if (pGoalDef)
{
strGoalName.Copy(pGoalDef->GetName());
@ -66,7 +66,7 @@ C4GoalDisplay::GoalPicture::GoalPicture(const C4Rect &rcBounds, C4ID idGoal, boo
sToolTip.Format(LoadResStr("IDS_DESC_GOALNOTFULFILLED"), strGoalName.getData(), strGoalDesc.getData());
SetToolTip(sToolTip.getData());
// create buffered picture of goal definition
C4Def *pDrawDef = Game.Defs.ID2Def(idGoal);
C4Def *pDrawDef = ::Definitions.ID2Def(idGoal);
if (pDrawDef)
{
Picture.Create(C4PictureSize, C4PictureSize);

View File

@ -162,7 +162,7 @@ bool C4GraphicsResource::InitFonts()
if (!Game.FontLoader.InitFont(FontRegular, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Files))
return false;
// assign def list as custom image source
FontRegular.SetCustomImages(&Game.Defs);
FontRegular.SetCustomImages(&::Definitions);
// load additional fonts
if (!Game.FontLoader.InitFont(FontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &::GraphicsResource.Files)) return false;
if (!Game.FontLoader.InitFont(FontCaption, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &::GraphicsResource.Files)) return false;

View File

@ -926,7 +926,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
switch (Extra)
{
case C4MN_Extra_Components:
if (pItem) pItem->Components.Draw(cgoExtra,-1,Game.Defs,C4D_All,TRUE,C4FCT_Right | C4FCT_Triple | C4FCT_Half);
if (pItem) pItem->Components.Draw(cgoExtra,-1,::Definitions,C4D_All,TRUE,C4FCT_Right | C4FCT_Triple | C4FCT_Half);
break;
case C4MN_Extra_Value:
{
@ -953,7 +953,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
::GraphicsResource.fctMagic.DrawValue2(cgoExtra,iValue,iUseExtraData,0,0,C4FCT_Right);
cgoExtra.Wdt = cgoExtra.X - iOriginalX - 5;
cgoExtra.X = iOriginalX;
pItem->Components.Draw(cgoExtra,-1,Game.Defs,C4D_All,TRUE,C4FCT_Right | C4FCT_Triple | C4FCT_Half);
pItem->Components.Draw(cgoExtra,-1,::Definitions,C4D_All,TRUE,C4FCT_Right | C4FCT_Triple | C4FCT_Half);
}
break;
}

View File

@ -1957,7 +1957,7 @@ BOOL C4Object::ActivateMenu(int32_t iMenu, int32_t iMenuSelect,
Menu->Init(fctSymbol,FormatString(LoadResStr("IDS_PLR_NOBKNOW"),pPlayer->GetName()).getData(),
this,C4MN_Extra_Components,0,iMenu);
// Add player's structure build knowledge
for (cnt=0; pDef=C4Id2Def(pPlayer->Knowledge.GetID(Game.Defs,C4D_Structure,cnt,&iCount)); cnt++)
for (cnt=0; pDef=C4Id2Def(pPlayer->Knowledge.GetID(::Definitions,C4D_Structure,cnt,&iCount)); cnt++)
{
// Caption
sprintf(szCaption,LoadResStr("IDS_MENU_CONSTRUCT"),pDef->GetName());
@ -2665,7 +2665,7 @@ void C4Object::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt( mkC4IDAdapt(id), "id", C4ID_None ));
if(fCompiler)
{
Def = Game.Defs.ID2Def(id);
Def = ::Definitions.ID2Def(id);
if(!Def)
{ pComp->excNotFound(LoadResStr("IDS_PRC_UNDEFINEDOBJECT"),C4IdText(id)); return; }
}

View File

@ -135,7 +135,7 @@ BOOL C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
const char *szPortraitName; C4ID idPortraitID;
szPortraitName = C4Portrait::EvaluatePortraitString(PortraitFile, idPortraitID, id, NULL);
// get portrait def
C4Def *pPortraitDef = Game.Defs.ID2Def(idPortraitID);
C4Def *pPortraitDef = ::Definitions.ID2Def(idPortraitID);
// def found?
if (pPortraitDef && pPortraitDef->Portraits)
{
@ -373,7 +373,7 @@ void C4ObjectInfo::Recruit()
#ifdef C4ENGINE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InActionTime=Game.Time;
// rank name overload by def?
C4Def *pDef=Game.Defs.ID2Def(id);
C4Def *pDef=::Definitions.ID2Def(id);
if (pDef) if (pDef->pRankNames)
{
StdStrBuf sRank(pDef->pRankNames->GetRankName(Rank, true));
@ -407,7 +407,7 @@ bool C4ObjectInfo::SetRandomPortrait(C4ID idSourceDef, bool fAssignPermanently,
if (!idSourceDef)
idSourceDef = id;
// Get source def
C4Def* pPortraitDef = Game.Defs.ID2Def(idSourceDef);
C4Def* pPortraitDef = ::Definitions.ID2Def(idSourceDef);
// Portrait source def not loaded: do not assign a portrait now, so the clonk can get
// the correct portrait later when the source def is available (assuming this clonk is
// not going to be used in this round anyway)
@ -417,7 +417,7 @@ bool C4ObjectInfo::SetRandomPortrait(C4ID idSourceDef, bool fAssignPermanently,
if (!pPortraitDef->PortraitCount)
{
// Then use CLNK portraits (2do: base on include chains in latter case)?
pPortraitDef = Game.Defs.ID2Def(C4ID_Clonk);
pPortraitDef = ::Definitions.ID2Def(C4ID_Clonk);
// Assign permanently, assuming it is some kind of normal clonk here...
fAssignPermanently=true;
fCopyFile=false;

View File

@ -193,7 +193,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
if (!(pPlayer = Game.Players.Get(pTarget->Base))) return FALSE;
C4Player *pBuyPlayer = Object ? Game.Players.Get(Object->Owner) : NULL;
C4ID idDef;
for (cnt=0; idDef=pPlayer->HomeBaseMaterial.GetID(Game.Defs,C4D_All,cnt,&iCount); cnt++)
for (cnt=0; idDef=pPlayer->HomeBaseMaterial.GetID(::Definitions,C4D_All,cnt,&iCount); cnt++)
{
pDef=C4Id2Def(idDef);
if (!pDef) continue; // skip invalid defs

View File

@ -459,7 +459,7 @@ BOOL C4Player::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny)
#ifndef C4ENGINE
C4DefList *pDefs = NULL;
#else
C4DefList *pDefs = &Game.Defs;
C4DefList *pDefs = &::Definitions;
#endif
if (!CrewInfoList.Save(hGroup, fSavegame, fStoreTiny, pDefs))
{ hGroup.Close(); return FALSE; }
@ -486,8 +486,8 @@ void C4Player::PlaceReadyCrew(int32_t tx1, int32_t tx2, int32_t ty, C4Object *Fi
// Set standard crew
C4ID idStdCrew = Game.C4S.PlrStart[PlrStartIndex].NativeCrew;
// Select member from home crew, add new if necessary
while (!(pInfo=CrewInfoList.GetIdle(idStdCrew,Game.Defs)))
if (!CrewInfoList.New(idStdCrew,&Game.Defs))
while (!(pInfo=CrewInfoList.GetIdle(idStdCrew,::Definitions)))
if (!CrewInfoList.New(idStdCrew,&::Definitions))
break;
// Crew placement location
if (!pInfo || !(pDef=C4Id2Def(pInfo->id))) continue;
@ -527,8 +527,8 @@ void C4Player::PlaceReadyCrew(int32_t tx1, int32_t tx2, int32_t ty, C4Object *Fi
for (int32_t cnt2=0; cnt2<iCount; cnt2++)
{
// Select member from home crew, add new if necessary
while (!(pInfo=CrewInfoList.GetIdle(id,Game.Defs)))
if (!CrewInfoList.New(id,&Game.Defs))
while (!(pInfo=CrewInfoList.GetIdle(id,::Definitions)))
if (!CrewInfoList.New(id,&::Definitions))
break;
// Safety
if (!pInfo || !(pDef=C4Id2Def(pInfo->id))) continue;
@ -688,15 +688,15 @@ BOOL C4Player::ScenarioInit()
// Wealth, home base materials, abilities
Wealth=Game.C4S.PlrStart[PlrStartIndex].Wealth.Evaluate();
HomeBaseMaterial=Game.C4S.PlrStart[PlrStartIndex].HomeBaseMaterial;
HomeBaseMaterial.ConsolidateValids(Game.Defs);
HomeBaseMaterial.ConsolidateValids(::Definitions);
HomeBaseProduction=Game.C4S.PlrStart[PlrStartIndex].HomeBaseProduction;
HomeBaseProduction.ConsolidateValids(Game.Defs);
HomeBaseProduction.ConsolidateValids(::Definitions);
Knowledge=Game.C4S.PlrStart[PlrStartIndex].BuildKnowledge;
Knowledge.ConsolidateValids(Game.Defs);
Knowledge.ConsolidateValids(::Definitions);
Magic=Game.C4S.PlrStart[PlrStartIndex].Magic;
Magic.ConsolidateValids(Game.Defs);
if (Magic.IsClear()) Magic.Load(Game.Defs,C4D_Magic); // All magic default if empty
Magic.SortByValue(Game.Defs);
Magic.ConsolidateValids(::Definitions);
if (Magic.IsClear()) Magic.Load(::Definitions,C4D_Magic); // All magic default if empty
Magic.SortByValue(::Definitions);
// Starting position
ptx = Game.C4S.PlrStart[PlrStartIndex].Position[0];
@ -1138,14 +1138,14 @@ BOOL C4Player::Strip(const char *szFilename, bool fAggressive)
if(!PlrInfoCore.Load(Grp) || !CrewInfoList.Load(Grp, false))
return FALSE;
// Strip crew info list (remove object infos that are invalid for this scenario)
CrewInfoList.Strip(Game.Defs);
CrewInfoList.Strip(::Definitions);
// Create a new group that receives the bare essentials
Grp.Close();
if(!EraseItem(szFilename) ||
!Grp.Open(szFilename, TRUE))
return FALSE;
// Save info core & crew info list to newly-created file
if(!PlrInfoCore.Save(Grp) || !CrewInfoList.Save(Grp, true, true, &Game.Defs))
if(!PlrInfoCore.Save(Grp) || !CrewInfoList.Save(Grp, true, true, &::Definitions))
return FALSE;
Grp.Close();
}
@ -1184,8 +1184,8 @@ BOOL C4Player::MakeCrewMember(C4Object *pObj, bool fForceInfo, bool fDoCalls)
// Find crew info by id
if (!cInf)
while (!( cInf = CrewInfoList.GetIdle(pObj->id,Game.Defs) ))
if (!CrewInfoList.New(pObj->id,&Game.Defs))
while (!( cInf = CrewInfoList.GetIdle(pObj->id,::Definitions) ))
if (!CrewInfoList.New(pObj->id,&::Definitions))
return FALSE;
// Set object info

View File

@ -215,7 +215,7 @@ BOOL C4PropertyDlg::Update()
{
Output.Append(LineFeed);
Output.Append(LoadResStr("IDS_CNS_CONTENTS"));
Output.Append(static_cast<const StdStrBuf &>(cobj->Contents.GetNameList(Game.Defs)));
Output.Append(static_cast<const StdStrBuf &>(cobj->Contents.GetNameList(::Definitions)));
}
// Action
if (cobj->Action.Act!=ActIdle)

View File

@ -620,7 +620,7 @@ static long FnGetPhysical(C4AulContext *cthr, C4String *szPhysical, long iMode,
if (idDef)
{
// get def
C4Def *pDef=Game.Defs.ID2Def(idDef); if (!pDef) return 0;
C4Def *pDef=::Definitions.ID2Def(idDef); if (!pDef) return 0;
// return physical value
return pDef->Physical.*off;
}
@ -980,7 +980,7 @@ static C4String *FnGetName(C4AulContext *cthr, C4Object *pObj, C4ID idDef/*, boo
{
/*if (idx)
{
pDef = Game.Defs.GetDef(idx-1);
pDef = ::Definitions.GetDef(idx-1);
}
else*/
pDef=C4Id2Def(idDef);
@ -1060,7 +1060,7 @@ static C4String *FnGetDesc(C4AulContext *cthr, C4Object *pObj, C4ID idDef)
if (pObj)
pDef = pObj->Def;
else
pDef = Game.Defs.ID2Def(idDef);
pDef = ::Definitions.ID2Def(idDef);
// nothing found?
if(!pDef) return NULL;
// return desc
@ -1142,7 +1142,7 @@ static long FnGetMass(C4AulContext *cthr, C4Object *pObj, C4ID idDef)
{
if (idDef)
{
C4Def *pDef = Game.Defs.ID2Def(idDef);
C4Def *pDef = ::Definitions.ID2Def(idDef);
if (!pDef) return 0;
return pDef->Mass;
}
@ -2749,7 +2749,7 @@ static C4Value FnGetPlrKnowledge_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Va
// Search by id, check if available, return bool
if (id) return C4VBool(Game.Players.Get(iPlr)->Knowledge.GetIDCount(id,1) != 0);
// Search indexed item of given category, return C4ID
return C4VID(Game.Players.Get(iPlr)->Knowledge.GetID( Game.Defs, dwCategory, iIndex ));
return C4VID(Game.Players.Get(iPlr)->Knowledge.GetID( ::Definitions, dwCategory, iIndex ));
}
static C4ID FnGetDefinition(C4AulContext *cthr, long iIndex, long dwCategory)
@ -2758,7 +2758,7 @@ static C4ID FnGetDefinition(C4AulContext *cthr, long iIndex, long dwCategory)
// Default: all categories
if (!dwCategory) dwCategory=C4D_All;
// Get def
if (!(pDef = Game.Defs.GetDef(iIndex,dwCategory))) return C4ID_None;
if (!(pDef = ::Definitions.GetDef(iIndex,dwCategory))) return C4ID_None;
// Return id
return pDef->id;
}
@ -2804,7 +2804,7 @@ static C4Value FnGetHomebaseMaterial_C4V(C4AulContext *cthr, C4Value* iPlr_C4V,
// Search by id, return available count
if (id) return C4VInt(Game.Players.Get(iPlr)->HomeBaseMaterial.GetIDCount(id));
// Search indexed item of given category, return C4ID
return C4VID(Game.Players.Get(iPlr)->HomeBaseMaterial.GetID( Game.Defs, dwCategory, iIndex ));
return C4VID(Game.Players.Get(iPlr)->HomeBaseMaterial.GetID( ::Definitions, dwCategory, iIndex ));
}
static C4Value FnGetHomebaseProduction_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Value* id_C4V, C4Value* iIndex_C4V, C4Value* dwCategory_C4V)
@ -2818,7 +2818,7 @@ static C4Value FnGetHomebaseProduction_C4V(C4AulContext *cthr, C4Value* iPlr_C4V
// Search by id, return available count
if (id) return C4VInt(Game.Players.Get(iPlr)->HomeBaseProduction.GetIDCount(id));
// Search indexed item of given category, return C4ID
return C4VID(Game.Players.Get(iPlr)->HomeBaseProduction.GetID( Game.Defs, dwCategory, iIndex ));
return C4VID(Game.Players.Get(iPlr)->HomeBaseProduction.GetID( ::Definitions, dwCategory, iIndex ));
}
static long FnSetPlrMagic(C4AulContext *cthr, long iPlr, C4ID id, bool fRemove)
@ -2848,7 +2848,7 @@ static C4Value FnGetPlrMagic_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Value*
// Search by id, check if available, return bool
if (id) return C4VBool(Game.Players.Get(iPlr)->Magic.GetIDCount(id,1) != 0);
// Search indexed item of given category, return C4ID
return C4VID(Game.Players.Get(iPlr)->Magic.GetID( Game.Defs, C4D_Magic, iIndex ));
return C4VID(Game.Players.Get(iPlr)->Magic.GetID( ::Definitions, C4D_Magic, iIndex ));
}
static long FnGetWealth(C4AulContext *cthr, long iPlr)
@ -5250,7 +5250,7 @@ static long FnReloadDef(C4AulContext* ctx, C4ID idDef, long iReloadWhat)
}
else
// def by ID
pDef=Game.Defs.ID2Def(idDef);
pDef=::Definitions.ID2Def(idDef);
// safety
if (!pDef) return false;
// reload everything if nothing has been specified
@ -5580,7 +5580,7 @@ static bool FnSetPortrait(C4AulContext *ctx, C4String *pstrPortrait, C4Object *p
if (SEqual(szPortrait, C4Portrait_None)) return pTarget->Info->ClearPortrait(!!fPermanent);
// get source def for portrait
C4Def *pSourceDef;
if (idSourceDef) pSourceDef = Game.Defs.ID2Def(idSourceDef); else pSourceDef=pTarget->Def;
if (idSourceDef) pSourceDef = ::Definitions.ID2Def(idSourceDef); else pSourceDef=pTarget->Def;
if (!pSourceDef) return FALSE;
// special case: random portrait
if (SEqual(szPortrait, C4Portrait_Random)) return pTarget->Info->SetRandomPortrait(pSourceDef->id, !!fPermanent, !!fCopyGfx);

View File

@ -920,7 +920,7 @@ void C4Viewport::DrawCursorInfo(C4TargetFacet &cgo)
{
// Object list
ccgo.Set(cgo.Surface,cgo.X+C4SymbolBorder,cgo.Y+cgo.Hgt-C4SymbolBorder-C4SymbolSize,7*C4SymbolSize,C4SymbolSize);
cursor->Contents.DrawIDList(ccgo,-1,Game.Defs,C4D_All,SetRegions,COM_Contents,FALSE);
cursor->Contents.DrawIDList(ccgo,-1,::Definitions,C4D_All,SetRegions,COM_Contents,FALSE);
}
C4ST_STOP(ContStat)