forked from Mirrors/openclonk
Replace BOOL by bool, TRUE by true, FALSE by false
parent
179097d389
commit
9a8b5dd739
|
@ -179,7 +179,7 @@ bool C4Application::DoInit()
|
|||
ApplyResolutionConstraints();
|
||||
|
||||
// activate
|
||||
Active=TRUE;
|
||||
Active=true;
|
||||
|
||||
// Init carrier window
|
||||
if (isFullScreen)
|
||||
|
@ -222,7 +222,7 @@ bool C4Application::DoInit()
|
|||
Log("WARNING: DDraw Software emulation is activated!");
|
||||
#endif
|
||||
// Initialize D3D/OpenGL
|
||||
DDraw = DDrawInit(this, isFullScreen, FALSE, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Engine, Config.Graphics.Monitor);
|
||||
DDraw = DDrawInit(this, isFullScreen, false, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Engine, Config.Graphics.Monitor);
|
||||
if (!DDraw) { LogFatal(LoadResStr("IDS_ERR_DDRAW")); Clear(); return false; }
|
||||
|
||||
#if defined(_WIN32) && !defined(USE_CONSOLE)
|
||||
|
@ -307,10 +307,10 @@ bool C4Application::PreInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Application::ProcessCallback(const char *szMessage, int iProcess)
|
||||
bool C4Application::ProcessCallback(const char *szMessage, int iProcess)
|
||||
{
|
||||
Console.Out(szMessage);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Application::Clear()
|
||||
|
|
|
@ -89,7 +89,7 @@ class C4Application: public CStdApp
|
|||
virtual bool DoInit();
|
||||
bool OpenGame();
|
||||
bool PreInit();
|
||||
static BOOL ProcessCallback(const char *szMessage, int iProcess);
|
||||
static bool ProcessCallback(const char *szMessage, int iProcess);
|
||||
void ApplyResolutionConstraints();
|
||||
|
||||
virtual void OnCommand(const char *szCmd);
|
||||
|
|
|
@ -410,11 +410,11 @@ void C4FullScreen::Execute()
|
|||
::GraphicsSystem.Execute();
|
||||
}
|
||||
|
||||
BOOL C4FullScreen::ViewportCheck()
|
||||
bool C4FullScreen::ViewportCheck()
|
||||
{
|
||||
int iPlrNum; C4Player *pPlr;
|
||||
// Not active
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
// Determine film mode
|
||||
bool fFilm = (Game.C4S.Head.Replay && Game.C4S.Head.Film);
|
||||
// Check viewports
|
||||
|
@ -465,7 +465,7 @@ BOOL C4FullScreen::ViewportCheck()
|
|||
pNoOwnerVp->Init(pPlr->Number, true);
|
||||
}
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4FullScreen::ShowAbortDlg()
|
||||
|
|
|
@ -36,12 +36,12 @@ class C4FullScreen: public CStdWindow
|
|||
C4FullScreen();
|
||||
~C4FullScreen();
|
||||
void Execute();
|
||||
BOOL Restart();
|
||||
BOOL ViewportCheck();
|
||||
BOOL OpenGame(const char *szCmdLine);
|
||||
bool Restart();
|
||||
bool ViewportCheck();
|
||||
bool OpenGame(const char *szCmdLine);
|
||||
bool ShowAbortDlg(); // show game abort dialog (Escape pressed)
|
||||
bool ActivateMenuMain();
|
||||
BOOL MenuCommand(const char *szCommand);
|
||||
bool MenuCommand(const char *szCommand);
|
||||
void CloseMenu();
|
||||
bool MenuKeyControl(BYTE byCom); // direct keyboard callback
|
||||
// User requests close
|
||||
|
|
540
src/C4Game.cpp
540
src/C4Game.cpp
File diff suppressed because it is too large
Load Diff
84
src/C4Game.h
84
src/C4Game.h
|
@ -165,11 +165,11 @@ class C4Game
|
|||
bool Init();
|
||||
bool PreInit();
|
||||
void ParseCommandLine(const char *szCmdLine);
|
||||
BOOL Execute();
|
||||
bool Execute();
|
||||
class C4Player *JoinPlayer(const char *szFilename, int32_t iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo);
|
||||
BOOL DoGameOver();
|
||||
bool DoGameOver();
|
||||
bool CanQuickSave();
|
||||
BOOL QuickSave(const char *strFilename, const char *strTitle, bool fForceSave=false);
|
||||
bool QuickSave(const char *strFilename, const char *strTitle, bool fForceSave=false);
|
||||
void SetInitProgress(float fToProgress);
|
||||
void OnResolutionChanged(unsigned int iXRes, unsigned int iYRes); // update anything that's dependant on screen resolution
|
||||
void InitFullscreenComponents(bool fRunning);
|
||||
|
@ -180,18 +180,18 @@ class C4Game
|
|||
bool Unpause();
|
||||
bool IsPaused();
|
||||
// Network
|
||||
void Synchronize(BOOL fSavePlayerFiles);
|
||||
void Synchronize(bool fSavePlayerFiles);
|
||||
void SyncClearance();
|
||||
BOOL ReSync();
|
||||
bool ReSync();
|
||||
void SyncCheckFiles(); // check if files are in sync
|
||||
// Editing
|
||||
BOOL DropFile(const char *szFilename, float iX, float iY);
|
||||
BOOL CreateViewport(int32_t iPlayer, bool fSilent=false);
|
||||
BOOL DropDef(C4ID id, float iX, float iY);
|
||||
BOOL LoadDef(const char *szFilename);
|
||||
BOOL ReloadFile(const char *szPath);
|
||||
BOOL ReloadDef(C4ID id);
|
||||
BOOL ReloadParticle(const char *szName);
|
||||
bool DropFile(const char *szFilename, float iX, float iY);
|
||||
bool CreateViewport(int32_t iPlayer, bool fSilent=false);
|
||||
bool DropDef(C4ID id, float iX, float iY);
|
||||
bool LoadDef(const char *szFilename);
|
||||
bool ReloadFile(const char *szPath);
|
||||
bool ReloadDef(C4ID id);
|
||||
bool ReloadParticle(const char *szName);
|
||||
// Object functions
|
||||
void ClearPointers(C4PropList *cobj);
|
||||
C4Object *CreateObject(C4PropList * type, C4Object *pCreator, int32_t owner=NO_OWNER,
|
||||
|
@ -204,7 +204,7 @@ class C4Game
|
|||
C4Object *pCreator,
|
||||
int32_t owner,
|
||||
int32_t ctx=0, int32_t bty=0,
|
||||
int32_t con=1, BOOL terrain=FALSE);
|
||||
int32_t con=1, bool terrain=false);
|
||||
C4Object *CreateInfoObject(C4ObjectInfo *cinf, int32_t owner,
|
||||
int32_t tx=50, int32_t ty=50);
|
||||
void BlastObjects(int32_t tx, int32_t ty, int32_t level, C4Object *inobj, int32_t iCausedBy, C4Object *pByObj);
|
||||
|
@ -241,8 +241,8 @@ class C4Game
|
|||
C4Object *PlaceVegetation(C4ID id, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iGrowth);
|
||||
C4Object *PlaceAnimal(C4ID idAnimal);
|
||||
|
||||
BOOL LoadScenarioSection(const char *szSection, DWORD dwFlags);
|
||||
BOOL SaveDesc(C4Group &hGroup, BOOL fSaveGame=FALSE, BOOL fReference=FALSE, BOOL fLobby=FALSE, BOOL fUnregistered=FALSE, BOOL fRecord=FALSE);
|
||||
bool LoadScenarioSection(const char *szSection, DWORD dwFlags);
|
||||
bool SaveDesc(C4Group &hGroup, bool fSaveGame=false, bool fReference=false, bool fLobby=false, bool fUnregistered=false, bool fRecord=false);
|
||||
|
||||
bool DrawTextSpecImage(C4FacetSurface &fctTarget, const char *szSpec, uint32_t dwClr=0xff);
|
||||
bool SpeedUp();
|
||||
|
@ -264,40 +264,40 @@ class C4Game
|
|||
void ExecObjects();
|
||||
void Ticks();
|
||||
const char *FoldersWithLocalsDefs(const char *szPath);
|
||||
BOOL CheckObjectEnumeration();
|
||||
BOOL LocalFileMatch(const char *szFilename, int32_t iCreation);
|
||||
BOOL DefinitionFilenamesFromSaveGame();
|
||||
bool CheckObjectEnumeration();
|
||||
bool LocalFileMatch(const char *szFilename, int32_t iCreation);
|
||||
bool DefinitionFilenamesFromSaveGame();
|
||||
bool LoadScenarioComponents();
|
||||
bool LoadScenarioScripts();
|
||||
public:
|
||||
BOOL SaveGameTitle(C4Group &hGroup);
|
||||
bool SaveGameTitle(C4Group &hGroup);
|
||||
protected:
|
||||
BOOL InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky);
|
||||
BOOL InitGameFinal();
|
||||
BOOL InitNetworkFromAddress(const char *szAddress);
|
||||
BOOL InitNetworkFromReference(const C4Network2Reference &Reference);
|
||||
BOOL InitNetworkHost();
|
||||
BOOL DoLobby();
|
||||
BOOL PreInitControl();
|
||||
BOOL InitControl();
|
||||
BOOL InitScriptEngine();
|
||||
BOOL LinkScriptEngine();
|
||||
BOOL InitPlayers();
|
||||
BOOL InitRecord();
|
||||
BOOL OpenScenario();
|
||||
BOOL InitDefs();
|
||||
BOOL InitMaterialTexture();
|
||||
BOOL GameOverCheck();
|
||||
BOOL PlaceInEarth(C4ID id);
|
||||
BOOL Compile(const char *szSource);
|
||||
BOOL Decompile(StdStrBuf &rBuf, bool fSaveSection, bool fSaveExact);
|
||||
bool InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky);
|
||||
bool InitGameFinal();
|
||||
bool InitNetworkFromAddress(const char *szAddress);
|
||||
bool InitNetworkFromReference(const C4Network2Reference &Reference);
|
||||
bool InitNetworkHost();
|
||||
bool DoLobby();
|
||||
bool PreInitControl();
|
||||
bool InitControl();
|
||||
bool InitScriptEngine();
|
||||
bool LinkScriptEngine();
|
||||
bool InitPlayers();
|
||||
bool InitRecord();
|
||||
bool OpenScenario();
|
||||
bool InitDefs();
|
||||
bool InitMaterialTexture();
|
||||
bool GameOverCheck();
|
||||
bool PlaceInEarth(C4ID id);
|
||||
bool Compile(const char *szSource);
|
||||
bool Decompile(StdStrBuf &rBuf, bool fSaveSection, bool fSaveExact);
|
||||
public:
|
||||
void CompileFunc(StdCompiler *pComp, CompileSettings comp);
|
||||
BOOL SaveData(C4Group &hGroup, bool fSaveSection, bool fInitial, bool fSaveExact);
|
||||
bool SaveData(C4Group &hGroup, bool fSaveSection, bool fInitial, bool fSaveExact);
|
||||
protected:
|
||||
BOOL CompileRuntimeData(C4ComponentHost &rGameData);
|
||||
BOOL StoreParticipantPlayers();
|
||||
BOOL RecreatePlayerFiles();
|
||||
bool CompileRuntimeData(C4ComponentHost &rGameData);
|
||||
bool StoreParticipantPlayers();
|
||||
bool RecreatePlayerFiles();
|
||||
|
||||
// Object function internals
|
||||
C4Object *NewObject( C4PropList *ndef, C4Object *pCreator,
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
C4GraphicsSystem::C4GraphicsSystem()
|
||||
{
|
||||
fViewportClassRegistered=FALSE;
|
||||
fViewportClassRegistered=false;
|
||||
Default();
|
||||
}
|
||||
|
||||
|
@ -80,20 +80,20 @@ BOOL C4GraphicsSystem::RegisterViewportClass(HINSTANCE hInst)
|
|||
return C4GUI::Dialog::RegisterWindowClass(hInst);
|
||||
}
|
||||
#endif
|
||||
BOOL C4GraphicsSystem::Init()
|
||||
bool C4GraphicsSystem::Init()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Register viewport class
|
||||
if (!fViewportClassRegistered)
|
||||
if (!RegisterViewportClass(Application.GetInstance()))
|
||||
return FALSE;
|
||||
fViewportClassRegistered=TRUE;
|
||||
return false;
|
||||
fViewportClassRegistered=true;
|
||||
#endif
|
||||
// Init video module
|
||||
if (Config.Graphics.VideoModule)
|
||||
Video.Init(Application.DDraw->lpBack);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::Clear()
|
||||
|
@ -119,11 +119,11 @@ void C4GraphicsSystem::Clear()
|
|||
DeactivateDebugOutput();
|
||||
}
|
||||
|
||||
BOOL C4GraphicsSystem::SetPalette()
|
||||
bool C4GraphicsSystem::SetPalette()
|
||||
{
|
||||
// Set primary palette by game palette
|
||||
if (!Application.DDraw->SetPrimaryPalette(::GraphicsResource.GamePalette, ::GraphicsResource.AlphaPalette)) return FALSE;
|
||||
return TRUE;
|
||||
if (!Application.DDraw->SetPrimaryPalette(::GraphicsResource.GamePalette, ::GraphicsResource.AlphaPalette)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
extern int32_t iLastControlSize,iPacketDelay;
|
||||
|
@ -222,13 +222,13 @@ void C4GraphicsSystem::Execute()
|
|||
}
|
||||
|
||||
// Palette update
|
||||
if (fSetPalette) { SetPalette(); /*SetDarkColorTable();*/ fSetPalette=FALSE; }
|
||||
if (fSetPalette) { SetPalette(); /*SetDarkColorTable();*/ fSetPalette=false; }
|
||||
|
||||
// gamma update
|
||||
if (fSetGamma)
|
||||
{
|
||||
ApplyGamma();
|
||||
fSetGamma=FALSE;
|
||||
fSetGamma=false;
|
||||
}
|
||||
|
||||
// Video record & status (fullsrceen)
|
||||
|
@ -239,7 +239,7 @@ void C4GraphicsSystem::Execute()
|
|||
FinishDrawing();
|
||||
}
|
||||
|
||||
BOOL C4GraphicsSystem::CloseViewport(C4Viewport * cvp)
|
||||
bool C4GraphicsSystem::CloseViewport(C4Viewport * cvp)
|
||||
{
|
||||
if (!cvp) return false;
|
||||
/*C4Viewport *next,*prev=NULL;
|
||||
|
@ -276,7 +276,7 @@ BOOL C4GraphicsSystem::CloseViewport(C4Viewport * cvp)
|
|||
// Recalculate viewports
|
||||
RecalculateViewports();
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
C4Viewport* C4GraphicsSystem::GetViewport(HWND hwnd)
|
||||
|
@ -287,17 +287,17 @@ C4Viewport* C4GraphicsSystem::GetViewport(HWND hwnd)
|
|||
return NULL;
|
||||
}
|
||||
#endif
|
||||
BOOL C4GraphicsSystem::CreateViewport(int32_t iPlayer, bool fSilent)
|
||||
bool C4GraphicsSystem::CreateViewport(int32_t iPlayer, bool fSilent)
|
||||
{
|
||||
// Create and init new viewport, add to viewport list
|
||||
int32_t iLastCount = GetViewportCount();
|
||||
C4Viewport *nvp = new C4Viewport;
|
||||
BOOL fOkay = FALSE;
|
||||
bool fOkay = false;
|
||||
if (Application.isFullScreen)
|
||||
fOkay = nvp->Init(iPlayer, false);
|
||||
else
|
||||
fOkay = nvp->Init(&Console,&Application,iPlayer);
|
||||
if (!fOkay) { delete nvp; return FALSE; }
|
||||
if (!fOkay) { delete nvp; return false; }
|
||||
C4Viewport *pLast;
|
||||
for (pLast=FirstViewport; pLast && pLast->Next; pLast=pLast->Next) {}
|
||||
if (pLast) pLast->Next=nvp; else FirstViewport=nvp;
|
||||
|
@ -308,7 +308,7 @@ BOOL C4GraphicsSystem::CreateViewport(int32_t iPlayer, bool fSilent)
|
|||
// Action sound
|
||||
if (GetViewportCount()!=iLastCount) if (!fSilent)
|
||||
StartSoundEffect("CloseViewport");
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::ClearPointers(C4Object *pObj)
|
||||
|
@ -324,21 +324,21 @@ void C4GraphicsSystem::Default()
|
|||
FirstViewport=NULL;
|
||||
InvalidateBg();
|
||||
ViewportArea.Default();
|
||||
ShowVertices=FALSE;
|
||||
ShowAction=FALSE;
|
||||
ShowCommand=FALSE;
|
||||
ShowEntrance=FALSE;
|
||||
ShowPathfinder=FALSE;
|
||||
ShowNetstatus=FALSE;
|
||||
ShowSolidMask=FALSE;
|
||||
ShowHelp=FALSE;
|
||||
ShowVertices=false;
|
||||
ShowAction=false;
|
||||
ShowCommand=false;
|
||||
ShowEntrance=false;
|
||||
ShowPathfinder=false;
|
||||
ShowNetstatus=false;
|
||||
ShowSolidMask=false;
|
||||
ShowHelp=false;
|
||||
FlashMessageText[0]=0;
|
||||
FlashMessageTime=0; FlashMessageX=FlashMessageY=0;
|
||||
fSetPalette=FALSE;
|
||||
fSetPalette=false;
|
||||
Video.Default();
|
||||
for (int32_t iRamp=0; iRamp<3*C4MaxGammaRamps; iRamp+=3)
|
||||
{ dwGamma[iRamp+0]=0; dwGamma[iRamp+1]=0x808080; dwGamma[iRamp+2]=0xffffff; }
|
||||
fSetGamma=FALSE;
|
||||
fSetGamma=false;
|
||||
pLoaderScreen=NULL;
|
||||
}
|
||||
|
||||
|
@ -363,18 +363,18 @@ void OnSurfaceRestore()
|
|||
::GraphicsSystem.InvalidateBg();
|
||||
}
|
||||
|
||||
BOOL C4GraphicsSystem::InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst)
|
||||
bool C4GraphicsSystem::InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst)
|
||||
{
|
||||
// create new loader; overwrite current only if successful
|
||||
C4LoaderScreen *pNewLoader = new C4LoaderScreen();
|
||||
pNewLoader->SetBlackScreen(fDrawBlackScreenFirst);
|
||||
if (!pNewLoader->Init(szLoaderSpec)) { delete pNewLoader; return FALSE; }
|
||||
if (!pNewLoader->Init(szLoaderSpec)) { delete pNewLoader; return false; }
|
||||
if (pLoaderScreen) delete pLoaderScreen;
|
||||
pLoaderScreen = pNewLoader;
|
||||
// apply user gamma for loader
|
||||
ApplyGamma();
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::EnableLoaderDrawing()
|
||||
|
@ -383,7 +383,7 @@ void C4GraphicsSystem::EnableLoaderDrawing()
|
|||
if (pLoaderScreen) pLoaderScreen->SetBlackScreen(false);
|
||||
}
|
||||
|
||||
BOOL C4GraphicsSystem::CloseViewport(int32_t iPlayer, bool fSilent)
|
||||
bool C4GraphicsSystem::CloseViewport(int32_t iPlayer, bool fSilent)
|
||||
{
|
||||
// Close all matching viewports
|
||||
int32_t iLastCount = GetViewportCount();
|
||||
|
@ -405,7 +405,7 @@ BOOL C4GraphicsSystem::CloseViewport(int32_t iPlayer, bool fSilent)
|
|||
// Action sound
|
||||
if (GetViewportCount()!=iLastCount) if (!fSilent)
|
||||
StartSoundEffect("CloseViewport");
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::RecalculateViewports()
|
||||
|
@ -513,12 +513,12 @@ void C4GraphicsSystem::SortViewportsByPlayerControl()
|
|||
{
|
||||
|
||||
// Sort
|
||||
BOOL fSorted;
|
||||
bool fSorted;
|
||||
C4Player *pPlr1,*pPlr2;
|
||||
C4Viewport *pView,*pNext,*pPrev;
|
||||
do
|
||||
{
|
||||
fSorted = TRUE;
|
||||
fSorted = true;
|
||||
for (pPrev=NULL,pView=FirstViewport; pView && (pNext = pView->Next); pView=pNext)
|
||||
{
|
||||
// Get players
|
||||
|
@ -532,7 +532,7 @@ void C4GraphicsSystem::SortViewportsByPlayerControl()
|
|||
pNext->Next = pView;
|
||||
pPrev = pNext;
|
||||
pNext = pView;
|
||||
fSorted = FALSE;
|
||||
fSorted = false;
|
||||
}
|
||||
// Don't swap
|
||||
else
|
||||
|
@ -609,7 +609,7 @@ bool C4GraphicsSystem::SaveScreenshot(bool fSaveAll)
|
|||
do
|
||||
sprintf(szFilename,"Screenshot%03i.png",iScreenshotIndex++);
|
||||
while (FileExists(strFilePath = Config.AtScreenshotPath(szFilename)));
|
||||
BOOL fSuccess=DoSaveScreenshot(fSaveAll, strFilePath);
|
||||
bool fSuccess=DoSaveScreenshot(fSaveAll, strFilePath);
|
||||
// log if successful/where it has been stored
|
||||
if (!fSuccess)
|
||||
LogF(LoadResStr("IDS_PRC_SCREENSHOTERROR"), Config.AtUserDataRelativePath(Config.AtScreenshotPath(szFilename)));
|
||||
|
@ -619,24 +619,24 @@ bool C4GraphicsSystem::SaveScreenshot(bool fSaveAll)
|
|||
return !!fSuccess;
|
||||
}
|
||||
|
||||
BOOL C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
|
||||
bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
|
||||
{
|
||||
// Fullscreen only
|
||||
if (!Application.isFullScreen) return FALSE;
|
||||
if (!Application.isFullScreen) return false;
|
||||
// back surface must be present
|
||||
if (!Application.DDraw->lpBack) return FALSE;
|
||||
if (!Application.DDraw->lpBack) return false;
|
||||
|
||||
// save landscape
|
||||
if (fSaveAll)
|
||||
{
|
||||
// get viewport to draw in
|
||||
C4Viewport *pVP=GetFirstViewport(); if (!pVP) return FALSE;
|
||||
C4Viewport *pVP=GetFirstViewport(); if (!pVP) return false;
|
||||
// create image large enough to hold the landcape
|
||||
CPNGFile png; int32_t lWdt=GBackWdt,lHgt=GBackHgt;
|
||||
if (!png.Create(lWdt, lHgt, false)) return FALSE;
|
||||
if (!png.Create(lWdt, lHgt, false)) return false;
|
||||
// get backbuffer size
|
||||
int32_t bkWdt=C4GUI::GetScreenWdt(), bkHgt=C4GUI::GetScreenHgt();
|
||||
if (!bkWdt || !bkHgt) return FALSE;
|
||||
if (!bkWdt || !bkHgt) return false;
|
||||
// facet for blitting
|
||||
C4TargetFacet bkFct;
|
||||
// mark background to be redrawn
|
||||
|
@ -684,13 +684,13 @@ BOOL C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
|
|||
|
||||
void C4GraphicsSystem::DeactivateDebugOutput()
|
||||
{
|
||||
ShowVertices=FALSE;
|
||||
ShowAction=FALSE;
|
||||
ShowCommand=FALSE;
|
||||
ShowEntrance=FALSE;
|
||||
ShowPathfinder=FALSE; // allow pathfinder! - why this??
|
||||
ShowSolidMask=FALSE;
|
||||
ShowNetstatus=FALSE;
|
||||
ShowVertices=false;
|
||||
ShowAction=false;
|
||||
ShowCommand=false;
|
||||
ShowEntrance=false;
|
||||
ShowPathfinder=false; // allow pathfinder! - why this??
|
||||
ShowSolidMask=false;
|
||||
ShowNetstatus=false;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::DrawHoldMessages()
|
||||
|
@ -836,7 +836,7 @@ void C4GraphicsSystem::SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_
|
|||
dwGamma[iRampIndex+1]=dwClr2;
|
||||
dwGamma[iRampIndex+2]=dwClr3;
|
||||
// mark gamma ramp to be recalculated
|
||||
fSetGamma=TRUE;
|
||||
fSetGamma=true;
|
||||
}
|
||||
|
||||
void C4GraphicsSystem::ApplyGamma()
|
||||
|
@ -883,13 +883,13 @@ bool C4GraphicsSystem::ToggleShowAction()
|
|||
{
|
||||
if (!Game.DebugMode && !Console.Active) { FlashMessage(LoadResStr("IDS_MSG_NODEBUGMODE")); return false; }
|
||||
if (!(ShowAction || ShowCommand || ShowPathfinder))
|
||||
{ ShowAction = TRUE; FlashMessage("Actions"); }
|
||||
{ ShowAction = true; FlashMessage("Actions"); }
|
||||
else if (ShowAction)
|
||||
{ ShowAction = FALSE; ShowCommand = TRUE; FlashMessage("Commands"); }
|
||||
{ ShowAction = false; ShowCommand = true; FlashMessage("Commands"); }
|
||||
else if (ShowCommand)
|
||||
{ ShowCommand = FALSE; ShowPathfinder = TRUE; FlashMessage("Pathfinder"); }
|
||||
{ ShowCommand = false; ShowPathfinder = true; FlashMessage("Pathfinder"); }
|
||||
else if (ShowPathfinder)
|
||||
{ ShowPathfinder = FALSE; FlashMessageOnOff("Actions/Commands/Pathfinder", false); }
|
||||
{ ShowPathfinder = false; FlashMessageOnOff("Actions/Commands/Pathfinder", false); }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,18 +43,18 @@ class C4GraphicsSystem
|
|||
C4MessageBoard MessageBoard;
|
||||
C4UpperBoard UpperBoard;
|
||||
int32_t iRedrawBackground;
|
||||
BOOL ShowHelp;
|
||||
BOOL ShowVertices;
|
||||
BOOL ShowAction;
|
||||
BOOL ShowCommand;
|
||||
BOOL ShowEntrance;
|
||||
BOOL ShowPathfinder;
|
||||
BOOL ShowNetstatus;
|
||||
BOOL ShowSolidMask;
|
||||
bool ShowHelp;
|
||||
bool ShowVertices;
|
||||
bool ShowAction;
|
||||
bool ShowCommand;
|
||||
bool ShowEntrance;
|
||||
bool ShowPathfinder;
|
||||
bool ShowNetstatus;
|
||||
bool ShowSolidMask;
|
||||
BYTE DarkColorTable[256];
|
||||
BOOL fSetPalette;
|
||||
bool fSetPalette;
|
||||
uint32_t dwGamma[C4MaxGammaRamps*3]; // gamma ramps
|
||||
BOOL fSetGamma; // must gamma ramp be reassigned?
|
||||
bool fSetGamma; // must gamma ramp be reassigned?
|
||||
C4Video Video;
|
||||
C4LoaderScreen *pLoaderScreen;
|
||||
void Default();
|
||||
|
@ -72,14 +72,14 @@ class C4GraphicsSystem
|
|||
void ClearPointers(C4Object *pObj);
|
||||
//void UpdateMouse(HWND hwnd, int32_t iX, int32_t iY, int32_t iB);
|
||||
void RecalculateViewports();
|
||||
BOOL Init();
|
||||
BOOL InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst);
|
||||
bool Init();
|
||||
bool InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst);
|
||||
void EnableLoaderDrawing(); // reset black screen loader flag
|
||||
bool SaveScreenshot(bool fSaveAll);
|
||||
BOOL DoSaveScreenshot(bool fSaveAll, const char *szFilename);
|
||||
BOOL SetPalette();
|
||||
BOOL CreateViewport(int32_t iPlayer, bool fSilent);
|
||||
BOOL CloseViewport(int32_t iPlayer, bool fSilent);
|
||||
bool DoSaveScreenshot(bool fSaveAll, const char *szFilename);
|
||||
bool SetPalette();
|
||||
bool CreateViewport(int32_t iPlayer, bool fSilent);
|
||||
bool CloseViewport(int32_t iPlayer, bool fSilent);
|
||||
int32_t GetAudibility(int32_t iX, int32_t iY, int32_t *iPan, int32_t iAudibilityRadius=0);
|
||||
int32_t GetViewportCount();
|
||||
C4Viewport* GetViewport(int32_t iPlayer);
|
||||
|
@ -88,14 +88,14 @@ class C4GraphicsSystem
|
|||
inline void OverwriteBg() { InvalidateBg(); }
|
||||
void SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_t iRampIndex); // set gamma ramp
|
||||
void ApplyGamma(); // apply gamma ramp to ddraw
|
||||
BOOL CloseViewport(C4Viewport * cvp);
|
||||
bool CloseViewport(C4Viewport * cvp);
|
||||
#ifdef _WIN32
|
||||
C4Viewport* GetViewport(HWND hwnd);
|
||||
BOOL RegisterViewportClass(HINSTANCE hInst);
|
||||
#endif
|
||||
protected:
|
||||
C4Viewport *FirstViewport;
|
||||
BOOL fViewportClassRegistered;
|
||||
bool fViewportClassRegistered;
|
||||
C4Facet ViewportArea;
|
||||
C4RectList BackgroundAreas; // rectangles covering background without viewports in fullscreen
|
||||
char FlashMessageText[C4MaxTitle+1];
|
||||
|
|
|
@ -101,7 +101,7 @@ C4ComponentHost::~C4ComponentHost()
|
|||
void C4ComponentHost::Default()
|
||||
{
|
||||
Data.Clear();
|
||||
Modified=FALSE;
|
||||
Modified=false;
|
||||
Name[0]=0;
|
||||
Filename[0]=0;
|
||||
FilePath[0]=0;
|
||||
|
@ -118,7 +118,7 @@ void C4ComponentHost::Clear()
|
|||
#endif
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::Load(const char *szName,
|
||||
bool C4ComponentHost::Load(const char *szName,
|
||||
C4Group &hGroup,
|
||||
const char *szFilename,
|
||||
const char *szLanguage)
|
||||
|
@ -151,7 +151,7 @@ BOOL C4ComponentHost::Load(const char *szName,
|
|||
hGroup.FindEntry(strEntryWithLanguage, Filename);
|
||||
CopyFilePathFromGroup(hGroup);
|
||||
// Got it
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Couldn't insert language code anyway - no point in trying other languages
|
||||
if (!SSearch(strEntry, "%s")) break;
|
||||
|
@ -161,10 +161,10 @@ BOOL C4ComponentHost::Load(const char *szName,
|
|||
SReplaceChar(Filename, '|', 0);
|
||||
CopyFilePathFromGroup(hGroup);
|
||||
// Not loaded
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::Load(const char *szName,
|
||||
bool C4ComponentHost::Load(const char *szName,
|
||||
C4GroupSet &hGroupSet,
|
||||
const char *szFilename,
|
||||
const char *szLanguage)
|
||||
|
@ -192,7 +192,7 @@ BOOL C4ComponentHost::Load(const char *szName,
|
|||
pGroup->FindEntry(strEntryWithLanguage, Filename);
|
||||
CopyFilePathFromGroup(*pGroup);
|
||||
// Got it
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Couldn't insert language code anyway - no point in trying other languages
|
||||
if (!SSearch(strEntry, "%s")) break;
|
||||
|
@ -203,10 +203,10 @@ BOOL C4ComponentHost::Load(const char *szName,
|
|||
// skip full path (unknown)
|
||||
FilePath[0] = 0;
|
||||
// Not loaded
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::LoadEx(const char *szName,
|
||||
bool C4ComponentHost::LoadEx(const char *szName,
|
||||
C4Group &hGroup,
|
||||
const char *szFilename,
|
||||
const char *szLanguage)
|
||||
|
@ -220,7 +220,7 @@ BOOL C4ComponentHost::LoadEx(const char *szName,
|
|||
return Load(szName, hGroups, szFilename, szLanguage);
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::LoadAppend(const char *szName,
|
||||
bool C4ComponentHost::LoadAppend(const char *szName,
|
||||
C4Group &hGroup, const char *szFilename,
|
||||
const char *szLanguage)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ BOOL C4ComponentHost::LoadAppend(const char *szName,
|
|||
}
|
||||
|
||||
// No matching files found?
|
||||
if(!iFileCnt) return FALSE;
|
||||
if(!iFileCnt) return false;
|
||||
|
||||
// Allocate memory
|
||||
Data.SetLength(iFileSizeSum);
|
||||
|
@ -294,18 +294,18 @@ void C4ComponentHost::CopyFilePathFromGroup(const C4Group &hGroup)
|
|||
SAppend(Filename, FilePath, _MAX_PATH);
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::Set(const char *szData)
|
||||
bool C4ComponentHost::Set(const char *szData)
|
||||
{
|
||||
// clear existing data
|
||||
Clear();
|
||||
// copy new data
|
||||
Data.Copy(szData);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ComponentHost::Save(C4Group &hGroup)
|
||||
bool C4ComponentHost::Save(C4Group &hGroup)
|
||||
{
|
||||
if (!Modified) return TRUE;
|
||||
if (!Modified) return true;
|
||||
if (!Data) return hGroup.Delete(Filename);
|
||||
return hGroup.Add(Filename,Data);
|
||||
}
|
||||
|
@ -357,14 +357,14 @@ void C4ComponentHost::Close()
|
|||
#ifdef _WIN32
|
||||
if (!hDialog) return;
|
||||
EndDialog(hDialog,1);
|
||||
hDialog=FALSE;
|
||||
hDialog=false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*BOOL C4ComponentHost::SetLanguageString(const char *szLanguage, const char *szString)
|
||||
/*bool C4ComponentHost::SetLanguageString(const char *szLanguage, const char *szString)
|
||||
{
|
||||
// Safety
|
||||
if (!szLanguage || !szString) return FALSE;
|
||||
if (!szLanguage || !szString) return false;
|
||||
// Allocate temp buffer
|
||||
char *cpBuffer = new char [Size+SLen(szLanguage)+1+SLen(szString)+2+1];
|
||||
cpBuffer[0]=0;
|
||||
|
@ -391,12 +391,12 @@ void C4ComponentHost::Close()
|
|||
Size=SLen(Data);
|
||||
delete [] cpBuffer;
|
||||
// Success
|
||||
Modified=TRUE;
|
||||
return TRUE;
|
||||
Modified=true;
|
||||
return true;
|
||||
}*/
|
||||
|
||||
void C4ComponentHost::TrimSpaces()
|
||||
{
|
||||
Data.TrimSpaces();
|
||||
Modified=TRUE;
|
||||
Modified=true;
|
||||
}
|
||||
|
|
|
@ -36,18 +36,18 @@ class C4ComponentHost
|
|||
const char *GetData() { return Data.getData(); }
|
||||
size_t GetDataSize() { return Data.getLength(); }
|
||||
virtual void Close();
|
||||
BOOL Load(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
BOOL Load(const char *szName, C4GroupSet &hGroupSet, const char *szFilename, const char *szLanguage=NULL);
|
||||
BOOL LoadEx(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
BOOL LoadAppend(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
BOOL Set(const char *szData);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool Load(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
bool Load(const char *szName, C4GroupSet &hGroupSet, const char *szFilename, const char *szLanguage=NULL);
|
||||
bool LoadEx(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
bool LoadAppend(const char *szName, C4Group &hGroup, const char *szFilename, const char *szLanguage=NULL);
|
||||
bool Set(const char *szData);
|
||||
bool Save(C4Group &hGroup);
|
||||
bool GetLanguageString(const char *szLanguage, class StdStrBuf &rTarget);
|
||||
BOOL SetLanguageString(const char *szLanguage, const char *szString);
|
||||
bool SetLanguageString(const char *szLanguage, const char *szString);
|
||||
void TrimSpaces();
|
||||
protected:
|
||||
StdCopyStrBuf Data;
|
||||
BOOL Modified;
|
||||
bool Modified;
|
||||
char Name[_MAX_FNAME+1];
|
||||
char Filename[_MAX_FNAME+1];
|
||||
char FilePath[_MAX_PATH+1];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -73,22 +73,22 @@ void C4Group_SetPasswords(const char *szPassword);
|
|||
void C4Group_SetTempPath(const char *szPath);
|
||||
const char* C4Group_GetTempPath();
|
||||
void C4Group_SetSortList(const char **ppSortList);
|
||||
void C4Group_SetProcessCallback(BOOL (*fnCallback)(const char *, int));
|
||||
BOOL C4Group_IsGroup(const char *szFilename);
|
||||
BOOL C4Group_CopyItem(const char *szSource, const char *szTarget, bool fNoSort=false, bool fResetAttributes=false);
|
||||
BOOL C4Group_MoveItem(const char *szSource, const char *szTarget, bool fNoSort=false);
|
||||
BOOL C4Group_DeleteItem(const char *szItem, bool fRecycle=false);
|
||||
void C4Group_SetProcessCallback(bool (*fnCallback)(const char *, int));
|
||||
bool C4Group_IsGroup(const char *szFilename);
|
||||
bool C4Group_CopyItem(const char *szSource, const char *szTarget, bool fNoSort=false, bool fResetAttributes=false);
|
||||
bool C4Group_MoveItem(const char *szSource, const char *szTarget, bool fNoSort=false);
|
||||
bool C4Group_DeleteItem(const char *szItem, bool fRecycle=false);
|
||||
bool C4Group_PackDirectoryTo(const char *szFilename, const char *szFilenameTo);
|
||||
bool C4Group_PackDirectory(const char *szFilename);
|
||||
BOOL C4Group_UnpackDirectory(const char *szFilename);
|
||||
bool C4Group_UnpackDirectory(const char *szFilename);
|
||||
bool C4Group_ExplodeDirectory(const char *szFilename);
|
||||
int C4Group_GetCreation(const char *szFilename);
|
||||
BOOL C4Group_SetOriginal(const char *szFilename, BOOL fOriginal);
|
||||
bool C4Group_SetOriginal(const char *szFilename, bool fOriginal);
|
||||
bool C4Group_ReadFile(const char *szFilename, char **pData, size_t *iSize);
|
||||
bool C4Group_GetFileCRC(const char *szFilename, uint32_t *pCRC32);
|
||||
bool C4Group_GetFileSHA1(const char *szFilename, BYTE *pSHA1);
|
||||
|
||||
BOOL EraseItemSafe(const char *szFilename);
|
||||
bool EraseItemSafe(const char *szFilename);
|
||||
|
||||
extern const char *C4CFN_FLS[];
|
||||
|
||||
|
@ -122,7 +122,7 @@ class C4GroupEntryCore
|
|||
C4GroupEntryCore();
|
||||
public:
|
||||
char FileName[260];
|
||||
BOOL Packed,ChildGroup;
|
||||
bool Packed,ChildGroup;
|
||||
int32_t Size, __Unused, Offset;
|
||||
uint32_t Time;
|
||||
char HasCRC; unsigned int CRC;
|
||||
|
@ -145,10 +145,10 @@ class C4GroupEntry: public C4GroupEntryCore
|
|||
public:
|
||||
char DiskPath[_MAX_PATH + 1];
|
||||
int Status;
|
||||
BOOL DeleteOnDisk;
|
||||
BOOL HoldBuffer;
|
||||
bool DeleteOnDisk;
|
||||
bool HoldBuffer;
|
||||
bool BufferIsStdbuf;
|
||||
BOOL NoSort;
|
||||
bool NoSort;
|
||||
BYTE *bpMemBuf;
|
||||
C4GroupEntry *Next;
|
||||
public:
|
||||
|
@ -170,7 +170,7 @@ class C4Group: public CStdStream
|
|||
char FileName[_MAX_PATH+1];
|
||||
// Parent status
|
||||
C4Group *Mother;
|
||||
BOOL ExclusiveChild;
|
||||
bool ExclusiveChild;
|
||||
// File & Folder
|
||||
C4GroupEntry *SearchPtr;
|
||||
CStdFile StdFile;
|
||||
|
@ -179,7 +179,7 @@ class C4Group: public CStdStream
|
|||
int FilePtr;
|
||||
int MotherOffset;
|
||||
int EntryOffset;
|
||||
BOOL Modified;
|
||||
bool Modified;
|
||||
C4GroupHeader Head;
|
||||
C4GroupEntry *FirstEntry;
|
||||
// Folder only
|
||||
|
@ -189,19 +189,19 @@ class C4Group: public CStdStream
|
|||
C4GroupEntry FolderSearchEntry;
|
||||
C4GroupEntry LastFolderSearchEntry;
|
||||
|
||||
BOOL StdOutput;
|
||||
BOOL (*fnProcessCallback)(const char *, int);
|
||||
bool StdOutput;
|
||||
bool (*fnProcessCallback)(const char *, int);
|
||||
char ErrorString[C4GroupMaxError+1];
|
||||
BOOL MadeOriginal;
|
||||
bool MadeOriginal;
|
||||
|
||||
BOOL NoSort; // If this flag is set, all entries will be marked NoSort in AddEntry
|
||||
bool NoSort; // If this flag is set, all entries will be marked NoSort in AddEntry
|
||||
|
||||
public:
|
||||
|
||||
bool Open(const char *szGroupName, BOOL fCreate=FALSE);
|
||||
bool Open(const char *szGroupName, bool fCreate=false);
|
||||
bool Close();
|
||||
bool Save(BOOL fReOpen);
|
||||
bool OpenAsChild(C4Group *pMother, const char *szEntryName, BOOL fExclusive=FALSE, BOOL fCreate=FALSE);
|
||||
bool Save(bool fReOpen);
|
||||
bool OpenAsChild(C4Group *pMother, const char *szEntryName, bool fExclusive=false, bool fCreate=false);
|
||||
bool OpenChild(const char* strEntry);
|
||||
bool OpenMother();
|
||||
bool Add(const char *szFiles);
|
||||
|
@ -245,9 +245,9 @@ class C4Group: public CStdStream
|
|||
bool Advance(int iOffset);
|
||||
void SetMaker(const char *szMaker);
|
||||
void SetPassword(const char *szPassword);
|
||||
void SetStdOutput(BOOL fStatus);
|
||||
void SetProcessCallback(BOOL (*fnCallback)(const char *, int));
|
||||
void MakeOriginal(BOOL fOriginal);
|
||||
void SetStdOutput(bool fStatus);
|
||||
void SetProcessCallback(bool (*fnCallback)(const char *, int));
|
||||
void MakeOriginal(bool fOriginal);
|
||||
void ResetSearch();
|
||||
const char *GetError();
|
||||
const char *GetMaker();
|
||||
|
@ -266,7 +266,7 @@ class C4Group: public CStdStream
|
|||
C4Group *GetMother();
|
||||
inline bool IsPacked() { return Status == GRPF_File; }
|
||||
inline bool HasPackedMother() { if (!Mother) return false; return Mother->IsPacked(); }
|
||||
inline bool SetNoSort(BOOL fNoSort) { NoSort = fNoSort; return true; }
|
||||
inline bool SetNoSort(bool fNoSort) { NoSort = fNoSort; return true; }
|
||||
#ifdef _DEBUG
|
||||
void PrintInternals(const char *szIndent=NULL);
|
||||
#endif
|
||||
|
@ -297,7 +297,7 @@ class C4Group: public CStdStream
|
|||
bool fHoldBuffer = false,
|
||||
bool fExecutable = false,
|
||||
bool fBufferIsStdbuf = false);
|
||||
bool AddEntryOnDisk(const char *szFilename, const char *szAddAs=NULL, bool fMove=FALSE);
|
||||
bool AddEntryOnDisk(const char *szFilename, const char *szAddAs=NULL, bool fMove=false);
|
||||
bool SetFilePtr2Entry(const char *szName, C4Group *pByChild=NULL, bool NeedsToBeAGroup = false);
|
||||
bool AppendEntry2StdFile(C4GroupEntry *centry, CStdFile &stdfile);
|
||||
C4GroupEntry *GetEntry(const char *szName);
|
||||
|
|
|
@ -334,14 +334,14 @@ C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
|
|||
if (!pGroup->OpenAsChild(pParentGroup, szParentfolder+iPos))
|
||||
{
|
||||
LogFatal(FormatString("%s: %s", LoadResStr("IDS_PRC_FILENOTFOUND"), szParentfolder+iPos).getData());
|
||||
delete pGroup; return FALSE;
|
||||
delete pGroup; return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!pGroup->Open(szParentfolder+iPos))
|
||||
{
|
||||
LogFatal(FormatString("%s: %s", LoadResStr("IDS_PRC_FILENOTFOUND"), szParentfolder+iPos).getData());
|
||||
delete pGroup; return FALSE;
|
||||
delete pGroup; return false;
|
||||
}
|
||||
// set this group as new parent
|
||||
pParentGroup=pGroup;
|
||||
|
@ -352,7 +352,7 @@ C4Group *C4GroupSet::RegisterParentFolders(const char *szScenFilename)
|
|||
else
|
||||
iContentsMask = C4GSCnt_Directory;
|
||||
if (!RegisterGroup(*pParentGroup, true, C4GSPrio_Folder+iGroupIndex++, iContentsMask))
|
||||
{ delete pParentGroup; LogFatal ("RegGrp: internal error"); return FALSE; }
|
||||
{ delete pParentGroup; LogFatal ("RegGrp: internal error"); return false; }
|
||||
// advance by file name length
|
||||
iPos+=SLen(szParentfolder+iPos);
|
||||
}
|
||||
|
|
|
@ -29,17 +29,17 @@ C4Config *GetCfg();
|
|||
#endif
|
||||
|
||||
// helper
|
||||
BOOL C4Group_CopyEntry(C4Group *pFrom, C4Group *pTo, const char *strItemName)
|
||||
bool C4Group_CopyEntry(C4Group *pFrom, C4Group *pTo, const char *strItemName)
|
||||
{
|
||||
// read entry
|
||||
char *pData; size_t iSize;
|
||||
if(!pFrom->LoadEntry(strItemName, &pData, &iSize))
|
||||
return FALSE;
|
||||
return false;
|
||||
// write entry (keep time)
|
||||
int iEntryTime = pFrom->EntryTime(strItemName);
|
||||
if(!pTo->Add(strItemName, pData, iSize, FALSE, TRUE, iEntryTime))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
if(!pTo->Add(strItemName, pData, iSize, false, true, iEntryTime))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Group_ApplyUpdate(C4Group &hGroup)
|
||||
|
@ -209,9 +209,9 @@ public:
|
|||
}
|
||||
|
||||
// close without header update
|
||||
BOOL Close(BOOL fHeaderUpdate)
|
||||
bool Close(bool fHeaderUpdate)
|
||||
{
|
||||
if(fHeaderUpdate) return C4Group::Close(); else { BOOL fSuccess = Save(FALSE); Clear(); return fSuccess; }
|
||||
if(fHeaderUpdate) return C4Group::Close(); else { bool fSuccess = Save(false); Clear(); return fSuccess; }
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -235,12 +235,12 @@ void C4UpdatePackageCore::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(GrpChks2, "GrpChks2", 0u));
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackageCore::Load(C4Group &hGroup)
|
||||
bool C4UpdatePackageCore::Load(C4Group &hGroup)
|
||||
{
|
||||
// Load from group
|
||||
StdStrBuf Source;
|
||||
if (!hGroup.LoadEntryString(C4CFN_UpdateCore,Source))
|
||||
return FALSE;
|
||||
return false;
|
||||
try
|
||||
{
|
||||
// Compile data
|
||||
|
@ -249,12 +249,12 @@ BOOL C4UpdatePackageCore::Load(C4Group &hGroup)
|
|||
catch(StdCompiler::Exception *pExc)
|
||||
{
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackageCore::Save(C4Group &hGroup)
|
||||
bool C4UpdatePackageCore::Save(C4Group &hGroup)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -263,23 +263,23 @@ BOOL C4UpdatePackageCore::Save(C4Group &hGroup)
|
|||
char *stupid_buffer = new char[Core.getLength() + 1];
|
||||
memcpy(stupid_buffer, Core.getMData(), Core.getLength() + 1);
|
||||
// add to group
|
||||
return hGroup.Add(C4CFN_UpdateCore, stupid_buffer, Core.getLength(), FALSE, TRUE);
|
||||
return hGroup.Add(C4CFN_UpdateCore, stupid_buffer, Core.getLength(), false, true);
|
||||
}
|
||||
catch(StdCompiler::Exception * pExc)
|
||||
{
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// *** C4UpdatePackage
|
||||
|
||||
BOOL C4UpdatePackage::Load(C4Group *pGroup)
|
||||
bool C4UpdatePackage::Load(C4Group *pGroup)
|
||||
{
|
||||
// read update core
|
||||
StdStrBuf Source;
|
||||
if (!pGroup->LoadEntryString(C4CFN_UpdateCore,Source))
|
||||
return FALSE;
|
||||
return false;
|
||||
try
|
||||
{
|
||||
// Compile data
|
||||
|
@ -290,14 +290,14 @@ BOOL C4UpdatePackage::Load(C4Group *pGroup)
|
|||
StdStrBuf Name = pGroup->GetFullName() + DirSep + C4CFN_UpdateCore;
|
||||
WriteLog("ERROR: %s (in %s)", pExc->Msg.getData(), Name.getData());
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// #define UPDATE_DEBUG
|
||||
|
||||
BOOL C4UpdatePackage::Execute(C4Group *pGroup)
|
||||
bool C4UpdatePackage::Execute(C4Group *pGroup)
|
||||
{
|
||||
|
||||
// search target
|
||||
|
@ -316,9 +316,9 @@ BOOL C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
// maker check (someone might try to unpack directories w/o asking user)
|
||||
if(fPacked)
|
||||
if(!SEqual(TargetGrp.GetMaker(), pGroup->GetMaker()))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Close Group
|
||||
TargetGrp.Close(TRUE);
|
||||
TargetGrp.Close(true);
|
||||
if(fPacked)
|
||||
// Unpack
|
||||
C4Group_UnpackDirectory(strTarget);
|
||||
|
@ -326,7 +326,7 @@ BOOL C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
else
|
||||
{
|
||||
// GrpUpdate -> file must exist
|
||||
if(GrpUpdate) return FALSE;
|
||||
if(GrpUpdate) return false;
|
||||
// create dir
|
||||
CreatePath(strTarget);
|
||||
}
|
||||
|
@ -335,30 +335,30 @@ BOOL C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
|
||||
// try to open it
|
||||
if(!TargetGrp.Open(strTarget, !GrpUpdate))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// check if the update is allowed
|
||||
if(GrpUpdate)
|
||||
{
|
||||
// maker must match
|
||||
/*if(!SEqual(TargetGrp.GetMaker(), pGroup->GetMaker())) - now allowing updates from different makers
|
||||
return FALSE;*/
|
||||
return false;*/
|
||||
// check checksum
|
||||
uint32_t iCRC32;
|
||||
if(!C4Group_GetFileCRC(TargetGrp.GetFullName().getData(), &iCRC32))
|
||||
return FALSE;
|
||||
return false;
|
||||
int i = 0;
|
||||
for(; i < UpGrpCnt; i++)
|
||||
if(iCRC32 == GrpChks1[i])
|
||||
break;
|
||||
if(i >= UpGrpCnt)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// only allow Extra.c4g-Updates
|
||||
if(!SEqual2(DestPath, "Extra.c4g"))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// update children
|
||||
|
@ -373,43 +373,43 @@ BOOL C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
DoGrpUpdate(pGroup, &TargetGrp);
|
||||
|
||||
// close the group
|
||||
TargetGrp.Close(FALSE);
|
||||
TargetGrp.Close(false);
|
||||
|
||||
if(GrpUpdate)
|
||||
{
|
||||
// check the result
|
||||
uint32_t iResChks;
|
||||
if(!C4Group_GetFileCRC(strTarget, &iResChks))
|
||||
return FALSE;
|
||||
return false;
|
||||
if(iResChks != GrpChks2)
|
||||
{
|
||||
#ifdef UPDATE_DEBUG
|
||||
char *pData; int iSize;
|
||||
CStdFile MyFile; MyFile.Load(strTarget, (BYTE **)&pData, &iSize, 0, TRUE);
|
||||
MyFile.Create("DiesesDingIstMist.txt", FALSE);
|
||||
CStdFile MyFile; MyFile.Load(strTarget, (BYTE **)&pData, &iSize, 0, true);
|
||||
MyFile.Create("DiesesDingIstMist.txt", false);
|
||||
MyFile.Write(pData, iSize);
|
||||
MyFile.Close();
|
||||
#endif
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackage::Optimize(C4Group *pGroup, const char *strTarget)
|
||||
bool C4UpdatePackage::Optimize(C4Group *pGroup, const char *strTarget)
|
||||
{
|
||||
|
||||
// Open target group
|
||||
C4GroupEx TargetGrp;
|
||||
if(!TargetGrp.Open(strTarget))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Both groups must be packed
|
||||
if(!pGroup->IsPacked() || !TargetGrp.IsPacked())
|
||||
{
|
||||
TargetGrp.Close(FALSE);
|
||||
return FALSE;
|
||||
TargetGrp.Close(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// update children
|
||||
|
@ -424,10 +424,10 @@ BOOL C4UpdatePackage::Optimize(C4Group *pGroup, const char *strTarget)
|
|||
TargetGrp.SetHead(*pGroup);
|
||||
|
||||
// save
|
||||
TargetGrp.Close(FALSE);
|
||||
TargetGrp.Close(false);
|
||||
|
||||
// okay
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int C4UpdatePackage::Check(C4Group *pGroup)
|
||||
|
@ -471,7 +471,7 @@ int C4UpdatePackage::Check(C4Group *pGroup)
|
|||
return C4UPD_CHK_OK;
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char *strFileName)
|
||||
bool C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char *strFileName)
|
||||
{
|
||||
// group file?
|
||||
C4Group ItemGroupFrom;
|
||||
|
@ -480,8 +480,8 @@ BOOL C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char
|
|||
// try to open target group
|
||||
C4GroupEx ItemGroupTo;
|
||||
char strTempGroup[_MAX_PATH+1]; strTempGroup[0] = 0;
|
||||
if(!ItemGroupTo.OpenAsChild(pGrpTo, strFileName, FALSE, TRUE))
|
||||
return FALSE;
|
||||
if(!ItemGroupTo.OpenAsChild(pGrpTo, strFileName, false, true))
|
||||
return false;
|
||||
// update children
|
||||
char ItemFileName[_MAX_PATH];
|
||||
ItemGroupFrom.ResetSearch();
|
||||
|
@ -494,7 +494,7 @@ BOOL C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char
|
|||
{
|
||||
DoGrpUpdate(&ItemGroupFrom, &ItemGroupTo);
|
||||
// write group (do not change any headers set by DoGrpUpdate!)
|
||||
ItemGroupTo.Close(FALSE);
|
||||
ItemGroupTo.Close(false);
|
||||
// set core (C4Group::Save overwrites it)
|
||||
pGrpTo->SaveEntryCore(*pGrpFrom, strFileName);
|
||||
pGrpTo->SetSavedEntryCore(strFileName);
|
||||
|
@ -504,11 +504,11 @@ BOOL C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char
|
|||
else
|
||||
{
|
||||
// write group
|
||||
ItemGroupTo.Close(TRUE);
|
||||
ItemGroupTo.Close(true);
|
||||
// temporary group?
|
||||
if(strTempGroup[0])
|
||||
if(!pGrpTo->Move(strTempGroup, strFileName))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -521,16 +521,16 @@ BOOL C4UpdatePackage::DoUpdate(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char
|
|||
puts(strMsg);
|
||||
#endif
|
||||
if(!C4Group_CopyEntry(pGrpFrom, pGrpTo, strFileName))
|
||||
return FALSE;
|
||||
return false;
|
||||
// set core
|
||||
pGrpTo->SaveEntryCore(*pGrpFrom, strFileName);
|
||||
pGrpTo->SetSavedEntryCore(strFileName);
|
||||
}
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackage::DoGrpUpdate(C4Group *pUpdateData, C4GroupEx *pGrpTo)
|
||||
bool C4UpdatePackage::DoGrpUpdate(C4Group *pUpdateData, C4GroupEx *pGrpTo)
|
||||
{
|
||||
char *pData;
|
||||
// sort entries
|
||||
|
@ -541,7 +541,7 @@ BOOL C4UpdatePackage::DoGrpUpdate(C4Group *pUpdateData, C4GroupEx *pGrpTo)
|
|||
pGrpTo->ResetSearch();
|
||||
while(pGrpTo->FindNextEntry("*", strItemName))
|
||||
{
|
||||
BOOL fGotIt = FALSE;
|
||||
bool fGotIt = false;
|
||||
for(int i = 0; fGotIt = SCopySegment(pData, i, strItemName2, '|', _MAX_FNAME); i++)
|
||||
{
|
||||
// remove seperator
|
||||
|
@ -577,20 +577,20 @@ BOOL C4UpdatePackage::DoGrpUpdate(C4Group *pUpdateData, C4GroupEx *pGrpTo)
|
|||
// copy header from update group
|
||||
pGrpTo->SetHead(*pUpdateData);
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4UpdatePackage::Optimize(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char *strFileName)
|
||||
bool C4UpdatePackage::Optimize(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char *strFileName)
|
||||
{
|
||||
// group file?
|
||||
C4Group ItemGroupFrom;
|
||||
if(!ItemGroupFrom.OpenAsChild(pGrpFrom, strFileName))
|
||||
return TRUE;
|
||||
return true;
|
||||
// try to open target group
|
||||
C4GroupEx ItemGroupTo;
|
||||
char strTempGroup[_MAX_PATH+1]; strTempGroup[0] = 0;
|
||||
if(!ItemGroupTo.OpenAsChild(pGrpTo, strFileName))
|
||||
return TRUE;
|
||||
return true;
|
||||
// update children
|
||||
char ItemFileName[_MAX_PATH];
|
||||
ItemGroupFrom.ResetSearch();
|
||||
|
@ -600,54 +600,54 @@ BOOL C4UpdatePackage::Optimize(C4Group *pGrpFrom, C4GroupEx *pGrpTo, const char
|
|||
if(ItemGroupTo.HeadIdentical(ItemGroupFrom, true))
|
||||
ItemGroupTo.SetHead(ItemGroupFrom);
|
||||
// write group (do not change any headers set by DoGrpUpdate!)
|
||||
ItemGroupTo.Close(FALSE);
|
||||
ItemGroupTo.Close(false);
|
||||
// set core (C4Group::Save overwrites it)
|
||||
pGrpTo->SaveEntryCore(*pGrpFrom, strFileName);
|
||||
pGrpTo->SetSavedEntryCore(strFileName);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemScramble(BYTE *, int);
|
||||
|
||||
BOOL C4UpdatePackage::MakeUpdate(const char *strFile1, const char *strFile2, const char *strUpdateFile, const char *strName)
|
||||
bool C4UpdatePackage::MakeUpdate(const char *strFile1, const char *strFile2, const char *strUpdateFile, const char *strName)
|
||||
{
|
||||
#ifdef UPDATE_DEBUG
|
||||
char *pData; int iSize;
|
||||
CStdFile MyFile; MyFile.Load(strFile2, (BYTE **)&pData, &iSize, 0, TRUE);
|
||||
MyFile.Create("SoIstRichtig.txt", FALSE);
|
||||
CStdFile MyFile; MyFile.Load(strFile2, (BYTE **)&pData, &iSize, 0, true);
|
||||
MyFile.Create("SoIstRichtig.txt", false);
|
||||
MyFile.Write(pData, iSize);
|
||||
MyFile.Close();
|
||||
MemScramble((BYTE *)pData, iSize);
|
||||
MyFile.Create("UndSoAuch.txt", FALSE);
|
||||
MyFile.Create("UndSoAuch.txt", false);
|
||||
MyFile.Write(pData, iSize);
|
||||
MyFile.Close();
|
||||
#endif
|
||||
|
||||
// open Log
|
||||
if(!Log.Create("Update.log"))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// begin message
|
||||
WriteLog("Source: %s\nTarget: %s\nOutput: %s\n\n", strFile1, strFile2, strUpdateFile);
|
||||
|
||||
// open both groups
|
||||
C4Group Group1, Group2;
|
||||
if(!Group1.Open(strFile1)) { WriteLog("Error: could not open %s!\n", strFile1); return FALSE; }
|
||||
if(!Group2.Open(strFile2)) { WriteLog("Error: could not open %s!\n", strFile2); return FALSE; }
|
||||
if(!Group1.Open(strFile1)) { WriteLog("Error: could not open %s!\n", strFile1); return false; }
|
||||
if(!Group2.Open(strFile2)) { WriteLog("Error: could not open %s!\n", strFile2); return false; }
|
||||
|
||||
// All groups to be compared need to be packed
|
||||
if (!Group1.IsPacked()) { WriteLog("Error: source group %s not packed!\n", strFile1); return FALSE; }
|
||||
if (!Group2.IsPacked()) { WriteLog("Error: target group %s not packed!\n", strFile2); return FALSE; }
|
||||
if (Group1.HasPackedMother()) { WriteLog("Error: source group %s must not have a packed mother group!\n", strFile1); return FALSE; }
|
||||
if (Group2.HasPackedMother()) { WriteLog("Error: target group %s must not have a packed mother group!\n", strFile2); return FALSE; }
|
||||
if (!Group1.IsPacked()) { WriteLog("Error: source group %s not packed!\n", strFile1); return false; }
|
||||
if (!Group2.IsPacked()) { WriteLog("Error: target group %s not packed!\n", strFile2); return false; }
|
||||
if (Group1.HasPackedMother()) { WriteLog("Error: source group %s must not have a packed mother group!\n", strFile1); return false; }
|
||||
if (Group2.HasPackedMother()) { WriteLog("Error: target group %s must not have a packed mother group!\n", strFile2); return false; }
|
||||
|
||||
// create/open update-group
|
||||
C4GroupEx UpGroup;
|
||||
if(!UpGroup.Open(strUpdateFile, TRUE)) { WriteLog("Error: could not open %s!\n", strUpdateFile); return FALSE; }
|
||||
if(!UpGroup.Open(strUpdateFile, true)) { WriteLog("Error: could not open %s!\n", strUpdateFile); return false; }
|
||||
|
||||
// may be continued update-file -> try to load core
|
||||
UpGrpCnt = 0;
|
||||
BOOL fContinued = C4UpdatePackageCore::Load(UpGroup);
|
||||
bool fContinued = C4UpdatePackageCore::Load(UpGroup);
|
||||
|
||||
// save crc2 for later check
|
||||
unsigned int iOldChks2 = GrpChks2;
|
||||
|
@ -658,52 +658,52 @@ BOOL C4UpdatePackage::MakeUpdate(const char *strFile1, const char *strFile2, con
|
|||
else
|
||||
sprintf(Name, "%s Update", GetFilename(strFile1));
|
||||
SCopy(strFile1, DestPath, _MAX_PATH);
|
||||
GrpUpdate = TRUE;
|
||||
GrpUpdate = true;
|
||||
if(!C4Group_GetFileCRC(strFile1, &GrpChks1[UpGrpCnt]))
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile1); return FALSE; }
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile1); return false; }
|
||||
if(!C4Group_GetFileCRC(strFile2, &GrpChks2))
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile2); return FALSE; }
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile2); return false; }
|
||||
if(fContinued)
|
||||
{
|
||||
// continuation check: GrpChks2 matches?
|
||||
if(GrpChks2 != iOldChks2)
|
||||
// that would mess up the update result...
|
||||
{ WriteLog("Error: could not add to update package - target groups don't match (checksum error)\n"); return FALSE; }
|
||||
{ WriteLog("Error: could not add to update package - target groups don't match (checksum error)\n"); return false; }
|
||||
// already supported by this update?
|
||||
int i = 0;
|
||||
for(; i < UpGrpCnt; i++)
|
||||
if(GrpChks1[UpGrpCnt] == GrpChks1[i])
|
||||
break;
|
||||
if(i < UpGrpCnt)
|
||||
{ WriteLog("This update already supports the version of the source file.\n"); return FALSE; }
|
||||
{ WriteLog("This update already supports the version of the source file.\n"); return false; }
|
||||
}
|
||||
|
||||
UpGrpCnt++;
|
||||
|
||||
// save core
|
||||
if(!C4UpdatePackageCore::Save(UpGroup))
|
||||
{ WriteLog("Could not save update package core!\n"); return FALSE; }
|
||||
{ WriteLog("Could not save update package core!\n"); return false; }
|
||||
|
||||
// compare groups, create update
|
||||
BOOL fModified = FALSE;
|
||||
BOOL fSuccess = MkUp(&Group1, &Group2, &UpGroup, &fModified);
|
||||
bool fModified = false;
|
||||
bool fSuccess = MkUp(&Group1, &Group2, &UpGroup, &fModified);
|
||||
// close (save) it
|
||||
UpGroup.Close(FALSE);
|
||||
UpGroup.Close(false);
|
||||
// error?
|
||||
if(!fSuccess)
|
||||
{
|
||||
WriteLog("Update package not created.\n");
|
||||
remove(strUpdateFile);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
WriteLog("Update package created.\n");
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
extern char C4Group_TempPath[_MAX_PATH+1];
|
||||
|
||||
BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BOOL *fModified)
|
||||
bool C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, bool *fModified)
|
||||
{
|
||||
// (CAUTION: pGrp1 may be NULL - that means that there is no counterpart for Grp2
|
||||
// in the base group)
|
||||
|
@ -714,7 +714,7 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
pGrp1->GetOriginal() != pGrp2->GetOriginal() ||
|
||||
!SEqual(pGrp1->GetMaker(), pGrp2->GetMaker()) ||
|
||||
!SEqual(pGrp1->GetPassword(), pGrp2->GetPassword()))
|
||||
*fModified = TRUE;
|
||||
*fModified = true;
|
||||
// set header
|
||||
pUpGrp->SetHead(*pGrp2);
|
||||
// compare entries
|
||||
|
@ -731,10 +731,10 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
if(!*fModified)
|
||||
{
|
||||
if(!pGrp1->FindNextEntry("*", strItemName2, NULL, NULL, !! strItemName2[0]))
|
||||
*fModified = TRUE;
|
||||
*fModified = true;
|
||||
else
|
||||
if(!SEqual(strItemName, strItemName2))
|
||||
*fModified = TRUE;
|
||||
*fModified = true;
|
||||
}
|
||||
|
||||
// TODO: write DeleteEntries.txt
|
||||
|
@ -756,18 +756,18 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
if (C4Group_TempPath[0]) { SCopy(C4Group_TempPath,strTempGroupName,_MAX_FNAME); SAppend("~upd",strTempGroupName,_MAX_FNAME); }
|
||||
else SCopy("~upd",strTempGroupName,_MAX_FNAME);
|
||||
MakeTempFilename(strTempGroupName);
|
||||
if(!UpdGroup.Open(strTempGroupName, TRUE)) { delete pChildGrp1; WriteLog("Error: could not create temp group\n"); return FALSE; }
|
||||
if(!UpdGroup.Open(strTempGroupName, true)) { delete pChildGrp1; WriteLog("Error: could not create temp group\n"); return false; }
|
||||
}
|
||||
// do nested MkUp-search
|
||||
BOOL Modified = FALSE;
|
||||
BOOL fSuccess = MkUp(pChildGrp1, &ChildGrp2, &UpdGroup, &Modified);
|
||||
bool Modified = false;
|
||||
bool fSuccess = MkUp(pChildGrp1, &ChildGrp2, &UpdGroup, &Modified);
|
||||
// sort & close
|
||||
extern const char ** C4Group_SortList;
|
||||
UpdGroup.SortByList(C4Group_SortList, ChildGrp2.GetName());
|
||||
UpdGroup.Close(FALSE);
|
||||
UpdGroup.Close(false);
|
||||
// check entry times
|
||||
if(!pGrp1 || (pGrp1->EntryTime(strItemName) != pGrp2->EntryTime(strItemName)))
|
||||
Modified = TRUE;
|
||||
Modified = true;
|
||||
// add group (if modified)
|
||||
if(fSuccess && Modified)
|
||||
{
|
||||
|
@ -775,13 +775,13 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
if(!pUpGrp->Move(strTempGroupName, strItemName))
|
||||
{
|
||||
WriteLog("Error: could not add modified group\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// copy core
|
||||
pUpGrp->SaveEntryCore(*pGrp2, strItemName);
|
||||
pUpGrp->SetSavedEntryCore(strItemName);
|
||||
// got a modification in a subgroup
|
||||
*fModified = TRUE;
|
||||
*fModified = true;
|
||||
iChangedEntries++;
|
||||
}
|
||||
else
|
||||
|
@ -789,7 +789,7 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
if(strTempGroupName[0])
|
||||
if(remove(strTempGroupName))
|
||||
if(rmdir(strTempGroupName))
|
||||
{ WriteLog("Error: could not delete temporary directory\n"); return FALSE; }
|
||||
{ WriteLog("Error: could not delete temporary directory\n"); return false; }
|
||||
delete pChildGrp1;
|
||||
}
|
||||
else
|
||||
|
@ -799,7 +799,7 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
pGrp1->EntrySize(strItemName) != pGrp2->EntrySize(strItemName) ||
|
||||
pGrp1->EntryCRC32(strItemName) != pGrp2->EntryCRC32(strItemName))
|
||||
{
|
||||
BOOL fCopied = FALSE;
|
||||
bool fCopied = false;
|
||||
|
||||
// save core (EntryCRC32 might set additional fields)
|
||||
pUpGrp->SaveEntryCore(*pGrp2, strItemName);
|
||||
|
@ -813,13 +813,13 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
if(!C4Group_CopyEntry(pGrp2, pUpGrp, strItemName))
|
||||
{
|
||||
WriteLog("Error: could not add changed entry to update group\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// set entry core
|
||||
pUpGrp->SetSavedEntryCore(strItemName);
|
||||
// modified...
|
||||
*fModified = TRUE;
|
||||
fCopied = TRUE;
|
||||
*fModified = true;
|
||||
fCopied = true;
|
||||
}
|
||||
iChangedEntries++;
|
||||
|
||||
|
@ -828,17 +828,17 @@ BOOL C4UpdatePackage::MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGrp, BO
|
|||
}
|
||||
}
|
||||
// write entries list (always)
|
||||
if(!pUpGrp->Add(C4CFN_UpdateEntries, EntryList, FALSE, TRUE))
|
||||
if(!pUpGrp->Add(C4CFN_UpdateEntries, EntryList, false, true))
|
||||
{
|
||||
WriteLog("Error: could not save entry list!");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (iChangedEntries > 0)
|
||||
WriteLog("%s: %d/%d changed (%s)\n", pGrp2->GetFullName().getData(), iChangedEntries, pGrp2->EntryCount(), *fModified ? "update" : "skip");
|
||||
|
||||
// success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4UpdatePackage::WriteLog(const char *strMsg, ...)
|
||||
|
|
|
@ -39,8 +39,8 @@ class C4UpdatePackageCore
|
|||
uint32_t GrpChks1[C4UP_MaxUpGrpCnt], GrpChks2;
|
||||
public:
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
BOOL Load(C4Group &hGroup);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool Load(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup);
|
||||
};
|
||||
|
||||
#define C4UPD_CHK_OK 0
|
||||
|
@ -53,20 +53,20 @@ class C4UpdatePackage : public C4UpdatePackageCore
|
|||
{
|
||||
|
||||
public:
|
||||
BOOL Load(C4Group *pGroup);
|
||||
BOOL Execute(C4Group *pGroup);
|
||||
static BOOL Optimize(C4Group *pGrpFrom, const char *strTarget);
|
||||
bool Load(C4Group *pGroup);
|
||||
bool Execute(C4Group *pGroup);
|
||||
static bool Optimize(C4Group *pGrpFrom, const char *strTarget);
|
||||
int Check(C4Group *pGroup);
|
||||
BOOL MakeUpdate(const char *strFile1, const char *strFile2, const char *strUpdateFile, const char *strName = NULL);
|
||||
bool MakeUpdate(const char *strFile1, const char *strFile2, const char *strUpdateFile, const char *strName = NULL);
|
||||
|
||||
protected:
|
||||
BOOL DoUpdate(C4Group *pGrpFrom, class C4GroupEx *pGrpTo, const char *strFileName);
|
||||
BOOL DoGrpUpdate(C4Group *pUpdateData, class C4GroupEx *pGrpTo);
|
||||
static BOOL Optimize(C4Group *pGrpFrom, class C4GroupEx *pGrpTo, const char *strFileName);
|
||||
bool DoUpdate(C4Group *pGrpFrom, class C4GroupEx *pGrpTo, const char *strFileName);
|
||||
bool DoGrpUpdate(C4Group *pUpdateData, class C4GroupEx *pGrpTo);
|
||||
static bool Optimize(C4Group *pGrpFrom, class C4GroupEx *pGrpTo, const char *strFileName);
|
||||
|
||||
BOOL MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGr, BOOL *fModified);
|
||||
bool MkUp(C4Group *pGrp1, C4Group *pGrp2, C4GroupEx *pUpGr, bool *fModified);
|
||||
|
||||
BOOL OpenUnpackParents(C4GroupEx &rGroup, const char *strGroup, const char *strEnsureMaker);
|
||||
bool OpenUnpackParents(C4GroupEx &rGroup, const char *strGroup, const char *strEnsureMaker);
|
||||
|
||||
CStdFile Log;
|
||||
void WriteLog(const char *strMsg, ...) GNUC_FORMAT_ATTRIBUTE_O;
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
|
||||
CStdFile::CStdFile()
|
||||
{
|
||||
Status=FALSE;
|
||||
Status=false;
|
||||
hFile=NULL;
|
||||
hgzFile=NULL;
|
||||
pMemory=NULL;
|
||||
ClearBuffer();
|
||||
ModeWrite=FALSE;
|
||||
ModeWrite=false;
|
||||
Name[0]=0;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ bool CStdFile::Create(const char *szFilename, bool fCompressed, bool fExecutable
|
|||
{
|
||||
SCopy(szFilename,Name,_MAX_PATH);
|
||||
// Set modes
|
||||
ModeWrite=TRUE;
|
||||
ModeWrite=true;
|
||||
// Open in memory?
|
||||
if (fMemory)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ bool CStdFile::Create(const char *szFilename, bool fCompressed, bool fExecutable
|
|||
// Reset buffer
|
||||
ClearBuffer();
|
||||
// Set status
|
||||
Status=TRUE;
|
||||
Status=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ bool CStdFile::Open(const char *szFilename, bool fCompressed)
|
|||
{
|
||||
SCopy(szFilename,Name,_MAX_PATH);
|
||||
// Set modes
|
||||
ModeWrite=FALSE;
|
||||
ModeWrite=false;
|
||||
// Open standard file
|
||||
if (fCompressed)
|
||||
{ if (!(hgzFile=gzopen(Name,"rb"))) return false; }
|
||||
|
@ -106,7 +106,7 @@ bool CStdFile::Open(const char *szFilename, bool fCompressed)
|
|||
// Reset buffer
|
||||
ClearBuffer();
|
||||
// Set status
|
||||
Status=TRUE;
|
||||
Status=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -114,26 +114,26 @@ bool CStdFile::Append(const char *szFilename)
|
|||
{
|
||||
SCopy(szFilename,Name,_MAX_PATH);
|
||||
// Set modes
|
||||
ModeWrite=TRUE;
|
||||
ModeWrite=true;
|
||||
// Open standard file
|
||||
if (!(hFile=fopen(Name,"ab"))) return FALSE;
|
||||
if (!(hFile=fopen(Name,"ab"))) return false;
|
||||
// Reset buffer
|
||||
ClearBuffer();
|
||||
// Set status
|
||||
Status=TRUE;
|
||||
return TRUE;
|
||||
Status=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Close(StdBuf **ppMemory)
|
||||
{
|
||||
BOOL rval=TRUE;
|
||||
Status=FALSE;
|
||||
bool rval=true;
|
||||
Status=false;
|
||||
Name[0]=0;
|
||||
// Save buffer if in write mode
|
||||
if (ModeWrite && BufferLoad) if (!SaveBuffer()) rval=FALSE;
|
||||
if (ModeWrite && BufferLoad) if (!SaveBuffer()) rval=false;
|
||||
// Close file(s)
|
||||
if (hgzFile) if (gzclose(hgzFile)!=Z_OK) rval=FALSE;
|
||||
if (hFile) if (fclose(hFile)!=0) rval=FALSE;
|
||||
if (hgzFile) if (gzclose(hgzFile)!=Z_OK) rval=false;
|
||||
if (hFile) if (fclose(hFile)!=0) rval=false;
|
||||
if (pMemory)
|
||||
if(ppMemory)
|
||||
{ *ppMemory = pMemory; pMemory = NULL; }
|
||||
|
@ -146,21 +146,21 @@ bool CStdFile::Close(StdBuf **ppMemory)
|
|||
|
||||
bool CStdFile::Default()
|
||||
{
|
||||
Status=FALSE;
|
||||
Status=false;
|
||||
Name[0]=0;
|
||||
hgzFile=NULL;
|
||||
hFile=NULL;
|
||||
pMemory=NULL;
|
||||
MemoryPtr=0;
|
||||
BufferLoad=BufferPtr=0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Read(void *pBuffer, size_t iSize, size_t *ipFSize)
|
||||
{
|
||||
int transfer;
|
||||
if (!pBuffer) return FALSE;
|
||||
if (ModeWrite) return FALSE;
|
||||
if (!pBuffer) return false;
|
||||
if (ModeWrite) return false;
|
||||
BYTE *bypBuffer= (BYTE*) pBuffer;
|
||||
if (ipFSize) *ipFSize = 0;
|
||||
while (iSize>0)
|
||||
|
@ -176,9 +176,9 @@ bool CStdFile::Read(void *pBuffer, size_t iSize, size_t *ipFSize)
|
|||
if (ipFSize) *ipFSize += transfer;
|
||||
}
|
||||
// Buffer empty: Load
|
||||
else if (LoadBuffer()<=0) return FALSE;
|
||||
else if (LoadBuffer()<=0) return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int CStdFile::LoadBuffer()
|
||||
|
@ -195,9 +195,9 @@ bool CStdFile::SaveBuffer()
|
|||
if (hFile) saved=fwrite(Buffer,1,BufferLoad,hFile);
|
||||
if (hgzFile) saved=gzwrite(hgzFile,Buffer,BufferLoad);
|
||||
if (pMemory) { pMemory->Append(Buffer, BufferLoad); saved = BufferLoad; }
|
||||
if (saved!=BufferLoad) return FALSE;
|
||||
if (saved!=BufferLoad) return false;
|
||||
BufferLoad=0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CStdFile::ClearBuffer()
|
||||
|
@ -208,8 +208,8 @@ void CStdFile::ClearBuffer()
|
|||
bool CStdFile::Write(const void *pBuffer, int iSize)
|
||||
{
|
||||
int transfer;
|
||||
if (!pBuffer) return FALSE;
|
||||
if (!ModeWrite) return FALSE;
|
||||
if (!pBuffer) return false;
|
||||
if (!ModeWrite) return false;
|
||||
BYTE *bypBuffer= (BYTE*) pBuffer;
|
||||
while (iSize>0)
|
||||
{
|
||||
|
@ -223,37 +223,37 @@ bool CStdFile::Write(const void *pBuffer, int iSize)
|
|||
iSize-=transfer;
|
||||
}
|
||||
// Buffer full: Save
|
||||
else if (!SaveBuffer()) return FALSE;
|
||||
else if (!SaveBuffer()) return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::WriteString(const char *szStr)
|
||||
{
|
||||
BYTE nl[2]={0x0D,0x0A};
|
||||
if (!szStr) return FALSE;
|
||||
if (!szStr) return false;
|
||||
int size=SLen(szStr);
|
||||
if (!Write((void*)szStr,size)) return FALSE;
|
||||
if (!Write(nl,2)) return FALSE;
|
||||
return TRUE;
|
||||
if (!Write((void*)szStr,size)) return false;
|
||||
if (!Write(nl,2)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Rewind()
|
||||
{
|
||||
if (ModeWrite) return FALSE;
|
||||
if (ModeWrite) return false;
|
||||
ClearBuffer();
|
||||
if (hFile) rewind(hFile);
|
||||
if (hgzFile)
|
||||
{
|
||||
if (gzclose(hgzFile)!=Z_OK) { hgzFile=NULL; return FALSE; }
|
||||
if (!(hgzFile=gzopen(Name,"rb"))) return FALSE;
|
||||
if (gzclose(hgzFile)!=Z_OK) { hgzFile=NULL; return false; }
|
||||
if (!(hgzFile=gzopen(Name,"rb"))) return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Advance(int iOffset)
|
||||
{
|
||||
if (ModeWrite) return FALSE;
|
||||
if (ModeWrite) return false;
|
||||
while (iOffset > 0)
|
||||
{
|
||||
// Valid data in the buffer: Transfer as much as possible
|
||||
|
@ -267,20 +267,20 @@ bool CStdFile::Advance(int iOffset)
|
|||
else
|
||||
{
|
||||
if (hFile) return !fseek(hFile, iOffset, SEEK_CUR); // uncompressed: Just skip
|
||||
if (LoadBuffer()<=0) return FALSE; // compressed: Read...
|
||||
if (LoadBuffer()<=0) return false; // compressed: Read...
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Save(const char *szFilename, const BYTE *bpBuf,
|
||||
int iSize, bool fCompressed)
|
||||
{
|
||||
if (!bpBuf || (iSize<1)) return FALSE;
|
||||
if (!Create(szFilename,fCompressed)) return FALSE;
|
||||
if (!Write(bpBuf,iSize)) return FALSE;
|
||||
if (!Close()) return FALSE;
|
||||
return TRUE;
|
||||
if (!bpBuf || (iSize<1)) return false;
|
||||
if (!Create(szFilename,fCompressed)) return false;
|
||||
if (!Write(bpBuf,iSize)) return false;
|
||||
if (!Close()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStdFile::Load(const char *szFilename, BYTE **lpbpBuf,
|
||||
|
@ -288,14 +288,14 @@ bool CStdFile::Load(const char *szFilename, BYTE **lpbpBuf,
|
|||
bool fCompressed)
|
||||
{
|
||||
int iSize = fCompressed ? UncompressedFileSize(szFilename) : FileSize(szFilename);
|
||||
if (!lpbpBuf || (iSize<1)) return FALSE;
|
||||
if (!Open(szFilename,fCompressed)) return FALSE;
|
||||
if (!(*lpbpBuf = new BYTE [iSize+iAppendZeros])) return FALSE;
|
||||
if (!Read(*lpbpBuf,iSize)) { delete [] *lpbpBuf; return FALSE; }
|
||||
if (!lpbpBuf || (iSize<1)) return false;
|
||||
if (!Open(szFilename,fCompressed)) return false;
|
||||
if (!(*lpbpBuf = new BYTE [iSize+iAppendZeros])) return false;
|
||||
if (!Read(*lpbpBuf,iSize)) { delete [] *lpbpBuf; return false; }
|
||||
if (iAppendZeros) ZeroMem( (*lpbpBuf)+iSize, iAppendZeros );
|
||||
if (ipSize) *ipSize=iSize;
|
||||
Close();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int UncompressedFileSize(const char *szFilename)
|
||||
|
|
|
@ -55,7 +55,7 @@ class CStdFile: public CStdStream
|
|||
int MemoryPtr;
|
||||
BYTE Buffer[CStdFileBufSize];
|
||||
int BufferLoad,BufferPtr;
|
||||
BOOL ModeWrite;
|
||||
bool ModeWrite;
|
||||
public:
|
||||
bool Create(const char *szFileName, bool fCompressed=false, bool fExecutable=false, bool fMemory=false);
|
||||
bool Open(const char *szFileName, bool fCompressed=false);
|
||||
|
@ -76,7 +76,7 @@ class CStdFile: public CStdStream
|
|||
int iSize,
|
||||
bool fCompressed = false);
|
||||
// flush contents to disk
|
||||
inline bool Flush() { if (ModeWrite && BufferLoad) return SaveBuffer(); else return TRUE; }
|
||||
inline bool Flush() { if (ModeWrite && BufferLoad) return SaveBuffer(); else return true; }
|
||||
int AccessedEntrySize();
|
||||
protected:
|
||||
void ClearBuffer();
|
||||
|
|
|
@ -87,7 +87,7 @@ bool ProcessGroup(const char *szFilename)
|
|||
C4Group hGroup;
|
||||
int iArg;
|
||||
bool fDeleteGroup = false;
|
||||
hGroup.SetStdOutput(TRUE);
|
||||
hGroup.SetStdOutput(true);
|
||||
|
||||
int argc = globalArgC;
|
||||
char **argv = globalArgV;
|
||||
|
@ -97,7 +97,7 @@ bool ProcessGroup(const char *szFilename)
|
|||
printf("Group: %s\n",szFilename);
|
||||
|
||||
// Open group file
|
||||
if (hGroup.Open(szFilename, TRUE && Config.Registered()))
|
||||
if (hGroup.Open(szFilename, true && Config.Registered()))
|
||||
{
|
||||
// No commands: display contents
|
||||
if (iFirstCommand<0)
|
||||
|
@ -205,7 +205,7 @@ bool ProcessGroup(const char *szFilename)
|
|||
break;
|
||||
// Make original
|
||||
case 'o':
|
||||
hGroup.MakeOriginal(TRUE);
|
||||
hGroup.MakeOriginal(true);
|
||||
break;
|
||||
// Pack
|
||||
case 'p':
|
||||
|
@ -262,7 +262,7 @@ bool ProcessGroup(const char *szFilename)
|
|||
case 'y':
|
||||
printf("Applying update...\n");
|
||||
if (C4Group_ApplyUpdate(hGroup))
|
||||
{ if (argv[iArg][2]=='d') fDeleteGroup = TRUE; }
|
||||
{ if (argv[iArg][2]=='d') fDeleteGroup = true; }
|
||||
else
|
||||
printf("Update failed.\n");
|
||||
break;
|
||||
|
@ -349,7 +349,7 @@ bool ProcessGroup(const char *szFilename)
|
|||
}
|
||||
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int RegisterShellExtensions()
|
||||
|
@ -419,7 +419,7 @@ bool Log(const char *msg)
|
|||
|
||||
bool LogFatal(const char *msg) { return Log(msg); }
|
||||
|
||||
BOOL LogF(const char *strMessage, ...)
|
||||
bool LogF(const char *strMessage, ...)
|
||||
{
|
||||
va_list args; va_start(args, strMessage);
|
||||
// Compose formatted message
|
||||
|
@ -479,7 +479,7 @@ int main(int argc, char *argv[])
|
|||
// Registration check
|
||||
Config.Init();
|
||||
bool fWasQuiet = fQuiet; fQuiet = true; // prevent premature logging of registration error
|
||||
Config.Load(FALSE);
|
||||
Config.Load(false);
|
||||
fQuiet = fWasQuiet;
|
||||
|
||||
// Init C4Group
|
||||
|
@ -571,7 +571,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
PROCESS_INFORMATION procInfo;
|
||||
|
||||
CreateProcess(strExecuteAtEnd, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startInfo, &procInfo);
|
||||
CreateProcess(strExecuteAtEnd, NULL, NULL, NULL, false, 0, NULL, NULL, &startInfo, &procInfo);
|
||||
}
|
||||
|
||||
// Done
|
||||
|
|
|
@ -62,7 +62,7 @@ bool Log(const char *msg) {
|
|||
return 1;
|
||||
}
|
||||
#define IMPLEMENT_LOGF(func) \
|
||||
BOOL func(const char *msg, ...) { \
|
||||
bool func(const char *msg, ...) { \
|
||||
va_list args; va_start(args, msg); \
|
||||
StdStrBuf Buf; \
|
||||
Buf.FormatV(msg, args); \
|
||||
|
@ -90,7 +90,7 @@ bool ProcessGroup(const char *FilenamePar) {
|
|||
LogF("Group: %s", szFilename);
|
||||
|
||||
// Open group file
|
||||
if (hGroup.Open(szFilename, TRUE)) {
|
||||
if (hGroup.Open(szFilename, true)) {
|
||||
// No commands: display contents
|
||||
if (iFirstCommand >= argc) {
|
||||
hGroup.SetStdOutput(true);
|
||||
|
@ -209,7 +209,7 @@ bool ProcessGroup(const char *FilenamePar) {
|
|||
break;
|
||||
// Make original
|
||||
case 'o':
|
||||
hGroup.MakeOriginal(TRUE);
|
||||
hGroup.MakeOriginal(true);
|
||||
break;
|
||||
// Pack
|
||||
case 'p':
|
||||
|
@ -291,7 +291,7 @@ bool ProcessGroup(const char *FilenamePar) {
|
|||
case 'y':
|
||||
Log("Applying update...");
|
||||
if (C4Group_ApplyUpdate(hGroup))
|
||||
{ if (argv[iArg][2]=='d') fDeleteGroup = TRUE; }
|
||||
{ if (argv[iArg][2]=='d') fDeleteGroup = true; }
|
||||
else
|
||||
fprintf(stderr,"Update failed.\n");
|
||||
break;
|
||||
|
@ -331,7 +331,7 @@ bool ProcessGroup(const char *FilenamePar) {
|
|||
}
|
||||
free(szFilename);
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int RegisterShellExtensions() {
|
||||
|
@ -447,7 +447,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
// Registration check
|
||||
/* Config.Init();
|
||||
Config.Load(FALSE);*/
|
||||
Config.Load(false);*/
|
||||
|
||||
// Init C4Group
|
||||
/* C4Group_SetMaker(Config.General.Name);
|
||||
|
@ -523,7 +523,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
PROCESS_INFORMATION procInfo;
|
||||
|
||||
CreateProcess(strExecuteAtEnd, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startInfo, &procInfo);
|
||||
CreateProcess(strExecuteAtEnd, NULL, NULL, NULL, false, 0, NULL, NULL, &startInfo, &procInfo);
|
||||
#else
|
||||
switch (fork())
|
||||
{
|
||||
|
|
|
@ -9,11 +9,11 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(stderr, "%s infile [outfile]", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
MyFile.Load(argv[1], (BYTE **)&pData, &iSize, 0, TRUE);
|
||||
MyFile.Load(argv[1], (BYTE **)&pData, &iSize, 0, true);
|
||||
if (argc < 3) {
|
||||
fwrite(pData, 1, iSize, stdout);
|
||||
} else {
|
||||
MyFile.Create(argv[2], FALSE);
|
||||
MyFile.Create(argv[2], false);
|
||||
MyFile.Write(pData, iSize);
|
||||
}
|
||||
MyFile.Close();
|
||||
|
|
|
@ -160,7 +160,7 @@ void C4ConfigGraphics::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(RenderInactiveEM, "RenderInactiveEM", 1 ));
|
||||
pComp->Value(mkNamingAdapt(DisableGamma, "DisableGamma", 0 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(Monitor, "Monitor", 0 )); // 0 = D3DADAPTER_DEFAULT
|
||||
pComp->Value(mkNamingAdapt(FireParticles, "FireParticles", TRUE ));
|
||||
pComp->Value(mkNamingAdapt(FireParticles, "FireParticles", true ));
|
||||
pComp->Value(mkNamingAdapt(MaxRefreshDelay, "MaxRefreshDelay", 30 ));
|
||||
pComp->Value(mkNamingAdapt(EnableShaders, "Shader", 0 ,false, true));
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ void C4Config::Default()
|
|||
fConfigLoaded=false;
|
||||
}
|
||||
|
||||
BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
|
||||
bool C4Config::Load(bool forceWorkingDirectory, const char *szConfigFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
|
|||
// Configuration file syntax error?
|
||||
LogF("Error loading configuration: %s"/*LoadResStr("IDS_ERR_CONFREAD") - restbl not yet loaded*/, pExc->Msg.getData());
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Config postinit
|
||||
|
@ -519,10 +519,10 @@ BOOL C4Config::Load(BOOL forceWorkingDirectory, const char *szConfigFile)
|
|||
Network.Nick.Copy(Network.LocalName); // assuming that LocalName will always contain some useful value*/
|
||||
fConfigLoaded = true;
|
||||
if (szConfigFile) ConfigFilename.Copy(szConfigFile); else ConfigFilename.Clear();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Config::Save()
|
||||
bool C4Config::Save()
|
||||
{
|
||||
/* - deactivated: Graphics.Engine might not be same as last initialized engine, because it might be changed by C4StartupOptionsDlg
|
||||
#ifdef USE_DIRECTX
|
||||
|
@ -582,12 +582,12 @@ BOOL C4Config::Save()
|
|||
{
|
||||
LogF(LoadResStr("IDS_ERR_CONFSAVE"), pExc->Msg.getData());
|
||||
delete pExc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ConfigGeneral::DeterminePaths(BOOL forceWorkingDirectory)
|
||||
void C4ConfigGeneral::DeterminePaths(bool forceWorkingDirectory)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Exe path
|
||||
|
@ -758,11 +758,11 @@ const char *C4Config::AtScreenshotPath(const char *szFilename)
|
|||
}
|
||||
|
||||
|
||||
BOOL C4ConfigGeneral::CreateSaveFolder(const char *strDirectory, const char *strLanguageTitle)
|
||||
bool C4ConfigGeneral::CreateSaveFolder(const char *strDirectory, const char *strLanguageTitle)
|
||||
{
|
||||
// Create directory if needed
|
||||
if (!CreatePath(strDirectory))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Create title component if needed
|
||||
char lang[3]; SCopy(Config.General.Language, lang, 2);
|
||||
StdStrBuf strTitleFile; strTitleFile.Format("%s%c%s", strDirectory, DirectorySeparator, C4CFN_WriteTitle);
|
||||
|
@ -770,9 +770,9 @@ BOOL C4ConfigGeneral::CreateSaveFolder(const char *strDirectory, const char *str
|
|||
CStdFile hFile;
|
||||
if (!FileExists(strTitleFile.getData()))
|
||||
if (!hFile.Create(strTitleFile.getData()) || !hFile.WriteString(strTitleData.getData()) || !hFile.Close())
|
||||
return FALSE;
|
||||
return false;
|
||||
// Save folder seems okay
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -915,15 +915,15 @@ void C4ConfigGeneral::DefaultLanguage()
|
|||
GetLanguageSequence(Language, LanguageEx);
|
||||
}
|
||||
|
||||
BOOL C4Config::Registered()
|
||||
bool C4Config::Registered()
|
||||
{
|
||||
// Dummy function: to be overloaded in C4Config
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Config::Init()
|
||||
bool C4Config::Init()
|
||||
{
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* C4Config::GetSubkeyPath(const char *strSubkey)
|
||||
|
|
|
@ -78,9 +78,9 @@ class C4ConfigGeneral
|
|||
public:
|
||||
static int GetLanguageSequence(const char *strSource, char *strTarget);
|
||||
void DefaultLanguage();
|
||||
BOOL CreateSaveFolder(const char *strDirectory, const char *strLanguageTitle);
|
||||
bool CreateSaveFolder(const char *strDirectory, const char *strLanguageTitle);
|
||||
void AdoptOldSettings();
|
||||
void DeterminePaths(BOOL forceWorkingDirectory);
|
||||
void DeterminePaths(bool forceWorkingDirectory);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
void AddAdditionalDataPath(const char *szPath);
|
||||
void ClearAdditionalDataPaths();
|
||||
|
@ -319,10 +319,10 @@ class C4Config: protected CStdConfig
|
|||
public:
|
||||
const char* GetSubkeyPath(const char *strSubkey);
|
||||
void Default();
|
||||
BOOL Save();
|
||||
BOOL Load(BOOL forceWorkingDirectory = TRUE, const char *szConfigFile = NULL);
|
||||
BOOL Init();
|
||||
BOOL Registered();
|
||||
bool Save();
|
||||
bool Load(bool forceWorkingDirectory = true, const char *szConfigFile = NULL);
|
||||
bool Init();
|
||||
bool Registered();
|
||||
const char *AtExePath(const char *szFilename);
|
||||
const char *AtTempPath(const char *szFilename);
|
||||
const char *AtNetworkPath(const char *szFilename);
|
||||
|
|
|
@ -272,25 +272,25 @@ void C4ConfigShareware::Default()
|
|||
C4Config::Default();
|
||||
}
|
||||
|
||||
BOOL C4ConfigShareware::Load(BOOL forceWorkingDirectory, const char *szCustomFile)
|
||||
bool C4ConfigShareware::Load(bool forceWorkingDirectory, const char *szCustomFile)
|
||||
{
|
||||
// Load standard config
|
||||
if (!C4Config::Load(forceWorkingDirectory, szCustomFile)) return FALSE;
|
||||
if (!C4Config::Load(forceWorkingDirectory, szCustomFile)) return false;
|
||||
// Load registration
|
||||
LoadRegistration();
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ConfigShareware::Save()
|
||||
bool C4ConfigShareware::Save()
|
||||
{
|
||||
// Save standard config
|
||||
if (!C4Config::Save()) return FALSE;
|
||||
if (!C4Config::Save()) return false;
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ConfigShareware::Registered()
|
||||
bool C4ConfigShareware::Registered()
|
||||
{
|
||||
return RegistrationValid;
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ class C4ConfigShareware: public C4Config
|
|||
char InvalidKeyFile[CFG_MaxString + 1];
|
||||
public:
|
||||
void Default();
|
||||
BOOL Save();
|
||||
BOOL Load(BOOL forceWorkingDirectory=TRUE, const char *szCustomFile=NULL);
|
||||
bool Save();
|
||||
bool Load(bool forceWorkingDirectory=true, const char *szCustomFile=NULL);
|
||||
public:
|
||||
void ClearRegistrationError();
|
||||
BOOL Registered();
|
||||
bool Registered();
|
||||
bool LoadRegistration();
|
||||
bool LoadRegistration(const char *szFrom);
|
||||
const char* GetRegistrationData(const char* strField);
|
||||
|
|
|
@ -172,7 +172,7 @@ void C4ControlSet::Execute() const
|
|||
// disable debug
|
||||
if (!fSet && Game.DebugMode)
|
||||
{
|
||||
Game.DebugMode=FALSE;
|
||||
Game.DebugMode=false;
|
||||
::GraphicsSystem.DeactivateDebugOutput();
|
||||
}
|
||||
// save flag, log
|
||||
|
@ -874,7 +874,7 @@ void C4ControlEMMoveObject::Execute() const
|
|||
{
|
||||
pObj->ForcePosition(pObj->GetX()+tx,pObj->GetY()+ty);
|
||||
pObj->xdir=pObj->ydir=0;
|
||||
pObj->Mobile = FALSE;
|
||||
pObj->Mobile = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -905,7 +905,7 @@ void C4ControlEMMoveObject::Execute() const
|
|||
// update status
|
||||
if (fLocalCall)
|
||||
{
|
||||
Console.EditCursor.SetHold(TRUE);
|
||||
Console.EditCursor.SetHold(true);
|
||||
Console.PropertyDlg.Update(Console.EditCursor.GetSelection());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ void C4GameParameters::Clear()
|
|||
Teams.Clear();
|
||||
}
|
||||
|
||||
BOOL C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames)
|
||||
bool C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames)
|
||||
{
|
||||
// Clear previous data
|
||||
Clear();
|
||||
|
@ -401,7 +401,7 @@ BOOL C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *
|
|||
|
||||
// Load teams
|
||||
if (!Teams.Load(hGroup, pScenario, pLang))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_ERRORLOADINGTEAMS")); return FALSE; }
|
||||
{ LogFatal(LoadResStr("IDS_PRC_ERRORLOADINGTEAMS")); return false; }
|
||||
|
||||
// Compile data
|
||||
StdStrBuf Buf;
|
||||
|
@ -411,7 +411,7 @@ BOOL C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *
|
|||
mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"),
|
||||
Buf,
|
||||
C4CFN_Parameters))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -440,7 +440,7 @@ BOOL C4GameParameters::Load(C4Group &hGroup, C4Scenario *pScenario, const char *
|
|||
if (isLeague()) EnforceLeagueRules(pScenario);
|
||||
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GameParameters::EnforceLeagueRules(C4Scenario *pScenario)
|
||||
|
@ -460,32 +460,32 @@ void C4GameParameters::EnforceLeagueRules(C4Scenario *pScenario)
|
|||
if (pScenario) MaxPlayers = pScenario->Head.MaxPlayerLeague;
|
||||
}
|
||||
|
||||
BOOL C4GameParameters::Save(C4Group &hGroup, C4Scenario *pScenario)
|
||||
bool C4GameParameters::Save(C4Group &hGroup, C4Scenario *pScenario)
|
||||
{
|
||||
|
||||
// Write Parameters.txt
|
||||
StdStrBuf ParData = DecompileToBuf<StdCompilerINIWrite>(
|
||||
mkNamingAdapt(mkParAdapt(*this, pScenario), "Parameters"));
|
||||
if(!hGroup.Add(C4CFN_Parameters, ParData, FALSE, TRUE))
|
||||
return FALSE;
|
||||
if(!hGroup.Add(C4CFN_Parameters, ParData, false, true))
|
||||
return false;
|
||||
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4GameParameters::InitNetwork(C4Network2ResList *pResList)
|
||||
bool C4GameParameters::InitNetwork(C4Network2ResList *pResList)
|
||||
{
|
||||
|
||||
// Scenario & material resource
|
||||
if(!Scenario.InitNetwork(pResList))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Other game resources
|
||||
if(!GameRes.InitNetwork(pResList))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GameParameters::CompileFunc(StdCompiler *pComp, C4Scenario *pScenario)
|
||||
|
|
|
@ -148,9 +148,9 @@ public:
|
|||
void EnforceLeagueRules(class C4Scenario *pScenario);
|
||||
|
||||
void Clear();
|
||||
BOOL Load(C4Group &hGroup, C4Scenario *pDefault, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames);
|
||||
BOOL InitNetwork(C4Network2ResList *pResList);
|
||||
BOOL Save(C4Group &hGroup, C4Scenario *pDefault);
|
||||
bool Load(C4Group &hGroup, C4Scenario *pDefault, const char *szGameText, C4LangStringTable *pLang, const char *DefinitionFilenames);
|
||||
bool InitNetwork(C4Network2ResList *pResList);
|
||||
bool Save(C4Group &hGroup, C4Scenario *pDefault);
|
||||
|
||||
void CompileFunc(StdCompiler *pComp, C4Scenario *pScenario = NULL);
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ bool C4GameSave::SaveCore()
|
|||
if (!fInitial)
|
||||
{
|
||||
// NoInitialize: Marks whether object data is contained and not to be created from core
|
||||
rC4S.Head.NoInitialize = TRUE;
|
||||
rC4S.Head.NoInitialize = true;
|
||||
// the SaveGame-value, despite it's name, marks whether exact runtime data is contained
|
||||
// the flag must not be altered for pure
|
||||
rC4S.Head.SaveGame = GetSaveRuntimeData() && IsExact();
|
||||
|
@ -103,7 +103,7 @@ bool C4GameSave::SaveCore()
|
|||
// clear shareware release for non-initial saves in fullscreen mode
|
||||
// do not clear in developer mode, because it's annoying when working on shareware scenarios
|
||||
if (!fInitial && Application.isFullScreen)
|
||||
rC4S.Head.EnableUnregisteredAccess = FALSE;
|
||||
rC4S.Head.EnableUnregisteredAccess = false;
|
||||
// OldGfx is no longer supported
|
||||
// checks for IsExact() || ExactLandscape wouldn't catch scenarios using more than 23 materials, so let's make it easy
|
||||
rC4S.Head.ForcedGfxMode = C4SGFXMODE_NEWGFX;
|
||||
|
@ -188,9 +188,9 @@ bool C4GameSave::SaveLandscape()
|
|||
if(!GetForceExactLandscape())
|
||||
{
|
||||
// save map
|
||||
if (!::Landscape.SaveMap(*pSaveGroup)) return FALSE;
|
||||
if (!::Landscape.SaveMap(*pSaveGroup)) return false;
|
||||
// save textures (if changed)
|
||||
if (!::Landscape.SaveTextures(*pSaveGroup)) return FALSE;
|
||||
if (!::Landscape.SaveTextures(*pSaveGroup)) return false;
|
||||
}
|
||||
}
|
||||
else if (::Landscape.Mode != C4LSC_Exact)
|
||||
|
@ -514,7 +514,7 @@ bool C4GameSaveSavegame::OnSaving()
|
|||
// but doing so would be too late when the queue is executed!
|
||||
// TODO: remove it? (-> PeterW ;))
|
||||
if (::Network.isEnabled())
|
||||
Game.Input.Add(CID_Synchronize, new C4ControlSynchronize(TRUE));
|
||||
Game.Input.Add(CID_Synchronize, new C4ControlSynchronize(true));
|
||||
else
|
||||
::Players.SynchronizeLocalFiles();
|
||||
// OK; save now
|
||||
|
@ -560,11 +560,11 @@ bool C4GameSaveSavegame::WriteDesc(StdStrBuf &sBuf)
|
|||
void C4GameSaveRecord::AdjustCore(C4Scenario &rC4S)
|
||||
{
|
||||
// specific recording flags
|
||||
rC4S.Head.Replay=TRUE;
|
||||
rC4S.Head.Replay=true;
|
||||
if (!rC4S.Head.Film) rC4S.Head.Film=C4SFilm_Normal; /* default to film */
|
||||
rC4S.Head.Icon=29;
|
||||
// unregistered replay OK
|
||||
rC4S.Head.EnableUnregisteredAccess = TRUE;
|
||||
rC4S.Head.EnableUnregisteredAccess = true;
|
||||
// default record title
|
||||
char buf[1024 + 1];
|
||||
sprintf(buf, "%03i %s [%d]", iNum, Game.ScenarioTitle.getData(), (int) C4XVERBUILD);
|
||||
|
@ -600,6 +600,6 @@ bool C4GameSaveRecord::WriteDesc(StdStrBuf &sBuf)
|
|||
void C4GameSaveNetwork::AdjustCore(C4Scenario &rC4S)
|
||||
{
|
||||
// specific dynamic flags
|
||||
rC4S.Head.NetworkGame=TRUE;
|
||||
rC4S.Head.NetworkGame=true;
|
||||
rC4S.Head.NetworkRuntimeJoin = !fInitial;
|
||||
}
|
||||
|
|
|
@ -1239,7 +1239,7 @@ bool C4PlayerInfoList::Save(C4Group &hGroup, const char *szToFile)
|
|||
StdStrBuf Buf = DecompileToBuf<StdCompilerINIWrite>(
|
||||
mkNamingAdapt(*this, "PlayerInfoList"));
|
||||
// save buffer to group
|
||||
hGroup.Add(szToFile, Buf, FALSE, TRUE);
|
||||
hGroup.Add(szToFile, Buf, false, true);
|
||||
}
|
||||
catch(StdCompiler::Exception *)
|
||||
{ return false; }
|
||||
|
@ -1255,7 +1255,7 @@ bool C4PlayerInfoList::LoadFromGameText(const char *pSource)
|
|||
const char *szPos;
|
||||
char szLinebuf[30+_MAX_PATH+1];
|
||||
if (szPos = SSearch(pSource,"[PlayerFiles]"))
|
||||
while (TRUE)
|
||||
while (true)
|
||||
{
|
||||
szPos = SAdvanceSpace(szPos);
|
||||
SCopyUntil(szPos,szLinebuf,0x0D,30+_MAX_PATH);
|
||||
|
@ -1642,7 +1642,7 @@ bool C4PlayerInfoList::RecreatePlayers()
|
|||
::Control.RecAddFile(szFilename, sFilenameInRecord.getData());
|
||||
}
|
||||
// recreate join directly
|
||||
::Players.Join(szFilename, FALSE, idAtClient, szAtClientName, pInfo);
|
||||
::Players.Join(szFilename, false, idAtClient, szAtClientName, pInfo);
|
||||
// delete temporary files immediately
|
||||
if (pInfo->IsTempFile()) pInfo->DeleteTempFile();
|
||||
}
|
||||
|
|
|
@ -126,14 +126,14 @@ C4Record::~C4Record()
|
|||
{
|
||||
}
|
||||
|
||||
BOOL C4Record::Start(bool fInitial)
|
||||
bool C4Record::Start(bool fInitial)
|
||||
{
|
||||
// no double record
|
||||
if (fRecording) return FALSE;
|
||||
if (fRecording) return false;
|
||||
|
||||
// create demos folder
|
||||
if (!Config.General.CreateSaveFolder(Config.General.SaveDemoFolder.getData(), LoadResStr("IDS_GAME_RECORDSTITLE")))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// various infos
|
||||
StdStrBuf sDemoFolder; sDemoFolder.Ref(Config.General.SaveDemoFolder);
|
||||
|
@ -162,35 +162,35 @@ BOOL C4Record::Start(bool fInitial)
|
|||
|
||||
// save game - this also saves player info list
|
||||
C4GameSaveRecord saveRec(fInitial, Index, Game.Parameters.isLeague());
|
||||
if (!saveRec.Save(sFilename.getData())) return FALSE;
|
||||
if (!saveRec.Save(sFilename.getData())) return false;
|
||||
saveRec.Close();
|
||||
|
||||
// unpack group, if neccessary
|
||||
if( !DirectoryExists(sFilename.getData()) &&
|
||||
!C4Group_UnpackDirectory(sFilename.getData()) )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// open control record file
|
||||
char szCtrlRecFilename[_MAX_PATH+1 + _MAX_FNAME];
|
||||
sprintf(szCtrlRecFilename, "%s" DirSep C4CFN_CtrlRec, sFilename.getData());
|
||||
if (!CtrlRec.Create(szCtrlRecFilename)) return FALSE;
|
||||
if (!CtrlRec.Create(szCtrlRecFilename)) return false;
|
||||
|
||||
// open record group
|
||||
if(!RecordGrp.Open(sFilename.getData()))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// record go
|
||||
fStreaming = false;
|
||||
fRecording = true;
|
||||
iLastFrame = 0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Record::Stop(StdStrBuf *pRecordName, BYTE *pRecordSHA1)
|
||||
bool C4Record::Stop(StdStrBuf *pRecordName, BYTE *pRecordSHA1)
|
||||
{
|
||||
// safety
|
||||
if (!fRecording) return FALSE;
|
||||
if (!DirectoryExists(sFilename.getData())) return FALSE;
|
||||
if (!fRecording) return false;
|
||||
if (!DirectoryExists(sFilename.getData())) return false;
|
||||
|
||||
// streaming finished
|
||||
StopStreaming();
|
||||
|
@ -212,7 +212,7 @@ BOOL C4Record::Stop(StdStrBuf *pRecordName, BYTE *pRecordSHA1)
|
|||
|
||||
// pack group
|
||||
#ifndef DEBUGREC
|
||||
if(!C4Group_PackDirectory(sFilename.getData())) return FALSE;
|
||||
if(!C4Group_PackDirectory(sFilename.getData())) return false;
|
||||
#endif
|
||||
|
||||
// return record data
|
||||
|
@ -338,7 +338,7 @@ bool C4Record::StartStreaming(bool fInitial)
|
|||
|
||||
// Save start state (without copy of scenario!)
|
||||
C4GameSaveRecord saveRec(fInitial, Index, Game.Parameters.isLeague(), false);
|
||||
if (!saveRec.Save(sTempFilename.getData())) return FALSE;
|
||||
if (!saveRec.Save(sTempFilename.getData())) return false;
|
||||
saveRec.Close();
|
||||
|
||||
// Add file into stream, delete file
|
||||
|
@ -400,7 +400,7 @@ C4Playback::~C4Playback()
|
|||
Clear();
|
||||
}
|
||||
|
||||
BOOL C4Playback::Open(C4Group &rGrp)
|
||||
bool C4Playback::Open(C4Group &rGrp)
|
||||
{
|
||||
// clean up
|
||||
Clear();
|
||||
|
@ -412,7 +412,7 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
if (rGrp.LoadEntryString(C4CFN_CtrlRecText, TextBuf))
|
||||
{
|
||||
if (!ReadText(TextBuf))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -423,15 +423,15 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
// get record file
|
||||
if (fLoadSequential)
|
||||
{
|
||||
if (!rGrp.FindEntry(C4CFN_CtrlRec)) return FALSE;
|
||||
if (!playbackFile.Open(FormatString("%s%c%s", rGrp.GetFullName().getData(), (char) DirectorySeparator, (const char *) C4CFN_CtrlRec).getData())) return FALSE;
|
||||
if (!rGrp.FindEntry(C4CFN_CtrlRec)) return false;
|
||||
if (!playbackFile.Open(FormatString("%s%c%s", rGrp.GetFullName().getData(), (char) DirectorySeparator, (const char *) C4CFN_CtrlRec).getData())) return false;
|
||||
// forcing first chunk to be read; will call ReadBinary
|
||||
currChunk = chunks.end();
|
||||
if (!NextSequentialChunk())
|
||||
{
|
||||
// empty replay??!
|
||||
LogFatal("Record: Binary read error.");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -441,7 +441,7 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
if (rGrp.LoadEntry(C4CFN_CtrlRec, BinaryBuf))
|
||||
{
|
||||
if (!ReadBinary(BinaryBuf))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -459,10 +459,10 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
if (!rGrp.Read(BinaryBuf.getMData(), iLoadSize))
|
||||
{
|
||||
LogFatal("Record: Binary load error!");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
iSize -= iLoadSize;
|
||||
if (!ReadBinary(BinaryBuf)) return FALSE;
|
||||
if (!ReadBinary(BinaryBuf)) return false;
|
||||
LogF("%d binary remaining", iSize);
|
||||
currChunk = chunks.begin();
|
||||
if (fStrip) Strip();
|
||||
|
@ -478,7 +478,7 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
{
|
||||
// no control data?
|
||||
LogFatal("Record: No control data found!");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -501,23 +501,23 @@ BOOL C4Playback::Open(C4Group &rGrp)
|
|||
if (!DbgRecFile.Create(DEBUGREC_EXTFILE))
|
||||
{
|
||||
LogFatal("DbgRec: Creation of external file \"" DEBUGREC_EXTFILE "\" failed!");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else Log("DbgRec: Writing to \"" DEBUGREC_EXTFILE "\"...");
|
||||
#else
|
||||
if (!DbgRecFile.Open(DEBUGREC_EXTFILE))
|
||||
{
|
||||
LogFatal("DbgRec: Opening of external file \"" DEBUGREC_EXTFILE "\" failed!");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else Log("DbgRec: Checking against \"" DEBUGREC_EXTFILE "\"...");
|
||||
#endif
|
||||
#endif
|
||||
// ok
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Playback::ReadBinary(const StdBuf &Buf)
|
||||
bool C4Playback::ReadBinary(const StdBuf &Buf)
|
||||
{
|
||||
// sequential reading: Take over rest from last buffer
|
||||
const StdBuf *pUseBuf; uint32_t iFrame = 0;
|
||||
|
@ -587,14 +587,14 @@ BOOL C4Playback::ReadBinary(const StdBuf &Buf)
|
|||
LogF("Record: Binary unpack error: %s", pEx->Msg.getData());
|
||||
c.Delete();
|
||||
delete pEx;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
catch(StdCompiler::Exception *pEx)
|
||||
{
|
||||
LogF("Record: Binary unpack error: %s", pEx->Msg.getData());
|
||||
c.Delete();
|
||||
delete pEx;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Add to list
|
||||
chunks.push_back(c); c.pPkt = NULL;
|
||||
|
@ -611,10 +611,10 @@ BOOL C4Playback::ReadBinary(const StdBuf &Buf)
|
|||
sequentialBuffer.Shrink(iPos);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Playback::ReadText(const StdStrBuf &Buf)
|
||||
bool C4Playback::ReadText(const StdStrBuf &Buf)
|
||||
{
|
||||
return CompileFromBuf_LogWarn<StdCompilerINIRead>(mkNamingAdapt(mkSTLContainerAdapt(chunks), "Rec"), Buf, C4CFN_CtrlRecText);
|
||||
}
|
||||
|
@ -841,11 +841,11 @@ void C4Playback::Strip()
|
|||
}
|
||||
|
||||
|
||||
BOOL C4Playback::ExecuteControl(C4Control *pCtrl, int iFrame)
|
||||
bool C4Playback::ExecuteControl(C4Control *pCtrl, int iFrame)
|
||||
{
|
||||
// still playbacking?
|
||||
if (currChunk == chunks.end()) return FALSE;
|
||||
if (Finished) { Finish(); return FALSE; }
|
||||
if (currChunk == chunks.end()) return false;
|
||||
if (Finished) { Finish(); return false; }
|
||||
#ifdef DEBUGREC
|
||||
if(DebugRec.firstPkt())
|
||||
DebugRecError("Debug rec overflow!");
|
||||
|
@ -895,7 +895,7 @@ BOOL C4Playback::ExecuteControl(C4Control *pCtrl, int iFrame)
|
|||
//char Indent[256+1]; strcpy(Indent, "");
|
||||
//pCtrl->deb_print(Indent);
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Playback::Finish()
|
||||
|
@ -931,7 +931,7 @@ void C4Playback::Clear()
|
|||
#endif
|
||||
#endif
|
||||
// done
|
||||
Finished = TRUE;
|
||||
Finished = true;
|
||||
}
|
||||
|
||||
const char * GetRecordChunkTypeName(C4RecordChunkType eType)
|
||||
|
|
|
@ -270,8 +270,8 @@ class C4Record // demo recording
|
|||
unsigned int GetStreamingPos() const { return iStreamingPos; }
|
||||
const StdBuf &GetStreamingBuf() const { return StreamingData; }
|
||||
|
||||
BOOL Start(bool fInitial);
|
||||
BOOL Stop(StdStrBuf *pRecordName = NULL, BYTE *pRecordSHA1 = NULL);
|
||||
bool Start(bool fInitial);
|
||||
bool Stop(StdStrBuf *pRecordName = NULL, BYTE *pRecordSHA1 = NULL);
|
||||
|
||||
bool Rec(const C4Control &Ctrl, int iFrame); // record control
|
||||
bool Rec(C4PacketType eCtrlType, C4ControlPacket *pCtrl, int iFrame); // record control packet
|
||||
|
@ -307,16 +307,16 @@ class C4Playback // demo playback
|
|||
C4Playback(); // constructor; init playback
|
||||
~C4Playback(); // destructor; deinit playback
|
||||
|
||||
BOOL Open(C4Group &rGrp);
|
||||
BOOL ReadBinary(const StdBuf &Buf);
|
||||
BOOL ReadText(const StdStrBuf &Buf);
|
||||
bool Open(C4Group &rGrp);
|
||||
bool ReadBinary(const StdBuf &Buf);
|
||||
bool ReadText(const StdStrBuf &Buf);
|
||||
void NextChunk(); // point to next prepared chunk in mem or read it
|
||||
bool NextSequentialChunk(); // read from seq file until a new chunk has been filled
|
||||
StdStrBuf ReWriteText();
|
||||
StdBuf ReWriteBinary();
|
||||
void Strip();
|
||||
BOOL ExecuteControl(C4Control *pCtrl, int iFrame); // assign control
|
||||
BOOL IsFinished() { return Finished; }
|
||||
bool ExecuteControl(C4Control *pCtrl, int iFrame); // assign control
|
||||
bool IsFinished() { return Finished; }
|
||||
void Clear();
|
||||
#ifdef DEBUGREC
|
||||
void Check(C4RecordChunkType eType, const uint8_t *pData, int iSize); // compare with debugrec
|
||||
|
|
|
@ -656,7 +656,7 @@ bool C4TeamList::Save(C4Group &hGroup)
|
|||
{
|
||||
StdStrBuf Buf = DecompileToBuf<StdCompilerINIWrite>(mkNamingAdapt(*this, "Teams"));
|
||||
// save it
|
||||
hGroup.Add(C4CFN_Teams, Buf, FALSE, TRUE);
|
||||
hGroup.Add(C4CFN_Teams, Buf, false, true);
|
||||
}
|
||||
catch(StdCompiler::Exception *)
|
||||
{ return false; }
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#ifdef _WIN32
|
||||
#include <commdlg.h>
|
||||
|
||||
BOOL SetMenuItemText(HMENU hMenu, WORD id, const char *szText);
|
||||
bool SetMenuItemText(HMENU hMenu, WORD id, const char *szText);
|
||||
#else
|
||||
namespace {
|
||||
const DWORD OFN_HIDEREADONLY = 1 << 0;
|
||||
|
@ -92,7 +92,7 @@ namespace {
|
|||
namespace {
|
||||
GtkWidget* CreateImageFromInlinedPixbuf(const guint8* pixbuf_data)
|
||||
{
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_data, FALSE, NULL);
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_data, false, NULL);
|
||||
GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
|
||||
gdk_pixbuf_unref(pixbuf);
|
||||
return image;
|
||||
|
@ -102,11 +102,11 @@ namespace {
|
|||
|
||||
C4Console::C4Console()
|
||||
{
|
||||
Active = FALSE;
|
||||
Editing = TRUE;
|
||||
Active = false;
|
||||
Editing = true;
|
||||
ScriptCounter=0;
|
||||
FrameCounter=0;
|
||||
fGameOpen=FALSE;
|
||||
fGameOpen=false;
|
||||
|
||||
#ifdef _WIN32
|
||||
hWindow=NULL;
|
||||
|
@ -307,9 +307,9 @@ void C4Console::HandleMessage (XEvent & e)
|
|||
CStdWindow * C4Console::Init(CStdApp * pApp)
|
||||
{
|
||||
// Active
|
||||
Active = TRUE;
|
||||
Active = true;
|
||||
// Editing (enable even if network)
|
||||
Editing = TRUE;
|
||||
Editing = true;
|
||||
// Create dialog window
|
||||
#ifdef _WIN32
|
||||
hWindow = CreateDialog(pApp->GetInstance(), MAKEINTRESOURCE(IDD_CONSOLE), NULL, ConsoleDlgProc);
|
||||
|
@ -350,7 +350,7 @@ CStdWindow * C4Console::Init(CStdApp * pApp)
|
|||
hbmHalt=(HBITMAP)LoadBitmap(pApp->GetInstance(),MAKEINTRESOURCE(IDB_HALT));
|
||||
hbmHalt2=(HBITMAP)LoadBitmap(pApp->GetInstance(),MAKEINTRESOURCE(IDB_HALT2));
|
||||
// Enable controls
|
||||
UpdateHaltCtrls(TRUE);
|
||||
UpdateHaltCtrls(true);
|
||||
EnableControls(fGameOpen);
|
||||
ClearViewportMenu();
|
||||
// Show window and set focus
|
||||
|
@ -366,7 +366,7 @@ CStdWindow * C4Console::Init(CStdApp * pApp)
|
|||
|
||||
// Calls InitGUI
|
||||
CStdWindow* retval = C4ConsoleBase::Init(pApp, LoadResStr("IDS_CNS_CONSOLE"), NULL, false);
|
||||
UpdateHaltCtrls(TRUE);
|
||||
UpdateHaltCtrls(true);
|
||||
EnableControls(fGameOpen);
|
||||
ClearViewportMenu();
|
||||
return retval;
|
||||
|
@ -398,25 +398,25 @@ GtkWidget* C4Console::InitGUI()
|
|||
gtk_container_add(GTK_CONTAINER(btnModeEdit), image_mode_edit);
|
||||
gtk_container_add(GTK_CONTAINER(btnModeDraw), image_mode_draw);
|
||||
|
||||
GtkWidget* top_hbox = gtk_hbox_new(FALSE, 18);
|
||||
GtkWidget* play_hbox = gtk_hbox_new(FALSE, 6);
|
||||
GtkWidget* mode_hbox = gtk_hbox_new(FALSE, 6);
|
||||
GtkWidget* top_hbox = gtk_hbox_new(false, 18);
|
||||
GtkWidget* play_hbox = gtk_hbox_new(false, 6);
|
||||
GtkWidget* mode_hbox = gtk_hbox_new(false, 6);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(play_hbox), btnPlay, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(play_hbox), btnHalt, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModePlay, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModeEdit, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModeDraw, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(play_hbox), btnPlay, false, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(play_hbox), btnHalt, false, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModePlay, false, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModeEdit, false, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(mode_hbox), btnModeDraw, false, true, 0);
|
||||
|
||||
lblCursor = gtk_label_new("");
|
||||
gtk_misc_set_alignment(GTK_MISC(lblCursor), 0.0, 0.5);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), lblCursor, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), play_hbox, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), mode_hbox, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), lblCursor, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), play_hbox, false, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(top_hbox), mode_hbox, false, true, 0);
|
||||
|
||||
// ------------ Statusbar ---------------------
|
||||
GtkWidget* statusbar = gtk_hbox_new(FALSE, 6);
|
||||
GtkWidget* statusbar = gtk_hbox_new(false, 6);
|
||||
|
||||
GtkWidget* status_frame = gtk_frame_new(NULL);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(status_frame), GTK_SHADOW_IN);
|
||||
|
@ -433,11 +433,11 @@ GtkWidget* C4Console::InitGUI()
|
|||
GtkWidget* sep1 = gtk_vseparator_new();
|
||||
GtkWidget* sep2 = gtk_vseparator_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblFrame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), sep1, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblScript, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), sep2, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblTime, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblFrame, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), sep1, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblScript, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), sep2, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(statusbar), lblTime, true, true, 0);
|
||||
|
||||
// ------------ Log view and script entry ---------------------
|
||||
GtkWidget* scroll = gtk_scrolled_window_new(NULL, NULL);
|
||||
|
@ -447,7 +447,7 @@ GtkWidget* C4Console::InitGUI()
|
|||
|
||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(txtLog), FALSE);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(txtLog), false);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(scroll), txtLog);
|
||||
|
||||
|
@ -534,17 +534,17 @@ GtkWidget* C4Console::InitGUI()
|
|||
gtk_menu_shell_append(GTK_MENU_SHELL(menuHelp), helpAbout);
|
||||
|
||||
// ------------ Window ---------------------
|
||||
GtkWidget* topbox = gtk_vbox_new(FALSE, 0);
|
||||
GtkWidget* midbox = gtk_vbox_new(FALSE, 6);
|
||||
GtkWidget* topbox = gtk_vbox_new(false, 0);
|
||||
GtkWidget* midbox = gtk_vbox_new(false, 6);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(midbox), 6);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(midbox), scroll, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(midbox), txtScript, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(midbox), top_hbox, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(midbox), scroll, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(midbox), txtScript, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(midbox), top_hbox, false, true, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(topbox), menuBar, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), midbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), status_frame, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), menuBar, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), midbox, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(topbox), status_frame, false, false, 0);
|
||||
|
||||
gtk_window_set_default_size(GTK_WINDOW(window), 320, 320);
|
||||
|
||||
|
@ -580,25 +580,25 @@ GtkWidget* C4Console::InitGUI()
|
|||
|
||||
bool C4Console::In(const char *szText)
|
||||
{
|
||||
if (!Active || !szText) return FALSE;
|
||||
if (!Active || !szText) return false;
|
||||
// begins with '/'? then it's a command
|
||||
if (*szText == '/')
|
||||
{
|
||||
::MessageInput.ProcessCommand(szText);
|
||||
// done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// begins with '#'? then it's a message. Route cia ProcessInput to allow #/sound
|
||||
if (*szText == '#')
|
||||
{
|
||||
::MessageInput.ProcessInput(szText + 1);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// editing enabled?
|
||||
if (!EditCursor.EditingOK()) return FALSE;
|
||||
if (!EditCursor.EditingOK()) return false;
|
||||
// pass through network queue
|
||||
::Control.DoInput(CID_Script, new C4ControlScript(szText, C4ControlScript::SCOPE_Console, false), CDT_Decide);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::Out(const char *szText)
|
||||
|
@ -631,11 +631,11 @@ bool C4Console::Out(const char *szText)
|
|||
gtk_text_buffer_insert(buffer, &end, szText, -1);
|
||||
gtk_text_buffer_insert(buffer, &end, "\n", 1);
|
||||
|
||||
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(txtLog), gtk_text_buffer_get_insert(buffer), 0.0, FALSE, 0.0, 0.0);
|
||||
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(txtLog), gtk_text_buffer_get_insert(buffer), 0.0, false, 0.0, 0.0);
|
||||
|
||||
// Cheap hack to get the Console window updated while loading
|
||||
while (g_main_context_pending(NULL))
|
||||
g_main_context_iteration(NULL, FALSE);
|
||||
g_main_context_iteration(NULL, false);
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
return true;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ void C4Console::DoHalt()
|
|||
|
||||
bool C4Console::UpdateStatusBars()
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
// Frame counter
|
||||
if (Game.FrameCounter!=FrameCounter)
|
||||
{
|
||||
|
@ -710,12 +710,12 @@ bool C4Console::UpdateStatusBars()
|
|||
gtk_label_set_label(GTK_LABEL(lblTime), str.getData());
|
||||
#endif // WITH_DEVELOPER_MODE
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::UpdateHaltCtrls(bool fHalt)
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
#ifdef _WIN32
|
||||
SendDlgItemMessage(hWindow,IDC_BUTTONPLAY,BM_SETSTATE,!fHalt,0);
|
||||
UpdateWindow(GetDlgItem(hWindow,IDC_BUTTONPLAY));
|
||||
|
@ -735,14 +735,14 @@ bool C4Console::UpdateHaltCtrls(bool fHalt)
|
|||
g_signal_handler_unblock(btnHalt, handlerHalt);
|
||||
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Console::SaveGame(BOOL fSaveGame)
|
||||
bool C4Console::SaveGame(bool fSaveGame)
|
||||
{
|
||||
// Network hosts only
|
||||
if (::Network.isEnabled() && !::Network.isHost())
|
||||
{ Message(LoadResStr("IDS_GAME_NOCLIENTSAVE")); return FALSE; }
|
||||
{ Message(LoadResStr("IDS_GAME_NOCLIENTSAVE")); return false; }
|
||||
|
||||
|
||||
// Can't save to child groups
|
||||
|
@ -752,11 +752,11 @@ BOOL C4Console::SaveGame(BOOL fSaveGame)
|
|||
str.Format(LoadResStr("IDS_CNS_NOCHILDSAVE"),
|
||||
GetFilename(Game.ScenarioFile.GetName()));
|
||||
Message(str.getData());
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save game to open scenario file
|
||||
BOOL fOkay=TRUE;
|
||||
bool fOkay=true;
|
||||
#ifdef _WIN32
|
||||
SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
#elif defined(WITH_DEVELOPER_MODE)
|
||||
|
@ -770,14 +770,14 @@ BOOL C4Console::SaveGame(BOOL fSaveGame)
|
|||
else
|
||||
pGameSave = new C4GameSaveScenario(!Console.Active || ::Landscape.Mode==C4LSC_Exact, false);
|
||||
if (!pGameSave->Save(Game.ScenarioFile, false))
|
||||
{ Out("Game::Save failed"); fOkay=FALSE; }
|
||||
{ Out("Game::Save failed"); fOkay=false; }
|
||||
delete pGameSave;
|
||||
|
||||
// Close and reopen scenario file to fix file changes
|
||||
if (!Game.ScenarioFile.Close())
|
||||
{ Out("ScenarioFile::Close failed"); fOkay=FALSE; }
|
||||
{ Out("ScenarioFile::Close failed"); fOkay=false; }
|
||||
if (!Game.ScenarioFile.Open(Game.ScenarioFilename))
|
||||
{ Out("ScenarioFile::Open failed"); fOkay=FALSE; }
|
||||
{ Out("ScenarioFile::Open failed"); fOkay=false; }
|
||||
|
||||
#ifdef _WIN32
|
||||
SetCursor(LoadCursor(0,IDC_ARROW));
|
||||
|
@ -792,7 +792,7 @@ BOOL C4Console::SaveGame(BOOL fSaveGame)
|
|||
StdStrBuf str(LoadResStr("IDS_CNS_SCRIPTCREATEDOBJECTS"));
|
||||
str += LoadResStr("IDS_CNS_WARNDOUBLE");
|
||||
Message(str.getData());
|
||||
Game.fScriptCreatedObjects=FALSE;
|
||||
Game.fScriptCreatedObjects=false;
|
||||
}
|
||||
|
||||
// Status report
|
||||
|
@ -802,20 +802,20 @@ BOOL C4Console::SaveGame(BOOL fSaveGame)
|
|||
return fOkay;
|
||||
}
|
||||
|
||||
BOOL C4Console::FileSave(BOOL fSaveGame)
|
||||
bool C4Console::FileSave(bool fSaveGame)
|
||||
{
|
||||
// Don't quicksave games over scenarios
|
||||
if (fSaveGame)
|
||||
if (!Game.C4S.Head.SaveGame)
|
||||
{
|
||||
Message(LoadResStr("IDS_CNS_NOGAMEOVERSCEN"));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Save game
|
||||
return SaveGame(fSaveGame);
|
||||
}
|
||||
|
||||
BOOL C4Console::FileSaveAs(BOOL fSaveGame)
|
||||
bool C4Console::FileSaveAs(bool fSaveGame)
|
||||
{
|
||||
// Do save-as dialog
|
||||
char filename[512+1];
|
||||
|
@ -823,22 +823,22 @@ BOOL C4Console::FileSaveAs(BOOL fSaveGame)
|
|||
if (!FileSelect(filename,512,
|
||||
"Clonk 4 Scenario\0*.c4s\0\0",
|
||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY,
|
||||
TRUE)) return FALSE;
|
||||
true)) return false;
|
||||
DefaultExtension(filename,"c4s");
|
||||
BOOL fOkay=TRUE;
|
||||
bool fOkay=true;
|
||||
// Close current scenario file
|
||||
if (!Game.ScenarioFile.Close()) fOkay=FALSE;
|
||||
if (!Game.ScenarioFile.Close()) fOkay=false;
|
||||
// Copy current scenario file to target
|
||||
if (!C4Group_CopyItem(Game.ScenarioFilename,filename)) fOkay=FALSE;
|
||||
if (!C4Group_CopyItem(Game.ScenarioFilename,filename)) fOkay=false;
|
||||
// Open new scenario file
|
||||
SCopy(filename,Game.ScenarioFilename);
|
||||
|
||||
SetCaption(GetFilename(Game.ScenarioFilename));
|
||||
if (!Game.ScenarioFile.Open(Game.ScenarioFilename)) fOkay=FALSE;
|
||||
if (!Game.ScenarioFile.Open(Game.ScenarioFilename)) fOkay=false;
|
||||
// Failure message
|
||||
if (!fOkay)
|
||||
{
|
||||
Message(FormatString(LoadResStr("IDS_CNS_SAVEASERROR"),Game.ScenarioFilename).getData()); return FALSE;
|
||||
Message(FormatString(LoadResStr("IDS_CNS_SAVEASERROR"),Game.ScenarioFilename).getData()); return false;
|
||||
}
|
||||
// Save game
|
||||
return SaveGame(fSaveGame);
|
||||
|
@ -846,7 +846,7 @@ BOOL C4Console::FileSaveAs(BOOL fSaveGame)
|
|||
|
||||
bool C4Console::Message(const char *szMessage, bool fQuery)
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
#ifdef _WIN32
|
||||
return (IDOK==MessageBox(hWindow,szMessage,C4ENGINECAPTION,fQuery ? (MB_OKCANCEL | MB_ICONEXCLAMATION) : MB_ICONEXCLAMATION));
|
||||
#elif defined(WITH_DEVELOPER_MODE)
|
||||
|
@ -940,36 +940,36 @@ void C4Console::EnableControls(bool fEnable)
|
|||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
}
|
||||
|
||||
BOOL C4Console::FileOpen()
|
||||
bool C4Console::FileOpen()
|
||||
{
|
||||
// Get scenario file name
|
||||
char c4sfile[512+1]="";
|
||||
if (!FileSelect(c4sfile,512,
|
||||
"Clonk 4 Scenario\0*.c4s;*.c4f;Scenario.txt\0\0",
|
||||
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST
|
||||
)) return FALSE;
|
||||
)) return false;
|
||||
// Compose command line
|
||||
char cmdline[2000]="";
|
||||
SAppend("\"",cmdline,1999); SAppend(c4sfile,cmdline,1999); SAppend("\" ",cmdline,1999);
|
||||
// Open game
|
||||
OpenGame(cmdline);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Console::FileOpenWPlrs()
|
||||
bool C4Console::FileOpenWPlrs()
|
||||
{
|
||||
// Get scenario file name
|
||||
char c4sfile[512+1]="";
|
||||
if (!FileSelect(c4sfile,512,
|
||||
"Clonk 4 Scenario\0*.c4s;*.c4f\0\0",
|
||||
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST
|
||||
)) return FALSE;
|
||||
)) return false;
|
||||
// Get player file name(s)
|
||||
char c4pfile[4096+1]="";
|
||||
if (!FileSelect(c4pfile,4096,
|
||||
"Clonk 4 Player\0*.c4p\0\0",
|
||||
OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT | OFN_EXPLORER
|
||||
)) return FALSE;
|
||||
)) return false;
|
||||
// Compose command line
|
||||
char cmdline[6000]="";
|
||||
SAppend("\"",cmdline,5999); SAppend(c4sfile,cmdline,5999); SAppend("\" ",cmdline,5999);
|
||||
|
@ -990,15 +990,15 @@ BOOL C4Console::FileOpenWPlrs()
|
|||
}
|
||||
// Open game
|
||||
OpenGame(cmdline);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Console::FileClose()
|
||||
bool C4Console::FileClose()
|
||||
{
|
||||
return CloseGame();
|
||||
}
|
||||
|
||||
BOOL C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DWORD dwFlags, BOOL fSave)
|
||||
bool C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DWORD dwFlags, bool fSave)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
OPENFILENAME ofn;
|
||||
|
@ -1012,7 +1012,7 @@ BOOL C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DW
|
|||
ofn.nFileExtension= GetExtension(sFilename) - sFilename;
|
||||
ofn.Flags=dwFlags;
|
||||
|
||||
BOOL fResult;
|
||||
bool fResult;
|
||||
const char *wd = GetWorkingDirectory();
|
||||
if (fSave)
|
||||
fResult = GetSaveFileName(&ofn);
|
||||
|
@ -1098,7 +1098,7 @@ BOOL C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DW
|
|||
if(response != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
gtk_widget_destroy(dialog);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build result string
|
||||
|
@ -1140,15 +1140,15 @@ BOOL C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DW
|
|||
}
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
return TRUE;
|
||||
return true;
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL C4Console::FileRecord()
|
||||
bool C4Console::FileRecord()
|
||||
{
|
||||
// only in running mode
|
||||
if (!Game.IsRunning || !::Control.IsRuntimeRecordPossible()) return FALSE;
|
||||
if (!Game.IsRunning || !::Control.IsRuntimeRecordPossible()) return false;
|
||||
// start record!
|
||||
::Control.RequestRuntimeRecord();
|
||||
// disable menuitem
|
||||
|
@ -1157,7 +1157,7 @@ BOOL C4Console::FileRecord()
|
|||
#elif defined(WITH_DEVELOPER_MODE)
|
||||
gtk_widget_set_sensitive(fileRecord, false);
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Console::ClearPointers(C4Object *pObj)
|
||||
|
@ -1199,10 +1199,10 @@ void C4Console::Close()
|
|||
Application.Quit();
|
||||
}
|
||||
|
||||
BOOL C4Console::FileQuit()
|
||||
bool C4Console::FileQuit()
|
||||
{
|
||||
Close();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Console::HelpAbout()
|
||||
|
@ -1224,7 +1224,7 @@ void C4Console::ViewportNew()
|
|||
|
||||
bool C4Console::UpdateCursorBar(const char *szCursor)
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
#ifdef _WIN32
|
||||
// Cursor
|
||||
SetDlgItemText(hWindow,IDC_STATICCURSOR,szCursor);
|
||||
|
@ -1232,12 +1232,12 @@ bool C4Console::UpdateCursorBar(const char *szCursor)
|
|||
#elif defined(WITH_DEVELOPER_MODE)
|
||||
gtk_label_set_label(GTK_LABEL(lblCursor), szCursor);
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::UpdateViewportMenu()
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
ClearViewportMenu();
|
||||
#ifdef _WIN32
|
||||
HMENU hMenu = GetSubMenu(GetMenu(hWindow),MenuIndexViewport);
|
||||
|
@ -1255,7 +1255,7 @@ bool C4Console::UpdateViewportMenu()
|
|||
gtk_widget_show(menuItem);
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Console::ClearViewportMenu()
|
||||
|
@ -1276,9 +1276,9 @@ void C4Console::ClearViewportMenu()
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL C4Console::AddMenuItem(HMENU hMenu, DWORD dwID, const char *szString, BOOL fEnabled)
|
||||
bool C4Console::AddMenuItem(HMENU hMenu, DWORD dwID, const char *szString, bool fEnabled)
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
MENUITEMINFO minfo;
|
||||
ZeroMem(&minfo,sizeof(minfo));
|
||||
minfo.cbSize = sizeof(minfo);
|
||||
|
@ -1401,7 +1401,7 @@ void C4Console::UpdateInputCtrl()
|
|||
|
||||
bool C4Console::UpdatePlayerMenu()
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
ClearPlayerMenu();
|
||||
#ifdef _WIN32
|
||||
HMENU hMenu = GetSubMenu(GetMenu(hWindow),MenuIndexPlayer);
|
||||
|
@ -1425,7 +1425,7 @@ bool C4Console::UpdatePlayerMenu()
|
|||
gtk_widget_set_sensitive(menuItem, (!::Network.isEnabled() || ::Network.isHost()) && Editing);
|
||||
#endif // WITH_DEVELOPER_MODE / _WIN32
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Console::ClearPlayerMenu()
|
||||
|
@ -1633,7 +1633,7 @@ bool C4Console::OpenGame(const char *szCmdLine)
|
|||
Default();
|
||||
SetCaption(GetFilename(Game.ScenarioFile.GetName()));
|
||||
// Init game dependent members
|
||||
if (!EditCursor.Init()) return FALSE;
|
||||
if (!EditCursor.Init()) return false;
|
||||
// Default game - only if open before, because we do not want to default out the GUI
|
||||
if (fGameWasOpen) Game.Default();
|
||||
|
||||
|
@ -1642,35 +1642,35 @@ bool C4Console::OpenGame(const char *szCmdLine)
|
|||
Game.ParseCommandLine(szCmdLine);
|
||||
|
||||
// PreInit is required because GUI has been deleted
|
||||
if(!Game.PreInit() ) { Game.Clear(); return FALSE; }
|
||||
if(!Game.PreInit() ) { Game.Clear(); return false; }
|
||||
|
||||
// Init game
|
||||
if (!Game.Init())
|
||||
{
|
||||
Game.Clear();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Console updates
|
||||
fGameOpen=TRUE;
|
||||
fGameOpen=true;
|
||||
UpdateInputCtrl();
|
||||
EnableControls(fGameOpen);
|
||||
UpdatePlayerMenu();
|
||||
UpdateViewportMenu();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::CloseGame()
|
||||
{
|
||||
if (!fGameOpen) return FALSE;
|
||||
if (!fGameOpen) return false;
|
||||
Game.Clear();
|
||||
Game.GameOver=FALSE; // No leftover values when exiting on closed game
|
||||
Game.GameOverDlgShown=FALSE;
|
||||
fGameOpen=FALSE;
|
||||
Game.GameOver=false; // No leftover values when exiting on closed game
|
||||
Game.GameOverDlgShown=false;
|
||||
fGameOpen=false;
|
||||
EnableControls(fGameOpen);
|
||||
SetCaption(LoadResStr("IDS_CNS_CONSOLE"));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Console::TogglePause()
|
||||
|
@ -1732,22 +1732,22 @@ void C4Console::OnFileOpenWPlrs(GtkWidget* item, gpointer data)
|
|||
|
||||
void C4Console::OnFileSave(GtkWidget* item, gpointer data)
|
||||
{
|
||||
static_cast<C4Console*>(data)->FileSave(FALSE);
|
||||
static_cast<C4Console*>(data)->FileSave(false);
|
||||
}
|
||||
|
||||
void C4Console::OnFileSaveAs(GtkWidget* item, gpointer data)
|
||||
{
|
||||
static_cast<C4Console*>(data)->FileSaveAs(FALSE);
|
||||
static_cast<C4Console*>(data)->FileSaveAs(false);
|
||||
}
|
||||
|
||||
void C4Console::OnFileSaveGame(GtkWidget* item, gpointer data)
|
||||
{
|
||||
static_cast<C4Console*>(data)->FileSave(TRUE);
|
||||
static_cast<C4Console*>(data)->FileSave(true);
|
||||
}
|
||||
|
||||
void C4Console::OnFileSaveGameAs(GtkWidget* item, gpointer data)
|
||||
{
|
||||
static_cast<C4Console*>(data)->FileSaveAs(TRUE);
|
||||
static_cast<C4Console*>(data)->FileSaveAs(true);
|
||||
}
|
||||
|
||||
void C4Console::OnFileRecord(GtkWidget* item, gpointer data)
|
||||
|
|
|
@ -58,7 +58,7 @@ class C4Console: public C4ConsoleBase
|
|||
public:
|
||||
C4Console();
|
||||
virtual ~C4Console();
|
||||
BOOL Editing;
|
||||
bool Editing;
|
||||
C4PropertyDlg PropertyDlg;
|
||||
C4ToolsDlg ToolsDlg;
|
||||
C4ObjectListDlg ObjectListDlg;
|
||||
|
@ -69,7 +69,7 @@ class C4Console: public C4ConsoleBase
|
|||
virtual CStdWindow * Init(CStdApp * app);
|
||||
void Execute();
|
||||
void ClearPointers(C4Object *pObj);
|
||||
bool Message(const char *szMessage, bool fQuery=FALSE);
|
||||
bool Message(const char *szMessage, bool fQuery=false);
|
||||
void SetCaption(const char *szCaption);
|
||||
bool In(const char *szText);
|
||||
bool Out(const char *szText);
|
||||
|
@ -102,16 +102,16 @@ class C4Console: public C4ConsoleBase
|
|||
void EditTitle();
|
||||
void ViewportNew();
|
||||
void HelpAbout();
|
||||
BOOL FileSelect(char *sFilename, int iSize, const char *szFilter, DWORD dwFlags, BOOL fSave=FALSE);
|
||||
BOOL SaveGame(BOOL fSaveGame);
|
||||
BOOL FileSaveAs(BOOL fSaveGame);
|
||||
BOOL FileSave(BOOL fSaveGame);
|
||||
BOOL FileOpen();
|
||||
BOOL FileOpenWPlrs();
|
||||
BOOL FileCommand();
|
||||
BOOL FileClose();
|
||||
BOOL FileQuit();
|
||||
BOOL FileRecord();
|
||||
bool FileSelect(char *sFilename, int iSize, const char *szFilter, DWORD dwFlags, bool fSave=false);
|
||||
bool SaveGame(bool fSaveGame);
|
||||
bool FileSaveAs(bool fSaveGame);
|
||||
bool FileSave(bool fSaveGame);
|
||||
bool FileOpen();
|
||||
bool FileOpenWPlrs();
|
||||
bool FileCommand();
|
||||
bool FileClose();
|
||||
bool FileQuit();
|
||||
bool FileRecord();
|
||||
|
||||
int ScriptCounter;
|
||||
int FrameCounter;
|
||||
|
@ -124,8 +124,8 @@ class C4Console: public C4ConsoleBase
|
|||
int MenuIndexHelp;
|
||||
#ifdef _WIN32
|
||||
void UpdateMenuText(HMENU hMenu);
|
||||
BOOL AddMenuItem(HMENU hMenu, DWORD dwID, const char *szString, BOOL fEnabled=TRUE);
|
||||
BOOL RegisterConsoleWindowClass(HINSTANCE hInst);
|
||||
bool AddMenuItem(HMENU hMenu, DWORD dwID, const char *szString, bool fEnabled=true);
|
||||
virtual bool Win32DialogMessageHandling(MSG * msg)
|
||||
{
|
||||
return (hWindow && IsDialogMessage(hWindow,msg)) || (PropertyDlg.hDialog && IsDialogMessage(PropertyDlg.hDialog,msg));
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace
|
|||
{
|
||||
// Just hide the window, don't destroy it
|
||||
C4DevmodeDlg::SwitchPage(NULL);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,14 @@ void C4DevmodeDlg::AddPage(GtkWidget* widget, GtkWindow* parent, const char* tit
|
|||
if(window == NULL)
|
||||
{
|
||||
notebook = gtk_notebook_new();
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
|
||||
gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), false);
|
||||
gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), false);
|
||||
gtk_widget_show(GTK_WIDGET(notebook));
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_add(GTK_CONTAINER(window), notebook);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
|
||||
gtk_window_set_resizable(GTK_WINDOW(window), true);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_UTILITY);
|
||||
gtk_window_set_role(GTK_WINDOW(window), "toolbox");
|
||||
|
||||
|
|
|
@ -95,12 +95,12 @@ void C4EditCursor::Execute()
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::Init()
|
||||
bool C4EditCursor::Init()
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!(hMenu = LoadMenu(Application.GetInstance(),MAKEINTRESOURCE(IDR_CONTEXTMENUS))))
|
||||
return FALSE;
|
||||
return false;
|
||||
#else // _WIN32
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
menuContext = gtk_menu_new();
|
||||
|
@ -126,7 +126,7 @@ BOOL C4EditCursor::Init()
|
|||
#endif // _WIN32
|
||||
Console.UpdateModeCtrls(Mode);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4EditCursor::ClearPointers(C4Object *pObj)
|
||||
|
@ -180,10 +180,10 @@ bool C4EditCursor::Move(float iX, float iY, WORD wKeyFlags)
|
|||
|
||||
// Update
|
||||
UpdateStatusBar();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::UpdateStatusBar()
|
||||
bool C4EditCursor::UpdateStatusBar()
|
||||
{
|
||||
StdStrBuf str;
|
||||
switch (Mode)
|
||||
|
@ -210,11 +210,11 @@ void C4EditCursor::OnSelectionChanged()
|
|||
fSelectionChanged = true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::LeftButtonDown(BOOL fControl)
|
||||
bool C4EditCursor::LeftButtonDown(bool fControl)
|
||||
{
|
||||
|
||||
// Hold
|
||||
Hold=TRUE;
|
||||
Hold=true;
|
||||
|
||||
switch (Mode)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ BOOL C4EditCursor::LeftButtonDown(BOOL fControl)
|
|||
{ Selection.Clear(); Selection.Add(Target, C4ObjectList::stNone); }
|
||||
// Click on nothing: drag frame
|
||||
if (!Target)
|
||||
{ Selection.Clear(); DragFrame=TRUE; X2=X; Y2=Y; }
|
||||
{ Selection.Clear(); DragFrame=true; X2=X; Y2=Y; }
|
||||
}
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -242,11 +242,11 @@ BOOL C4EditCursor::LeftButtonDown(BOOL fControl)
|
|||
switch (Console.ToolsDlg.Tool)
|
||||
{
|
||||
case C4TLS_Brush: ApplyToolBrush(); break;
|
||||
case C4TLS_Line: DragLine=TRUE; X2=X; Y2=Y; break;
|
||||
case C4TLS_Rect: DragFrame=TRUE; X2=X; Y2=Y; break;
|
||||
case C4TLS_Line: DragLine=true; X2=X; Y2=Y; break;
|
||||
case C4TLS_Rect: DragFrame=true; X2=X; Y2=Y; break;
|
||||
case C4TLS_Fill:
|
||||
if (Game.HaltCount)
|
||||
{ Hold=FALSE; Console.Message(LoadResStr("IDS_CNS_FILLNOHALT")); return FALSE; }
|
||||
{ Hold=false; Console.Message(LoadResStr("IDS_CNS_FILLNOHALT")); return false; }
|
||||
break;
|
||||
case C4TLS_Picker: ApplyToolPicker(); break;
|
||||
}
|
||||
|
@ -257,10 +257,10 @@ BOOL C4EditCursor::LeftButtonDown(BOOL fControl)
|
|||
DropTarget=NULL;
|
||||
|
||||
OnSelectionChanged();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::RightButtonDown(BOOL fControl)
|
||||
bool C4EditCursor::RightButtonDown(bool fControl)
|
||||
{
|
||||
|
||||
switch (Mode)
|
||||
|
@ -293,10 +293,10 @@ BOOL C4EditCursor::RightButtonDown(BOOL fControl)
|
|||
}
|
||||
|
||||
OnSelectionChanged();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::LeftButtonUp()
|
||||
bool C4EditCursor::LeftButtonUp()
|
||||
{
|
||||
// Finish edit/tool
|
||||
switch (Mode)
|
||||
|
@ -322,22 +322,22 @@ BOOL C4EditCursor::LeftButtonUp()
|
|||
}
|
||||
|
||||
// Release
|
||||
Hold=FALSE;
|
||||
DragFrame=FALSE;
|
||||
DragLine=FALSE;
|
||||
Hold=false;
|
||||
DragFrame=false;
|
||||
DragLine=false;
|
||||
DropTarget=NULL;
|
||||
// Update
|
||||
UpdateStatusBar();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL SetMenuItemEnable(HMENU hMenu, WORD id, BOOL fEnable)
|
||||
bool SetMenuItemEnable(HMENU hMenu, WORD id, bool fEnable)
|
||||
{
|
||||
return EnableMenuItem(hMenu,id,MF_BYCOMMAND | MF_ENABLED | ( fEnable ? 0 : MF_GRAYED));
|
||||
}
|
||||
|
||||
BOOL SetMenuItemText(HMENU hMenu, WORD id, const char *szText)
|
||||
bool SetMenuItemText(HMENU hMenu, WORD id, const char *szText)
|
||||
{
|
||||
MENUITEMINFO minfo;
|
||||
ZeroMem(&minfo,sizeof(minfo));
|
||||
|
@ -347,11 +347,11 @@ BOOL SetMenuItemText(HMENU hMenu, WORD id, const char *szText)
|
|||
minfo.wID = id;
|
||||
minfo.dwTypeData = (char*) szText;
|
||||
minfo.cch = SLen(szText);
|
||||
return SetMenuItemInfo(hMenu,id,FALSE,&minfo);
|
||||
return SetMenuItemInfo(hMenu,id,false,&minfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL C4EditCursor::RightButtonUp()
|
||||
bool C4EditCursor::RightButtonUp()
|
||||
{
|
||||
Target=NULL;
|
||||
|
||||
|
@ -359,12 +359,12 @@ BOOL C4EditCursor::RightButtonUp()
|
|||
|
||||
// Update
|
||||
UpdateStatusBar();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4EditCursor::Delete()
|
||||
{
|
||||
if (!EditingOK()) return FALSE;
|
||||
if (!EditingOK()) return false;
|
||||
EMMoveObject(EMMO_Remove, 0, 0, NULL, &Selection);
|
||||
if(::Control.isCtrlHost())
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ bool C4EditCursor::Delete()
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::OpenPropTools()
|
||||
bool C4EditCursor::OpenPropTools()
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
|
@ -385,13 +385,13 @@ BOOL C4EditCursor::OpenPropTools()
|
|||
Console.ToolsDlg.Open();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::Duplicate()
|
||||
bool C4EditCursor::Duplicate()
|
||||
{
|
||||
EMMoveObject(EMMO_Duplicate, 0, 0, NULL, &Selection);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4EditCursor::Draw(C4TargetFacet &cgo, float Zoom)
|
||||
|
@ -477,10 +477,10 @@ void C4EditCursor::FrameSelection()
|
|||
Console.PropertyDlg.Update(Selection);
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::In(const char *szText)
|
||||
bool C4EditCursor::In(const char *szText)
|
||||
{
|
||||
EMMoveObject(EMMO_Script, 0, 0, NULL, &Selection, szText);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4EditCursor::Default()
|
||||
|
@ -492,7 +492,7 @@ void C4EditCursor::Default()
|
|||
#ifdef _WIN32
|
||||
hMenu=NULL;
|
||||
#endif
|
||||
Hold=DragFrame=DragLine=FALSE;
|
||||
Hold=DragFrame=DragLine=false;
|
||||
Selection.Default();
|
||||
fSelectionChanged = false;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ void C4EditCursor::Clear()
|
|||
Selection.Clear();
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::SetMode(int32_t iMode)
|
||||
bool C4EditCursor::SetMode(int32_t iMode)
|
||||
{
|
||||
// Store focus
|
||||
#ifdef _WIN32
|
||||
|
@ -514,22 +514,22 @@ BOOL C4EditCursor::SetMode(int32_t iMode)
|
|||
// Update console buttons (always)
|
||||
Console.UpdateModeCtrls(iMode);
|
||||
// No change
|
||||
if (iMode==Mode) return TRUE;
|
||||
if (iMode==Mode) return true;
|
||||
// Set mode
|
||||
Mode = iMode;
|
||||
// Update prop tools by mode
|
||||
BOOL fOpenPropTools = FALSE;
|
||||
bool fOpenPropTools = false;
|
||||
switch (Mode)
|
||||
{
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CNS_ModeEdit: case C4CNS_ModePlay:
|
||||
if (Console.ToolsDlg.Active || Console.PropertyDlg.Active) fOpenPropTools=TRUE;
|
||||
if (Console.ToolsDlg.Active || Console.PropertyDlg.Active) fOpenPropTools=true;
|
||||
Console.ToolsDlg.Clear();
|
||||
if (fOpenPropTools) OpenPropTools();
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CNS_ModeDraw:
|
||||
if (Console.ToolsDlg.Active || Console.PropertyDlg.Active) fOpenPropTools=TRUE;
|
||||
if (Console.ToolsDlg.Active || Console.PropertyDlg.Active) fOpenPropTools=true;
|
||||
Console.PropertyDlg.Clear();
|
||||
if (fOpenPropTools) OpenPropTools();
|
||||
break;
|
||||
|
@ -543,7 +543,7 @@ BOOL C4EditCursor::SetMode(int32_t iMode)
|
|||
SetFocus(hFocus);
|
||||
#endif
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4EditCursor::ToggleMode()
|
||||
|
@ -600,9 +600,9 @@ void C4EditCursor::ApplyToolFill()
|
|||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Fill, ::Landscape.Mode, X,Y,0,Y2, pTools->Grade, false, pTools->Material));
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::DoContextMenu()
|
||||
bool C4EditCursor::DoContextMenu()
|
||||
{
|
||||
BOOL fObjectSelected = Selection.ObjectCount();
|
||||
bool fObjectSelected = Selection.ObjectCount();
|
||||
#ifdef _WIN32
|
||||
POINT point; GetCursorPos(&point);
|
||||
HMENU hContext = GetSubMenu(hMenu,0);
|
||||
|
@ -640,7 +640,7 @@ BOOL C4EditCursor::DoContextMenu()
|
|||
gtk_menu_popup(GTK_MENU(menuContext), NULL, NULL, NULL, NULL, 3, 0);
|
||||
#endif
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4EditCursor::GrabContents()
|
||||
|
@ -650,7 +650,7 @@ void C4EditCursor::GrabContents()
|
|||
if (!( pFrom = Selection.GetObject() )) return;
|
||||
Selection.Copy(pFrom->Contents);
|
||||
Console.PropertyDlg.Update(Selection);
|
||||
Hold=TRUE;
|
||||
Hold=true;
|
||||
|
||||
// Exit all objects
|
||||
EMMoveObject(EMMO_Exit, 0, 0, NULL, &Selection);
|
||||
|
@ -685,15 +685,15 @@ C4Object *C4EditCursor::GetTarget()
|
|||
return Target;
|
||||
}
|
||||
|
||||
BOOL C4EditCursor::EditingOK()
|
||||
bool C4EditCursor::EditingOK()
|
||||
{
|
||||
if (!Console.Editing)
|
||||
{
|
||||
Hold=FALSE;
|
||||
Hold=false;
|
||||
Console.Message(LoadResStr("IDS_CNS_NONETEDIT"));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t C4EditCursor::GetMode()
|
||||
|
@ -704,7 +704,7 @@ int32_t C4EditCursor::GetMode()
|
|||
void C4EditCursor::ToolFailure()
|
||||
{
|
||||
C4ToolsDlg *pTools=&Console.ToolsDlg;
|
||||
Hold=FALSE;
|
||||
Hold=false;
|
||||
Console.Message(FormatString(LoadResStr("IDS_CNS_NOMATDEF"),pTools->Material,pTools->Texture).getData());
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,7 @@ void C4EditCursor::ApplyToolPicker()
|
|||
Console.ToolsDlg.SelectMaterial(C4TLS_MatSky);
|
||||
break;
|
||||
}
|
||||
Hold=FALSE;
|
||||
Hold=false;
|
||||
}
|
||||
|
||||
void C4EditCursor::EMMoveObject(C4ControlEMObjectAction eAction, int32_t tx, int32_t ty, C4Object *pTargetObj, const C4ObjectList *pObjs, const char *szScript)
|
||||
|
|
|
@ -40,7 +40,7 @@ class C4EditCursor
|
|||
bool fSelectionChanged;
|
||||
int32_t Mode;
|
||||
int32_t X,Y,X2,Y2;
|
||||
BOOL Hold,DragFrame,DragLine;
|
||||
bool Hold,DragFrame,DragLine;
|
||||
C4Object *Target,*DropTarget;
|
||||
#ifdef _WIN32
|
||||
HMENU hMenu;
|
||||
|
@ -64,31 +64,31 @@ class C4EditCursor
|
|||
void Draw(C4TargetFacet &cgo, float Zoom);
|
||||
int32_t GetMode();
|
||||
C4Object* GetTarget();
|
||||
BOOL SetMode(int32_t iMode);
|
||||
BOOL In(const char *szText);
|
||||
BOOL Duplicate();
|
||||
BOOL OpenPropTools();
|
||||
bool SetMode(int32_t iMode);
|
||||
bool In(const char *szText);
|
||||
bool Duplicate();
|
||||
bool OpenPropTools();
|
||||
bool Delete();
|
||||
BOOL LeftButtonUp();
|
||||
BOOL LeftButtonDown(BOOL fControl);
|
||||
BOOL RightButtonUp();
|
||||
BOOL RightButtonDown(BOOL fControl);
|
||||
bool LeftButtonUp();
|
||||
bool LeftButtonDown(bool fControl);
|
||||
bool RightButtonUp();
|
||||
bool RightButtonDown(bool fControl);
|
||||
bool Move(float iX, float iY, WORD wKeyFlags);
|
||||
BOOL Init();
|
||||
BOOL EditingOK();
|
||||
bool Init();
|
||||
bool EditingOK();
|
||||
C4ObjectList &GetSelection() { return Selection; }
|
||||
void SetHold(BOOL fToState) { Hold = fToState; }
|
||||
void SetHold(bool fToState) { Hold = fToState; }
|
||||
void OnSelectionChanged();
|
||||
bool AltDown();
|
||||
bool AltUp();
|
||||
protected:
|
||||
BOOL UpdateStatusBar();
|
||||
bool UpdateStatusBar();
|
||||
void ApplyToolPicker();
|
||||
void ToolFailure();
|
||||
void PutContents();
|
||||
void UpdateDropTarget(WORD wKeyFlags);
|
||||
void GrabContents();
|
||||
BOOL DoContextMenu();
|
||||
bool DoContextMenu();
|
||||
void ApplyToolFill();
|
||||
void ApplyToolRect();
|
||||
void ApplyToolLine();
|
||||
|
|
|
@ -127,23 +127,23 @@ c4_list_get_iter (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreePath * p
|
|||
for (int i = 0; i < depth; ++i)
|
||||
{
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
if (indices[i] < 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
for (int j = 0; j < indices[i]; ++j)
|
||||
{
|
||||
pLnk = pLnk->Next;
|
||||
// Skip Contained Objects in the main list
|
||||
while (i == 0 && pLnk && pLnk->Obj->Contained) pLnk = pLnk->Next;
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
iter->user_data = pLnk;
|
||||
iter->user_data2 = pLnk->Obj->Contained;
|
||||
pLnk = pLnk->Obj->Contents.First;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// converts 'iter' into a new tree path and returns that.
|
||||
|
@ -195,10 +195,10 @@ c4_list_get_path (GtkTreeModel * tree_model, GtkTreeIter * iter)
|
|||
static gboolean
|
||||
c4_list_iter_next (GtkTreeModel * tree_model, GtkTreeIter * iter)
|
||||
{
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), FALSE);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), false);
|
||||
|
||||
if (iter == NULL || iter->user_data == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
C4ObjectLink * pLnk = (C4ObjectLink *) iter->user_data;
|
||||
|
||||
|
@ -209,21 +209,21 @@ c4_list_iter_next (GtkTreeModel * tree_model, GtkTreeIter * iter)
|
|||
while (pLnk && pLnk->Obj->Contained)
|
||||
pLnk = pLnk->Next;
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
iter->user_data = pLnk;
|
||||
iter->user_data2 = pLnk->Obj->Contained;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set 'iter' to the first child of 'parent', or the first top-level row if
|
||||
// 'parent' is 0, or return FALSE if there aren't any children.
|
||||
// 'parent' is 0, or return false if there aren't any children.
|
||||
static gboolean
|
||||
c4_list_iter_children (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIter * parent)
|
||||
{
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), FALSE);
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, false);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), false);
|
||||
|
||||
C4List *c4_list = C4_LIST(tree_model);
|
||||
|
||||
|
@ -240,23 +240,23 @@ c4_list_iter_children (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIte
|
|||
while (pLnk && pLnk->Obj->Contained) pLnk = pLnk->Next;
|
||||
}
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* Set iter to first item in list */
|
||||
iter->stamp = c4_list->stamp;
|
||||
iter->user_data = pLnk;
|
||||
iter->user_data2 = pLnk->Obj->Contained;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return TRUE if 'parent' has children.
|
||||
// Return true if 'parent' has children.
|
||||
static gboolean
|
||||
c4_list_iter_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *parent)
|
||||
{
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), FALSE);
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, false);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), false);
|
||||
|
||||
C4List *c4_list = C4_LIST(tree_model);
|
||||
|
||||
|
@ -303,8 +303,8 @@ c4_list_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *parent)
|
|||
static gboolean
|
||||
c4_list_iter_nth_child (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIter * parent, gint n)
|
||||
{
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), FALSE);
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, FALSE);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), false);
|
||||
g_return_val_if_fail (parent == NULL || parent->user_data != NULL, false);
|
||||
|
||||
C4List *c4_list = C4_LIST(tree_model);
|
||||
|
||||
|
@ -316,7 +316,7 @@ c4_list_iter_nth_child (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIt
|
|||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
pLnk = pLnk->Next;
|
||||
}
|
||||
}
|
||||
|
@ -326,27 +326,27 @@ c4_list_iter_nth_child (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIt
|
|||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
pLnk = pLnk->Next;
|
||||
// Skip...
|
||||
while (pLnk && pLnk->Obj->Contained) pLnk = pLnk->Next;
|
||||
}
|
||||
}
|
||||
if (!pLnk)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
iter->stamp = c4_list->stamp;
|
||||
iter->user_data = pLnk;
|
||||
iter->user_data2 = pLnk->Obj->Contained;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Helper function.
|
||||
static gboolean c4_list_iter_for_C4Object (GtkTreeModel * tree_model, GtkTreeIter * iter, C4ObjectList * pList, C4Object * pObj)
|
||||
{
|
||||
if (!pObj)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
C4List * c4_list = C4_LIST(tree_model);
|
||||
|
||||
|
@ -358,19 +358,19 @@ static gboolean c4_list_iter_for_C4Object (GtkTreeModel * tree_model, GtkTreeIte
|
|||
iter->user_data = pLnk;
|
||||
iter->user_data2 = pLnk->Obj->Contained;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
g_return_val_if_reached(FALSE);
|
||||
g_return_val_if_reached(false);
|
||||
}
|
||||
|
||||
// Sets 'iter' to the parent row of 'child'.
|
||||
static gboolean
|
||||
c4_list_iter_parent (GtkTreeModel * tree_model, GtkTreeIter * iter, GtkTreeIter * child)
|
||||
{
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), FALSE);
|
||||
g_return_val_if_fail (child == NULL || child->user_data != NULL, FALSE);
|
||||
g_return_val_if_fail (C4_IS_LIST (tree_model), false);
|
||||
g_return_val_if_fail (child == NULL || child->user_data != NULL, false);
|
||||
|
||||
C4List * c4_list = C4_LIST(tree_model);
|
||||
|
||||
|
@ -719,7 +719,7 @@ static void icon_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* rend
|
|||
if(object->Def->Graphics.BitmapClr) surface = object->Def->Graphics.BitmapClr;
|
||||
|
||||
const C4Rect& picture = object->Def->PictureRect;
|
||||
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, picture.Wdt, picture.Hgt);
|
||||
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, picture.Wdt, picture.Hgt);
|
||||
guchar* pixels = gdk_pixbuf_get_pixels(pixbuf);
|
||||
surface->Lock();
|
||||
for(int y = 0; y < picture.Hgt; ++ y) for(int x = 0; x < picture.Wdt; ++ x)
|
||||
|
@ -767,7 +767,7 @@ void C4ObjectListDlg::Open()
|
|||
// The Windows
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
|
||||
gtk_window_set_resizable(GTK_WINDOW(window), true);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_UTILITY);
|
||||
gtk_window_set_role(GTK_WINDOW(window), "objectlist");
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Objects");
|
||||
|
@ -778,7 +778,7 @@ void C4ObjectListDlg::Open()
|
|||
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(OnDestroy), this);
|
||||
|
||||
// The VBox and Tree
|
||||
GtkWidget* vbox = gtk_vbox_new(FALSE, 8);
|
||||
GtkWidget* vbox = gtk_vbox_new(false, 8);
|
||||
|
||||
GtkWidget* scrolled_wnd = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_wnd), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
@ -794,19 +794,19 @@ void C4ObjectListDlg::Open()
|
|||
GtkCellRenderer * renderer;
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, FALSE);
|
||||
gtk_tree_view_column_pack_start(col, renderer, false);
|
||||
gtk_tree_view_column_set_cell_data_func(col, renderer, icon_cell_data_func, g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)g_object_unref), (GDestroyNotify)g_hash_table_unref);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_pack_start(col, renderer, true);
|
||||
gtk_tree_view_column_set_cell_data_func(col, renderer, name_cell_data_func, NULL, NULL);
|
||||
|
||||
gtk_tree_view_column_set_title(col, "Name");
|
||||
gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview),col);
|
||||
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
|
||||
gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(treeview), TRUE);
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), false);
|
||||
gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(treeview), true);
|
||||
|
||||
GtkTreeSelection * selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
||||
|
@ -814,7 +814,7 @@ void C4ObjectListDlg::Open()
|
|||
g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(OnSelectionChanged), this);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_wnd), treeview);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), scrolled_wnd, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), scrolled_wnd, true, true, 0);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
|
||||
|
|
|
@ -110,15 +110,15 @@ C4PropertyDlg::~C4PropertyDlg()
|
|||
#endif // WITH_DEVELOPER_MODE
|
||||
}
|
||||
|
||||
BOOL C4PropertyDlg::Open()
|
||||
bool C4PropertyDlg::Open()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (hDialog) return TRUE;
|
||||
if (hDialog) return true;
|
||||
hDialog = CreateDialog(Application.GetInstance(),
|
||||
MAKEINTRESOURCE(IDD_PROPERTIES),
|
||||
Console.hWindow,
|
||||
(DLGPROC) PropertyDlgProc);
|
||||
if (!hDialog) return FALSE;
|
||||
if (!hDialog) return false;
|
||||
// Set text
|
||||
SetWindowText(hDialog,LoadResStr("IDS_DLG_PROPERTIES"));
|
||||
// Enable controls
|
||||
|
@ -133,7 +133,7 @@ BOOL C4PropertyDlg::Open()
|
|||
#ifdef WITH_DEVELOPER_MODE
|
||||
if(vbox == NULL)
|
||||
{
|
||||
vbox = gtk_vbox_new(FALSE, 6);
|
||||
vbox = gtk_vbox_new(false, 6);
|
||||
|
||||
GtkWidget* scrolled_wnd = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_wnd), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
@ -143,10 +143,10 @@ BOOL C4PropertyDlg::Open()
|
|||
entry = gtk_entry_new();
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_wnd), textview);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), scrolled_wnd, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), scrolled_wnd, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), entry, false, false, 0);
|
||||
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), false);
|
||||
gtk_widget_set_sensitive(entry, Console.Editing);
|
||||
|
||||
gtk_widget_show_all(vbox);
|
||||
|
@ -162,12 +162,12 @@ BOOL C4PropertyDlg::Open()
|
|||
#endif // WITH_DEVELOPER_MODE
|
||||
#endif // _WIN32
|
||||
Active = true;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PropertyDlg::Update(C4ObjectList &rSelection)
|
||||
bool C4PropertyDlg::Update(C4ObjectList &rSelection)
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
// Set new selection
|
||||
Selection.Copy(rSelection);
|
||||
// Update input control
|
||||
|
@ -176,17 +176,17 @@ BOOL C4PropertyDlg::Update(C4ObjectList &rSelection)
|
|||
return Update();
|
||||
}
|
||||
|
||||
BOOL IsObjectPointer(int iValue)
|
||||
bool IsObjectPointer(int iValue)
|
||||
{
|
||||
for (C4ObjectLink *cLnk=::Objects.First; cLnk; cLnk=cLnk->Next)
|
||||
if (cLnk->Obj == (C4Object*) iValue)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4PropertyDlg::Update()
|
||||
bool C4PropertyDlg::Update()
|
||||
{
|
||||
if (!Active) return FALSE;
|
||||
if (!Active) return false;
|
||||
|
||||
StdStrBuf Output;
|
||||
|
||||
|
@ -272,7 +272,7 @@ BOOL C4PropertyDlg::Update()
|
|||
gtk_text_buffer_set_text(buffer, Output.getData(), -1);
|
||||
#endif
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PropertyDlg::Default()
|
||||
|
@ -358,7 +358,7 @@ void C4PropertyDlg::UpdateInputCtrl(C4Object *pObj)
|
|||
}
|
||||
// Add object script functions
|
||||
#ifdef _WIN32
|
||||
BOOL fDivider = FALSE;
|
||||
bool fDivider = false;
|
||||
#endif
|
||||
C4AulScriptFunc *pRef;
|
||||
// Object script available
|
||||
|
@ -370,7 +370,7 @@ void C4PropertyDlg::UpdateInputCtrl(C4Object *pObj)
|
|||
{
|
||||
#ifdef _WIN32
|
||||
// Insert divider if necessary
|
||||
if (!fDivider) { SendMessage(hCombo,CB_INSERTSTRING,0,(LPARAM)"----------"); fDivider=TRUE; }
|
||||
if (!fDivider) { SendMessage(hCombo,CB_INSERTSTRING,0,(LPARAM)"----------"); fDivider=true; }
|
||||
#endif
|
||||
// Add function
|
||||
#ifdef _WIN32
|
||||
|
@ -413,12 +413,12 @@ void C4PropertyDlg::OnScriptActivate(GtkWidget* widget, gpointer data)
|
|||
|
||||
void C4PropertyDlg::OnWindowHide(GtkWidget* widget, gpointer user_data)
|
||||
{
|
||||
static_cast<C4PropertyDlg*>(user_data)->Active = FALSE;
|
||||
static_cast<C4PropertyDlg*>(user_data)->Active = false;
|
||||
}
|
||||
|
||||
/*void C4PropertyDlg::OnDestroy(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4PropertyDlg*>(data)->window = NULL;
|
||||
static_cast<C4PropertyDlg*>(data)->Active = FALSE;
|
||||
static_cast<C4PropertyDlg*>(data)->Active = false;
|
||||
}*/
|
||||
#endif
|
||||
|
|
|
@ -40,9 +40,9 @@ class C4PropertyDlg
|
|||
void Execute();
|
||||
void ClearPointers(C4Object *pObj);
|
||||
void UpdateInputCtrl(C4Object *pObj);
|
||||
BOOL Open();
|
||||
BOOL Update();
|
||||
BOOL Update(C4ObjectList &rSelection);
|
||||
bool Open();
|
||||
bool Update();
|
||||
bool Update(C4ObjectList &rSelection);
|
||||
bool Active;
|
||||
#ifdef _WIN32
|
||||
HWND hDialog;
|
||||
|
|
|
@ -91,14 +91,14 @@ namespace {
|
|||
gchar* text;
|
||||
gtk_tree_model_get(model, iter, 0, &text, -1);
|
||||
|
||||
if(SEqual(text, "------")) { g_free(text); return TRUE; }
|
||||
if(SEqual(text, "------")) { g_free(text); return true; }
|
||||
g_free(text);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
GtkWidget* CreateImageFromInlinedPixbuf(const guint8* pixbuf_data)
|
||||
{
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_data, FALSE, NULL);
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_data, false, NULL);
|
||||
GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
|
||||
gdk_pixbuf_unref(pixbuf);
|
||||
return image;
|
||||
|
@ -263,16 +263,16 @@ C4ToolsDlg::~C4ToolsDlg()
|
|||
#endif
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::Open()
|
||||
bool C4ToolsDlg::Open()
|
||||
{
|
||||
// Create dialog window
|
||||
#ifdef _WIN32
|
||||
if (hDialog) return TRUE;
|
||||
if (hDialog) return true;
|
||||
hDialog = CreateDialog(Application.GetInstance(),
|
||||
MAKEINTRESOURCE(IDD_TOOLS),
|
||||
Console.hWindow,
|
||||
(DLGPROC) ToolsDlgProc);
|
||||
if (!hDialog) return FALSE;
|
||||
if (!hDialog) return false;
|
||||
// Set text
|
||||
SetWindowText(hDialog,LoadResStr("IDS_DLG_TOOLS"));
|
||||
SetDlgItemText(hDialog,IDC_STATICMATERIAL,LoadResStr("IDS_CTL_MATERIAL"));
|
||||
|
@ -291,8 +291,8 @@ BOOL C4ToolsDlg::Open()
|
|||
#ifdef WITH_DEVELOPER_MODE
|
||||
if(hbox == NULL)
|
||||
{
|
||||
hbox = gtk_hbox_new(FALSE, 12);
|
||||
GtkWidget* vbox = gtk_vbox_new(FALSE, 6);
|
||||
hbox = gtk_hbox_new(false, 12);
|
||||
GtkWidget* vbox = gtk_vbox_new(false, 6);
|
||||
|
||||
GtkWidget* image_brush = CreateImageFromInlinedPixbuf(brush_pixbuf_data);
|
||||
GtkWidget* image_line = CreateImageFromInlinedPixbuf(line_pixbuf_data);
|
||||
|
@ -315,14 +315,14 @@ BOOL C4ToolsDlg::Open()
|
|||
gtk_container_add(GTK_CONTAINER(landscape_static), image_static);
|
||||
gtk_container_add(GTK_CONTAINER(landscape_exact), image_exact);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_dynamic, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_static, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_exact, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_dynamic, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_static, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), landscape_exact, false, false, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
|
||||
vbox = gtk_vbox_new(FALSE, 12);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
|
||||
GtkWidget* local_hbox = gtk_hbox_new(FALSE, 6);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox, false, false, 0);
|
||||
vbox = gtk_vbox_new(false, 12);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox, true, true, 0);
|
||||
GtkWidget* local_hbox = gtk_hbox_new(false, 6);
|
||||
|
||||
brush = gtk_toggle_button_new();
|
||||
line = gtk_toggle_button_new();
|
||||
|
@ -336,23 +336,23 @@ BOOL C4ToolsDlg::Open()
|
|||
gtk_container_add(GTK_CONTAINER(fill), image_fill);
|
||||
gtk_container_add(GTK_CONTAINER(picker), image_picker);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), brush, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), line, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), rect, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), fill, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), picker, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), brush, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), line, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), rect, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), fill, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), picker, false, false, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), local_hbox, FALSE, FALSE, 0);
|
||||
local_hbox = gtk_hbox_new(FALSE, 12);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), local_hbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), local_hbox, false, false, 0);
|
||||
local_hbox = gtk_hbox_new(false, 12);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), local_hbox, true, true, 0);
|
||||
|
||||
preview = gtk_image_new();
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), preview, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), preview, false, false, 0);
|
||||
|
||||
scale = gtk_vscale_new(NULL);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), scale, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), scale, false, false, 0);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 6);
|
||||
vbox = gtk_vbox_new(false, 6);
|
||||
|
||||
ift = gtk_toggle_button_new();
|
||||
no_ift = gtk_toggle_button_new();
|
||||
|
@ -360,12 +360,12 @@ BOOL C4ToolsDlg::Open()
|
|||
gtk_container_add(GTK_CONTAINER(ift), image_ift);
|
||||
gtk_container_add(GTK_CONTAINER(no_ift), image_no_ift);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), ift, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), no_ift, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), ift, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), no_ift, false, false, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), vbox, false, false, 0);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 6);
|
||||
vbox = gtk_vbox_new(false, 6);
|
||||
|
||||
materials = gtk_combo_box_new_text();
|
||||
textures = gtk_combo_box_new_text();
|
||||
|
@ -373,10 +373,10 @@ BOOL C4ToolsDlg::Open()
|
|||
gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(materials), RowSeparatorFunc, NULL, NULL);
|
||||
gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(textures), RowSeparatorFunc, NULL, NULL);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), materials, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), textures, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), materials, true, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), textures, true, false, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), vbox, TRUE, TRUE, 0); // ???
|
||||
gtk_box_pack_start(GTK_BOX(local_hbox), vbox, true, true, 0); // ???
|
||||
gtk_widget_show_all(hbox);
|
||||
|
||||
C4DevmodeDlg::AddPage(hbox, GTK_WINDOW(Console.window), LoadResStr("IDS_DLG_TOOLS"));
|
||||
|
@ -411,7 +411,7 @@ BOOL C4ToolsDlg::Open()
|
|||
UpdateIFTControls();
|
||||
InitMaterialCtrls();
|
||||
EnableControls();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ToolsDlg::Default()
|
||||
|
@ -429,7 +429,7 @@ void C4ToolsDlg::Default()
|
|||
Active = false;
|
||||
Tool = SelectedTool = C4TLS_Brush;
|
||||
Grade = C4TLS_GradeDefault;
|
||||
ModeIFT = TRUE;
|
||||
ModeIFT = true;
|
||||
SCopy("Earth",Material);
|
||||
SCopy("earth",Texture);
|
||||
}
|
||||
|
@ -450,13 +450,13 @@ void C4ToolsDlg::Clear()
|
|||
Active = false;
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SetTool(int32_t iTool, bool fTemp)
|
||||
bool C4ToolsDlg::SetTool(int32_t iTool, bool fTemp)
|
||||
{
|
||||
Tool=iTool;
|
||||
if (!fTemp) SelectedTool = Tool;
|
||||
UpdateToolCtrls();
|
||||
UpdatePreview();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ToolsDlg::UpdateToolCtrls()
|
||||
|
@ -539,7 +539,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
if (::Landscape.Mode!=C4LSC_Exact)
|
||||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
if (!::TextureMap.GetIndex(Material, szTexture, FALSE))
|
||||
if (!::TextureMap.GetIndex(Material, szTexture, false))
|
||||
{
|
||||
fAnyEntry = true;
|
||||
#ifdef _WIN32
|
||||
|
@ -567,7 +567,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
// Current material-texture valid? Always valid for exact mode
|
||||
if (::TextureMap.GetIndex(Material,szTexture,FALSE) || ::Landscape.Mode==C4LSC_Exact)
|
||||
if (::TextureMap.GetIndex(Material,szTexture,false) || ::Landscape.Mode==C4LSC_Exact)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOTEXTURE,CB_INSERTSTRING,0,(LPARAM)szTexture);
|
||||
|
@ -620,12 +620,12 @@ void C4ToolsDlg::SetTexture(const char *szTexture)
|
|||
UpdatePreview();
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SetIFT(BOOL fIFT)
|
||||
bool C4ToolsDlg::SetIFT(bool fIFT)
|
||||
{
|
||||
if (fIFT) ModeIFT = 1; else ModeIFT=0;
|
||||
UpdateIFTControls();
|
||||
UpdatePreview();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ToolsDlg::SetColorPattern(const char *szMaterial, const char *szTexture)
|
||||
|
@ -678,7 +678,7 @@ void C4ToolsDlg::UpdatePreview()
|
|||
{
|
||||
bCol=Mat2PixColDefault(::MaterialMap.Get(Material));
|
||||
// Get/Create TexMap entry
|
||||
BYTE iTex = ::TextureMap.GetIndex(Material, Texture, TRUE);
|
||||
BYTE iTex = ::TextureMap.GetIndex(Material, Texture, true);
|
||||
if (iTex)
|
||||
{
|
||||
// Define texture pattern
|
||||
|
@ -727,7 +727,7 @@ void C4ToolsDlg::UpdatePreview()
|
|||
#else
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
// TODO: Can we optimize this?
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 64, 64);
|
||||
GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, 64, 64);
|
||||
guchar* data = gdk_pixbuf_get_pixels(pixbuf);
|
||||
sfcPreview->Lock();
|
||||
for(int x = 0; x < 64; ++ x) for(int y = 0; y < 64; ++ y)
|
||||
|
@ -764,18 +764,18 @@ void C4ToolsDlg::InitGradeCtrl()
|
|||
g_signal_handler_block(scale, handlerScale);
|
||||
gtk_range_set_increments(GTK_RANGE(scale), 1, 5);
|
||||
gtk_range_set_range(GTK_RANGE(scale), C4TLS_GradeMin, C4TLS_GradeMax);
|
||||
gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE);
|
||||
gtk_scale_set_draw_value(GTK_SCALE(scale), false);
|
||||
gtk_range_set_value(GTK_RANGE(scale), C4TLS_GradeMax-Grade);
|
||||
g_signal_handler_unblock(scale, handlerScale);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SetGrade(int32_t iGrade)
|
||||
bool C4ToolsDlg::SetGrade(int32_t iGrade)
|
||||
{
|
||||
Grade = BoundBy(iGrade,C4TLS_GradeMin,C4TLS_GradeMax);
|
||||
UpdatePreview();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4ToolsDlg::ChangeGrade(int32_t iChange)
|
||||
|
@ -881,20 +881,20 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls()
|
|||
#endif
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
|
||||
bool C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
|
||||
{
|
||||
int32_t iLastMode=::Landscape.Mode;
|
||||
// Exact to static: confirm data loss warning
|
||||
if (iLastMode==C4LSC_Exact)
|
||||
if (iMode==C4LSC_Static)
|
||||
if (!fThroughControl)
|
||||
if (!Console.Message(LoadResStr("IDS_CNS_EXACTTOSTATIC"),TRUE))
|
||||
return FALSE;
|
||||
if (!Console.Message(LoadResStr("IDS_CNS_EXACTTOSTATIC"),true))
|
||||
return false;
|
||||
// send as control
|
||||
if (!fThroughControl)
|
||||
{
|
||||
::Control.DoInput(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_SetMode, iMode), CDT_Decide);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Set landscape mode
|
||||
::Landscape.SetMode(iMode);
|
||||
|
@ -911,7 +911,7 @@ BOOL C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
|
|||
EnableControls();
|
||||
UpdateTextures();
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ToolsDlg::EnableControls()
|
||||
|
@ -989,18 +989,18 @@ void C4ToolsDlg::AssertValidTexture()
|
|||
// Ignore if sky
|
||||
if (SEqual(Material,C4TLS_MatSky)) return;
|
||||
// Current material-texture valid
|
||||
if (::TextureMap.GetIndex(Material,Texture,FALSE)) return;
|
||||
if (::TextureMap.GetIndex(Material,Texture,false)) return;
|
||||
// Find valid material-texture
|
||||
const char *szTexture;
|
||||
for (int32_t iTexture=0; szTexture=::TextureMap.GetTexture(iTexture); iTexture++)
|
||||
{
|
||||
if (::TextureMap.GetIndex(Material,szTexture,FALSE))
|
||||
if (::TextureMap.GetIndex(Material,szTexture,false))
|
||||
{ SelectTexture(szTexture); return; }
|
||||
}
|
||||
// No valid texture found
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SelectTexture(const char *szTexture)
|
||||
bool C4ToolsDlg::SelectTexture(const char *szTexture)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOTEXTURE,CB_SELECTSTRING,0,(LPARAM)szTexture);
|
||||
|
@ -1012,10 +1012,10 @@ BOOL C4ToolsDlg::SelectTexture(const char *szTexture)
|
|||
#endif
|
||||
#endif
|
||||
SetTexture(szTexture);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ToolsDlg::SelectMaterial(const char *szMaterial)
|
||||
bool C4ToolsDlg::SelectMaterial(const char *szMaterial)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOMATERIAL,CB_SELECTSTRING,0,(LPARAM)szMaterial);
|
||||
|
@ -1027,7 +1027,7 @@ BOOL C4ToolsDlg::SelectMaterial(const char *szMaterial)
|
|||
#endif
|
||||
#endif
|
||||
SetMaterial(szMaterial);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ToolsDlg::SetAlternateTool()
|
||||
|
@ -1047,7 +1047,7 @@ void C4ToolsDlg::ResetAlternateTool()
|
|||
/*void C4ToolsDlg::OnDestroy(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg*>(data)->window = NULL;
|
||||
static_cast<C4ToolsDlg*>(data)->Active = FALSE;
|
||||
static_cast<C4ToolsDlg*>(data)->Active = false;
|
||||
}*/
|
||||
|
||||
void C4ToolsDlg::OnButtonModeDynamic(GtkWidget* widget, gpointer data)
|
||||
|
@ -1092,12 +1092,12 @@ void C4ToolsDlg::OnButtonPicker(GtkWidget* widget, gpointer data)
|
|||
|
||||
void C4ToolsDlg::OnButtonIft(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg*>(data)->SetIFT(TRUE);
|
||||
static_cast<C4ToolsDlg*>(data)->SetIFT(true);
|
||||
}
|
||||
|
||||
void C4ToolsDlg::OnButtonNoIft(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg*>(data)->SetIFT(FALSE);
|
||||
static_cast<C4ToolsDlg*>(data)->SetIFT(false);
|
||||
}
|
||||
|
||||
void C4ToolsDlg::OnComboMaterial(GtkWidget* widget, gpointer data)
|
||||
|
@ -1123,6 +1123,6 @@ void C4ToolsDlg::OnGrade(GtkWidget* widget, gpointer data)
|
|||
|
||||
void C4ToolsDlg::OnWindowHide(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg*>(data)->Active = FALSE;
|
||||
static_cast<C4ToolsDlg*>(data)->Active = false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -118,7 +118,7 @@ class C4ToolsDlg
|
|||
#endif
|
||||
int32_t Tool, SelectedTool;
|
||||
int32_t Grade;
|
||||
BOOL ModeIFT;
|
||||
bool ModeIFT;
|
||||
char Material[C4M_MaxName+1];
|
||||
char Texture[C4M_MaxName+1];
|
||||
protected:
|
||||
|
@ -141,15 +141,15 @@ class C4ToolsDlg
|
|||
bool PopMaterial();
|
||||
bool ChangeGrade(int32_t iChange);
|
||||
void UpdatePreview();
|
||||
BOOL Open();
|
||||
BOOL SetGrade(int32_t iGrade);
|
||||
BOOL SetTool(int32_t iTool, bool fTemp);
|
||||
bool Open();
|
||||
bool SetGrade(int32_t iGrade);
|
||||
bool SetTool(int32_t iTool, bool fTemp);
|
||||
bool ToggleTool() { return !!SetTool((Tool+1)%4, false); }
|
||||
BOOL SetLandscapeMode(int32_t iMode, bool fThroughControl=false);
|
||||
BOOL SetIFT(BOOL fIFT);
|
||||
bool SetLandscapeMode(int32_t iMode, bool fThroughControl=false);
|
||||
bool SetIFT(bool fIFT);
|
||||
bool ToggleIFT() { return !!SetIFT(!ModeIFT); }
|
||||
BOOL SelectTexture(const char *szTexture);
|
||||
BOOL SelectMaterial(const char *szMaterial);
|
||||
bool SelectTexture(const char *szTexture);
|
||||
bool SelectMaterial(const char *szMaterial);
|
||||
void SetAlternateTool();
|
||||
void ResetAlternateTool();
|
||||
protected:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -92,41 +92,41 @@ class C4Landscape
|
|||
void ScanSideOpen();
|
||||
void CheckInstabilityRange(int32_t tx, int32_t ty);
|
||||
void ShakeFree(int32_t tx, int32_t ty, int32_t rad);
|
||||
void DigFree(int32_t tx, int32_t ty, int32_t rad, BOOL fRequest=FALSE, C4Object *pByObj=NULL);
|
||||
void DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, BOOL fRequest=FALSE, C4Object *pByObj=NULL);
|
||||
void DigFree(int32_t tx, int32_t ty, int32_t rad, bool fRequest=false, C4Object *pByObj=NULL);
|
||||
void DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, bool fRequest=false, C4Object *pByObj=NULL);
|
||||
void DigFreeMat(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mat);
|
||||
void BlastFree(int32_t tx, int32_t ty, int32_t rad, int32_t grade, int32_t iByPlayer);
|
||||
void DrawMaterialRect(int32_t mat, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt);
|
||||
void RaiseTerrain(int32_t tx, int32_t ty, int32_t wdt);
|
||||
void FindMatTop(int32_t mat, int32_t &x, int32_t &y);
|
||||
BYTE GetMapIndex(int32_t iX, int32_t iY);
|
||||
BOOL Load(C4Group &hGroup, bool fLoadSky, bool fSavegame);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
BOOL SaveDiff(C4Group &hGroup, bool fSyncSave);
|
||||
BOOL SaveMap(C4Group &hGroup);
|
||||
BOOL SaveInitial();
|
||||
bool Load(C4Group &hGroup, bool fLoadSky, bool fSavegame);
|
||||
bool Save(C4Group &hGroup);
|
||||
bool SaveDiff(C4Group &hGroup, bool fSyncSave);
|
||||
bool SaveMap(C4Group &hGroup);
|
||||
bool SaveInitial();
|
||||
bool SaveTextures(C4Group &hGroup);
|
||||
BOOL Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bool &rfLoaded, bool fSavegame);
|
||||
BOOL MapToLandscape();
|
||||
BOOL ApplyDiff(C4Group &hGroup);
|
||||
BOOL SetMode(int32_t iMode);
|
||||
BOOL SetPix(int32_t x, int32_t y, BYTE npix); // set landscape pixel (bounds checked)
|
||||
BOOL SetPixDw(int32_t x, int32_t y, DWORD dwPix); // set pixel how it is visible only
|
||||
BOOL _SetPix(int32_t x, int32_t y, BYTE npix); // set landsape pixel (bounds not checked)
|
||||
BOOL _SetPixIfMask(int32_t x, int32_t y, BYTE npix, BYTE nMask) ; // set landscape pixel, if it matches nMask color (no bound-checks)
|
||||
BOOL CheckInstability(int32_t tx, int32_t ty);
|
||||
BOOL ClearPix(int32_t tx, int32_t ty);
|
||||
BOOL InsertMaterial(int32_t mat, int32_t tx, int32_t ty, int32_t vx = 0, int32_t vy = 0);
|
||||
BOOL FindMatPath(int32_t &fx, int32_t &fy, int32_t ydir, int32_t mdens, int32_t mslide);
|
||||
BOOL FindMatSlide(int32_t &fx, int32_t &fy, int32_t ydir, int32_t mdens, int32_t mslide);
|
||||
BOOL FindMatPathPush(int32_t &fx, int32_t &fy, int32_t mdens, int32_t mslide, bool liquid);
|
||||
BOOL FindMatPathPull(int32_t &fx, int32_t &fy, int32_t mdens, int32_t mslide, bool liquid);
|
||||
BOOL Incinerate(int32_t x, int32_t y);
|
||||
BOOL DrawBrush(int32_t iX, int32_t iY, int32_t iGrade, const char *szMaterial, const char *szTexture, BOOL fIFT);
|
||||
BOOL DrawLine(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iGrade, const char *szMaterial, const char *szTexture, BOOL fIFT);
|
||||
BOOL DrawBox(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iGrade, const char *szMaterial, const char *szTexture, BOOL fIFT);
|
||||
BOOL DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t icntx, int32_t icnty, const char *szMaterial, const char *szTexture, bool bIFT);
|
||||
BOOL DrawQuad(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iX3, int32_t iY3, int32_t iX4, int32_t iY4, const char *szMaterial, bool bIFT);
|
||||
bool Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bool &rfLoaded, bool fSavegame);
|
||||
bool MapToLandscape();
|
||||
bool ApplyDiff(C4Group &hGroup);
|
||||
bool SetMode(int32_t iMode);
|
||||
bool SetPix(int32_t x, int32_t y, BYTE npix); // set landscape pixel (bounds checked)
|
||||
bool SetPixDw(int32_t x, int32_t y, DWORD dwPix); // set pixel how it is visible only
|
||||
bool _SetPix(int32_t x, int32_t y, BYTE npix); // set landsape pixel (bounds not checked)
|
||||
bool _SetPixIfMask(int32_t x, int32_t y, BYTE npix, BYTE nMask) ; // set landscape pixel, if it matches nMask color (no bound-checks)
|
||||
bool CheckInstability(int32_t tx, int32_t ty);
|
||||
bool ClearPix(int32_t tx, int32_t ty);
|
||||
bool InsertMaterial(int32_t mat, int32_t tx, int32_t ty, int32_t vx = 0, int32_t vy = 0);
|
||||
bool FindMatPath(int32_t &fx, int32_t &fy, int32_t ydir, int32_t mdens, int32_t mslide);
|
||||
bool FindMatSlide(int32_t &fx, int32_t &fy, int32_t ydir, int32_t mdens, int32_t mslide);
|
||||
bool FindMatPathPush(int32_t &fx, int32_t &fy, int32_t mdens, int32_t mslide, bool liquid);
|
||||
bool FindMatPathPull(int32_t &fx, int32_t &fy, int32_t mdens, int32_t mslide, bool liquid);
|
||||
bool Incinerate(int32_t x, int32_t y);
|
||||
bool DrawBrush(int32_t iX, int32_t iY, int32_t iGrade, const char *szMaterial, const char *szTexture, bool fIFT);
|
||||
bool DrawLine(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iGrade, const char *szMaterial, const char *szTexture, bool fIFT);
|
||||
bool DrawBox(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iGrade, const char *szMaterial, const char *szTexture, bool fIFT);
|
||||
bool DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t icntx, int32_t icnty, const char *szMaterial, const char *szTexture, bool bIFT);
|
||||
bool DrawQuad(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iX3, int32_t iY3, int32_t iX4, int32_t iY4, const char *szMaterial, bool bIFT);
|
||||
CStdPalette *GetPal() const { return Surface8 ? Surface8->pPal : NULL; }
|
||||
inline BYTE _GetPix(int32_t x, int32_t y) // get landscape pixel (bounds not checked)
|
||||
{
|
||||
|
@ -187,16 +187,16 @@ class C4Landscape
|
|||
int32_t BlastFreePix(int32_t tx, int32_t ty, int32_t grade, int32_t iBlastSize);
|
||||
int32_t AreaSolidCount(int32_t x, int32_t y, int32_t wdt, int32_t hgt);
|
||||
int32_t ExtractMaterial(int32_t fx, int32_t fy);
|
||||
BOOL DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef); // creates and draws a map section using MapCreatorS2
|
||||
bool DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef); // creates and draws a map section using MapCreatorS2
|
||||
bool ClipRect(int32_t &rX, int32_t &rY, int32_t &rWdt, int32_t &rHgt); // clip given rect by landscape size; return whether anything is left unclipped
|
||||
BOOL DrawDefMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef); // creates and draws a map section using MapCreatorS2 and a map from the loaded Landscape.txt
|
||||
bool DrawDefMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef); // creates and draws a map section using MapCreatorS2 and a map from the loaded Landscape.txt
|
||||
bool SetModulation(DWORD dwWithClr) // adjust the way the landscape is blitted
|
||||
{ Modulation=dwWithClr; return true; }
|
||||
DWORD GetModulation() { return Modulation; }
|
||||
void DiscardMap(); // discard map if present
|
||||
bool PostInitMap(); // do script callbacks of MapCreatorS2 in finished landscape
|
||||
bool ReplaceMapColor(BYTE iOldIndex, BYTE iNewIndex); // find every occurance of iOldIndex in map; replace it by new index
|
||||
BOOL SetTextureIndex(const char *szMatTex, BYTE iNewIndex, bool fInsert); // change color index of map texture, or insert a new one
|
||||
bool SetTextureIndex(const char *szMatTex, BYTE iNewIndex, bool fInsert); // change color index of map texture, or insert a new one
|
||||
void SetMapChanged() { fMapChanged = true; }
|
||||
void HandleTexMapUpdate();
|
||||
void UpdatePixMaps();
|
||||
|
@ -209,12 +209,12 @@ class C4Landscape
|
|||
void DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, int32_t iChunkType, int32_t cro);
|
||||
void DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, BYTE flip, int32_t cro);
|
||||
void ChunkOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iTexture,int32_t iOffX=0,int32_t iOffY=0);
|
||||
BOOL GetTexUsage(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage);
|
||||
BOOL TexOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage, int32_t iToX=0,int32_t iToY=0);
|
||||
BOOL MapToSurface(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
BOOL MapToLandscape(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iOffsX = 0, int32_t iOffsY = 0); // zoom map segment to surface (or sector surfaces)
|
||||
BOOL GetMapColorIndex(const char *szMaterial, const char *szTexture, BOOL fIFT, BYTE &rbyCol);
|
||||
BOOL SkyToLandscape(int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
bool GetTexUsage(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage);
|
||||
bool TexOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage, int32_t iToX=0,int32_t iToY=0);
|
||||
bool MapToSurface(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
bool MapToLandscape(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iOffsX = 0, int32_t iOffsY = 0); // zoom map segment to surface (or sector surfaces)
|
||||
bool GetMapColorIndex(const char *szMaterial, const char *szTexture, bool fIFT, BYTE &rbyCol);
|
||||
bool SkyToLandscape(int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
CSurface8 * CreateMap(); // create map by landscape attributes
|
||||
CSurface8 * CreateMapS2(C4Group &ScenFile); // create map by def file
|
||||
bool Relight(C4Rect To);
|
||||
|
@ -240,19 +240,19 @@ extern C4Landscape Landscape;
|
|||
|
||||
/* Some global landscape functions */
|
||||
|
||||
BOOL AboveSolid(int32_t &rx, int32_t &ry);
|
||||
BOOL AboveSemiSolid(int32_t &rx, int32_t &ry);
|
||||
BOOL SemiAboveSolid(int32_t &rx, int32_t &ry);
|
||||
BOOL FindSolidGround(int32_t &rx, int32_t &ry, int32_t width);
|
||||
BOOL FindLiquid(int32_t &rx, int32_t &ry, int32_t width, int32_t height);
|
||||
BOOL FindSurfaceLiquid(int32_t &rx, int32_t &ry, int32_t width, int32_t height);
|
||||
BOOL FindLevelGround(int32_t &rx, int32_t &ry, int32_t width, int32_t hrange);
|
||||
BOOL FindConSiteSpot(int32_t &rx, int32_t &ry, int32_t wdt, int32_t hgt, DWORD category, int32_t hrange=-1);
|
||||
BOOL FindThrowingPosition(int32_t iTx, int32_t iTy, FIXED fXDir, FIXED fYDir, int32_t iHeight, int32_t &rX, int32_t &rY);
|
||||
BOOL PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL, int32_t *iy=NULL);
|
||||
BOOL PathFreeIgnoreVehicle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL, int32_t *iy=NULL);
|
||||
BOOL FindClosestFree(int32_t &rX, int32_t &rY, int32_t iAngle1, int32_t iAngle2, int32_t iExcludeAngle1, int32_t iExcludeAngle2);
|
||||
BOOL ConstructionCheck(C4PropList *, int32_t iX, int32_t iY, C4Object *pByObj=NULL);
|
||||
bool AboveSolid(int32_t &rx, int32_t &ry);
|
||||
bool AboveSemiSolid(int32_t &rx, int32_t &ry);
|
||||
bool SemiAboveSolid(int32_t &rx, int32_t &ry);
|
||||
bool FindSolidGround(int32_t &rx, int32_t &ry, int32_t width);
|
||||
bool FindLiquid(int32_t &rx, int32_t &ry, int32_t width, int32_t height);
|
||||
bool FindSurfaceLiquid(int32_t &rx, int32_t &ry, int32_t width, int32_t height);
|
||||
bool FindLevelGround(int32_t &rx, int32_t &ry, int32_t width, int32_t hrange);
|
||||
bool FindConSiteSpot(int32_t &rx, int32_t &ry, int32_t wdt, int32_t hgt, DWORD category, int32_t hrange=-1);
|
||||
bool FindThrowingPosition(int32_t iTx, int32_t iTy, FIXED fXDir, FIXED fYDir, int32_t iHeight, int32_t &rX, int32_t &rY);
|
||||
bool PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL, int32_t *iy=NULL);
|
||||
bool PathFreeIgnoreVehicle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix=NULL, int32_t *iy=NULL);
|
||||
bool FindClosestFree(int32_t &rX, int32_t &rY, int32_t iAngle1, int32_t iAngle2, int32_t iExcludeAngle1, int32_t iExcludeAngle2);
|
||||
bool ConstructionCheck(C4PropList *, int32_t iX, int32_t iY, C4Object *pByObj=NULL);
|
||||
int32_t PixCol2Mat(BYTE pixc);
|
||||
|
||||
#define GBackWdt ::Landscape.Width
|
||||
|
|
|
@ -85,7 +85,7 @@ BYTE C4MapCreator::GetPix(int32_t x, int32_t y)
|
|||
|
||||
void C4MapCreator::Create(CSurface8 *sfcMap,
|
||||
C4SLandscape &rLScape, C4TextureMap &rTexMap,
|
||||
BOOL fLayers, int32_t iPlayerNum)
|
||||
bool fLayers, int32_t iPlayerNum)
|
||||
{
|
||||
double fullperiod= 20.0 * pi;
|
||||
BYTE ccol;
|
||||
|
@ -185,27 +185,27 @@ void C4MapCreator::Create(CSurface8 *sfcMap,
|
|||
|
||||
}
|
||||
|
||||
/*BOOL C4MapCreator::Load(
|
||||
/*bool C4MapCreator::Load(
|
||||
BYTE **pbypBuffer,
|
||||
int32_t &rBufWdt, int32_t &rMapWdt, int32_t &rMapHgt,
|
||||
C4Group &hGroup, const char *szEntryName,
|
||||
C4TextureMap &rTexMap)
|
||||
{
|
||||
BOOL fOwnBuf=FALSE;
|
||||
bool fOwnBuf=false;
|
||||
|
||||
CBitmap256Info Bmp;
|
||||
|
||||
// Access entry in group, read bitmap info
|
||||
if (!hGroup.AccessEntry(szEntryName)) return FALSE;
|
||||
if (!hGroup.Read(&Bmp,sizeof(Bmp))) return FALSE;
|
||||
if (!Bmp.Valid()) return FALSE;
|
||||
if (!hGroup.Advance(Bmp.FileBitsOffset())) return FALSE;
|
||||
if (!hGroup.AccessEntry(szEntryName)) return false;
|
||||
if (!hGroup.Read(&Bmp,sizeof(Bmp))) return false;
|
||||
if (!Bmp.Valid()) return false;
|
||||
if (!hGroup.Advance(Bmp.FileBitsOffset())) return false;
|
||||
|
||||
// If buffer is present, check for sufficient size
|
||||
if (*pbypBuffer)
|
||||
{
|
||||
if ((Bmp.Info.biWidth>rMapWdt)
|
||||
|| (Bmp.Info.biHeight>rMapHgt) ) return FALSE;
|
||||
|| (Bmp.Info.biHeight>rMapHgt) ) return false;
|
||||
}
|
||||
// Else, allocate buffer, set sizes
|
||||
else
|
||||
|
@ -214,14 +214,14 @@ void C4MapCreator::Create(CSurface8 *sfcMap,
|
|||
rMapHgt = Bmp.Info.biHeight;
|
||||
rBufWdt = rMapWdt; int dwBufWdt = rBufWdt; DWordAlign(dwBufWdt); rBufWdt = dwBufWdt;
|
||||
if (!(*pbypBuffer = new BYTE [rBufWdt*rMapHgt]))
|
||||
return FALSE;
|
||||
fOwnBuf=TRUE;
|
||||
return false;
|
||||
fOwnBuf=true;
|
||||
}
|
||||
|
||||
// Read bits to buffer
|
||||
for (int32_t cline=Bmp.Info.biHeight-1; cline>=0; cline--)
|
||||
if (!hGroup.Read(*pbypBuffer+rBufWdt*cline,rBufWdt))
|
||||
{ if (fOwnBuf) delete [] *pbypBuffer; return FALSE; }
|
||||
{ if (fOwnBuf) delete [] *pbypBuffer; return false; }
|
||||
|
||||
// Validate texture indices
|
||||
MapBuf=*pbypBuffer;
|
||||
|
@ -229,7 +229,7 @@ void C4MapCreator::Create(CSurface8 *sfcMap,
|
|||
MapWdt=rMapWdt; MapHgt=rMapHgt;
|
||||
ValidateTextureIndices(rTexMap);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}*/
|
||||
|
||||
void C4MapCreator::ValidateTextureIndices(C4TextureMap &rTextureMap)
|
||||
|
|
|
@ -36,8 +36,8 @@ class C4MapCreator
|
|||
public:
|
||||
void Create(CSurface8 *sfcMap,
|
||||
C4SLandscape &rLScape, C4TextureMap &rTexMap,
|
||||
BOOL fLayers=FALSE, int32_t iPlayerNum=1);
|
||||
BOOL Load(BYTE **pbypBuffer,
|
||||
bool fLayers=false, int32_t iPlayerNum=1);
|
||||
bool Load(BYTE **pbypBuffer,
|
||||
int32_t &rBufWdt, int32_t &rMapWdt, int32_t &rMapHgt,
|
||||
C4Group &hGroup, const char *szEntryName,
|
||||
C4TextureMap &rTexMap);
|
||||
|
|
|
@ -736,7 +736,7 @@ void C4MapCreatorS2::Clear()
|
|||
Default();
|
||||
}
|
||||
|
||||
BOOL C4MapCreatorS2::ReadFile(const char *szFilename, C4Group *pGrp)
|
||||
bool C4MapCreatorS2::ReadFile(const char *szFilename, C4Group *pGrp)
|
||||
{
|
||||
// create parser and read file
|
||||
try
|
||||
|
@ -746,13 +746,13 @@ BOOL C4MapCreatorS2::ReadFile(const char *szFilename, C4Group *pGrp)
|
|||
catch(C4MCParserErr err)
|
||||
{
|
||||
err.show();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4MapCreatorS2::ReadScript(const char *szScript)
|
||||
bool C4MapCreatorS2::ReadScript(const char *szScript)
|
||||
{
|
||||
// create parser and read
|
||||
try
|
||||
|
@ -762,10 +762,10 @@ BOOL C4MapCreatorS2::ReadScript(const char *szScript)
|
|||
catch(C4MCParserErr err)
|
||||
{
|
||||
err.show();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4MCMap *C4MapCreatorS2::GetMap(const char *szMapName)
|
||||
|
@ -884,7 +884,7 @@ void C4MCParser::Clear()
|
|||
*Filename=0;
|
||||
}
|
||||
|
||||
BOOL C4MCParser::AdvanceSpaces()
|
||||
bool C4MCParser::AdvanceSpaces()
|
||||
{
|
||||
char C, C2 = (char) 0;
|
||||
// defaultly, not in comment
|
||||
|
@ -903,11 +903,11 @@ BOOL C4MCParser::AdvanceSpaces()
|
|||
{
|
||||
case '/': InComment = 1; break;
|
||||
case '*': InComment = 2; break;
|
||||
default: CPos--; return TRUE;
|
||||
default: CPos--; return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((BYTE) C > 32) return TRUE;
|
||||
if ((BYTE) C > 32) return true;
|
||||
break;
|
||||
case 1:
|
||||
if (((BYTE) C == 13) || ((BYTE) C == 10)) InComment = 0;
|
||||
|
@ -919,14 +919,14 @@ BOOL C4MCParser::AdvanceSpaces()
|
|||
// next char; store prev
|
||||
CPos++; C2 = C;
|
||||
}
|
||||
// end of code reached; return FALSE
|
||||
return FALSE;
|
||||
// end of code reached; return false
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4MCParser::GetNextToken()
|
||||
bool C4MCParser::GetNextToken()
|
||||
{
|
||||
// move to start of token
|
||||
if (!AdvanceSpaces()) { CurrToken=MCT_EOF; return FALSE; }
|
||||
if (!AdvanceSpaces()) { CurrToken=MCT_EOF; return false; }
|
||||
// store offset
|
||||
const char *CPos0 = CPos;
|
||||
int32_t Len = 0;
|
||||
|
@ -941,7 +941,7 @@ BOOL C4MCParser::GetNextToken()
|
|||
TokenGetState State = TGS_None;
|
||||
|
||||
// loop until finished
|
||||
while (TRUE)
|
||||
while (true)
|
||||
{
|
||||
// get char
|
||||
char C = *CPos;
|
||||
|
@ -954,13 +954,13 @@ BOOL C4MCParser::GetNextToken()
|
|||
if (((C >= '0') && (C <= '9') || (C == '+') || (C == '-')))
|
||||
State = TGS_Int; // integer by +, -, 0-9
|
||||
else if (C == '#') State = TGS_Dir; // directive by "#"
|
||||
else if (C == ';') {CPos++; CurrToken=MCT_SCOLON; return TRUE; } // ";"
|
||||
else if (C == '=') {CPos++; CurrToken=MCT_EQ; return TRUE; } // "="
|
||||
else if (C == '{') {CPos++; CurrToken=MCT_BLOPEN; return TRUE; } // "{"
|
||||
else if (C == '}') {CPos++; CurrToken=MCT_BLCLOSE; return TRUE; } // "}"
|
||||
else if (C == '&') {CPos++; CurrToken=MCT_AND; return TRUE; } // "&"
|
||||
else if (C == '|') {CPos++; CurrToken=MCT_OR; return TRUE; } // "|"
|
||||
else if (C == '^') {CPos++; CurrToken=MCT_XOR; return TRUE; } // "^"
|
||||
else if (C == ';') {CPos++; CurrToken=MCT_SCOLON; return true; } // ";"
|
||||
else if (C == '=') {CPos++; CurrToken=MCT_EQ; return true; } // "="
|
||||
else if (C == '{') {CPos++; CurrToken=MCT_BLOPEN; return true; } // "{"
|
||||
else if (C == '}') {CPos++; CurrToken=MCT_BLCLOSE; return true; } // "}"
|
||||
else if (C == '&') {CPos++; CurrToken=MCT_AND; return true; } // "&"
|
||||
else if (C == '|') {CPos++; CurrToken=MCT_OR; return true; } // "|"
|
||||
else if (C == '^') {CPos++; CurrToken=MCT_XOR; return true; } // "^"
|
||||
else if (C >= '@') State = TGS_Ident; // identifier by all non-special chars
|
||||
else
|
||||
{
|
||||
|
@ -978,7 +978,7 @@ BOOL C4MCParser::GetNextToken()
|
|||
Len = Min<int32_t>(Len, C4MaxName);
|
||||
SCopy(CPos0, CurrTokenIdtf, Len);
|
||||
if (State==TGS_Ident) CurrToken=MCT_IDTF; else CurrToken=MCT_DIR;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ BOOL C4MCParser::GetNextToken()
|
|||
SCopy(CPos0, CurrTokenIdtf, Len);
|
||||
// it's not, so return the int32_t
|
||||
sscanf(CurrTokenIdtf, "%d", &CurrTokenVal);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ static void PrintNodeTree(C4MCNode *pNode, int depth)
|
|||
void C4MCParser::ParseTo(C4MCNode *pToNode)
|
||||
{
|
||||
C4MCNode *pNewNode=NULL; // new node
|
||||
BOOL Done=FALSE; // finished?
|
||||
bool Done=false; // finished?
|
||||
C4MCNodeType LastOperand; // last first operand of operator
|
||||
char FieldName[C4MaxName];// buffer for current field to access
|
||||
C4MCNode *pCpyNode; // node to copy from
|
||||
|
@ -1108,7 +1108,7 @@ void C4MCParser::ParseTo(C4MCNode *pToNode)
|
|||
case MCT_BLCLOSE:
|
||||
case MCT_EOF:
|
||||
// block done
|
||||
Done=TRUE;
|
||||
Done=true;
|
||||
break;
|
||||
default:
|
||||
// we don't like that
|
||||
|
|
|
@ -165,8 +165,8 @@ class C4MCNode
|
|||
void Reg2Owner(C4MCNode *pOwner); // register into list
|
||||
|
||||
protected:
|
||||
virtual BOOL GlobalScope() { return FALSE; } // whether node is a global scope
|
||||
virtual BOOL SetOp(C4MCTokenType eOp) { return FALSE; } // set following operator
|
||||
virtual bool GlobalScope() { return false; } // whether node is a global scope
|
||||
virtual bool SetOp(C4MCTokenType eOp) { return false; } // set following operator
|
||||
C4MCNode *GetNodeByName(const char *szName); // search node by name
|
||||
|
||||
virtual bool SetField(C4MCParser *pParser, const char *szField, const char *szSVal, int32_t iVal, C4MCTokenType ValType); // set field
|
||||
|
@ -248,7 +248,7 @@ class C4MCOverlay : public C4MCNode
|
|||
C4MCCallbackArray *pEvaluateFunc; // function called for nodes being evaluated and fulfilled
|
||||
C4MCCallbackArray *pDrawFunc; // function called when this node is drawn - pass drawcolor as first param, return color to be actually used
|
||||
|
||||
BOOL SetOp(C4MCTokenType eOp) { Op=eOp; return TRUE; } // set following operator
|
||||
bool SetOp(C4MCTokenType eOp) { Op=eOp; return true; } // set following operator
|
||||
|
||||
C4MCAlgorithm *GetAlgo(const char *szName);
|
||||
|
||||
|
@ -329,8 +329,8 @@ class C4MapCreatorS2 : public C4MCNode
|
|||
|
||||
void Default(); // set default data
|
||||
void Clear(); // clear any data
|
||||
BOOL ReadFile(const char *szFilename, C4Group *pGrp); // read defs of file
|
||||
BOOL ReadScript(const char *szScript); // reads def directly from mem
|
||||
bool ReadFile(const char *szFilename, C4Group *pGrp); // read defs of file
|
||||
bool ReadScript(const char *szScript); // reads def directly from mem
|
||||
|
||||
public:
|
||||
C4MCMap *GetMap(const char *szMapName); // get map by name
|
||||
|
@ -353,7 +353,7 @@ class C4MapCreatorS2 : public C4MCNode
|
|||
C4MCCallbackArrayList CallbackArrays; // list of callback arrays
|
||||
int PlayerCount; // player count for MapPlayerExtend
|
||||
|
||||
BOOL GlobalScope() { return TRUE; } // it's the global node
|
||||
bool GlobalScope() { return true; } // it's the global node
|
||||
|
||||
public:
|
||||
void ExecuteCallbacks(int32_t iMapZoom) { CallbackArrays.Execute(iMapZoom); }
|
||||
|
@ -390,8 +390,8 @@ class C4MCParser
|
|||
int32_t CurrTokenVal; // current token value
|
||||
char Filename[C4MaxName]; // filename
|
||||
|
||||
BOOL AdvanceSpaces(); // advance to next token char; return whether EOF is reached
|
||||
BOOL GetNextToken(); // get token, store in fields and advance to next; return whether not EOF
|
||||
bool AdvanceSpaces(); // advance to next token char; return whether EOF is reached
|
||||
bool GetNextToken(); // get token, store in fields and advance to next; return whether not EOF
|
||||
void ParseTo(C4MCNode *pToNode); // parse stuff into
|
||||
void ParseValue(C4MCNode *pToNode, const char *szFieldName); // Set Field
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ void C4MassMoverSet::Execute()
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4MassMoverSet::Create(int32_t x, int32_t y, BOOL fExecute)
|
||||
bool C4MassMoverSet::Create(int32_t x, int32_t y, bool fExecute)
|
||||
{
|
||||
if(Count == C4MassMoverChunk) return FALSE;
|
||||
if(Count == C4MassMoverChunk) return false;
|
||||
#ifdef DEBUGREC
|
||||
C4RCMassMover rc;
|
||||
rc.x=x; rc.y=y;
|
||||
|
@ -87,14 +87,14 @@ BOOL C4MassMoverSet::Create(int32_t x, int32_t y, BOOL fExecute)
|
|||
if (cptr>=C4MassMoverChunk) cptr=0;
|
||||
if (Set[cptr].Mat==MNone)
|
||||
{
|
||||
if (!Set[cptr].Init(x,y)) return FALSE;
|
||||
if (!Set[cptr].Init(x,y)) return false;
|
||||
CreatePtr=cptr;
|
||||
if (fExecute) Set[cptr].Execute();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
while (cptr!=CreatePtr);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4MassMoverSet::Draw()
|
||||
|
@ -104,11 +104,11 @@ void C4MassMoverSet::Draw()
|
|||
if (Set[cnt].Mat!=MNone)*/
|
||||
}
|
||||
|
||||
BOOL C4MassMover::Init(int32_t tx, int32_t ty)
|
||||
bool C4MassMover::Init(int32_t tx, int32_t ty)
|
||||
{
|
||||
// Out of bounds check
|
||||
if (!Inside<int32_t>(tx,0,GBackWdt-1) || !Inside<int32_t>(ty,0,GBackHgt-1))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Check mat
|
||||
Mat=GBackMat(tx,ty);
|
||||
x=tx; y=ty;
|
||||
|
@ -127,12 +127,12 @@ void C4MassMover::Cease()
|
|||
Mat=MNone;
|
||||
}
|
||||
|
||||
BOOL C4MassMover::Execute()
|
||||
bool C4MassMover::Execute()
|
||||
{
|
||||
int32_t tx,ty;
|
||||
|
||||
// Lost target material
|
||||
if (GBackMat(x,y)!=Mat) { Cease(); return FALSE; }
|
||||
if (GBackMat(x,y)!=Mat) { Cease(); return false; }
|
||||
|
||||
// Check for transfer target space
|
||||
C4Material *pMat = ::MaterialMap.Map+Mat;
|
||||
|
@ -144,11 +144,11 @@ BOOL C4MassMover::Execute()
|
|||
{
|
||||
// material has been used up
|
||||
::Landscape.ExtractMaterial(x,y);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// No space, die
|
||||
Cease(); return FALSE;
|
||||
Cease(); return false;
|
||||
}
|
||||
|
||||
// do check at this pos for conversion check
|
||||
|
@ -156,7 +156,7 @@ BOOL C4MassMover::Execute()
|
|||
{
|
||||
// material has been used up by conversion
|
||||
::Landscape.ExtractMaterial(x,y);
|
||||
return TRUE;
|
||||
return true;
|
||||
}*/
|
||||
|
||||
// Save back material that is about to be overwritten.
|
||||
|
@ -177,10 +177,10 @@ BOOL C4MassMover::Execute()
|
|||
// Create new mover at target
|
||||
::MassMover.Create(tx,ty,!Rnd3());
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4MassMover::Corrosion(int32_t dx, int32_t dy)
|
||||
bool C4MassMover::Corrosion(int32_t dx, int32_t dy)
|
||||
{
|
||||
// check reaction map of massmover-mat to target mat
|
||||
int32_t tmat=GBackMat(x+dx,y+dy);
|
||||
|
@ -189,9 +189,9 @@ BOOL C4MassMover::Corrosion(int32_t dx, int32_t dy)
|
|||
{
|
||||
FIXED xdir=Fix0, ydir=Fix0;
|
||||
if ((*pReact->pFunc)(pReact, x,y, x+dx,y+dy, xdir,ydir, Mat,tmat, meeMassMove, NULL))
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4MassMoverSet::Default()
|
||||
|
@ -202,7 +202,7 @@ void C4MassMoverSet::Default()
|
|||
CreatePtr=0;
|
||||
}
|
||||
|
||||
BOOL C4MassMoverSet::Save(C4Group &hGroup)
|
||||
bool C4MassMoverSet::Save(C4Group &hGroup)
|
||||
{
|
||||
int32_t cnt;
|
||||
// Consolidate
|
||||
|
@ -216,26 +216,26 @@ BOOL C4MassMoverSet::Save(C4Group &hGroup)
|
|||
if (!Count)
|
||||
{
|
||||
hGroup.Delete(C4CFN_MassMover);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Save set
|
||||
if (!hGroup.Add(C4CFN_MassMover,Set,Count*sizeof(C4MassMover)))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4MassMoverSet::Load(C4Group &hGroup)
|
||||
bool C4MassMoverSet::Load(C4Group &hGroup)
|
||||
{
|
||||
size_t iBinSize,iMoverSize=sizeof(C4MassMover);
|
||||
if (!hGroup.AccessEntry(C4CFN_MassMover,&iBinSize)) return FALSE;
|
||||
if ((iBinSize % iMoverSize)!=0) return FALSE;
|
||||
if (!hGroup.AccessEntry(C4CFN_MassMover,&iBinSize)) return false;
|
||||
if ((iBinSize % iMoverSize)!=0) return false;
|
||||
// clear previous
|
||||
Clear(); Default();
|
||||
// load new
|
||||
Count = iBinSize / iMoverSize;
|
||||
if (!hGroup.Read(Set,iBinSize)) return FALSE;
|
||||
return TRUE;
|
||||
if (!hGroup.Read(Set,iBinSize)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4MassMoverSet::Consolidate()
|
||||
|
|
|
@ -33,9 +33,9 @@ class C4MassMover
|
|||
int32_t Mat,x,y;
|
||||
protected:
|
||||
void Cease();
|
||||
BOOL Execute();
|
||||
BOOL Init(int32_t tx, int32_t ty);
|
||||
BOOL Corrosion(int32_t dx, int32_t dy);
|
||||
bool Execute();
|
||||
bool Init(int32_t tx, int32_t ty);
|
||||
bool Corrosion(int32_t dx, int32_t dy);
|
||||
};
|
||||
|
||||
class C4MassMoverSet
|
||||
|
@ -55,9 +55,9 @@ class C4MassMoverSet
|
|||
void Clear();
|
||||
void Draw();
|
||||
void Execute();
|
||||
BOOL Create(int32_t x, int32_t y, BOOL fExecute=FALSE);
|
||||
BOOL Load(C4Group &hGroup);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool Create(int32_t x, int32_t y, bool fExecute=false);
|
||||
bool Load(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup);
|
||||
protected:
|
||||
void Consolidate();
|
||||
};
|
||||
|
|
|
@ -151,15 +151,15 @@ void C4MaterialCore::Default()
|
|||
Clear();
|
||||
}
|
||||
|
||||
BOOL C4MaterialCore::Load(C4Group &hGroup,
|
||||
bool C4MaterialCore::Load(C4Group &hGroup,
|
||||
const char *szEntryName)
|
||||
{
|
||||
StdStrBuf Source;
|
||||
if (!hGroup.LoadEntryString(szEntryName,Source))
|
||||
return FALSE;
|
||||
return false;
|
||||
StdStrBuf Name = hGroup.GetFullName() + DirSep + szEntryName;
|
||||
if(!CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, Source, Name.getData()))
|
||||
return FALSE;
|
||||
return false;
|
||||
// adjust placement, if not specified
|
||||
if (!Placement)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ BOOL C4MaterialCore::Load(C4Group &hGroup,
|
|||
Placement=10;
|
||||
else Placement=5;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4MaterialCore::CompileFunc(StdCompiler *pComp)
|
||||
|
@ -381,7 +381,7 @@ bool C4MaterialMap::CrossMapMaterials() // Called after load
|
|||
if (!szTextureOverlay)
|
||||
szTextureOverlay = "Smooth";
|
||||
// search/create entry in texmap
|
||||
Map[cnt].DefaultMatTex = ::TextureMap.GetIndex(Map[cnt].Name, szTextureOverlay, TRUE,
|
||||
Map[cnt].DefaultMatTex = ::TextureMap.GetIndex(Map[cnt].Name, szTextureOverlay, true,
|
||||
FormatString("DefaultMatTex of mat %s", Map[cnt].Name).getData());
|
||||
// init PXS facet
|
||||
SURFACE sfcTexture;
|
||||
|
@ -472,13 +472,13 @@ bool C4MaterialMap::CrossMapMaterials() // Called after load
|
|||
for (cnt=0; cnt<Num; cnt++)
|
||||
{
|
||||
if (Map[cnt].sBlastShiftTo.getLength())
|
||||
Map[cnt].BlastShiftTo=::TextureMap.GetIndexMatTex(Map[cnt].sBlastShiftTo.getData(), NULL, TRUE, FormatString("BlastShiftTo of mat %s", Map[cnt].Name).getData());
|
||||
Map[cnt].BlastShiftTo=::TextureMap.GetIndexMatTex(Map[cnt].sBlastShiftTo.getData(), NULL, true, FormatString("BlastShiftTo of mat %s", Map[cnt].Name).getData());
|
||||
if (Map[cnt].sInMatConvertTo.getLength())
|
||||
Map[cnt].InMatConvertTo=Get(Map[cnt].sInMatConvertTo.getData());
|
||||
if (Map[cnt].sBelowTempConvertTo.getLength())
|
||||
Map[cnt].BelowTempConvertTo=::TextureMap.GetIndexMatTex(Map[cnt].sBelowTempConvertTo.getData(), NULL, TRUE, FormatString("BelowTempConvertTo of mat %s", Map[cnt].Name).getData());
|
||||
Map[cnt].BelowTempConvertTo=::TextureMap.GetIndexMatTex(Map[cnt].sBelowTempConvertTo.getData(), NULL, true, FormatString("BelowTempConvertTo of mat %s", Map[cnt].Name).getData());
|
||||
if (Map[cnt].sAboveTempConvertTo.getLength())
|
||||
Map[cnt].AboveTempConvertTo=::TextureMap.GetIndexMatTex(Map[cnt].sAboveTempConvertTo.getData(), NULL, TRUE, FormatString("AboveTempConvertTo of mat %s", Map[cnt].Name).getData());
|
||||
Map[cnt].AboveTempConvertTo=::TextureMap.GetIndexMatTex(Map[cnt].sAboveTempConvertTo.getData(), NULL, true, FormatString("AboveTempConvertTo of mat %s", Map[cnt].Name).getData());
|
||||
}
|
||||
#if 0
|
||||
int32_t i=0;
|
||||
|
@ -510,7 +510,7 @@ void C4MaterialMap::SetMatReaction(int32_t iPXSMat, int32_t iLSMat, C4MaterialRe
|
|||
ppReactionMap[(iLSMat+1)*(Num+1) + iPXSMat+1] = pReact;
|
||||
}
|
||||
|
||||
BOOL C4MaterialMap::SaveEnumeration(C4Group &hGroup)
|
||||
bool C4MaterialMap::SaveEnumeration(C4Group &hGroup)
|
||||
{
|
||||
char *mapbuf = new char [1000];
|
||||
mapbuf[0]=0;
|
||||
|
@ -521,20 +521,20 @@ BOOL C4MaterialMap::SaveEnumeration(C4Group &hGroup)
|
|||
SAppend(LineFeed,mapbuf);
|
||||
}
|
||||
SAppend(EndOfFile,mapbuf);
|
||||
return hGroup.Add(C4CFN_MatMap,mapbuf,SLen(mapbuf),FALSE,TRUE);
|
||||
return hGroup.Add(C4CFN_MatMap,mapbuf,SLen(mapbuf),false,true);
|
||||
}
|
||||
|
||||
BOOL C4MaterialMap::LoadEnumeration(C4Group &hGroup)
|
||||
bool C4MaterialMap::LoadEnumeration(C4Group &hGroup)
|
||||
{
|
||||
// Load enumeration map (from savegame), succeed if not present
|
||||
StdStrBuf mapbuf;
|
||||
if (!hGroup.LoadEntryString(C4CFN_MatMap, mapbuf)) return TRUE;
|
||||
if (!hGroup.LoadEntryString(C4CFN_MatMap, mapbuf)) return true;
|
||||
|
||||
// Sort material array by enumeration map, fail if some missing
|
||||
const char *csearch;
|
||||
char cmatname[C4M_MaxName+1];
|
||||
int32_t cmat=0;
|
||||
if (!(csearch = SSearch(mapbuf.getData(),"[Enumeration]"))) { return FALSE; }
|
||||
if (!(csearch = SSearch(mapbuf.getData(),"[Enumeration]"))) { return false; }
|
||||
csearch=SAdvanceSpace(csearch);
|
||||
while (IsIdentifier(*csearch))
|
||||
{
|
||||
|
@ -542,21 +542,21 @@ BOOL C4MaterialMap::LoadEnumeration(C4Group &hGroup)
|
|||
if (!SortEnumeration(cmat,cmatname))
|
||||
{
|
||||
// Output error message!
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
cmat++;
|
||||
csearch+=SLen(cmatname);
|
||||
csearch=SAdvanceSpace(csearch);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4MaterialMap::SortEnumeration(int32_t iMat, const char *szMatName)
|
||||
bool C4MaterialMap::SortEnumeration(int32_t iMat, const char *szMatName)
|
||||
{
|
||||
|
||||
// Not enough materials loaded
|
||||
if (iMat>=Num) return FALSE;
|
||||
if (iMat>=Num) return false;
|
||||
|
||||
// Find requested mat
|
||||
int32_t cmat;
|
||||
|
@ -564,10 +564,10 @@ BOOL C4MaterialMap::SortEnumeration(int32_t iMat, const char *szMatName)
|
|||
if (SEqual(szMatName,Map[cmat].Name))
|
||||
break;
|
||||
// Not found
|
||||
if (cmat>=Num) return FALSE;
|
||||
if (cmat>=Num) return false;
|
||||
|
||||
// already the same?
|
||||
if (cmat == iMat) return TRUE;
|
||||
if (cmat == iMat) return true;
|
||||
|
||||
// Move requested mat to indexed position
|
||||
C4Material mswap;
|
||||
|
@ -575,7 +575,7 @@ BOOL C4MaterialMap::SortEnumeration(int32_t iMat, const char *szMatName)
|
|||
Map[iMat] = Map[cmat];
|
||||
Map[cmat] = mswap;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4MaterialMap::Default()
|
||||
|
|
|
@ -124,7 +124,7 @@ class C4MaterialCore
|
|||
public:
|
||||
void Clear();
|
||||
void Default();
|
||||
BOOL Load(C4Group &hGroup, const char *szEntryName);
|
||||
bool Load(C4Group &hGroup, const char *szEntryName);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
};
|
||||
|
||||
|
@ -170,8 +170,8 @@ class C4MaterialMap
|
|||
int32_t Load(C4Group &hGroup, C4Group* OverloadFile = 0);
|
||||
bool HasMaterials(C4Group &hGroup) const;
|
||||
int32_t Get(const char *szMaterial);
|
||||
BOOL SaveEnumeration(C4Group &hGroup);
|
||||
BOOL LoadEnumeration(C4Group &hGroup);
|
||||
bool SaveEnumeration(C4Group &hGroup);
|
||||
bool LoadEnumeration(C4Group &hGroup);
|
||||
C4MaterialReaction *GetReactionUnsafe(int32_t iPXSMat, int32_t iLandscapeMat)
|
||||
{ assert(ppReactionMap); assert(Inside<int32_t>(iPXSMat,-1,Num-1)); assert(Inside<int32_t>(iLandscapeMat,-1,Num-1));
|
||||
return ppReactionMap[(iLandscapeMat+1)*(Num+1) + iPXSMat+1]; }
|
||||
|
@ -180,7 +180,7 @@ class C4MaterialMap
|
|||
bool CrossMapMaterials();
|
||||
protected:
|
||||
void SetMatReaction(int32_t iPXSMat, int32_t iLSMat, C4MaterialReaction *pReact);
|
||||
BOOL SortEnumeration(int32_t iMat, const char *szMatName);
|
||||
bool SortEnumeration(int32_t iMat, const char *szMatName);
|
||||
};
|
||||
|
||||
extern C4MaterialMap MaterialMap;
|
||||
|
|
|
@ -201,15 +201,15 @@ C4PXS* C4PXSSystem::New()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL C4PXSSystem::Create(int32_t mat, FIXED ix, FIXED iy, FIXED ixdir, FIXED iydir)
|
||||
bool C4PXSSystem::Create(int32_t mat, FIXED ix, FIXED iy, FIXED ixdir, FIXED iydir)
|
||||
{
|
||||
C4PXS *pxp;
|
||||
if (!MatValid(mat)) return FALSE;
|
||||
if (!(pxp=New())) return FALSE;
|
||||
if (!MatValid(mat)) return false;
|
||||
if (!(pxp=New())) return false;
|
||||
pxp->Mat=mat;
|
||||
pxp->x=ix; pxp->y=iy;
|
||||
pxp->xdir=ixdir; pxp->ydir=iydir;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PXSSystem::Execute()
|
||||
|
@ -325,7 +325,7 @@ void C4PXSSystem::Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t
|
|||
itofix(Random(level+1)-level)/10);
|
||||
}
|
||||
|
||||
BOOL C4PXSSystem::Save(C4Group &hGroup)
|
||||
bool C4PXSSystem::Save(C4Group &hGroup)
|
||||
{
|
||||
unsigned int cnt;
|
||||
|
||||
|
@ -339,61 +339,61 @@ BOOL C4PXSSystem::Save(C4Group &hGroup)
|
|||
if (!iChunks)
|
||||
{
|
||||
hGroup.Delete(C4CFN_PXS);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Save chunks to temp file
|
||||
CStdFile hTempFile;
|
||||
if (!hTempFile.Create(Config.AtTempPath(C4CFN_TempPXS)))
|
||||
return FALSE;
|
||||
return false;
|
||||
#ifdef USE_FIXED
|
||||
int32_t iNumFormat = 1;
|
||||
#else
|
||||
int32_t iNumFormat = 2;
|
||||
#endif
|
||||
if(!hTempFile.Write(&iNumFormat, sizeof (iNumFormat)))
|
||||
return FALSE;
|
||||
return false;
|
||||
for (cnt=0; cnt<PXSMaxChunk; cnt++)
|
||||
if (Chunk[cnt]) // must save all chunks in order to keep order consistent on all clients
|
||||
if (!hTempFile.Write(Chunk[cnt],PXSChunkSize * sizeof(C4PXS)))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!hTempFile.Close())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Move temp file to group
|
||||
if (!hGroup.Move( Config.AtTempPath(C4CFN_TempPXS),
|
||||
C4CFN_PXS ))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PXSSystem::Load(C4Group &hGroup)
|
||||
bool C4PXSSystem::Load(C4Group &hGroup)
|
||||
{
|
||||
// load new
|
||||
size_t iBinSize,iChunkNum,cnt2;
|
||||
size_t iChunkSize = PXSChunkSize * sizeof(C4PXS);
|
||||
if (!hGroup.AccessEntry(C4CFN_PXS,&iBinSize)) return FALSE;
|
||||
if (!hGroup.AccessEntry(C4CFN_PXS,&iBinSize)) return false;
|
||||
// clear previous
|
||||
Clear();
|
||||
// using FIXED or float?
|
||||
int32_t iNumForm = 1;
|
||||
if(iBinSize % iChunkSize == 4)
|
||||
{
|
||||
if(!hGroup.Read(&iNumForm, sizeof (iNumForm))) return FALSE;
|
||||
if(!Inside<int32_t>(iNumForm, 1, 2)) return FALSE;
|
||||
if(!hGroup.Read(&iNumForm, sizeof (iNumForm))) return false;
|
||||
if(!Inside<int32_t>(iNumForm, 1, 2)) return false;
|
||||
iBinSize -= 4;
|
||||
}
|
||||
// old pxs-files have no tag for the number format
|
||||
else if(iBinSize % iChunkSize != 0) return FALSE;
|
||||
else if(iBinSize % iChunkSize != 0) return false;
|
||||
// calc chunk count
|
||||
iChunkNum = iBinSize / iChunkSize;
|
||||
if(iChunkNum > PXSMaxChunk) return FALSE;
|
||||
if(iChunkNum > PXSMaxChunk) return false;
|
||||
for (uint32_t cnt=0; cnt<iChunkNum; cnt++)
|
||||
{
|
||||
if (!(Chunk[cnt]=new C4PXS[PXSChunkSize])) return FALSE;
|
||||
if (!hGroup.Read(Chunk[cnt],iChunkSize)) return FALSE;
|
||||
if (!(Chunk[cnt]=new C4PXS[PXSChunkSize])) return false;
|
||||
if (!hGroup.Read(Chunk[cnt],iChunkSize)) return false;
|
||||
// count the PXS, Peter!
|
||||
// convert num format, if neccessary
|
||||
C4PXS *pxp; iChunkPXS[cnt]=0;
|
||||
|
@ -409,7 +409,7 @@ BOOL C4PXSSystem::Load(C4Group &hGroup)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PXSSystem::Synchronize()
|
||||
|
|
|
@ -57,9 +57,9 @@ class C4PXSSystem
|
|||
void Synchronize();
|
||||
void SyncClearance();
|
||||
void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level);
|
||||
BOOL Create(int32_t mat, FIXED ix, FIXED iy, FIXED ixdir=Fix0, FIXED iydir=Fix0);
|
||||
BOOL Load(C4Group &hGroup);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool Create(int32_t mat, FIXED ix, FIXED iy, FIXED ixdir=Fix0, FIXED iydir=Fix0);
|
||||
bool Load(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup);
|
||||
protected:
|
||||
C4PXS *New();
|
||||
};
|
||||
|
|
|
@ -108,7 +108,7 @@ void C4PathFinderRay::Clear()
|
|||
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::Execute()
|
||||
bool C4PathFinderRay::Execute()
|
||||
{
|
||||
C4TransferZone *pZone = NULL;
|
||||
int32_t iX,iY,iLastX,iLastY;
|
||||
|
@ -120,7 +120,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
if (UseZone)
|
||||
{
|
||||
// Mark zone used
|
||||
UseZone->Used=TRUE;
|
||||
UseZone->Used=true;
|
||||
// Target in transfer zone: success
|
||||
if (UseZone->At(TargetX,TargetY))
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
// Set complete path
|
||||
SetCompletePath();
|
||||
// Done
|
||||
pPathFinder->Success=TRUE;
|
||||
pPathFinder->Success=true;
|
||||
Status=C4PF_Ray_Still;
|
||||
}
|
||||
// Continue from other end of zone
|
||||
|
@ -144,7 +144,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
// Still
|
||||
Status=C4PF_Ray_Still;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Not in zone: check path to target
|
||||
// Path free: success
|
||||
|
@ -153,9 +153,9 @@ BOOL C4PathFinderRay::Execute()
|
|||
// Set complete path
|
||||
SetCompletePath();
|
||||
// Done
|
||||
pPathFinder->Success=TRUE;
|
||||
pPathFinder->Success=true;
|
||||
Status=C4PF_Ray_Still;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Path intersected by transfer zone
|
||||
else if (pZone)
|
||||
|
@ -169,7 +169,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
// Still
|
||||
Status=C4PF_Ray_Still;
|
||||
// Continue
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Path intersected by solid
|
||||
else
|
||||
|
@ -184,7 +184,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
// Intersected but no attach found: unexpected failure
|
||||
if (!CrawlAttach) { Status=C4PF_Ray_Failure; break; }
|
||||
// Continue
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -207,7 +207,7 @@ BOOL C4PathFinderRay::Execute()
|
|||
if (!pPathFinder->AddRay(iX,iY,TargetX,TargetY,Depth+1,Direction,this,pZone))
|
||||
{ Status=C4PF_Ray_Failure; break; }
|
||||
// Continue crawling
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Crawl length
|
||||
CrawlLength++;
|
||||
|
@ -238,10 +238,10 @@ BOOL C4PathFinderRay::Execute()
|
|||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4PF_Ray_Still: case C4PF_Ray_Failure: case C4PF_Ray_Deleted:
|
||||
return FALSE;
|
||||
return false;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PathFinderRay::Draw(C4TargetFacet &cgo)
|
||||
|
@ -287,7 +287,7 @@ void C4PathFinderRay::Draw(C4TargetFacet &cgo)
|
|||
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t iToY, C4TransferZone **ppZone)
|
||||
bool C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t iToY, C4TransferZone **ppZone)
|
||||
{
|
||||
int32_t d,dx,dy,aincr,bincr,xincr,yincr,x,y;
|
||||
// Y based
|
||||
|
@ -299,13 +299,13 @@ BOOL C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t i
|
|||
for (y=rY; y!=iToY; y+=yincr)
|
||||
{
|
||||
// Check point free
|
||||
if (PointFree(x,y)) { rY=y; rX=x; } else return FALSE;
|
||||
if (PointFree(x,y)) { rY=y; rX=x; } else return false;
|
||||
// Check transfer zone intersection
|
||||
if (ppZone)
|
||||
if (pPathFinder->TransferZonesEnabled)
|
||||
if (pPathFinder->TransferZones)
|
||||
if (*ppZone = pPathFinder->TransferZones->Find(rX,rY))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Advance
|
||||
if (d>=0) { x+=xincr; d+=aincr; } else d+=bincr;
|
||||
}
|
||||
|
@ -319,19 +319,19 @@ BOOL C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t i
|
|||
for (x=rX; x!=iToX; x+=xincr)
|
||||
{
|
||||
// Check point free
|
||||
if (PointFree(x,y)) { rY=y; rX=x; } else return FALSE;
|
||||
if (PointFree(x,y)) { rY=y; rX=x; } else return false;
|
||||
// Check transfer zone intersection
|
||||
if (ppZone)
|
||||
if (pPathFinder->TransferZonesEnabled)
|
||||
if (pPathFinder->TransferZones)
|
||||
if (*ppZone = pPathFinder->TransferZones->Find(rX,rY))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Advance
|
||||
if (d>=0) { y+=yincr; d+=aincr; } else d+=bincr;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*void C4PathFinderRay::DrawLine(SURFACE sfcSurface, int32_t rX, int32_t rY, int32_t iToX, int32_t iToY, BYTE byCol)
|
||||
|
@ -367,12 +367,12 @@ BOOL C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t i
|
|||
}*/
|
||||
|
||||
|
||||
BOOL C4PathFinderRay::Crawl()
|
||||
bool C4PathFinderRay::Crawl()
|
||||
{
|
||||
|
||||
// No attach: crawl failure (shouldn't ever get here)
|
||||
if (!CrawlAttach)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Last attach lost (don't check on first crawl for that might be a diagonal attach)
|
||||
if (CrawlLength)
|
||||
|
@ -383,9 +383,9 @@ BOOL C4PathFinderRay::Crawl()
|
|||
TurnAttach(CrawlAttach,-Direction);
|
||||
// Safety: new attach not found - unexpected failure
|
||||
if (!IsCrawlAttach(X2,Y2,CrawlAttach))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Corner okay
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check crawl target by attach
|
||||
|
@ -396,14 +396,14 @@ BOOL C4PathFinderRay::Crawl()
|
|||
TurnAttach(CrawlAttach,Direction); iTurned++;
|
||||
// Turned four times: all enclosed, crawl failure
|
||||
if (iTurned==4)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Crawl by attach
|
||||
CrawlByAttach(X2,Y2,CrawlAttach,Direction);
|
||||
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -427,12 +427,12 @@ void C4PathFinderRay::SetCompletePath()
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::PointFree(int32_t iX, int32_t iY)
|
||||
bool C4PathFinderRay::PointFree(int32_t iX, int32_t iY)
|
||||
{
|
||||
return pPathFinder->PointFree(iX,iY);
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::CrawlTargetFree(int32_t iX, int32_t iY, int32_t iAttach, int32_t iDirection)
|
||||
bool C4PathFinderRay::CrawlTargetFree(int32_t iX, int32_t iY, int32_t iAttach, int32_t iDirection)
|
||||
{
|
||||
CrawlByAttach(iX,iY,iAttach,iDirection);
|
||||
return PointFree(iX,iY);
|
||||
|
@ -476,7 +476,7 @@ void C4PathFinderRay::CrawlToAttach(int32_t &rX, int32_t &rY, int32_t iAttach)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::IsCrawlAttach(int32_t iX, int32_t iY, int32_t iAttach)
|
||||
bool C4PathFinderRay::IsCrawlAttach(int32_t iX, int32_t iY, int32_t iAttach)
|
||||
{
|
||||
CrawlToAttach(iX,iY,iAttach);
|
||||
return !PointFree(iX,iY);
|
||||
|
@ -511,14 +511,14 @@ int32_t C4PathFinderRay::FindCrawlAttachDiagonal(int32_t iX, int32_t iY, int32_t
|
|||
return C4PF_Crawl_NoAttach;
|
||||
}
|
||||
|
||||
BOOL C4PathFinderRay::CheckBackRayShorten()
|
||||
bool C4PathFinderRay::CheckBackRayShorten()
|
||||
{
|
||||
C4PathFinderRay *pRay,*pRay2;
|
||||
int32_t iX,iY;
|
||||
for (pRay=From; pRay; pRay=pRay->From)
|
||||
{
|
||||
// Don't shorten transfer over zones
|
||||
if (pRay->UseZone) return FALSE;
|
||||
if (pRay->UseZone) return false;
|
||||
// Skip self
|
||||
if (pRay==From) continue;
|
||||
// Check shortcut
|
||||
|
@ -532,10 +532,10 @@ BOOL C4PathFinderRay::CheckBackRayShorten()
|
|||
pRay->X2=X; pRay->Y2=Y;
|
||||
From=pRay;
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------- C4PathFinder ---------------------------------------------
|
||||
|
@ -556,7 +556,7 @@ void C4PathFinder::Default()
|
|||
SetWaypoint=NULL;
|
||||
FirstRay=NULL;
|
||||
WaypointParameter=0;
|
||||
Success=FALSE;
|
||||
Success=false;
|
||||
TransferZones=NULL;
|
||||
TransferZonesEnabled=true;
|
||||
Level=1;
|
||||
|
@ -595,23 +595,23 @@ void C4PathFinder::Draw(C4TargetFacet &cgo)
|
|||
void C4PathFinder::Run()
|
||||
{
|
||||
if (TransferZones) TransferZones->ClearUsed();
|
||||
Success=FALSE;
|
||||
Success=false;
|
||||
while (!Success && Execute()) {}
|
||||
// Notice that ray zone-pointers might be invalid after run
|
||||
}
|
||||
|
||||
BOOL C4PathFinder::Execute()
|
||||
bool C4PathFinder::Execute()
|
||||
{
|
||||
|
||||
// Execute & count rays
|
||||
BOOL fContinue=FALSE;
|
||||
bool fContinue=false;
|
||||
int32_t iRays=0;
|
||||
for (C4PathFinderRay *pRay=FirstRay; pRay && !Success; pRay=pRay->Next,iRays++)
|
||||
if (pRay->Execute())
|
||||
fContinue=TRUE;
|
||||
fContinue=true;
|
||||
|
||||
// Max ray limit
|
||||
if (iRays>=C4PF_MaxRay) return FALSE;
|
||||
if (iRays>=C4PF_MaxRay) return false;
|
||||
|
||||
// Draw
|
||||
if (::GraphicsSystem.ShowPathfinder)
|
||||
|
@ -627,23 +627,23 @@ BOOL C4PathFinder::Execute()
|
|||
return fContinue;
|
||||
}
|
||||
|
||||
BOOL C4PathFinder::Find(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, bool (*fnSetWaypoint)(int32_t, int32_t, intptr_t, intptr_t), intptr_t iWaypointParameter)
|
||||
bool C4PathFinder::Find(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, bool (*fnSetWaypoint)(int32_t, int32_t, intptr_t, intptr_t), intptr_t iWaypointParameter)
|
||||
{
|
||||
|
||||
// Prepare
|
||||
Clear();
|
||||
|
||||
// Parameter safety
|
||||
if (!fnSetWaypoint) return FALSE;
|
||||
if (!fnSetWaypoint) return false;
|
||||
SetWaypoint=fnSetWaypoint;
|
||||
WaypointParameter=iWaypointParameter;
|
||||
|
||||
// Start & target coordinates must be free
|
||||
if (!PointFree(iFromX,iFromY) || !PointFree(iToX,iToY)) return FALSE;
|
||||
if (!PointFree(iFromX,iFromY) || !PointFree(iToX,iToY)) return false;
|
||||
|
||||
// Add the first two rays
|
||||
if (!AddRay(iFromX,iFromY,iToX,iToY,0,C4PF_Direction_Left,NULL)) return FALSE;
|
||||
if (!AddRay(iFromX,iFromY,iToX,iToY,0,C4PF_Direction_Right,NULL)) return FALSE;
|
||||
if (!AddRay(iFromX,iFromY,iToX,iToY,0,C4PF_Direction_Left,NULL)) return false;
|
||||
if (!AddRay(iFromX,iFromY,iToX,iToY,0,C4PF_Direction_Right,NULL)) return false;
|
||||
|
||||
// Run
|
||||
Run();
|
||||
|
@ -653,13 +653,13 @@ BOOL C4PathFinder::Find(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iT
|
|||
|
||||
}
|
||||
|
||||
BOOL C4PathFinder::AddRay(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, int32_t iDepth, int32_t iDirection, C4PathFinderRay *pFrom, C4TransferZone *pUseZone)
|
||||
bool C4PathFinder::AddRay(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, int32_t iDepth, int32_t iDirection, C4PathFinderRay *pFrom, C4TransferZone *pUseZone)
|
||||
{
|
||||
// Max depth
|
||||
if (iDepth >= C4PF_MaxDepth * Level) return FALSE;
|
||||
if (iDepth >= C4PF_MaxDepth * Level) return false;
|
||||
// Allocate and set new ray
|
||||
C4PathFinderRay *pRay;
|
||||
if (!(pRay = new C4PathFinderRay)) return FALSE;
|
||||
if (!(pRay = new C4PathFinderRay)) return false;
|
||||
pRay->X=iFromX; pRay->Y=iFromY;
|
||||
pRay->X2=iFromX; pRay->Y2=iFromY;
|
||||
pRay->TargetX=iToX; pRay->TargetY=iToY;
|
||||
|
@ -670,16 +670,16 @@ BOOL C4PathFinder::AddRay(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t
|
|||
pRay->Next=FirstRay;
|
||||
pRay->UseZone=pUseZone;
|
||||
FirstRay=pRay;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PathFinder::SplitRay(C4PathFinderRay *pRay, int32_t iAtX, int32_t iAtY)
|
||||
bool C4PathFinder::SplitRay(C4PathFinderRay *pRay, int32_t iAtX, int32_t iAtY)
|
||||
{
|
||||
// Max depth
|
||||
if (pRay->Depth >= C4PF_MaxDepth * Level) return FALSE;
|
||||
if (pRay->Depth >= C4PF_MaxDepth * Level) return false;
|
||||
// Allocate and set new ray
|
||||
C4PathFinderRay *pNewRay;
|
||||
if (!(pNewRay = new C4PathFinderRay)) return FALSE;
|
||||
if (!(pNewRay = new C4PathFinderRay)) return false;
|
||||
pNewRay->Status=C4PF_Ray_Still;
|
||||
pNewRay->X=pRay->X; pNewRay->Y=pRay->Y;
|
||||
pNewRay->X2=iAtX; pNewRay->Y2=iAtY;
|
||||
|
@ -693,7 +693,7 @@ BOOL C4PathFinder::SplitRay(C4PathFinderRay *pRay, int32_t iAtX, int32_t iAtY)
|
|||
// Adjust split ray
|
||||
pRay->From=pNewRay;
|
||||
pRay->X=iAtX; pRay->Y=iAtY;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,13 +51,13 @@ class C4PathFinderRay
|
|||
void Draw(C4TargetFacet &cgo);
|
||||
int32_t FindCrawlAttachDiagonal(int32_t iX, int32_t iY, int32_t iDirection);
|
||||
int32_t FindCrawlAttach(int32_t iX, int32_t iY);
|
||||
BOOL IsCrawlAttach(int32_t iX, int32_t iY, int32_t iAttach);
|
||||
BOOL CheckBackRayShorten();
|
||||
BOOL Execute();
|
||||
BOOL CrawlTargetFree(int32_t iX, int32_t iY, int32_t iAttach, int32_t iDirection);
|
||||
BOOL PointFree(int32_t iX, int32_t iY);
|
||||
BOOL Crawl();
|
||||
BOOL PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t iToY, C4TransferZone **ppZone=NULL);
|
||||
bool IsCrawlAttach(int32_t iX, int32_t iY, int32_t iAttach);
|
||||
bool CheckBackRayShorten();
|
||||
bool Execute();
|
||||
bool CrawlTargetFree(int32_t iX, int32_t iY, int32_t iAttach, int32_t iDirection);
|
||||
bool PointFree(int32_t iX, int32_t iY);
|
||||
bool Crawl();
|
||||
bool PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t iToY, C4TransferZone **ppZone=NULL);
|
||||
};
|
||||
|
||||
class C4PathFinder
|
||||
|
@ -73,7 +73,7 @@ class C4PathFinder
|
|||
bool (*SetWaypoint)(int32_t, int32_t, intptr_t, intptr_t);
|
||||
C4PathFinderRay *FirstRay;
|
||||
intptr_t WaypointParameter;
|
||||
BOOL Success;
|
||||
bool Success;
|
||||
C4TransferZones *TransferZones;
|
||||
bool TransferZonesEnabled;
|
||||
int Level;
|
||||
|
@ -82,14 +82,14 @@ class C4PathFinder
|
|||
void Clear();
|
||||
void Default();
|
||||
void Init(bool (*fnPointFree)(int32_t, int32_t), C4TransferZones* pTransferZones=NULL);
|
||||
BOOL Find(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, bool (*fnSetWaypoint)(int32_t, int32_t, intptr_t, intptr_t), intptr_t iWaypointParameter);
|
||||
bool Find(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, bool (*fnSetWaypoint)(int32_t, int32_t, intptr_t, intptr_t), intptr_t iWaypointParameter);
|
||||
void EnableTransferZones(bool fEnabled);
|
||||
void SetLevel(int iLevel);
|
||||
protected:
|
||||
void Run();
|
||||
BOOL AddRay(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, int32_t iDepth, int32_t iDirection, C4PathFinderRay *pFrom, C4TransferZone *pUseZone=NULL);
|
||||
BOOL SplitRay(C4PathFinderRay *pRay, int32_t iAtX, int32_t iAtY);
|
||||
BOOL Execute();
|
||||
bool AddRay(int32_t iFromX, int32_t iFromY, int32_t iToX, int32_t iToY, int32_t iDepth, int32_t iDirection, C4PathFinderRay *pFrom, C4TransferZone *pUseZone=NULL);
|
||||
bool SplitRay(C4PathFinderRay *pRay, int32_t iAtX, int32_t iAtY);
|
||||
bool Execute();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -75,22 +75,22 @@ void C4RegionList::Clear()
|
|||
First=NULL;
|
||||
}
|
||||
|
||||
BOOL C4RegionList::Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption,
|
||||
bool C4RegionList::Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption,
|
||||
int iCom, C4Object *pTarget, int iMoveOverCom, int iHoldCom, int iData)
|
||||
{
|
||||
C4Region *pRgn = new C4Region;
|
||||
pRgn->Set(iX+AdjustX,iY+AdjustY,iWdt,iHgt,szCaption,iCom,iMoveOverCom,iHoldCom,iData,pTarget);
|
||||
pRgn->Next=First;
|
||||
First=pRgn;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4RegionList::Add(C4Facet &fctArea, const char *szCaption, int iCom, C4Object *pTarget, int iMoveOverCom, int iHoldCom, int iData)
|
||||
bool C4RegionList::Add(C4Facet &fctArea, const char *szCaption, int iCom, C4Object *pTarget, int iMoveOverCom, int iHoldCom, int iData)
|
||||
{
|
||||
return Add(fctArea.X,fctArea.Y,fctArea.Wdt,fctArea.Hgt,szCaption,iCom,pTarget,iMoveOverCom,iHoldCom,iData);
|
||||
}
|
||||
|
||||
BOOL C4RegionList::Add(C4Region &rRegion)
|
||||
bool C4RegionList::Add(C4Region &rRegion)
|
||||
{
|
||||
C4Region *pRgn = new C4Region;
|
||||
*pRgn = rRegion;
|
||||
|
@ -98,7 +98,7 @@ BOOL C4RegionList::Add(C4Region &rRegion)
|
|||
pRgn->Y+=AdjustY;
|
||||
pRgn->Next=First;
|
||||
First=pRgn;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Region::Set(int iX, int iY, int iWdt, int iHgt, const char *szCaption,
|
||||
|
@ -147,7 +147,7 @@ void C4Region::Set(C4Facet &fctArea, const char *szCaption, C4Object *pTarget)
|
|||
if (pTarget) Target=pTarget;
|
||||
}
|
||||
|
||||
BOOL C4RegionList::Add(C4RegionList &rRegionList, BOOL fAdjust)
|
||||
bool C4RegionList::Add(C4RegionList &rRegionList, bool fAdjust)
|
||||
{
|
||||
C4Region *pNewFirst=NULL,*pPrev=NULL;
|
||||
for (C4Region *cRgn=rRegionList.First; cRgn; cRgn=cRgn->Next)
|
||||
|
@ -161,5 +161,5 @@ BOOL C4RegionList::Add(C4RegionList &rRegionList, BOOL fAdjust)
|
|||
pPrev=pRgn;
|
||||
}
|
||||
if (pNewFirst) First=pNewFirst;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,10 +65,10 @@ class C4RegionList
|
|||
void Clear();
|
||||
void Default();
|
||||
C4Region* Find(int iX, int iY);
|
||||
BOOL Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
BOOL Add(C4Facet &fctArea, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
BOOL Add(C4Region &rRegion);
|
||||
BOOL Add(C4RegionList &rRegionList, BOOL fAdjust=TRUE);
|
||||
bool Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
bool Add(C4Facet &fctArea, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
bool Add(C4Region &rRegion);
|
||||
bool Add(C4RegionList &rRegionList, bool fAdjust=true);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,28 +87,28 @@ void C4Scenario::Default()
|
|||
Environment.Default();
|
||||
}
|
||||
|
||||
BOOL C4Scenario::Load(C4Group &hGroup, bool fLoadSection)
|
||||
bool C4Scenario::Load(C4Group &hGroup, bool fLoadSection)
|
||||
{
|
||||
char *pSource;
|
||||
// Load
|
||||
if (!hGroup.LoadEntry(C4CFN_ScenarioCore,&pSource,NULL,1)) return FALSE;
|
||||
if (!hGroup.LoadEntry(C4CFN_ScenarioCore,&pSource,NULL,1)) return false;
|
||||
// Compile
|
||||
if (!Compile(pSource, fLoadSection)) { delete [] pSource; return FALSE; }
|
||||
if (!Compile(pSource, fLoadSection)) { delete [] pSource; return false; }
|
||||
delete [] pSource;
|
||||
// Convert
|
||||
Game.ConvertGoals(Game.Realism);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Scenario::Save(C4Group &hGroup, bool fSaveSection)
|
||||
bool C4Scenario::Save(C4Group &hGroup, bool fSaveSection)
|
||||
{
|
||||
char *Buffer; int32_t BufferSize;
|
||||
if (!Decompile(&Buffer,&BufferSize, fSaveSection))
|
||||
return FALSE;
|
||||
if (!hGroup.Add(C4CFN_ScenarioCore,Buffer,BufferSize,FALSE,TRUE))
|
||||
{ StdBuf Buf; Buf.Take(Buffer, BufferSize); return FALSE; }
|
||||
return TRUE;
|
||||
return false;
|
||||
if (!hGroup.Add(C4CFN_ScenarioCore,Buffer,BufferSize,false,true))
|
||||
{ StdBuf Buf; Buf.Take(Buffer, BufferSize); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Scenario::CompileFunc(StdCompiler *pComp, bool fSection)
|
||||
|
@ -139,7 +139,7 @@ int32_t C4Scenario::GetMinPlayer()
|
|||
|
||||
void C4SDefinitions::Default()
|
||||
{
|
||||
LocalOnly=AllowUserChange=FALSE;
|
||||
LocalOnly=AllowUserChange=false;
|
||||
ZeroMem(Definition,sizeof (Definition));
|
||||
SkipDefs.Default();
|
||||
}
|
||||
|
@ -173,18 +173,18 @@ void C4SHead::CompileFunc(StdCompiler *pComp, bool fSection)
|
|||
pComp->Value(mkNamingAdapt(mkStringAdaptMA(Font), "Font", ""));
|
||||
pComp->Value(mkNamingAdapt(mkArrayAdaptDM(C4XVer,0), "Version" ));
|
||||
pComp->Value(mkNamingAdapt(Difficulty, "Difficulty", 0));
|
||||
pComp->Value(mkNamingAdapt(EnableUnregisteredAccess, "Access", FALSE));
|
||||
pComp->Value(mkNamingAdapt(EnableUnregisteredAccess, "Access", false));
|
||||
pComp->Value(mkNamingAdapt(MaxPlayer, "MaxPlayer", C4S_MaxPlayerDefault));
|
||||
pComp->Value(mkNamingAdapt(MaxPlayerLeague, "MaxPlayerLeague", MaxPlayer));
|
||||
pComp->Value(mkNamingAdapt(MinPlayer, "MinPlayer", 0));
|
||||
pComp->Value(mkNamingAdapt(SaveGame, "SaveGame", FALSE));
|
||||
pComp->Value(mkNamingAdapt(Replay, "Replay", FALSE));
|
||||
pComp->Value(mkNamingAdapt(Film, "Film", FALSE));
|
||||
pComp->Value(mkNamingAdapt(DisableMouse, "DisableMouse", FALSE));
|
||||
pComp->Value(mkNamingAdapt(IgnoreSyncChecks, "IgnoreSyncChecks", FALSE));
|
||||
pComp->Value(mkNamingAdapt(SaveGame, "SaveGame", false));
|
||||
pComp->Value(mkNamingAdapt(Replay, "Replay", false));
|
||||
pComp->Value(mkNamingAdapt(Film, "Film", false));
|
||||
pComp->Value(mkNamingAdapt(DisableMouse, "DisableMouse", false));
|
||||
pComp->Value(mkNamingAdapt(IgnoreSyncChecks, "IgnoreSyncChecks", false));
|
||||
pComp->Value(mkNamingAdapt(StartupPlayerCount, "StartupPlayerCount", 0));
|
||||
}
|
||||
pComp->Value(mkNamingAdapt(NoInitialize, "NoInitialize", FALSE));
|
||||
pComp->Value(mkNamingAdapt(NoInitialize, "NoInitialize", false));
|
||||
pComp->Value(mkNamingAdapt(RandomSeed, "RandomSeed", 0));
|
||||
if (!fSection)
|
||||
{
|
||||
|
@ -225,15 +225,15 @@ void C4SGame::CompileFunc(StdCompiler *pComp, bool fSection)
|
|||
pComp->Value(mkNamingAdapt(ClearObjects, "ClearObjects", C4IDList()));
|
||||
pComp->Value(mkNamingAdapt(ClearMaterial, "ClearMaterials", C4NameList()));
|
||||
pComp->Value(mkNamingAdapt(ValueGain, "ValueGain", 0));
|
||||
pComp->Value(mkNamingAdapt(EnableRemoveFlag, "EnableRemoveFlag", FALSE));
|
||||
pComp->Value(mkNamingAdapt(Realism.ConstructionNeedsMaterial, "StructNeedMaterial", FALSE));
|
||||
pComp->Value(mkNamingAdapt(Realism.StructuresNeedEnergy, "StructNeedEnergy", TRUE));
|
||||
pComp->Value(mkNamingAdapt(EnableRemoveFlag, "EnableRemoveFlag", false));
|
||||
pComp->Value(mkNamingAdapt(Realism.ConstructionNeedsMaterial, "StructNeedMaterial", false));
|
||||
pComp->Value(mkNamingAdapt(Realism.StructuresNeedEnergy, "StructNeedEnergy", true));
|
||||
if (!fSection)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(Realism.ValueOverloads, "ValueOverloads", C4IDList()));
|
||||
}
|
||||
pComp->Value(mkNamingAdapt(mkRuntimeValueAdapt(Realism.LandscapePushPull), "LandscapePushPull", FALSE));
|
||||
pComp->Value(mkNamingAdapt(mkRuntimeValueAdapt(Realism.LandscapeInsertThrust), "LandscapeInsertThrust",TRUE));
|
||||
pComp->Value(mkNamingAdapt(mkRuntimeValueAdapt(Realism.LandscapePushPull), "LandscapePushPull", false));
|
||||
pComp->Value(mkNamingAdapt(mkRuntimeValueAdapt(Realism.LandscapeInsertThrust), "LandscapeInsertThrust",true));
|
||||
|
||||
const StdBitfieldEntry<int32_t> BaseFunctionalities[] = {
|
||||
{ "BASEFUNC_AutoSellContents", BASEFUNC_AutoSellContents },
|
||||
|
@ -358,19 +358,19 @@ void C4SLandscape::GetMapSize(int32_t &rWdt, int32_t &rHgt, int32_t iPlayerNum)
|
|||
|
||||
void C4SLandscape::CompileFunc(StdCompiler *pComp)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(ExactLandscape, "ExactLandscape", FALSE));
|
||||
pComp->Value(mkNamingAdapt(ExactLandscape, "ExactLandscape", false));
|
||||
pComp->Value(mkNamingAdapt(Vegetation, "Vegetation", C4IDList()));
|
||||
pComp->Value(mkNamingAdapt(VegLevel, "VegetationLevel", C4SVal(50,30,0,100), true));
|
||||
pComp->Value(mkNamingAdapt(InEarth, "InEarth", C4IDList()));
|
||||
pComp->Value(mkNamingAdapt(InEarthLevel, "InEarthLevel", C4SVal(50,0,0,100), true));
|
||||
pComp->Value(mkNamingAdapt(mkStringAdaptMA(SkyDef), "Sky", ""));
|
||||
pComp->Value(mkNamingAdapt(mkArrayAdaptDM(SkyDefFade,0),"SkyFade" ));
|
||||
pComp->Value(mkNamingAdapt(NoSky, "NoSky", FALSE));
|
||||
pComp->Value(mkNamingAdapt(BottomOpen, "BottomOpen", FALSE));
|
||||
pComp->Value(mkNamingAdapt(TopOpen, "TopOpen", TRUE));
|
||||
pComp->Value(mkNamingAdapt(NoSky, "NoSky", false));
|
||||
pComp->Value(mkNamingAdapt(BottomOpen, "BottomOpen", false));
|
||||
pComp->Value(mkNamingAdapt(TopOpen, "TopOpen", true));
|
||||
pComp->Value(mkNamingAdapt(LeftOpen, "LeftOpen", 0));
|
||||
pComp->Value(mkNamingAdapt(RightOpen, "RightOpen", 0));
|
||||
pComp->Value(mkNamingAdapt(AutoScanSideOpen, "AutoScanSideOpen", TRUE));
|
||||
pComp->Value(mkNamingAdapt(AutoScanSideOpen, "AutoScanSideOpen", true));
|
||||
pComp->Value(mkNamingAdapt(MapWdt, "MapWidth", C4SVal(100,0,64,250), true));
|
||||
pComp->Value(mkNamingAdapt(MapHgt, "MapHeight", C4SVal(50,0,40,250), true));
|
||||
pComp->Value(mkNamingAdapt(MapZoom, "MapZoom", C4SVal(10,0,5,15), true));
|
||||
|
@ -384,10 +384,10 @@ void C4SLandscape::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(MapPlayerExtend, "MapPlayerExtend", 0));
|
||||
pComp->Value(mkNamingAdapt(Layers, "Layers", C4NameList()));
|
||||
pComp->Value(mkNamingAdapt(Gravity, "Gravity", C4SVal(100,0,10,200), true));
|
||||
pComp->Value(mkNamingAdapt(NoScan, "NoScan", FALSE));
|
||||
pComp->Value(mkNamingAdapt(KeepMapCreator, "KeepMapCreator", FALSE));
|
||||
pComp->Value(mkNamingAdapt(NoScan, "NoScan", false));
|
||||
pComp->Value(mkNamingAdapt(KeepMapCreator, "KeepMapCreator", false));
|
||||
pComp->Value(mkNamingAdapt(SkyScrollMode, "SkyScrollMode", 0));
|
||||
pComp->Value(mkNamingAdapt(NewStyleLandscape, "NewStyleLandscape", FALSE));
|
||||
pComp->Value(mkNamingAdapt(NewStyleLandscape, "NewStyleLandscape", false));
|
||||
pComp->Value(mkNamingAdapt(FoWRes, "FoWRes", static_cast<int32_t>(CClrModAddMap::DefResolutionX)));
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ void C4SWeather::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(Wind, "Wind", C4SVal(0,70,-100,+100), true));
|
||||
pComp->Value(mkNamingAdapt(Lightning, "Lightning", C4SVal()));
|
||||
pComp->Value(mkNamingAdapt(mkStringAdaptMA(Precipitation),"Precipitation", "Water"));
|
||||
pComp->Value(mkNamingAdapt(NoGamma, "NoGamma", TRUE));
|
||||
pComp->Value(mkNamingAdapt(NoGamma, "NoGamma", true));
|
||||
}
|
||||
|
||||
void C4SAnimals::Default()
|
||||
|
@ -460,13 +460,13 @@ void C4SDisasters::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(Earthquake, "Earthquake", C4SVal()));
|
||||
}
|
||||
|
||||
BOOL C4Scenario::Compile(const char *szSource, bool fLoadSection)
|
||||
bool C4Scenario::Compile(const char *szSource, bool fLoadSection)
|
||||
{
|
||||
if (!fLoadSection) Default();
|
||||
return CompileFromBuf_LogWarn<StdCompilerINIRead>(mkParAdapt(*this, fLoadSection), StdStrBuf(szSource), C4CFN_ScenarioCore);
|
||||
}
|
||||
|
||||
BOOL C4Scenario::Decompile(char **ppOutput, int32_t *ipSize, bool fSaveSection)
|
||||
bool C4Scenario::Decompile(char **ppOutput, int32_t *ipSize, bool fSaveSection)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -477,8 +477,8 @@ BOOL C4Scenario::Decompile(char **ppOutput, int32_t *ipSize, bool fSaveSection)
|
|||
*ipSize = Buf.getSize();
|
||||
}
|
||||
catch(StdCompiler::Exception *)
|
||||
{ return FALSE; }
|
||||
return TRUE;
|
||||
{ return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Scenario::Clear()
|
||||
|
@ -511,7 +511,7 @@ void C4Scenario::SetExactLandscape()
|
|||
bool C4SDefinitions::GetModules(StdStrBuf *psOutModules) const
|
||||
{
|
||||
// Local only
|
||||
if (LocalOnly) { psOutModules->Copy(""); return TRUE; }
|
||||
if (LocalOnly) { psOutModules->Copy(""); return true; }
|
||||
// Scan for any valid entries
|
||||
bool fSpecified = false;
|
||||
int32_t cnt=0;
|
||||
|
@ -529,7 +529,7 @@ bool C4SDefinitions::GetModules(StdStrBuf *psOutModules) const
|
|||
psOutModules->Append(Definition[cnt]);
|
||||
}
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -540,13 +540,13 @@ void C4SDefinitions::SetModules(const char *szList, const char *szRelativeToPath
|
|||
// Empty list: local only
|
||||
if (!SModuleCount(szList))
|
||||
{
|
||||
LocalOnly=TRUE;
|
||||
LocalOnly=true;
|
||||
for (cnt=0; cnt<C4S_MaxDefinitions; cnt++) Definition[cnt][0]=0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set list
|
||||
LocalOnly=FALSE;
|
||||
LocalOnly=false;
|
||||
for (cnt=0; cnt<C4S_MaxDefinitions; cnt++)
|
||||
{
|
||||
SGetModule(szList,cnt,Definition[cnt],_MAX_PATH);
|
||||
|
@ -561,13 +561,13 @@ void C4SDefinitions::SetModules(const char *szList, const char *szRelativeToPath
|
|||
|
||||
}
|
||||
|
||||
BOOL C4SDefinitions::AssertModules(const char *szPath, char *sMissing)
|
||||
bool C4SDefinitions::AssertModules(const char *szPath, char *sMissing)
|
||||
{
|
||||
// Local only
|
||||
if (LocalOnly) return TRUE;
|
||||
if (LocalOnly) return true;
|
||||
|
||||
// Check all listed modules for availability
|
||||
BOOL fAllAvailable=TRUE;
|
||||
bool fAllAvailable=true;
|
||||
char szModule[_MAX_PATH+1];
|
||||
if (sMissing) sMissing[0]=0;
|
||||
// Check all definition files
|
||||
|
@ -583,7 +583,7 @@ BOOL C4SDefinitions::AssertModules(const char *szPath, char *sMissing)
|
|||
{
|
||||
// Add to list
|
||||
if (sMissing) { SNewSegment(sMissing,", "); SAppend(Definition[cnt],sMissing); }
|
||||
fAllAvailable=FALSE;
|
||||
fAllAvailable=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,8 +592,8 @@ BOOL C4SDefinitions::AssertModules(const char *szPath, char *sMissing)
|
|||
|
||||
void C4SDefinitions::CompileFunc(StdCompiler *pComp)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(LocalOnly, "LocalOnly", FALSE));
|
||||
pComp->Value(mkNamingAdapt(AllowUserChange, "AllowUserChange", FALSE));
|
||||
pComp->Value(mkNamingAdapt(LocalOnly, "LocalOnly", false));
|
||||
pComp->Value(mkNamingAdapt(AllowUserChange, "AllowUserChange", false));
|
||||
for(int32_t i = 0; i < C4S_MaxDefinitions; i++)
|
||||
pComp->Value(mkNamingAdapt(mkStringAdaptMA(Definition[i]), FormatString("Definition%i", i+1).getData(), ""));
|
||||
pComp->Value(mkNamingAdapt(SkipDefs, "SkipDefs", C4IDList()));
|
||||
|
@ -605,38 +605,38 @@ void C4SGame::ConvertGoals(C4SRealism &rRealism)
|
|||
// Convert mode to goals
|
||||
switch (Mode)
|
||||
{
|
||||
case C4S_Melee: Goals.SetIDCount(C4Id("MELE"),1,TRUE); ClearOldGoals(); break;
|
||||
case C4S_MeleeTeamwork: Goals.SetIDCount(C4Id("MELE"),1,TRUE); ClearOldGoals(); break;
|
||||
case C4S_Melee: Goals.SetIDCount(C4Id("MELE"),1,true); ClearOldGoals(); break;
|
||||
case C4S_MeleeTeamwork: Goals.SetIDCount(C4Id("MELE"),1,true); ClearOldGoals(); break;
|
||||
}
|
||||
Mode=0;
|
||||
|
||||
// Convert goals (master selection)
|
||||
switch (CooperativeGoal)
|
||||
{
|
||||
case C4S_Goldmine: Goals.SetIDCount(C4Id("GLDM"),1,TRUE); ClearOldGoals(); break;
|
||||
case C4S_Monsterkill: Goals.SetIDCount(C4Id("MNTK"),1,TRUE); ClearOldGoals(); break;
|
||||
case C4S_ValueGain: Goals.SetIDCount(C4Id("VALG"),Max(ValueGain/100,1),TRUE); ClearOldGoals(); break;
|
||||
case C4S_Goldmine: Goals.SetIDCount(C4Id("GLDM"),1,true); ClearOldGoals(); break;
|
||||
case C4S_Monsterkill: Goals.SetIDCount(C4Id("MNTK"),1,true); ClearOldGoals(); break;
|
||||
case C4S_ValueGain: Goals.SetIDCount(C4Id("VALG"),Max(ValueGain/100,1),true); ClearOldGoals(); break;
|
||||
}
|
||||
CooperativeGoal=0;
|
||||
// CreateObjects,ClearObjects,ClearMaterials are still valid but invisible
|
||||
|
||||
// Convert realism to rules
|
||||
if (rRealism.ConstructionNeedsMaterial) Rules.SetIDCount(C4Id("CNMT"),1,TRUE); rRealism.ConstructionNeedsMaterial=0;
|
||||
if (rRealism.StructuresNeedEnergy) Rules.SetIDCount(C4Id("ENRG"),1,TRUE); rRealism.StructuresNeedEnergy=0;
|
||||
if (rRealism.ConstructionNeedsMaterial) Rules.SetIDCount(C4Id("CNMT"),1,true); rRealism.ConstructionNeedsMaterial=0;
|
||||
if (rRealism.StructuresNeedEnergy) Rules.SetIDCount(C4Id("ENRG"),1,true); rRealism.StructuresNeedEnergy=0;
|
||||
|
||||
// Convert rules
|
||||
if (EnableRemoveFlag) Rules.SetIDCount(C4Id("FGRV"),1,TRUE); EnableRemoveFlag=0;
|
||||
if (EnableRemoveFlag) Rules.SetIDCount(C4Id("FGRV"),1,true); EnableRemoveFlag=0;
|
||||
|
||||
// Convert eliminiation to rules
|
||||
switch (Elimination)
|
||||
{
|
||||
case C4S_KillTheCaptain: Rules.SetIDCount(C4Id("KILC"),1,TRUE); break;
|
||||
case C4S_CaptureTheFlag: Rules.SetIDCount(C4Id("CTFL"),1,TRUE); break;
|
||||
case C4S_KillTheCaptain: Rules.SetIDCount(C4Id("KILC"),1,true); break;
|
||||
case C4S_CaptureTheFlag: Rules.SetIDCount(C4Id("CTFL"),1,true); break;
|
||||
}
|
||||
Elimination=1; // unconvertible default crew elimination
|
||||
|
||||
// CaptureTheFlag requires FlagRemoveable
|
||||
if (Rules.GetIDCount(C4Id("CTFL"))) Rules.SetIDCount(C4Id("FGRV"),1,TRUE);
|
||||
if (Rules.GetIDCount(C4Id("CTFL"))) Rules.SetIDCount(C4Id("FGRV"),1,true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ void C4SGame::ClearOldGoals()
|
|||
ValueGain=0;
|
||||
}
|
||||
|
||||
BOOL C4SGame::IsMelee()
|
||||
bool C4SGame::IsMelee()
|
||||
{
|
||||
return (Goals.GetIDCount(C4Id("MELE")) || Goals.GetIDCount(C4Id("MEL2")));
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ bool C4ScenarioSection::EnsureTempStore(bool fExtractLandscape, bool fExtractObj
|
|||
{
|
||||
if (!CreatePath(szTmp)) return false;
|
||||
C4Group hGroup;
|
||||
if (!hGroup.Open(szTmp, TRUE)) { EraseItem(szTmp); return false; }
|
||||
if (!hGroup.Open(szTmp, true)) { EraseItem(szTmp); return false; }
|
||||
// extract all desired section files
|
||||
Game.ScenarioFile.ResetSearch();
|
||||
char fn[_MAX_FNAME+1]; *fn=0;
|
||||
|
|
|
@ -113,7 +113,7 @@ class C4SDefinitions
|
|||
public:
|
||||
void SetModules(const char *szList, const char *szRelativeToPath=NULL, const char *szRelativeToPath2=NULL);
|
||||
bool GetModules(StdStrBuf *psOutModules) const;
|
||||
BOOL AssertModules(const char *szPath=NULL, char *sMissing=NULL);
|
||||
bool AssertModules(const char *szPath=NULL, char *sMissing=NULL);
|
||||
void Default();
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
};
|
||||
|
@ -158,7 +158,7 @@ class C4SGame
|
|||
C4SRealism Realism;
|
||||
|
||||
public:
|
||||
BOOL IsMelee();
|
||||
bool IsMelee();
|
||||
void ConvertGoals(C4SRealism &rRealism);
|
||||
void Default();
|
||||
void ClearCooperativeGoals();
|
||||
|
@ -311,13 +311,13 @@ class C4Scenario
|
|||
void SetExactLandscape();
|
||||
void Clear();
|
||||
void Default();
|
||||
BOOL Load(C4Group &hGroup, bool fLoadSection=false);
|
||||
BOOL Save(C4Group &hGroup, bool fSaveSection=false);
|
||||
bool Load(C4Group &hGroup, bool fLoadSection=false);
|
||||
bool Save(C4Group &hGroup, bool fSaveSection=false);
|
||||
void CompileFunc(StdCompiler *pComp, bool fSection);
|
||||
int32_t GetMinPlayer(); // will try to determine the minimum player count for this scenario
|
||||
protected:
|
||||
BOOL Compile(const char *szSource, bool fLoadSection=false);
|
||||
BOOL Decompile(char **ppOutput, int32_t *ipSize, bool fSaveSection=false);
|
||||
bool Compile(const char *szSource, bool fLoadSection=false);
|
||||
bool Decompile(char **ppOutput, int32_t *ipSize, bool fSaveSection=false);
|
||||
};
|
||||
|
||||
class C4ScenarioSection;
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#endif
|
||||
|
||||
static BOOL SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
|
||||
static bool SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
|
||||
{
|
||||
// safety
|
||||
if (!ppSfc) return FALSE; if (!*ppSfc) return FALSE;
|
||||
if (!ppSfc) return false; if (!*ppSfc) return false;
|
||||
// get size
|
||||
int iWdt=(*ppSfc)->Wdt, iHgt=(*ppSfc)->Hgt;
|
||||
int iDstWdt=iWdt, iDstHgt=iHgt;
|
||||
|
@ -45,20 +45,20 @@ static BOOL SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
|
|||
while (iDstWdt<iMinWdt) iDstWdt+=iWdt;
|
||||
while (iDstHgt<iMinHgt) iDstHgt+=iHgt;
|
||||
// Without shaders, the textures need to be small for the FoW.
|
||||
if (iDstWdt==iWdt && iDstHgt==iHgt && lpDDraw->IsShaderific()) return TRUE;
|
||||
if (iDstWdt==iWdt && iDstHgt==iHgt && lpDDraw->IsShaderific()) return true;
|
||||
// create new surface
|
||||
C4Surface *pNewSfc=new C4Surface();
|
||||
if (!pNewSfc->Create(iDstWdt, iDstHgt, false, false, lpDDraw->IsShaderific() ? 0 : 64))
|
||||
{
|
||||
delete pNewSfc;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// blit tiled into dest surface
|
||||
lpDDraw->BlitSurfaceTile2(*ppSfc, pNewSfc, 0, 0, iDstWdt, iDstHgt, 0, 0, FALSE);
|
||||
lpDDraw->BlitSurfaceTile2(*ppSfc, pNewSfc, 0, 0, iDstWdt, iDstHgt, 0, 0, false);
|
||||
// destroy old surface, assign new
|
||||
delete *ppSfc; *ppSfc=pNewSfc;
|
||||
// success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Sky::SetFadePalette(int32_t *ipColors)
|
||||
|
@ -78,7 +78,7 @@ void C4Sky::SetFadePalette(int32_t *ipColors)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Sky::Init(bool fSavegame)
|
||||
bool C4Sky::Init(bool fSavegame)
|
||||
{
|
||||
int32_t skylistn;
|
||||
|
||||
|
@ -125,7 +125,7 @@ BOOL C4Sky::Init(bool fSavegame)
|
|||
else*/
|
||||
FadeClr1=FadeClr2=0xffffff;
|
||||
// enlarge surface to avoid slow 1*1-px-skies
|
||||
if (!SurfaceEnsureSize(&Surface, 128, 128)) return FALSE;
|
||||
if (!SurfaceEnsureSize(&Surface, 128, 128)) return false;
|
||||
|
||||
// set parallax scroll mode
|
||||
switch (Game.C4S.Landscape.SkyScrollMode)
|
||||
|
@ -154,7 +154,7 @@ BOOL C4Sky::Init(bool fSavegame)
|
|||
|
||||
// no sky - using fade in newgfx
|
||||
if (!Surface)
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
// Store size
|
||||
if (Surface)
|
||||
|
@ -167,7 +167,7 @@ BOOL C4Sky::Init(bool fSavegame)
|
|||
}
|
||||
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Sky::Default()
|
||||
|
@ -179,7 +179,7 @@ void C4Sky::Default()
|
|||
ParX=ParY=10;
|
||||
ParallaxMode=C4SkyPM_Fixed;
|
||||
BackClr=0;
|
||||
BackClrEnabled=FALSE;
|
||||
BackClrEnabled=false;
|
||||
}
|
||||
|
||||
C4Sky::~C4Sky()
|
||||
|
@ -193,20 +193,20 @@ void C4Sky::Clear()
|
|||
Modulation=0x00ffffff;
|
||||
}
|
||||
|
||||
BOOL C4Sky::Save(C4Group &hGroup)
|
||||
bool C4Sky::Save(C4Group &hGroup)
|
||||
{
|
||||
// Sky-saving disabled by scenario core
|
||||
// (With this option enabled, script-defined changes to sky palette will not be saved!)
|
||||
if (Game.C4S.Landscape.NoSky)
|
||||
{
|
||||
hGroup.Delete(C4CFN_Sky);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// no sky?
|
||||
if (!Surface) return TRUE;
|
||||
if (!Surface) return true;
|
||||
// FIXME?
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Sky::Execute()
|
||||
|
@ -233,7 +233,7 @@ void C4Sky::Draw(C4TargetFacet &cgo)
|
|||
// blit parallax sky
|
||||
int iParX = cgo.TargetX * 10 / ParX - fixtoi(x);
|
||||
int iParY = cgo.TargetY * 10 / ParY - fixtoi(y);
|
||||
Application.DDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, iParX, iParY, FALSE);
|
||||
Application.DDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, iParX, iParY, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ bool C4Sky::SetModulation(DWORD dwWithClr, DWORD dwBackClr)
|
|||
{
|
||||
Modulation=dwWithClr;
|
||||
BackClr=dwBackClr;
|
||||
BackClrEnabled=(Modulation>>24) ? TRUE : FALSE;
|
||||
BackClrEnabled=(Modulation>>24) ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ class C4Sky
|
|||
~C4Sky();
|
||||
void Default(); // zero fields
|
||||
|
||||
BOOL Init(bool fSavegame);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool Init(bool fSavegame);
|
||||
bool Save(C4Group &hGroup);
|
||||
void Clear();
|
||||
void SetColor(int32_t iIndex, int32_t iRed, int32_t iGreen, int32_t iBlue);
|
||||
void SetFadePalette(int32_t *ipColors);
|
||||
|
|
|
@ -175,7 +175,7 @@ void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRes
|
|||
}
|
||||
}
|
||||
// Store mask put status
|
||||
MaskPut=TRUE;
|
||||
MaskPut=true;
|
||||
// restore attached object positions if moved
|
||||
if (fRestoreAttachment && iAttachingObjectsCount)
|
||||
{
|
||||
|
|
|
@ -109,11 +109,11 @@ C4TextureMap::~C4TextureMap()
|
|||
Clear();
|
||||
}
|
||||
|
||||
BOOL C4TextureMap::AddEntry(BYTE byIndex, const char *szMaterial, const char *szTexture)
|
||||
bool C4TextureMap::AddEntry(BYTE byIndex, const char *szMaterial, const char *szTexture)
|
||||
{
|
||||
// Security
|
||||
if(byIndex <= 0 || byIndex >= C4M_MaxTexIndex)
|
||||
return FALSE;
|
||||
return false;
|
||||
// Set entry and initialize
|
||||
Entry[byIndex].Create(szMaterial, szTexture);
|
||||
if(fInitialized)
|
||||
|
@ -122,23 +122,23 @@ BOOL C4TextureMap::AddEntry(BYTE byIndex, const char *szMaterial, const char *sz
|
|||
{
|
||||
// Clear entry if it could not be initialized
|
||||
Entry[byIndex].Clear();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Landscape must be notified (new valid pixel clr)
|
||||
::Landscape.HandleTexMapUpdate();
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4TextureMap::AddTexture(const char *szTexture, CSurface * sfcSurface)
|
||||
bool C4TextureMap::AddTexture(const char *szTexture, CSurface * sfcSurface)
|
||||
{
|
||||
C4Texture *pTexture;
|
||||
if (!(pTexture=new C4Texture)) return FALSE;
|
||||
if (!(pTexture=new C4Texture)) return false;
|
||||
SCopy(szTexture,pTexture->Name,C4M_MaxName);
|
||||
pTexture->Surface32=sfcSurface;
|
||||
pTexture->Next=FirstTexture;
|
||||
FirstTexture=pTexture;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4TextureMap::Clear()
|
||||
|
@ -155,15 +155,15 @@ void C4TextureMap::Clear()
|
|||
fInitialized = false;
|
||||
}
|
||||
|
||||
BOOL C4TextureMap::LoadFlags(C4Group &hGroup, const char *szEntryName, BOOL *pOverloadMaterials, BOOL *pOverloadTextures)
|
||||
bool C4TextureMap::LoadFlags(C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures)
|
||||
{
|
||||
// Load the file
|
||||
StdStrBuf TexMap;
|
||||
if(!hGroup.LoadEntryString(szEntryName, TexMap))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Reset flags
|
||||
if(pOverloadMaterials) *pOverloadMaterials = FALSE;
|
||||
if(pOverloadTextures) *pOverloadTextures = FALSE;
|
||||
if(pOverloadMaterials) *pOverloadMaterials = false;
|
||||
if(pOverloadTextures) *pOverloadTextures = false;
|
||||
// Check if there are flags in there
|
||||
for(const char *pPos = TexMap.getData(); pPos && *pPos; pPos = SSearch(pPos + 1, "\n"))
|
||||
{
|
||||
|
@ -171,15 +171,15 @@ BOOL C4TextureMap::LoadFlags(C4Group &hGroup, const char *szEntryName, BOOL *pOv
|
|||
while(*pPos == '\r' || *pPos == '\n') pPos++;
|
||||
// Flag?
|
||||
if (pOverloadMaterials && SEqual2(pPos, "OverloadMaterials"))
|
||||
*pOverloadMaterials = TRUE;
|
||||
*pOverloadMaterials = true;
|
||||
if (pOverloadTextures && SEqual2(pPos, "OverloadTextures"))
|
||||
*pOverloadTextures = TRUE;
|
||||
*pOverloadTextures = true;
|
||||
}
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t C4TextureMap::LoadMap(C4Group &hGroup, const char *szEntryName, BOOL *pOverloadMaterials, BOOL *pOverloadTextures)
|
||||
int32_t C4TextureMap::LoadMap(C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures)
|
||||
{
|
||||
char *bpMap;
|
||||
char szLine[100+1];
|
||||
|
@ -202,8 +202,8 @@ int32_t C4TextureMap::LoadMap(C4Group &hGroup, const char *szEntryName, BOOL *pO
|
|||
}
|
||||
else
|
||||
{
|
||||
if (SEqual2(szLine, "OverloadMaterials")) { fOverloadMaterials = TRUE; if(pOverloadMaterials) *pOverloadMaterials = TRUE; }
|
||||
if (SEqual2(szLine, "OverloadTextures")) { fOverloadTextures = TRUE; if(pOverloadTextures) *pOverloadTextures = TRUE; }
|
||||
if (SEqual2(szLine, "OverloadMaterials")) { fOverloadMaterials = true; if(pOverloadMaterials) *pOverloadMaterials = true; }
|
||||
if (SEqual2(szLine, "OverloadTextures")) { fOverloadTextures = true; if(pOverloadTextures) *pOverloadTextures = true; }
|
||||
}
|
||||
// Delete buffer, return entry count
|
||||
delete [] bpMap;
|
||||
|
@ -299,7 +299,7 @@ void C4TextureMap::MoveIndex(BYTE byOldIndex, BYTE byNewIndex)
|
|||
fEntriesAdded = true;
|
||||
}
|
||||
|
||||
int32_t C4TextureMap::GetIndex(const char *szMaterial, const char *szTexture, BOOL fAddIfNotExist, const char *szErrorIfFailed)
|
||||
int32_t C4TextureMap::GetIndex(const char *szMaterial, const char *szTexture, bool fAddIfNotExist, const char *szErrorIfFailed)
|
||||
{
|
||||
BYTE byIndex;
|
||||
// Find existing
|
||||
|
@ -326,7 +326,7 @@ int32_t C4TextureMap::GetIndex(const char *szMaterial, const char *szTexture, BO
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t C4TextureMap::GetIndexMatTex(const char *szMaterialTexture, const char *szDefaultTexture, BOOL fAddIfNotExist, const char *szErrorIfFailed)
|
||||
int32_t C4TextureMap::GetIndexMatTex(const char *szMaterialTexture, const char *szDefaultTexture, bool fAddIfNotExist, const char *szErrorIfFailed)
|
||||
{
|
||||
// split material/texture pair
|
||||
StdStrBuf Material, Texture;
|
||||
|
|
|
@ -79,21 +79,21 @@ class C4TextureMap
|
|||
void Default();
|
||||
void Clear();
|
||||
void StoreMapPalette(BYTE *bypPalette, C4MaterialMap &rMaterials);
|
||||
static BOOL LoadFlags(C4Group &hGroup, const char *szEntryName, BOOL *pOverloadMaterials, BOOL *pOverloadTextures);
|
||||
int32_t LoadMap(C4Group &hGroup, const char *szEntryName, BOOL *pOverloadMaterials, BOOL *pOverloadTextures);
|
||||
static bool LoadFlags(C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures);
|
||||
int32_t LoadMap(C4Group &hGroup, const char *szEntryName, bool *pOverloadMaterials, bool *pOverloadTextures);
|
||||
int32_t Init();
|
||||
bool SaveMap(C4Group &hGroup, const char *szEntryName);
|
||||
int32_t LoadTextures(C4Group &hGroup, C4Group* OverloadFile=0);
|
||||
bool HasTextures(C4Group &hGroup);
|
||||
const char *GetTexture(int32_t iIndex);
|
||||
void MoveIndex(BYTE byOldIndex, BYTE byNewIndex); // change index of texture
|
||||
int32_t GetIndex(const char *szMaterial, const char *szTexture, BOOL fAddIfNotExist=TRUE, const char *szErrorIfFailed=NULL);
|
||||
int32_t GetIndexMatTex(const char *szMaterialTexture, const char *szDefaultTexture = NULL, BOOL fAddIfNotExist=TRUE, const char *szErrorIfFailed=NULL);
|
||||
int32_t GetIndex(const char *szMaterial, const char *szTexture, bool fAddIfNotExist=true, const char *szErrorIfFailed=NULL);
|
||||
int32_t GetIndexMatTex(const char *szMaterialTexture, const char *szDefaultTexture = NULL, bool fAddIfNotExist=true, const char *szErrorIfFailed=NULL);
|
||||
C4Texture * GetTexture(const char *szTexture);
|
||||
bool CheckTexture(const char *szTexture); // return whether texture exists
|
||||
BOOL AddEntry(BYTE byIndex, const char *szMaterial, const char *szTexture);
|
||||
bool AddEntry(BYTE byIndex, const char *szMaterial, const char *szTexture);
|
||||
protected:
|
||||
BOOL AddTexture(const char *szTexture, CSurface * sfcSurface);
|
||||
bool AddTexture(const char *szTexture, CSurface * sfcSurface);
|
||||
};
|
||||
|
||||
extern C4TextureMap TextureMap;
|
||||
|
|
|
@ -41,7 +41,7 @@ C4Weather::~C4Weather()
|
|||
Clear();
|
||||
}
|
||||
|
||||
void C4Weather::Init(BOOL fScenario)
|
||||
void C4Weather::Init(bool fScenario)
|
||||
{
|
||||
if(fScenario)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ void C4Weather::Execute()
|
|||
if (!Random(35))
|
||||
if (Random(100)<LightningLevel)
|
||||
LaunchLightning(Random(GBackWdt),0,
|
||||
-20,41,+5,15, TRUE);
|
||||
-20,41,+5,15, true);
|
||||
// Earthquake
|
||||
if (!Random(50))
|
||||
if (Random(100)<EarthquakeLevel)
|
||||
|
@ -146,7 +146,7 @@ void C4Weather::Clear()
|
|||
|
||||
}
|
||||
|
||||
BOOL C4Weather::LaunchLightning(int32_t x, int32_t y, int32_t xdir, int32_t xrange, int32_t ydir, int32_t yrange, BOOL fDoGamma)
|
||||
bool C4Weather::LaunchLightning(int32_t x, int32_t y, int32_t xdir, int32_t xrange, int32_t ydir, int32_t yrange, bool fDoGamma)
|
||||
{
|
||||
C4Object *pObj;
|
||||
if (pObj=Game.CreateObject(C4Id("FXL1"), NULL))
|
||||
|
@ -157,7 +157,7 @@ BOOL C4Weather::LaunchLightning(int32_t x, int32_t y, int32_t xdir, int32_t xran
|
|||
C4VInt(ydir),
|
||||
C4VInt(yrange),
|
||||
C4VBool(!!fDoGamma)));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t C4Weather::GetWind(int32_t x, int32_t y)
|
||||
|
@ -171,12 +171,12 @@ int32_t C4Weather::GetTemperature()
|
|||
return Temperature;
|
||||
}
|
||||
|
||||
BOOL C4Weather::LaunchVolcano(int32_t mat, int32_t x, int32_t y, int32_t size)
|
||||
bool C4Weather::LaunchVolcano(int32_t mat, int32_t x, int32_t y, int32_t size)
|
||||
{
|
||||
C4Object *pObj;
|
||||
if (pObj=Game.CreateObject(C4Id("FXV1"), NULL))
|
||||
pObj->Call(PSF_Activate,&C4AulParSet(C4VInt(x), C4VInt(y), C4VInt(size), C4VInt(mat)));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Weather::Default()
|
||||
|
@ -186,28 +186,28 @@ void C4Weather::Default()
|
|||
Temperature=Climate=0;
|
||||
TemperatureRange=30;
|
||||
MeteoriteLevel=VolcanoLevel=EarthquakeLevel=LightningLevel=0;
|
||||
NoGamma=TRUE;
|
||||
NoGamma=true;
|
||||
}
|
||||
|
||||
BOOL C4Weather::LaunchEarthquake(int32_t iX, int32_t iY)
|
||||
bool C4Weather::LaunchEarthquake(int32_t iX, int32_t iY)
|
||||
{
|
||||
C4Object *pObj;
|
||||
if (pObj=Game.CreateObject(C4Id("FXQ1"),NULL,NO_OWNER,iX,iY))
|
||||
if (!! pObj->Call(PSF_Activate))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4Weather::LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation)
|
||||
bool C4Weather::LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation)
|
||||
{
|
||||
if (::MaterialMap.Get(szPrecipitation)==MNone) return FALSE;
|
||||
if (::MaterialMap.Get(szPrecipitation)==MNone) return false;
|
||||
C4Object *pObj;
|
||||
if (pObj=Game.CreateObject(C4Id("FXP1"),NULL,NO_OWNER,iX,iY))
|
||||
if (!!pObj->Call(PSF_Activate,&C4AulParSet(C4VInt(::MaterialMap.Get(szPrecipitation)),
|
||||
C4VInt(iWidth),
|
||||
C4VInt(iStrength))))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Weather::SetWind(int32_t iWind)
|
||||
|
@ -293,7 +293,7 @@ void C4Weather::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(VolcanoLevel, "VolcanoLevel", 0));
|
||||
pComp->Value(mkNamingAdapt(EarthquakeLevel, "EarthquakeLevel", 0));
|
||||
pComp->Value(mkNamingAdapt(LightningLevel, "LightningLevel", 0));
|
||||
pComp->Value(mkNamingAdapt(NoGamma, "NoGamma", TRUE));
|
||||
pComp->Value(mkNamingAdapt(NoGamma, "NoGamma", true));
|
||||
uint32_t dwGammaDefaults[C4MaxGammaRamps*3];
|
||||
for (int32_t i=0; i<C4MaxGammaRamps; ++i)
|
||||
{
|
||||
|
|
|
@ -41,16 +41,16 @@ class C4Weather
|
|||
void SetClimate(int32_t iClimate);
|
||||
void SetSeason(int32_t iSeason);
|
||||
void SetTemperature(int32_t iTemperature);
|
||||
void Init(BOOL fScenario);
|
||||
void Init(bool fScenario);
|
||||
void SetWind(int32_t iWind);
|
||||
int32_t GetWind(int32_t x, int32_t y);
|
||||
int32_t GetTemperature();
|
||||
int32_t GetSeason();
|
||||
int32_t GetClimate();
|
||||
BOOL LaunchLightning(int32_t x, int32_t y, int32_t xdir, int32_t xrange, int32_t ydir, int32_t yrange, BOOL fDoGamma);
|
||||
BOOL LaunchVolcano(int32_t mat, int32_t x, int32_t y, int32_t size);
|
||||
BOOL LaunchEarthquake(int32_t iX, int32_t iY);
|
||||
BOOL LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation);
|
||||
bool LaunchLightning(int32_t x, int32_t y, int32_t xdir, int32_t xrange, int32_t ydir, int32_t yrange, bool fDoGamma);
|
||||
bool LaunchVolcano(int32_t mat, int32_t x, int32_t y, int32_t size);
|
||||
bool LaunchEarthquake(int32_t iX, int32_t iY);
|
||||
bool LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation);
|
||||
void SetSeasonGamma(); // set gamma adjustment for season
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
};
|
||||
|
|
|
@ -99,7 +99,7 @@ int32_t CommandByName(const char *szCommand)
|
|||
return C4CMD_None;
|
||||
}
|
||||
|
||||
void AdjustMoveToTarget(int32_t &rX, int32_t &rY, BOOL fFreeMove, int32_t iShapeHgt)
|
||||
void AdjustMoveToTarget(int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShapeHgt)
|
||||
{
|
||||
// Above solid (always)
|
||||
int32_t iY;
|
||||
|
@ -122,20 +122,20 @@ void AdjustMoveToTarget(int32_t &rX, int32_t &rY, BOOL fFreeMove, int32_t iShape
|
|||
|
||||
}
|
||||
|
||||
BOOL FreeMoveTo(C4Object *cObj)
|
||||
bool FreeMoveTo(C4Object *cObj)
|
||||
{
|
||||
// Floating: we accept any move-to target
|
||||
if (cObj->GetProcedure()==DFA_FLOAT) return TRUE;
|
||||
if (cObj->GetProcedure()==DFA_FLOAT) return true;
|
||||
// Can fly: we accept any move-to target
|
||||
if (cObj->GetPhysical()->CanFly) return TRUE;
|
||||
if (cObj->GetPhysical()->CanFly) return true;
|
||||
// Assume we're walking: move-to targets are adjusted
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL AdjustSolidOffset(int32_t &rX, int32_t &rY, int32_t iXOff, int32_t iYOff)
|
||||
bool AdjustSolidOffset(int32_t &rX, int32_t &rY, int32_t iXOff, int32_t iYOff)
|
||||
{
|
||||
// In solid: fail
|
||||
if (GBackSolid(rX,rY)) return FALSE;
|
||||
if (GBackSolid(rX,rY)) return false;
|
||||
// Y Offset
|
||||
int32_t cnt;
|
||||
for (cnt=1; cnt<iYOff; cnt++)
|
||||
|
@ -150,7 +150,7 @@ BOOL AdjustSolidOffset(int32_t &rX, int32_t &rY, int32_t iXOff, int32_t iYOff)
|
|||
if (GBackSolid(rX-cnt,rY) && !GBackSolid(rX+cnt,rY)) rX++;
|
||||
}
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t SolidOnWhichSide(int32_t iX, int32_t iY)
|
||||
|
@ -178,9 +178,9 @@ void C4Command::Default()
|
|||
{
|
||||
Command=C4CMD_None;
|
||||
cObj=NULL;
|
||||
Evaluated=FALSE;
|
||||
PathChecked=FALSE;
|
||||
Finished=FALSE;
|
||||
Evaluated=false;
|
||||
PathChecked=false;
|
||||
Finished=false;
|
||||
Tx=C4VNull;
|
||||
Ty=0;
|
||||
Target=Target2=NULL;
|
||||
|
@ -197,11 +197,11 @@ void C4Command::Default()
|
|||
|
||||
static bool ObjectAddWaypoint(int32_t iX, int32_t iY, intptr_t iTransferTarget, intptr_t ipObject)
|
||||
{
|
||||
C4Object *cObj = (C4Object*) ipObject; if (!cObj) return FALSE;
|
||||
C4Object *cObj = (C4Object*) ipObject; if (!cObj) return false;
|
||||
|
||||
// Transfer waypoint
|
||||
if (iTransferTarget)
|
||||
return cObj->AddCommand(C4CMD_Transfer,(C4Object*)iTransferTarget,iX,iY,0,NULL,FALSE);
|
||||
return cObj->AddCommand(C4CMD_Transfer,(C4Object*)iTransferTarget,iX,iY,0,NULL,false);
|
||||
|
||||
// Solid offset
|
||||
AdjustSolidOffset(iX,iY,cObj->Shape.Wdt/2,cObj->Shape.Hgt/2);
|
||||
|
@ -213,9 +213,9 @@ static bool ObjectAddWaypoint(int32_t iX, int32_t iY, intptr_t iTransferTarget,
|
|||
// Add waypoint
|
||||
//AddCommand(iCommand,pTarget,iTx,iTy,iUpdateInterval,pTarget2,fInitEvaluation,iData,fAppend,iRetries,szText,iBaseMode)
|
||||
assert(cObj->Command);
|
||||
if (!cObj->AddCommand(C4CMD_MoveTo,NULL,iX,iY,25,NULL,FALSE,cObj->Command->Data)) return FALSE;
|
||||
if (!cObj->AddCommand(C4CMD_MoveTo,NULL,iX,iY,25,NULL,false,cObj->Command->Data)) return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Command::MoveTo()
|
||||
|
@ -226,8 +226,8 @@ void C4Command::MoveTo()
|
|||
|
||||
// Current object position
|
||||
int32_t cx,cy; cx=cObj->GetX(); cy=cObj->GetY();
|
||||
BOOL fWaypoint=FALSE;
|
||||
if (Next && (Next->Command==C4CMD_MoveTo)) fWaypoint=TRUE;
|
||||
bool fWaypoint=false;
|
||||
if (Next && (Next->Command==C4CMD_MoveTo)) fWaypoint=true;
|
||||
|
||||
// Contained: exit
|
||||
if (cObj->Contained)
|
||||
|
@ -250,15 +250,15 @@ void C4Command::MoveTo()
|
|||
Tx._getInt(),Ty,
|
||||
&ObjectAddWaypoint,
|
||||
(intptr_t)cObj)) // intptr for 64bit?
|
||||
{ /* Path not found: react? */ PathChecked=TRUE; /* recheck delay */ }
|
||||
{ /* Path not found: react? */ PathChecked=true; /* recheck delay */ }
|
||||
return;
|
||||
}
|
||||
// Path free: recheck delay
|
||||
else
|
||||
PathChecked=TRUE;
|
||||
PathChecked=true;
|
||||
}
|
||||
// Path recheck
|
||||
if (!::Game.iTick35) PathChecked=FALSE;
|
||||
if (!::Game.iTick35) PathChecked=false;
|
||||
|
||||
// Pushing grab only or not desired: let go (pulling, too?)
|
||||
if (cObj->GetProcedure()==DFA_PUSH)
|
||||
|
@ -266,7 +266,7 @@ void C4Command::MoveTo()
|
|||
if (cObj->Action.Target->Def->Grab == 2 || !(Data.getInt() & C4CMD_MoveTo_PushTarget))
|
||||
{
|
||||
// Re-evaluate this command because vehicle control might have blocked evaluation
|
||||
Evaluated=FALSE;
|
||||
Evaluated=false;
|
||||
cObj->AddCommand(C4CMD_UnGrab,NULL,0,0,50); return;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ void C4Command::MoveTo()
|
|||
&& Inside(cy-Ty,-iRangeFactorBottom*iTargetRange,+iRangeFactorTop*iTargetRange))
|
||||
{
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Idles can't move to
|
||||
|
@ -415,7 +415,7 @@ void C4Command::Dig()
|
|||
int32_t cx,cy,tx,ty;
|
||||
cx=cObj->GetX(); cy=cObj->GetY();
|
||||
tx=Tx._getInt(); ty=Ty+cObj->Shape.GetY() + 3; // Target coordinates are bottom center
|
||||
BOOL fDigOutMaterial=Data.getBool();
|
||||
bool fDigOutMaterial=Data.getBool();
|
||||
|
||||
// Grabbing: let go
|
||||
if (cObj->GetProcedure()==DFA_PUSH)
|
||||
|
@ -442,7 +442,7 @@ void C4Command::Dig()
|
|||
&& Inside(cy - ty, -iMoveToRange, +iMoveToRange))
|
||||
{
|
||||
ObjectComStop(cObj);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Can start digging only from walk
|
||||
|
@ -477,7 +477,7 @@ void C4Command::Follow()
|
|||
// If crew member, only selected objects can follow
|
||||
if (cObj->Def->CrewMember)
|
||||
// Finish successfully to avoid fail message
|
||||
if (!cObj->Select && cObj->Owner != NO_OWNER) { Finish(TRUE); return; }
|
||||
if (!cObj->Select && cObj->Owner != NO_OWNER) { Finish(true); return; }
|
||||
|
||||
// No-one to follow
|
||||
if (!Target) { Finish(); return; }
|
||||
|
@ -537,7 +537,7 @@ void C4Command::Enter()
|
|||
if (!Target || cObj->Def->NoPushEnter) { Finish(); return; }
|
||||
|
||||
// Already in target object
|
||||
if (cObj->Contained==Target) { Finish(TRUE); return; }
|
||||
if (cObj->Contained==Target) { Finish(true); return; }
|
||||
|
||||
// Building or chopping: stop
|
||||
if ((cObj->GetProcedure()==DFA_CHOP) || (cObj->GetProcedure()==DFA_BUILD))
|
||||
|
@ -574,7 +574,7 @@ void C4Command::Enter()
|
|||
if ((cObj->GetProcedure()==DFA_PUSH) && cObj->Action.Target)
|
||||
{
|
||||
cObj->Action.Target->SetCommand(C4CMD_Enter,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
// Else, enter self
|
||||
else
|
||||
|
@ -583,7 +583,7 @@ void C4Command::Enter()
|
|||
if (Target->EntranceStatus!=0)
|
||||
{
|
||||
cObj->Enter(Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
else // Else, activate entrance
|
||||
Target->ActivateEntrance(cObj->Controller,cObj);
|
||||
|
@ -603,7 +603,7 @@ void C4Command::Exit()
|
|||
{
|
||||
|
||||
// Outside: done
|
||||
if (!cObj->Contained) { Finish(TRUE); return; }
|
||||
if (!cObj->Contained) { Finish(true); return; }
|
||||
|
||||
// Building: stop
|
||||
if (cObj->GetProcedure()==DFA_BUILD)
|
||||
|
@ -614,23 +614,23 @@ void C4Command::Exit()
|
|||
{
|
||||
// Exit to container's container
|
||||
if (cObj->Contained->Contained)
|
||||
{ cObj->Enter(cObj->Contained->Contained); Finish(TRUE); return; }
|
||||
{ cObj->Enter(cObj->Contained->Contained); Finish(true); return; }
|
||||
// Exit to entrance area
|
||||
int32_t ex,ey,ewdt,ehgt;
|
||||
if (cObj->Contained->OCF & OCF_Entrance)
|
||||
if (cObj->Contained->GetEntranceArea(ex,ey,ewdt,ehgt))
|
||||
{ cObj->Exit(ex+ewdt/2,ey+ehgt+cObj->Shape.GetY()-1); Finish(TRUE); return; }
|
||||
{ cObj->Exit(ex+ewdt/2,ey+ehgt+cObj->Shape.GetY()-1); Finish(true); return; }
|
||||
// Exit jump out of collection area
|
||||
if (cObj->GetPropertyInt(P_Collectible))
|
||||
if (cObj->Contained->Def->Collection.Wdt)
|
||||
{
|
||||
cObj->Exit(cObj->Contained->GetX(),cObj->Contained->GetY()+cObj->Contained->Def->Collection.y-1);
|
||||
ObjectComJump(cObj);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
// Plain exit
|
||||
cObj->Exit(cObj->GetX(),cObj->GetY());
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Entrance closed, activate entrance
|
||||
|
@ -648,7 +648,7 @@ void C4Command::Grab()
|
|||
// Command fulfilled
|
||||
if (cObj->GetProcedure()==DFA_PUSH)
|
||||
if (cObj->Action.Target==Target)
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
// Building or chopping: stop
|
||||
if ((cObj->GetProcedure()==DFA_CHOP) || (cObj->GetProcedure()==DFA_BUILD))
|
||||
ObjectComStop(cObj);
|
||||
|
@ -690,7 +690,7 @@ void C4Command::PushTo()
|
|||
{
|
||||
// Object in correct target container: success
|
||||
if (Target->Contained==Target2)
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -701,7 +701,7 @@ void C4Command::PushTo()
|
|||
cObj->Action.ComDir=COMD_Stop;
|
||||
cObj->AddCommand(C4CMD_UnGrab);
|
||||
cObj->AddCommand(C4CMD_Wait,NULL,0,0,10);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ void C4Command::Chop()
|
|||
{ Finish(); return; }
|
||||
// Target not chopable: done (assume was successfully chopped)
|
||||
if (!(Target->OCF & OCF_Chop))
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
// Chopping target: wait
|
||||
if ((cObj->GetProcedure()==DFA_CHOP) && (cObj->Action.Target==Target))
|
||||
return;
|
||||
|
@ -774,7 +774,7 @@ void C4Command::Build()
|
|||
// Lost the ability to build? Fail.
|
||||
if (cObj->GetPhysical() && !cObj->GetPhysical()->CanConstruct)
|
||||
{
|
||||
Finish(FALSE, FormatString(LoadResStr("IDS_TEXT_CANTBUILD"), cObj->GetName()).getData());
|
||||
Finish(false, FormatString(LoadResStr("IDS_TEXT_CANTBUILD"), cObj->GetName()).getData());
|
||||
return;
|
||||
}
|
||||
// Target complete: Command fulfilled
|
||||
|
@ -801,7 +801,7 @@ void C4Command::Build()
|
|||
}
|
||||
// Done
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
// Currently working on target: continue
|
||||
if (cObj->GetProcedure()==DFA_BUILD)
|
||||
|
@ -843,7 +843,7 @@ void C4Command::UnGrab()
|
|||
{
|
||||
ObjectComUnGrab(cObj);
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Throw()
|
||||
|
@ -890,7 +890,7 @@ void C4Command::Throw()
|
|||
if (cObj->GetX() < Tx._getInt()) cObj->SetDir(DIR_Right); else cObj->SetDir(DIR_Left);
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
if (ObjectComThrow(cObj,Target))
|
||||
Finish(TRUE); // Throw successfull: done, else continue
|
||||
Finish(true); // Throw successfull: done, else continue
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -904,7 +904,7 @@ void C4Command::Throw()
|
|||
if (cObj->Contained)
|
||||
{
|
||||
ObjectComPutTake(cObj,cObj->Contained,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Pushing: put or take
|
||||
|
@ -912,24 +912,24 @@ void C4Command::Throw()
|
|||
{
|
||||
if (cObj->Action.Target)
|
||||
ObjectComPutTake(cObj,cObj->Action.Target,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Outside: Throw
|
||||
ObjectComThrow(cObj,Target);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Take()
|
||||
{
|
||||
ObjectComTake(cObj);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Take2()
|
||||
{
|
||||
ObjectComTake2(cObj);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Drop()
|
||||
|
@ -961,7 +961,7 @@ void C4Command::Drop()
|
|||
{
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
ObjectComDrop(cObj,Target);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
return;
|
||||
}
|
||||
// Move to target position
|
||||
|
@ -973,7 +973,7 @@ void C4Command::Drop()
|
|||
if (cObj->Contained)
|
||||
{
|
||||
ObjectComPutTake(cObj,cObj->Contained,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Pushing: put
|
||||
|
@ -981,12 +981,12 @@ void C4Command::Drop()
|
|||
{
|
||||
if (cObj->Action.Target)
|
||||
ObjectComPutTake(cObj,cObj->Action.Target,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Outside: Drop
|
||||
ObjectComDrop(cObj,Target);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Jump()
|
||||
|
@ -1000,7 +1000,7 @@ void C4Command::Jump()
|
|||
// Jump
|
||||
ObjectComJump(cObj);
|
||||
// Done
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Wait()
|
||||
|
@ -1022,7 +1022,7 @@ void C4Command::Context()
|
|||
cObj->Menu->SetLocation(Tx._getInt(),Ty);
|
||||
}
|
||||
// Done
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
bool C4Command::GetTryEnter()
|
||||
|
@ -1041,11 +1041,11 @@ bool C4Command::GetTryEnter()
|
|||
bool fWasContained = !!Target->Contained;
|
||||
// Grab target object
|
||||
bool fRejectCollect = false;
|
||||
bool fSuccess = !!Target->Enter(cObj, TRUE, true, &fRejectCollect);
|
||||
bool fSuccess = !!Target->Enter(cObj, true, true, &fRejectCollect);
|
||||
// target is void?
|
||||
// well...most likely the new container has done something with it
|
||||
// so count it as success
|
||||
if (!Target) { Finish(TRUE); return true; }
|
||||
if (!Target) { Finish(true); return true; }
|
||||
// collection rejected by target: make room for more contents
|
||||
if (fRejectCollect)
|
||||
{
|
||||
|
@ -1069,7 +1069,7 @@ void C4Command::Get()
|
|||
if (((Data.getInt()==1) || (Data.getInt()==2)) && Target)
|
||||
{
|
||||
cObj->ActivateMenu((Data.getInt()==1) ? C4MN_Get : C4MN_Contents,0,0,0,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Get target specified by container and type
|
||||
|
@ -1091,7 +1091,7 @@ void C4Command::Get()
|
|||
{ Target = NULL; Tx--; return; }
|
||||
// We're done
|
||||
else
|
||||
{ cObj->Action.ComDir=COMD_Stop; Finish(TRUE); return; }
|
||||
{ cObj->Action.ComDir=COMD_Stop; Finish(true); return; }
|
||||
|
||||
// Grabbing other than target container: let go
|
||||
if (cObj->GetProcedure()==DFA_PUSH)
|
||||
|
@ -1232,14 +1232,14 @@ void C4Command::Activate()
|
|||
if (Target2 && !Target && !Data)
|
||||
{
|
||||
cObj->ActivateMenu(C4MN_Activate,0,0,0,Target2);
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Target object specified & outside: success
|
||||
if (Target)
|
||||
if (!Target->Contained)
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
|
||||
// No container specified: determine container by target object
|
||||
if (!Target2)
|
||||
|
@ -1314,7 +1314,7 @@ void C4Command::Put() // Notice: Put command is currently using Ty as an interna
|
|||
// No contents object to put - most likely we did have a target but it was deleted,
|
||||
// e.g. by AutoSellContents in a base. New behaviour: if there is nothing to put, we
|
||||
// now consider the command succesfully completed.
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
|
||||
// Thing is in target
|
||||
if (Target2->Contained == Target)
|
||||
|
@ -1323,7 +1323,7 @@ void C4Command::Put() // Notice: Put command is currently using Ty as an interna
|
|||
{ Target2 = NULL; Tx--; return; }
|
||||
// We're done
|
||||
else
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
|
||||
// Thing to put not in contents: get object
|
||||
if (!cObj->Contents.GetLink(Target2))
|
||||
|
@ -1442,7 +1442,7 @@ void C4Command::Execute()
|
|||
{
|
||||
UpdateInterval--;
|
||||
if (UpdateInterval==0) {
|
||||
Finish(TRUE); return; }
|
||||
Finish(true); return; }
|
||||
}
|
||||
|
||||
// Initial command evaluation
|
||||
|
@ -1499,10 +1499,10 @@ void C4Command::Execute()
|
|||
|
||||
}
|
||||
|
||||
void C4Command::Finish(BOOL fSuccess, const char *szFailMessage)
|
||||
void C4Command::Finish(bool fSuccess, const char *szFailMessage)
|
||||
{
|
||||
// Mark finished
|
||||
Finished=TRUE;
|
||||
Finished=true;
|
||||
// Failed
|
||||
if (!fSuccess)
|
||||
Fail(szFailMessage);
|
||||
|
@ -1517,12 +1517,12 @@ void C4Command::Finish(BOOL fSuccess, const char *szFailMessage)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Command::InitEvaluation()
|
||||
bool C4Command::InitEvaluation()
|
||||
{
|
||||
// Already evaluated
|
||||
if (Evaluated) return FALSE;
|
||||
if (Evaluated) return false;
|
||||
// Set evaluation flag
|
||||
Evaluated=TRUE;
|
||||
Evaluated=true;
|
||||
// Evaluate
|
||||
switch (Command)
|
||||
{
|
||||
|
@ -1535,7 +1535,7 @@ BOOL C4Command::InitEvaluation()
|
|||
int32_t iTx = Tx._getInt();
|
||||
if (~Data.getInt() & C4CMD_MoveTo_NoPosAdjust) AdjustMoveToTarget(iTx,Ty,FreeMoveTo(cObj),cObj->Shape.Hgt);
|
||||
Tx.SetInt(iTx);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CMD_PushTo:
|
||||
|
@ -1544,38 +1544,38 @@ BOOL C4Command::InitEvaluation()
|
|||
int32_t iTx = Tx._getInt();
|
||||
AdjustMoveToTarget(iTx,Ty,FreeMoveTo(cObj),cObj->Shape.Hgt);
|
||||
Tx.SetInt(iTx);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CMD_Exit:
|
||||
// Cancel attach
|
||||
ObjectComCancelAttach(cObj);
|
||||
return TRUE;
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CMD_Wait:
|
||||
// Update interval by Data
|
||||
if (!Data) UpdateInterval=Data.getInt();
|
||||
// Else update interval by Tx
|
||||
else if (Tx._getInt()) UpdateInterval=Tx._getInt();
|
||||
return TRUE;
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CMD_Acquire:
|
||||
// update default search range
|
||||
if (!Tx._getInt()) Tx.SetInt(500);
|
||||
if (!Ty) Ty=250;
|
||||
return TRUE;
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
// Need not be evaluated
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Command::Clear()
|
||||
{
|
||||
Command=C4CMD_None;
|
||||
cObj=NULL;
|
||||
Evaluated=FALSE;
|
||||
PathChecked=FALSE;
|
||||
Evaluated=false;
|
||||
PathChecked=false;
|
||||
Tx=C4VNull;
|
||||
Ty=0;
|
||||
Target=Target2=NULL;
|
||||
|
@ -1589,14 +1589,14 @@ void C4Command::Construct()
|
|||
// Only those who can
|
||||
if (cObj->GetPhysical() && !cObj->GetPhysical()->CanConstruct)
|
||||
{
|
||||
Finish(FALSE, FormatString(LoadResStr("IDS_TEXT_CANTBUILD"), cObj->GetName()).getData());
|
||||
Finish(false, FormatString(LoadResStr("IDS_TEXT_CANTBUILD"), cObj->GetName()).getData());
|
||||
return;
|
||||
}
|
||||
// No target type to construct: open menu & done
|
||||
if (!Data)
|
||||
{
|
||||
cObj->ActivateMenu(C4MN_Construction);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
|
||||
// Determine move-to range
|
||||
|
@ -1611,14 +1611,14 @@ void C4Command::Construct()
|
|||
if (pBuildCmd)
|
||||
{
|
||||
// then help
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
cObj->AddCommand(C4CMD_Build,pBuildCmd->Target);
|
||||
}
|
||||
// construct command still present? (might find another stacked command, which doesn't really matter for now...)
|
||||
if (!Target->FindCommand(C4CMD_Construct))
|
||||
// command aborted (or done?): failed to help; don't issue another construct command, because it is likely to fail anyway
|
||||
// (and maybe, it had been finished while this Clonk was still moving to the site)
|
||||
{ Finish(FALSE); return; }
|
||||
{ Finish(false); return; }
|
||||
// site not yet placed: move to target, if necessary and known
|
||||
if (Tx._getInt() || Ty)
|
||||
if (!Inside<int32_t>(cObj->GetX() - Tx._getInt(), -iMoveToRange, +iMoveToRange) || !Inside<int32_t>(cObj->GetY()-Ty,-20,+20))
|
||||
|
@ -1661,14 +1661,14 @@ void C4Command::Construct()
|
|||
if (!cObj->Status) return;
|
||||
if (1 == scriptresult) return;
|
||||
if (2 == scriptresult)
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
if (3 == scriptresult)
|
||||
{ Finish(); return; }
|
||||
|
||||
// Has no construction kit: acquire one
|
||||
C4Object *pKit;
|
||||
if (!(pKit=cObj->Contents.Find(C4ID_Conkit)))
|
||||
{ cObj->AddCommand(C4CMD_Acquire,0,0,0,50,0,TRUE,C4VID(C4ID_Conkit),FALSE,5,0,C4CMD_Mode_Sub); return; }
|
||||
{ cObj->AddCommand(C4CMD_Acquire,0,0,0,50,0,true,C4VID(C4ID_Conkit),false,5,0,C4CMD_Mode_Sub); return; }
|
||||
|
||||
// Move to construction site
|
||||
if (!Inside<int32_t>(cObj->GetX() - Tx._getInt(), -iMoveToRange, +iMoveToRange)
|
||||
|
@ -1681,28 +1681,28 @@ void C4Command::Construct()
|
|||
{ Finish(); return; }
|
||||
|
||||
// Create construction
|
||||
C4Object *pConstruction = Game.CreateObjectConstruction(Data.getPropList(),NULL,cObj->Owner,Tx._getInt(),Ty,1,TRUE);
|
||||
C4Object *pConstruction = Game.CreateObjectConstruction(Data.getPropList(),NULL,cObj->Owner,Tx._getInt(),Ty,1,true);
|
||||
|
||||
// Remove conkit
|
||||
pKit->AssignRemoval();
|
||||
|
||||
// Finish, start building
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
cObj->AddCommand(C4CMD_Build,pConstruction);
|
||||
|
||||
}
|
||||
|
||||
BOOL C4Command::FlightControl() // Called by DFA_WALK, DFA_FLIGHT
|
||||
bool C4Command::FlightControl() // Called by DFA_WALK, DFA_FLIGHT
|
||||
{
|
||||
// Objects with CanFly physical only
|
||||
if (!cObj->GetPhysical()->CanFly) return FALSE;
|
||||
if (!cObj->GetPhysical()->CanFly) return false;
|
||||
// Crew members or pathfinder objects only
|
||||
if (!((cObj->OCF & OCF_CrewMember) || cObj->Def->Pathfinder)) return FALSE;
|
||||
if (!((cObj->OCF & OCF_CrewMember) || cObj->Def->Pathfinder)) return false;
|
||||
|
||||
// Not while in a disabled action
|
||||
if (cObj->Action.pActionDef)
|
||||
{
|
||||
if (cObj->Action.pActionDef->GetPropertyInt(P_ObjectDisabled)) return FALSE;
|
||||
if (cObj->Action.pActionDef->GetPropertyInt(P_ObjectDisabled)) return false;
|
||||
}
|
||||
|
||||
// Target angle
|
||||
|
@ -1719,7 +1719,7 @@ BOOL C4Command::FlightControl() // Called by DFA_WALK, DFA_FLIGHT
|
|||
if (iTopFree>=15)
|
||||
{
|
||||
//sprintf(OSTR,"Flight take off at %d (%d)",iAngle,Distance(cx,cy,Tx,Ty)); Log(OSTR); GameMsgObject(OSTR,cObj);
|
||||
//cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return TRUE;
|
||||
//cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return true;
|
||||
|
||||
// Take off
|
||||
cObj->SetActionByName("Fly"); // This is a little primitive... we should have a ObjectActionFly or maybe a command for this...
|
||||
|
@ -1727,14 +1727,14 @@ BOOL C4Command::FlightControl() // Called by DFA_WALK, DFA_FLIGHT
|
|||
}
|
||||
|
||||
// No flight control
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4Command::JumpControl() // Called by DFA_WALK
|
||||
bool C4Command::JumpControl() // Called by DFA_WALK
|
||||
{
|
||||
|
||||
// Crew members or pathfinder objects only
|
||||
if (! ((cObj->OCF & OCF_CrewMember) || cObj->Def->Pathfinder) ) return FALSE;
|
||||
if (! ((cObj->OCF & OCF_CrewMember) || cObj->Def->Pathfinder) ) return false;
|
||||
|
||||
// Target angle
|
||||
int32_t cx=cObj->GetX(),cy=cObj->GetY();
|
||||
|
@ -1751,7 +1751,7 @@ BOOL C4Command::JumpControl() // Called by DFA_WALK
|
|||
if (iTopFree>=15)
|
||||
{
|
||||
//sprintf(OSTR,"Diagonal %d (%d)",iAngle,Distance(cx,cy,Tx,Ty)); GameMsgObject(OSTR,cObj);
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return TRUE;
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ BOOL C4Command::JumpControl() // Called by DFA_WALK
|
|||
{
|
||||
int32_t iSide=SolidOnWhichSide(Tx._getInt(),Ty); // take jump height of side move position into consideration...!
|
||||
int32_t iDist=5*Abs(cy-Ty)/6;
|
||||
int32_t iSideX=cx-iDist*iSide,iSideY=cy; AdjustMoveToTarget(iSideX,iSideY,FALSE,0);
|
||||
int32_t iSideX=cx-iDist*iSide,iSideY=cy; AdjustMoveToTarget(iSideX,iSideY,false,0);
|
||||
// Side move target in range
|
||||
if (Inside<int32_t>(iSideY-cy,-20,+20))
|
||||
{
|
||||
|
@ -1772,7 +1772,7 @@ BOOL C4Command::JumpControl() // Called by DFA_WALK
|
|||
//sprintf(OSTR,"High side move %d (%d,%d)",iAngle,iSideX-cx,iSideY-cy); GameMsgObject(OSTR,cObj);
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty);
|
||||
cObj->AddCommand(C4CMD_MoveTo,NULL,iSideX,iSideY,50);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
/*else
|
||||
{ sprintf(OSTR,"Side move %d/%d path not free",iSideX,iSideY); GameMsgObject(OSTR,cObj); }*/
|
||||
|
@ -1789,17 +1789,17 @@ BOOL C4Command::JumpControl() // Called by DFA_WALK
|
|||
if (Inside(iAngle-JumpLowAngle,-iLowSideRange*JumpAngleRange,+iLowSideRange*JumpAngleRange))
|
||||
{
|
||||
//sprintf(OSTR,"Low contact right %d",iAngle); GameMsgObject(OSTR,cObj);
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return TRUE;
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return true;
|
||||
}
|
||||
if (cObj->t_contact & CNAT_Left)
|
||||
if (Inside(iAngle+JumpLowAngle,-iLowSideRange*JumpAngleRange,+iLowSideRange*JumpAngleRange))
|
||||
{
|
||||
//sprintf(OSTR,"Low contact left %d",iAngle); GameMsgObject(OSTR,cObj);
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return TRUE;
|
||||
cObj->AddCommand(C4CMD_Jump,NULL,Tx,Ty); return true;
|
||||
}
|
||||
|
||||
// No jump control
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Command::Transfer()
|
||||
|
@ -1826,12 +1826,12 @@ void C4Command::Transfer()
|
|||
{
|
||||
|
||||
C4AulScriptFunc *f;
|
||||
BOOL fHandled = (f = Target->Def->Script.SFn_ControlTransfer) != NULL;
|
||||
bool fHandled = (f = Target->Def->Script.SFn_ControlTransfer) != NULL;
|
||||
if (fHandled) fHandled = f->Exec(Target,&C4AulParSet(C4VObj(cObj), Tx, C4VInt(Ty))).getBool();
|
||||
|
||||
if (!fHandled)
|
||||
// Transfer not handled by target: done
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1876,7 +1876,7 @@ void C4Command::Attack()
|
|||
else
|
||||
{
|
||||
// Success, target might be no crew member due to that is has been killed
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ void C4Command::Buy()
|
|||
if (!Data)
|
||||
{
|
||||
cObj->ActivateMenu(C4MN_Buy,0,0,0,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
// Target object is no base or hostile: fail
|
||||
if (!ValidPlr(Target->Base) || Hostile(Target->Base,cObj->Owner))
|
||||
|
@ -1924,7 +1924,7 @@ void C4Command::Buy()
|
|||
// Failed (with ugly message)
|
||||
{ Finish(); return; }
|
||||
// Done: success
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Sell()
|
||||
|
@ -1943,7 +1943,7 @@ void C4Command::Sell()
|
|||
if (!Data)
|
||||
{
|
||||
cObj->ActivateMenu(C4MN_Sell,0,0,0,Target);
|
||||
Finish(TRUE); return;
|
||||
Finish(true); return;
|
||||
}
|
||||
// Target object is no base or hostile: fail
|
||||
if (!ValidPlr(Target->Base) || Hostile(Target->Base,cObj->Owner))
|
||||
|
@ -1960,7 +1960,7 @@ void C4Command::Sell()
|
|||
// preferred sell object can be sold once only :)
|
||||
Target2=NULL;
|
||||
// Done
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Acquire()
|
||||
|
@ -1971,7 +1971,7 @@ void C4Command::Acquire()
|
|||
|
||||
// Target material in inventory: done
|
||||
if (cObj->Contents.Find(Data.getC4ID()))
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
|
||||
// script overload
|
||||
int32_t scriptresult = cObj->Call(PSF_ControlCommandAcquire, &C4AulParSet(C4VObj(Target), Tx, C4VInt(Ty), C4VObj(Target2), Data)).getInt ();
|
||||
|
@ -1980,7 +1980,7 @@ void C4Command::Acquire()
|
|||
if (!cObj->Status) return;
|
||||
if (1 == scriptresult) return;
|
||||
if (2 == scriptresult)
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
if (3 == scriptresult)
|
||||
{ Finish(); return; }
|
||||
|
||||
|
@ -2010,7 +2010,7 @@ void C4Command::Acquire()
|
|||
// No available material found: buy material
|
||||
// This command will fail immediately if buying at bases is not possible
|
||||
// - but the command should be created anyway because it might be overloaded
|
||||
cObj->AddCommand(C4CMD_Buy,NULL,0,0,100,NULL,TRUE,Data,false,0,0,C4CMD_Mode_Sub);
|
||||
cObj->AddCommand(C4CMD_Buy,NULL,0,0,100,NULL,true,Data,false,0,0,C4CMD_Mode_Sub);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2111,7 +2111,7 @@ void C4Command::Fail(const char *szFailMessage)
|
|||
// Message (if not empty)
|
||||
if (!!str)
|
||||
{
|
||||
::Messages.Append(C4GM_Target, str.getData(), l_Obj, NO_OWNER, 0, 0, FWhite, TRUE);
|
||||
::Messages.Append(C4GM_Target, str.getData(), l_Obj, NO_OWNER, 0, 0, FWhite, true);
|
||||
}
|
||||
// Fail sound
|
||||
StartSoundEffect("CommandFailure*",false,100,l_Obj);
|
||||
|
@ -2133,7 +2133,7 @@ void C4Command::Energy()
|
|||
// Target supplied
|
||||
if ( !(Game.Rules & C4RULE_StructuresNeedEnergy)
|
||||
|| (Game.FindObject(C4ID_PowerLine,0,0,0,0,OCF_All,"Connect",Target) && !Target->NeedEnergy) )
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
// No energy supply specified: find one
|
||||
if (!Target2) Target2=Game.FindObject(0,Target->GetX(),Target->GetY(),-1,-1,OCF_PowerSupply,NULL,NULL,Target);
|
||||
// No energy supply: fail
|
||||
|
@ -2145,7 +2145,7 @@ void C4Command::Energy()
|
|||
// No linekit: get one
|
||||
C4Object *pKit, *pLine = NULL, *pKitWithLine;
|
||||
if (!(pKit=cObj->Contents.Find(C4ID_Linekit)))
|
||||
{ cObj->AddCommand(C4CMD_Acquire,NULL,0,0,50,NULL,TRUE,C4VID(C4ID_Linekit)); return; }
|
||||
{ cObj->AddCommand(C4CMD_Acquire,NULL,0,0,50,NULL,true,C4VID(C4ID_Linekit)); return; }
|
||||
// Find line constructing kit
|
||||
for (int32_t cnt=0; pKitWithLine=cObj->Contents.GetObject(cnt); cnt++)
|
||||
if ((pKitWithLine->id==C4ID_Linekit) && (pLine=Game.FindObject(C4ID_PowerLine,0,0,0,0,OCF_All,"Connect",pKitWithLine)))
|
||||
|
@ -2180,7 +2180,7 @@ void C4Command::Energy()
|
|||
// Done
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
// Success
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
}
|
||||
|
||||
void C4Command::Retry()
|
||||
|
@ -2192,7 +2192,7 @@ void C4Command::Home()
|
|||
{
|
||||
// At home base: done
|
||||
if (cObj->Contained && (cObj->Contained->Base==cObj->Owner))
|
||||
{ Finish(TRUE); return; }
|
||||
{ Finish(true); return; }
|
||||
// No target (base) object specified: find closest base
|
||||
int32_t cnt; C4Object *pBase;
|
||||
if (!Target)
|
||||
|
@ -2207,7 +2207,7 @@ void C4Command::Home()
|
|||
|
||||
void C4Command::Set(int32_t iCommand, C4Object *pObj, C4Object *pTarget, C4Value nTx, int32_t iTy,
|
||||
C4Object *pTarget2, C4Value iData, int32_t iUpdateInterval,
|
||||
BOOL fEvaluated, int32_t iRetries, C4String * szText, int32_t iBaseMode)
|
||||
bool fEvaluated, int32_t iRetries, C4String * szText, int32_t iBaseMode)
|
||||
{
|
||||
// Reset
|
||||
Clear(); Default();
|
||||
|
@ -2233,7 +2233,7 @@ void C4Command::Call()
|
|||
// No target object: fail
|
||||
if (!Target) { Finish(); return; }
|
||||
// Done: success
|
||||
Finish(TRUE);
|
||||
Finish(true);
|
||||
// Object call FIXME:use c4string-api
|
||||
Target->Call(Text->GetCStr(),&C4AulParSet(C4VObj(cObj), Tx, C4VInt(Ty), C4VObj(Target2)));
|
||||
// Extreme caution notice: the script call might do just about anything
|
||||
|
|
|
@ -96,7 +96,7 @@ class C4Command
|
|||
int32_t iExec; // 0 = not executing, 1 = executing, 2 = executing, command should delete himself on finish
|
||||
int32_t BaseMode; // 0: subcommand/unmarked base (if failing, base will fail, too); 1: base command; 2: silent base command
|
||||
public:
|
||||
void Set(int32_t iCommand, C4Object *pObj, C4Object *pTarget, C4Value iTx, int32_t iTy, C4Object *pTarget2, C4Value iData, int32_t iUpdateInterval, BOOL fEvaluated, int32_t iRetries, C4String *szText, int32_t iBaseMode);
|
||||
void Set(int32_t iCommand, C4Object *pObj, C4Object *pTarget, C4Value iTx, int32_t iTy, C4Object *pTarget2, C4Value iData, int32_t iUpdateInterval, bool fEvaluated, int32_t iRetries, C4String *szText, int32_t iBaseMode);
|
||||
void Clear();
|
||||
void Execute();
|
||||
void ClearPointers(C4Object *pObj);
|
||||
|
@ -116,7 +116,7 @@ class C4Command
|
|||
void Attack();
|
||||
void Transfer();
|
||||
void Construct();
|
||||
void Finish(BOOL fSuccess=FALSE, const char *szFailMessage=0);
|
||||
void Finish(bool fSuccess=false, const char *szFailMessage=0);
|
||||
void Follow();
|
||||
void MoveTo();
|
||||
void Enter();
|
||||
|
@ -139,9 +139,9 @@ class C4Command
|
|||
void PushTo();
|
||||
void Context();
|
||||
int32_t CallFailed();
|
||||
BOOL JumpControl();
|
||||
BOOL FlightControl();
|
||||
BOOL InitEvaluation();
|
||||
bool JumpControl();
|
||||
bool FlightControl();
|
||||
bool InitEvaluation();
|
||||
int32_t GetExpGain(); // get control counts gained by this command; 1EXP=5 ControlCounts
|
||||
bool CheckMinimumCon (C4Object *pObj);
|
||||
};
|
||||
|
|
|
@ -150,14 +150,14 @@ void C4Def::DefaultDefCore()
|
|||
NoTransferZones=0;
|
||||
}
|
||||
|
||||
BOOL C4Def::LoadDefCore(C4Group &hGroup)
|
||||
bool C4Def::LoadDefCore(C4Group &hGroup)
|
||||
{
|
||||
StdStrBuf Source;
|
||||
if (hGroup.LoadEntryString(C4CFN_DefCore,Source))
|
||||
{
|
||||
StdStrBuf Name = hGroup.GetFullName() + (const StdStrBuf &)FormatString("%cDefCore.txt", DirectorySeparator);
|
||||
if (!Compile(Source.getData(), Name.getData()))
|
||||
return FALSE;
|
||||
return false;
|
||||
Source.Clear();
|
||||
|
||||
// Let's be bold: Rewrite, with current version
|
||||
|
@ -188,25 +188,25 @@ BOOL C4Def::LoadDefCore(C4Group &hGroup)
|
|||
Mass = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4Def::Save(C4Group &hGroup)
|
||||
bool C4Def::Save(C4Group &hGroup)
|
||||
{
|
||||
StdStrBuf Out;
|
||||
if (! Decompile(&Out, FormatString("%s::DefCore.txt", C4IdText(id)).getData()) )
|
||||
return FALSE;
|
||||
return hGroup.Add(C4CFN_DefCore,Out,FALSE,TRUE);
|
||||
return false;
|
||||
return hGroup.Add(C4CFN_DefCore,Out,false,true);
|
||||
}
|
||||
|
||||
BOOL C4Def::Compile(const char *szSource, const char *szName)
|
||||
bool C4Def::Compile(const char *szSource, const char *szName)
|
||||
{
|
||||
return CompileFromBuf_LogWarn<StdCompilerINIRead>(mkNamingAdapt(*this, "DefCore"), StdStrBuf(szSource), szName);
|
||||
}
|
||||
|
||||
BOOL C4Def::Decompile(StdStrBuf *pOut, const char *szName)
|
||||
bool C4Def::Decompile(StdStrBuf *pOut, const char *szName)
|
||||
{
|
||||
return DecompileToBuf_Log<StdCompilerINIWrite>(mkNamingAdapt(*this, "DefCore"), pOut, szName);
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ void C4Def::Default()
|
|||
Image=NULL;
|
||||
#endif
|
||||
Next=NULL;
|
||||
Temporary=FALSE;
|
||||
Temporary=false;
|
||||
Maker[0]=0;
|
||||
Filename[0]=0;
|
||||
Creation=0;
|
||||
|
@ -457,12 +457,12 @@ void C4Def::Clear()
|
|||
Desc.Clear();
|
||||
}
|
||||
|
||||
BOOL C4Def::Load(C4Group &hGroup,
|
||||
bool C4Def::Load(C4Group &hGroup,
|
||||
DWORD dwLoadWhat,
|
||||
const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem)
|
||||
{
|
||||
BOOL fSuccess=TRUE;
|
||||
bool fSuccess=true;
|
||||
|
||||
bool AddFileMonitoring = false;
|
||||
if (Game.pFileMonitor && !SEqual(hGroup.GetFullName().getData(),Filename) && !hGroup.IsPacked())
|
||||
|
@ -483,7 +483,7 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
if (hGroup.AccessEntry(C4CFN_ParticleCore))
|
||||
{
|
||||
// def loading not successful; abort after reading sounds
|
||||
fSuccess=FALSE;
|
||||
fSuccess=false;
|
||||
// create new particle def
|
||||
C4ParticleDef *pParticleDef = new C4ParticleDef();
|
||||
// load it
|
||||
|
@ -503,14 +503,14 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
{
|
||||
// wie geth ID?????ßßßß
|
||||
LogF(LoadResStr("IDS_ERR_INVALIDID"), GetFilename(hGroup.GetName()));
|
||||
fSuccess=FALSE;
|
||||
fSuccess=false;
|
||||
}
|
||||
|
||||
// skip def: don't even read sounds!
|
||||
if (fSuccess && Game.C4S.Definitions.SkipDefs.GetIDCount(id, 1)) return FALSE;
|
||||
if (fSuccess && Game.C4S.Definitions.SkipDefs.GetIDCount(id, 1)) return false;
|
||||
|
||||
// OldGfx is no longer supported
|
||||
if (NeededGfxMode == C4DGFXMODE_OLDGFX) return FALSE;
|
||||
if (NeededGfxMode == C4DGFXMODE_OLDGFX) return false;
|
||||
|
||||
if (!fSuccess)
|
||||
{
|
||||
|
@ -520,7 +520,7 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
if (pSoundSystem)
|
||||
pSoundSystem->LoadEffects(hGroup);
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read surface bitmap
|
||||
|
@ -528,7 +528,7 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
if (!Graphics.LoadBitmaps(hGroup, !!ColorByOwner))
|
||||
{
|
||||
DebugLogF(" Error loading graphics of %s (%s)", hGroup.GetFullName().getData(), C4IdText(id));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read portraits
|
||||
|
@ -536,7 +536,7 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
if (!LoadPortraits(hGroup))
|
||||
{
|
||||
DebugLogF(" Error loading portrait graphics of %s (%s)", hGroup.GetFullName().getData(), C4IdText(id));
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -555,7 +555,7 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
if (!hGroup.AccessEntry(C4CFN_DefGraphics)
|
||||
|| !hGroup.ReadDDBSection(&Picture,NULL,PictureRect.x,PictureRect.y,PictureRect.Wdt,PictureRect.Hgt))
|
||||
// None loaded
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Read picture section for use in image list
|
||||
if (dwLoadWhat & C4D_Load_Image)
|
||||
|
@ -564,15 +564,15 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
|| !hGroup.ReadPNGSection(&Image, NULL, -1, -1, -1, -1, 32, 32))
|
||||
// Load from BMP title
|
||||
if (!hGroup.AccessEntry(C4CFN_ScenarioTitle)
|
||||
|| !hGroup.ReadDDBSection(&Image, NULL, -1, -1, -1, -1, 32, 32, TRUE))
|
||||
|| !hGroup.ReadDDBSection(&Image, NULL, -1, -1, -1, -1, 32, 32, true))
|
||||
// Load from PNG graphics
|
||||
if (!hGroup.AccessEntry(C4CFN_DefGraphicsPNG)
|
||||
|| !hGroup.ReadPNGSection(&Image, NULL, PictureRect.x, PictureRect.y, PictureRect.Wdt, PictureRect.Hgt, 32, 32))
|
||||
// Load from BMP graphics
|
||||
if (!hGroup.AccessEntry(C4CFN_DefGraphics)
|
||||
|| !hGroup.ReadDDBSection(&Image, NULL, PictureRect.x, PictureRect.y, PictureRect.Wdt, PictureRect.Hgt, 32, 32, TRUE))
|
||||
|| !hGroup.ReadDDBSection(&Image, NULL, PictureRect.x, PictureRect.y, PictureRect.Wdt, PictureRect.Hgt, 32, 32, true))
|
||||
// None loaded
|
||||
return FALSE;
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Read script
|
||||
|
@ -690,14 +690,14 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
|
||||
|
||||
// Temporary flag
|
||||
if (dwLoadWhat & C4D_Load_Temporary) Temporary=TRUE;
|
||||
if (dwLoadWhat & C4D_Load_Temporary) Temporary=true;
|
||||
|
||||
if (Carryable) SetProperty(Strings.P[P_Collectible], C4VTrue);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY)
|
||||
void C4Def::Draw(C4Facet &cgo, bool fSelected, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY)
|
||||
{
|
||||
|
||||
// default: def picture rect
|
||||
|
@ -714,7 +714,7 @@ void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int
|
|||
|
||||
// specific object color?
|
||||
if (pObj) pObj->PrepareDrawing();
|
||||
fctPicture.Draw(cgo,TRUE,iPhaseX,iPhaseY,TRUE);
|
||||
fctPicture.Draw(cgo,true,iPhaseX,iPhaseY,true);
|
||||
if (pObj) pObj->FinishedDrawing();
|
||||
|
||||
// draw overlays
|
||||
|
@ -792,15 +792,15 @@ C4DefList::~C4DefList()
|
|||
int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
|
||||
const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem,
|
||||
BOOL fOverload,
|
||||
BOOL fSearchMessage, int32_t iMinProgress, int32_t iMaxProgress, bool fLoadSysGroups)
|
||||
bool fOverload,
|
||||
bool fSearchMessage, int32_t iMinProgress, int32_t iMaxProgress, bool fLoadSysGroups)
|
||||
{
|
||||
int32_t iResult=0;
|
||||
C4Def *nDef;
|
||||
char szEntryname[_MAX_FNAME+1];
|
||||
C4Group hChild;
|
||||
BOOL fPrimaryDef=FALSE;
|
||||
BOOL fThisSearchMessage=FALSE;
|
||||
bool fPrimaryDef=false;
|
||||
bool fThisSearchMessage=false;
|
||||
|
||||
// This search message
|
||||
if (fSearchMessage)
|
||||
|
@ -808,8 +808,8 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
|
|||
|| SEqualNoCase(GetExtension(hGroup.GetName()),"c4s")
|
||||
|| SEqualNoCase(GetExtension(hGroup.GetName()),"c4f"))
|
||||
{
|
||||
fThisSearchMessage=TRUE;
|
||||
fSearchMessage=FALSE;
|
||||
fThisSearchMessage=true;
|
||||
fSearchMessage=false;
|
||||
}
|
||||
|
||||
if (fThisSearchMessage) { LogF("%s...",GetFilename(hGroup.GetName())); }
|
||||
|
@ -817,7 +817,7 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
|
|||
// Load primary definition
|
||||
if (nDef=new C4Def)
|
||||
if ( nDef->Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem) && Add(nDef,fOverload) )
|
||||
{ iResult++; fPrimaryDef=TRUE; }
|
||||
{ iResult++; fPrimaryDef=true; }
|
||||
else
|
||||
{ delete nDef; }
|
||||
|
||||
|
@ -868,7 +868,7 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
|
|||
int32_t C4DefList::LoadFolderLocal( const char *szPath,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem,
|
||||
BOOL fOverload, char *sStoreName, int32_t iMinProgress, int32_t iMaxProgress)
|
||||
bool fOverload, char *sStoreName, int32_t iMinProgress, int32_t iMaxProgress)
|
||||
{
|
||||
int32_t iResult = 0;
|
||||
|
||||
|
@ -894,12 +894,12 @@ int32_t C4DefList::LoadFolderLocal( const char *szPath,
|
|||
return iResult;
|
||||
}
|
||||
|
||||
extern BOOL C4EngineLoadProcess(const char *szMessage, int32_t iProcess);
|
||||
extern bool C4EngineLoadProcess(const char *szMessage, int32_t iProcess);
|
||||
|
||||
int32_t C4DefList::Load(const char *szSearch,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem,
|
||||
BOOL fOverload, int32_t iMinProgress, int32_t iMaxProgress)
|
||||
bool fOverload, int32_t iMinProgress, int32_t iMaxProgress)
|
||||
{
|
||||
int32_t iResult=0;
|
||||
|
||||
|
@ -922,7 +922,7 @@ int32_t C4DefList::Load(const char *szSearch,
|
|||
{
|
||||
#ifdef _WIN32
|
||||
struct _finddata_t fdt; int32_t fdthnd;
|
||||
if ((fdthnd=_findfirst(szSearch,&fdt))<0) return FALSE;
|
||||
if ((fdthnd=_findfirst(szSearch,&fdt))<0) return false;
|
||||
do
|
||||
{
|
||||
iResult += Load(fdt.name,dwLoadWhat,szLanguage,pSoundSystem,fOverload);
|
||||
|
@ -957,10 +957,10 @@ int32_t C4DefList::Load(const char *szSearch,
|
|||
{
|
||||
// Specified file not found (failure)
|
||||
LogFatal(FormatString(LoadResStr("IDS_PRC_DEFNOTFOUND"),szSearch).getData());
|
||||
LoadFailure=TRUE;
|
||||
LoadFailure=true;
|
||||
return iResult;
|
||||
}
|
||||
iResult += Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,TRUE,iMinProgress,iMaxProgress);
|
||||
iResult += Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,true,iMinProgress,iMaxProgress);
|
||||
hGroup.Close();
|
||||
|
||||
// progress (could go down one level of recursion...)
|
||||
|
@ -969,13 +969,13 @@ int32_t C4DefList::Load(const char *szSearch,
|
|||
return iResult;
|
||||
}
|
||||
|
||||
BOOL C4DefList::Add(C4Def *pDef, BOOL fOverload)
|
||||
bool C4DefList::Add(C4Def *pDef, bool fOverload)
|
||||
{
|
||||
if (!pDef) return FALSE;
|
||||
if (!pDef) return false;
|
||||
|
||||
// Check old def to overload
|
||||
C4Def *pLastDef = ID2Def(pDef->id);
|
||||
if (pLastDef && !fOverload) return FALSE;
|
||||
if (pLastDef && !fOverload) return false;
|
||||
|
||||
// Log overloaded def
|
||||
if (Config.Graphics.VerboseObjectLoading>=1)
|
||||
|
@ -996,10 +996,10 @@ BOOL C4DefList::Add(C4Def *pDef, BOOL fOverload)
|
|||
pDef->Next=FirstDef;
|
||||
FirstDef=pDef;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4DefList::Remove(C4ID id)
|
||||
bool C4DefList::Remove(C4ID id)
|
||||
{
|
||||
C4Def *cdef,*prev;
|
||||
for (cdef=FirstDef,prev=NULL; cdef; prev=cdef,cdef=cdef->Next)
|
||||
|
@ -1008,9 +1008,9 @@ BOOL C4DefList::Remove(C4ID id)
|
|||
if (prev) prev->Next=cdef->Next;
|
||||
else FirstDef=cdef->Next;
|
||||
delete cdef;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4DefList::Remove(C4Def *def)
|
||||
|
@ -1182,7 +1182,7 @@ int32_t C4DefList::CheckRequireDef()
|
|||
return rcount;
|
||||
}
|
||||
|
||||
void C4DefList::Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor)
|
||||
void C4DefList::Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor)
|
||||
{
|
||||
C4Def *cdef = ID2Def(id);
|
||||
if (cdef) cdef->Draw(cgo,fSelected,iColor);
|
||||
|
@ -1191,7 +1191,7 @@ void C4DefList::Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor)
|
|||
void C4DefList::Default()
|
||||
{
|
||||
FirstDef=NULL;
|
||||
LoadFailure=FALSE;
|
||||
LoadFailure=false;
|
||||
ZeroMem(&Table, sizeof(Table));
|
||||
fTable=false;
|
||||
}
|
||||
|
@ -1201,7 +1201,7 @@ void C4DefList::Default()
|
|||
int32_t C4DefList::LoadForScenario(const char *szScenario,
|
||||
const char *szSelection,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem, BOOL fOverload,
|
||||
C4SoundSystem *pSoundSystem, bool fOverload,
|
||||
int32_t iMinProgress, int32_t iMaxProgress)
|
||||
{
|
||||
int32_t iDefs=0;
|
||||
|
@ -1242,10 +1242,10 @@ int32_t C4DefList::LoadForScenario(const char *szScenario,
|
|||
return iDefs;
|
||||
}
|
||||
|
||||
BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem)
|
||||
bool C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem)
|
||||
{
|
||||
// Safety
|
||||
if (!pDef) return FALSE;
|
||||
if (!pDef) return false;
|
||||
// backup graphics names and pointers
|
||||
// GfxBackup-dtor will ensure that upon loading-failure all graphics are reset to default
|
||||
C4DefGraphicsPtrBackup GfxBackup(&pDef->Graphics);
|
||||
|
@ -1253,8 +1253,8 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
|
|||
pDef->Clear(); // Assume filename is being kept
|
||||
// Reload def
|
||||
C4Group hGroup;
|
||||
if (!hGroup.Open(pDef->Filename)) return FALSE;
|
||||
if (!pDef->Load( hGroup, dwLoadWhat, szLanguage, pSoundSystem )) return FALSE;
|
||||
if (!hGroup.Open(pDef->Filename)) return false;
|
||||
if (!pDef->Load( hGroup, dwLoadWhat, szLanguage, pSoundSystem )) return false;
|
||||
hGroup.Close();
|
||||
// rebuild quick access table
|
||||
BuildTable();
|
||||
|
@ -1263,7 +1263,7 @@ BOOL C4DefList::Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4
|
|||
// restore graphics
|
||||
GfxBackup.AssignUpdate(&pDef->Graphics);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4DefList::BuildTable()
|
||||
|
|
|
@ -224,12 +224,12 @@ class C4Def: public C4PropList
|
|||
int32_t AllowPictureStack; // allow stacking of multiple items in menus even if some attributes do not match. APS_*-values
|
||||
public:
|
||||
void DefaultDefCore();
|
||||
BOOL LoadDefCore(C4Group &hGroup);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
bool LoadDefCore(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
protected:
|
||||
BOOL Compile(const char *szSource, const char *szName);
|
||||
BOOL Decompile(StdStrBuf *pOut, const char *szName);
|
||||
bool Compile(const char *szSource, const char *szName);
|
||||
bool Decompile(StdStrBuf *pOut, const char *szName);
|
||||
|
||||
|
||||
// Here begins the C4Def
|
||||
|
@ -274,14 +274,14 @@ class C4Def: public C4PropList
|
|||
|
||||
protected:
|
||||
C4Def *Next;
|
||||
BOOL Temporary;
|
||||
bool Temporary;
|
||||
public:
|
||||
void Clear();
|
||||
void Default();
|
||||
BOOL Load(C4Group &hGroup,
|
||||
bool Load(C4Group &hGroup,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
class C4SoundSystem *pSoundSystem = NULL);
|
||||
void Draw(C4Facet &cgo, BOOL fSelected=FALSE, DWORD iColor=0, C4Object *pObj=NULL, int32_t iPhaseX=0, int32_t iPhaseY=0);
|
||||
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=NULL, int32_t iPhaseX=0, int32_t iPhaseY=0);
|
||||
|
||||
inline C4Facet &GetMainFace(C4DefGraphics *pGraphics, DWORD dwClr=0) { MainFace.Surface=pGraphics->GetBitmap(dwClr); return MainFace; }
|
||||
int32_t GetValue(C4Object *pInBase, int32_t iBuyPlayer); // get value of def; calling script functions if defined
|
||||
|
@ -292,7 +292,7 @@ class C4Def: public C4PropList
|
|||
virtual C4Def* GetDef() { return this; }
|
||||
protected:
|
||||
bool LoadPortraits(C4Group &hGroup);
|
||||
BOOL LoadActMap(C4Group &hGroup);
|
||||
bool LoadActMap(C4Group &hGroup);
|
||||
void CrossMapActMap();
|
||||
private:
|
||||
C4ValueArray *GetCustomComponents(C4Value *pvArrayHolder, C4Object *pBuilder, C4Object *pObjInstance=NULL);
|
||||
|
@ -313,7 +313,7 @@ class C4DefList
|
|||
C4DefList();
|
||||
virtual ~C4DefList();
|
||||
public:
|
||||
BOOL LoadFailure;
|
||||
bool LoadFailure;
|
||||
C4Def **Table[64]; // From space to _; some minor waste of mem
|
||||
bool fTable;
|
||||
protected:
|
||||
|
@ -324,21 +324,21 @@ class C4DefList
|
|||
int32_t Load(C4Group &hGroup,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem = NULL,
|
||||
BOOL fOverload = FALSE,
|
||||
BOOL fSearchMessage = FALSE, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups = true);
|
||||
bool fOverload = false,
|
||||
bool fSearchMessage = false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups = true);
|
||||
int32_t Load(const char *szSearch,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem = NULL,
|
||||
BOOL fOverload = FALSE, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
bool fOverload = false, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
int32_t LoadFolderLocal(const char *szPath,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem = NULL,
|
||||
BOOL fOverload = FALSE, char *szStoreName=NULL, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
bool fOverload = false, char *szStoreName=NULL, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
int32_t LoadForScenario(const char *szScenario,
|
||||
const char *szSpecified,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem = NULL,
|
||||
BOOL fOverload = FALSE, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
bool fOverload = false, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
C4Def *ID2Def(C4ID id);
|
||||
C4Def *GetDef(int32_t Index, DWORD dwCategory = C4D_All);
|
||||
C4Def *GetByPath(const char *szPath);
|
||||
|
@ -347,11 +347,11 @@ class C4DefList
|
|||
int32_t RemoveTemporary();
|
||||
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2, int32_t ver3, int32_t ver4);
|
||||
int32_t CheckRequireDef();
|
||||
void Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor);
|
||||
void Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor);
|
||||
void Remove(C4Def *def);
|
||||
BOOL Remove(C4ID id);
|
||||
BOOL Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem = NULL);
|
||||
BOOL Add(C4Def *ndef, BOOL fOverload);
|
||||
bool Remove(C4ID id);
|
||||
bool Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem = NULL);
|
||||
bool Add(C4Def *ndef, bool fOverload);
|
||||
void BuildTable(); // build quick access table
|
||||
void ResetIncludeDependencies(); // resets all pointers into foreign definitions caused by include chains
|
||||
void CallEveryDefinition();
|
||||
|
|
|
@ -275,7 +275,7 @@ bool C4DefGraphics::CopyGraphicsFrom(C4DefGraphics &rSource)
|
|||
return true;
|
||||
}
|
||||
|
||||
void C4DefGraphics::DrawClr(C4Facet &cgo, BOOL fAspect, DWORD dwClr)
|
||||
void C4DefGraphics::DrawClr(C4Facet &cgo, bool fAspect, DWORD dwClr)
|
||||
{
|
||||
// create facet and draw it
|
||||
C4Surface *pSfc = BitmapClr ? BitmapClr : Bitmap; if (!pSfc) return;
|
||||
|
@ -919,7 +919,7 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj)
|
|||
if (dwClrModulation != 0xffffff) Application.DDraw->ActivateBlitModulation(dwClrModulation);
|
||||
}
|
||||
// draw at given rect
|
||||
fctBlit.DrawT(cgo, TRUE, iPhase, 0, &C4DrawTransform(Transform, cgo.X+float(cgo.Wdt)/2, cgo.Y+float(cgo.Hgt)/2));
|
||||
fctBlit.DrawT(cgo, true, iPhase, 0, &C4DrawTransform(Transform, cgo.X+float(cgo.Wdt)/2, cgo.Y+float(cgo.Hgt)/2));
|
||||
// cleanup
|
||||
if (dwBlitMode == C4GFXBLIT_PARENT)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ class C4DefGraphics
|
|||
C4AdditionalDefGraphics *GetNext() { return pNext; }
|
||||
virtual C4PortraitGraphics *IsPortrait() { return NULL; }
|
||||
|
||||
void DrawClr(C4Facet &cgo, BOOL fAspect=TRUE, DWORD dwClr=0); // set surface color and draw
|
||||
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0); // set surface color and draw
|
||||
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void C4GameObjects::Init(int32_t iWidth, int32_t iHeight)
|
|||
Sectors.Init(iWidth, iHeight);
|
||||
}
|
||||
|
||||
BOOL C4GameObjects::Add(C4Object *nObj)
|
||||
bool C4GameObjects::Add(C4Object *nObj)
|
||||
{
|
||||
// add inactive objects to the inactive list only
|
||||
if (nObj->Status == C4OS_INACTIVE)
|
||||
|
@ -73,14 +73,14 @@ BOOL C4GameObjects::Add(C4Object *nObj)
|
|||
::Objects.ForeObjects.Add(nObj, C4ObjectList::stMain);
|
||||
// manipulate main list
|
||||
if(!C4ObjectList::Add(nObj, C4ObjectList::stMain))
|
||||
return FALSE;
|
||||
return false;
|
||||
// add to sectors
|
||||
Sectors.Add(nObj, this);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BOOL C4GameObjects::Remove(C4Object *pObj)
|
||||
bool C4GameObjects::Remove(C4Object *pObj)
|
||||
{
|
||||
// if it's an inactive object, simply remove from the inactiv elist
|
||||
if (pObj->Status == C4OS_INACTIVE) return InactiveObjects.Remove(pObj);
|
||||
|
@ -126,7 +126,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
// Incineration
|
||||
if ((ocf1 & OCF_OnFire) && (ocf2 & OCF_Inflammable))
|
||||
if (!Random(obj2->Def->ContactIncinerate))
|
||||
{ obj2->Incinerate(obj1->GetFireCausePlr(), FALSE, obj1); continue; }
|
||||
{ obj2->Incinerate(obj1->GetFireCausePlr(), false, obj1); continue; }
|
||||
// Fight
|
||||
if ((ocf1 & OCF_FightReady) && (ocf2 & OCF_FightReady))
|
||||
if (::Players.Hostile(obj1->Owner,obj2->Owner))
|
||||
|
@ -376,7 +376,7 @@ C4ObjResort::C4ObjResort()
|
|||
OrderFunc=NULL;
|
||||
Next=NULL;
|
||||
pSortObj = pObjBefore = NULL;
|
||||
fSortAfter = FALSE;
|
||||
fSortAfter = false;
|
||||
}
|
||||
|
||||
C4ObjResort::~C4ObjResort()
|
||||
|
@ -542,7 +542,7 @@ void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
|
|||
// FIXME: Inform C4ObjectList about this reorder
|
||||
C4Object *pObj=pCurr->Obj; pCurr->Obj=pCurr2->Obj; pCurr2->Obj=pObj;
|
||||
// and readd to sector lists
|
||||
pCurr->Obj->Unsorted=pCurr2->Obj->Unsorted=TRUE;
|
||||
pCurr->Obj->Unsorted=pCurr2->Obj->Unsorted=true;
|
||||
// grow list section to scan next
|
||||
pNewFirst=pCurr;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ void C4ObjResort::Sort(C4ObjectLink *pFirst, C4ObjectLink *pLast)
|
|||
C4Object *pObj=pCurr->Obj;
|
||||
if (pObj->Status && pObj->Unsorted)
|
||||
{
|
||||
pObj->Unsorted=FALSE;
|
||||
pObj->Unsorted=false;
|
||||
::Objects.UpdatePosResort(pObj);
|
||||
}
|
||||
}
|
||||
|
@ -721,19 +721,19 @@ int C4GameObjects::Load(C4Group &hGroup, bool fKeepInactive)
|
|||
return ObjectCount();
|
||||
}
|
||||
|
||||
BOOL C4GameObjects::Save(C4Group &hGroup, BOOL fSaveGame, bool fSaveInactive)
|
||||
bool C4GameObjects::Save(C4Group &hGroup, bool fSaveGame, bool fSaveInactive)
|
||||
{
|
||||
// Save to temp file
|
||||
char szFilename[_MAX_PATH+1]; SCopy( Config.AtTempPath(C4CFN_ScenarioObjects), szFilename );
|
||||
if (!Save(szFilename,fSaveGame,fSaveInactive)) return FALSE;
|
||||
if (!Save(szFilename,fSaveGame,fSaveInactive)) return false;
|
||||
|
||||
// Move temp file to group
|
||||
hGroup.Move(szFilename, NULL); // check?
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4GameObjects::Save(const char *szFilename, BOOL fSaveGame, bool fSaveInactive)
|
||||
bool C4GameObjects::Save(const char *szFilename, bool fSaveGame, bool fSaveInactive)
|
||||
{
|
||||
// Enumerate
|
||||
Enumerate();
|
||||
|
@ -758,7 +758,7 @@ BOOL C4GameObjects::Save(const char *szFilename, BOOL fSaveGame, bool fSaveInact
|
|||
|
||||
// Error?
|
||||
if(!fSuccess)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Write
|
||||
return Buffer.SaveToFile(szFilename);
|
||||
|
@ -786,32 +786,32 @@ void C4GameObjects::UpdatePosResort(C4Object *pObj)
|
|||
Sectors.Add(pObj, this);
|
||||
}
|
||||
|
||||
BOOL C4GameObjects::OrderObjectBefore(C4Object *pObj1, C4Object *pObj2)
|
||||
bool C4GameObjects::OrderObjectBefore(C4Object *pObj1, C4Object *pObj2)
|
||||
{
|
||||
// check that this won't screw the category sort
|
||||
if((pObj1->Category & C4D_SortLimit) < (pObj2->Category & C4D_SortLimit))
|
||||
return FALSE;
|
||||
return false;
|
||||
// reorder
|
||||
if(!C4ObjectList::OrderObjectBefore(pObj1, pObj2))
|
||||
return FALSE;
|
||||
return false;
|
||||
// update area lists
|
||||
UpdatePosResort(pObj1);
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4GameObjects::OrderObjectAfter(C4Object *pObj1, C4Object *pObj2)
|
||||
bool C4GameObjects::OrderObjectAfter(C4Object *pObj1, C4Object *pObj2)
|
||||
{
|
||||
// check that this won't screw the category sort
|
||||
if((pObj1->Category & C4D_SortLimit) > (pObj2->Category & C4D_SortLimit))
|
||||
return FALSE;
|
||||
return false;
|
||||
// reorder
|
||||
if(!C4ObjectList::OrderObjectAfter(pObj1, pObj2))
|
||||
return FALSE;
|
||||
return false;
|
||||
// update area lists
|
||||
UpdatePosResort(pObj1);
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4GameObjects::FixObjectOrder()
|
||||
|
@ -904,7 +904,7 @@ void C4GameObjects::ResortUnsorted()
|
|||
{
|
||||
// readd to main object list
|
||||
Remove(cObj);
|
||||
cObj->Unsorted=FALSE;
|
||||
cObj->Unsorted=false;
|
||||
if (!Add(cObj))
|
||||
{
|
||||
// readd failed: Better kill object to prevent leaking...
|
||||
|
@ -958,17 +958,17 @@ void C4GameObjects::AssignPlrViewRange()
|
|||
void C4GameObjects::SortByCategory()
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
BOOL fSorted;
|
||||
bool fSorted;
|
||||
// Sort by category
|
||||
do
|
||||
{
|
||||
fSorted = TRUE;
|
||||
fSorted = true;
|
||||
for (cLnk=First; cLnk && cLnk->Next; cLnk=cLnk->Next)
|
||||
if ((cLnk->Obj->Category & C4D_SortLimit) < (cLnk->Next->Obj->Category & C4D_SortLimit))
|
||||
{
|
||||
RemoveLink(cLnk);
|
||||
InsertLink(cLnk,cLnk->Next);
|
||||
fSorted = FALSE;
|
||||
fSorted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ class C4GameObjects : public C4NotifyingObjectList
|
|||
|
||||
unsigned int LastUsedMarker; // last used value for C4Object::Marker
|
||||
|
||||
BOOL Add(C4Object *nObj); // add object
|
||||
BOOL Remove(C4Object *pObj); // clear pointers to object
|
||||
bool Add(C4Object *nObj); // add object
|
||||
bool Remove(C4Object *pObj); // clear pointers to object
|
||||
|
||||
C4ObjectList &ObjectsAt(int ix, int iy); // get object list for map pos
|
||||
|
||||
|
@ -69,16 +69,16 @@ class C4GameObjects : public C4NotifyingObjectList
|
|||
void RecheckSolidMasks();
|
||||
|
||||
int Load(C4Group &hGroup, bool fKeepInactive);
|
||||
BOOL Save(const char *szFilename, BOOL fSaveGame, bool fSaveInactive);
|
||||
BOOL Save(C4Group &hGroup, BOOL fSaveGame, bool fSaveInactive);
|
||||
bool Save(const char *szFilename, bool fSaveGame, bool fSaveInactive);
|
||||
bool Save(C4Group &hGroup, bool fSaveGame, bool fSaveInactive);
|
||||
|
||||
void UpdateScriptPointers(); // update pointers to C4AulScript *
|
||||
|
||||
void UpdatePos(C4Object *pObj);
|
||||
void UpdatePosResort(C4Object *pObj);
|
||||
|
||||
BOOL OrderObjectBefore(C4Object *pObj1, C4Object *pObj2); // order pObj1 before pObj2
|
||||
BOOL OrderObjectAfter(C4Object *pObj1, C4Object *pObj2); // order pObj1 after pObj2
|
||||
bool OrderObjectBefore(C4Object *pObj1, C4Object *pObj2); // order pObj1 before pObj2
|
||||
bool OrderObjectAfter(C4Object *pObj1, C4Object *pObj2); // order pObj1 after pObj2
|
||||
void FixObjectOrder(); // Called after loading: Resort any objects that are out of order
|
||||
void ResortUnsorted(); // resort any objects with unsorted-flag set into lists
|
||||
void ExecuteResorts(); // execute custom resort procs
|
||||
|
@ -115,7 +115,7 @@ class C4ObjResort
|
|||
C4AulFunc *OrderFunc; // function determining new sort order
|
||||
C4ObjResort *Next; // next resort holder
|
||||
C4Object *pSortObj, *pObjBefore; // objects that are swapped if no OrderFunc is given
|
||||
BOOL fSortAfter; // if set, the sort object is sorted
|
||||
bool fSortAfter; // if set, the sort object is sorted
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -574,8 +574,8 @@ bool C4IDList::ConsolidateCounts()
|
|||
bool C4IDList::SwapItems(size_t iIndex1, size_t iIndex2)
|
||||
{
|
||||
// Invalid index
|
||||
if (!Inside<int32_t>(iIndex1,0,Count-1)) return FALSE;
|
||||
if (!Inside<int32_t>(iIndex2,0,Count-1)) return FALSE;
|
||||
if (!Inside<int32_t>(iIndex1,0,Count-1)) return false;
|
||||
if (!Inside<int32_t>(iIndex2,0,Count-1)) return false;
|
||||
// get first+second chunk and index
|
||||
C4IDListChunk *pChunk1=this;
|
||||
while (iIndex1>=C4IDListChunkSize) { pChunk1=pChunk1->pNext; iIndex1-=C4IDListChunkSize; }
|
||||
|
@ -597,7 +597,7 @@ bool C4IDList::SwapItems(size_t iIndex1, size_t iIndex2)
|
|||
bool C4IDList::DeleteItem(size_t iIndex)
|
||||
{
|
||||
// invalid index
|
||||
if (!Inside<size_t>(iIndex,0,Count-1)) return FALSE;
|
||||
if (!Inside<size_t>(iIndex,0,Count-1)) return false;
|
||||
// get chunk to delete of
|
||||
size_t index=iIndex;
|
||||
C4IDListChunk *pQueryChunk=this;
|
||||
|
|
|
@ -70,8 +70,8 @@ class C4IDList : protected C4IDListChunk
|
|||
// Access by ID
|
||||
int32_t GetIDCount(C4ID c_id, int32_t iZeroDefVal=0) const;
|
||||
bool SetIDCount(C4ID c_id, int32_t iCount, bool fAddNewID=false);
|
||||
bool IncreaseIDCount(C4ID c_id, bool fAddNewID=TRUE, int32_t IncreaseBy=1, bool fRemoveEmpty=false);
|
||||
bool DecreaseIDCount(C4ID c_id, bool fRemoveEmptyID=TRUE)
|
||||
bool IncreaseIDCount(C4ID c_id, bool fAddNewID=true, int32_t IncreaseBy=1, bool fRemoveEmpty=false);
|
||||
bool DecreaseIDCount(C4ID c_id, bool fRemoveEmptyID=true)
|
||||
{ return IncreaseIDCount(c_id, false, -1, fRemoveEmptyID); }
|
||||
int32_t GetNumberOfIDs() const;
|
||||
int32_t GetIndex(C4ID c_id) const;
|
||||
|
@ -98,7 +98,7 @@ class C4IDList : protected C4IDListChunk
|
|||
// Graphics
|
||||
void Draw(C4Facet &cgo, int32_t iSelection,
|
||||
C4DefList &rDefs, DWORD dwCategory,
|
||||
bool fCounts=TRUE, int32_t iAlign=0) const;
|
||||
bool fCounts=true, int32_t iAlign=0) const;
|
||||
// Compiling
|
||||
void CompileFunc(StdCompiler *pComp, bool fValues = true);
|
||||
};
|
||||
|
|
|
@ -70,14 +70,14 @@ void GetC4IdText(C4ID id, char *sBuf)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL LooksLikeID(const char *szText)
|
||||
bool LooksLikeID(const char *szText)
|
||||
{
|
||||
int cnt;
|
||||
if (SLen(szText)!=4) return FALSE;
|
||||
if (SLen(szText)!=4) return false;
|
||||
for (cnt=0; cnt<4; cnt++)
|
||||
if (!(Inside(szText[cnt],'A','Z') || Inside(szText[cnt],'0','9') || (szText[cnt] =='_')))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LooksLikeID(C4ID id)
|
||||
|
|
|
@ -58,7 +58,7 @@ const C4ID C4ID_None = 0x0,
|
|||
C4ID C4Id(const char *szId);
|
||||
void GetC4IdText(C4ID id, char *sBuf);
|
||||
const char *C4IdText(C4ID id);
|
||||
BOOL LooksLikeID(const char *szText);
|
||||
bool LooksLikeID(const char *szText);
|
||||
bool LooksLikeID(C4ID id);
|
||||
|
||||
// * C4ID Adaptor
|
||||
|
|
|
@ -73,7 +73,7 @@ DWORD C4PlayerInfoCore::GetPrefColorValue(int32_t iPrefColor)
|
|||
return 0xAAAAAA;
|
||||
}
|
||||
|
||||
BOOL C4PlayerInfoCore::Load(C4Group &hGroup)
|
||||
bool C4PlayerInfoCore::Load(C4Group &hGroup)
|
||||
{
|
||||
// New version
|
||||
StdStrBuf Source;
|
||||
|
@ -82,7 +82,7 @@ BOOL C4PlayerInfoCore::Load(C4Group &hGroup)
|
|||
// Compile
|
||||
StdStrBuf GrpName = hGroup.GetFullName(); GrpName.Append(DirSep C4CFN_PlayerInfoCore);
|
||||
if(!CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, Source, GrpName.getData()))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Pref for AutoContextMenus is still undecided: default by player's control style
|
||||
if (PrefAutoContextMenu == -1)
|
||||
PrefAutoContextMenu = PrefControlStyle;
|
||||
|
@ -95,22 +95,22 @@ BOOL C4PlayerInfoCore::Load(C4Group &hGroup)
|
|||
// Validate name
|
||||
CMarkup::StripMarkup(PrefName);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Old version no longer supported - sorry
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4PlayerInfoCore::Save(C4Group &hGroup)
|
||||
bool C4PlayerInfoCore::Save(C4Group &hGroup)
|
||||
{
|
||||
StdStrBuf Source, Name = hGroup.GetFullName(); Name.Append(DirSep C4CFN_PlayerInfoCore);
|
||||
if(!DecompileToBuf_Log<StdCompilerINIWrite>(*this, &Source, Name.getData()))
|
||||
return FALSE;
|
||||
if (!hGroup.Add(C4CFN_PlayerInfoCore,Source,FALSE,TRUE))
|
||||
return FALSE;
|
||||
return false;
|
||||
if (!hGroup.Add(C4CFN_PlayerInfoCore,Source,false,true))
|
||||
return false;
|
||||
hGroup.Delete("C4Player.c4b");
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PlayerInfoCore::Promote(int32_t iRank, C4RankSystem &rRanks)
|
||||
|
@ -119,14 +119,14 @@ void C4PlayerInfoCore::Promote(int32_t iRank, C4RankSystem &rRanks)
|
|||
SCopy(rRanks.GetRankName(Rank,true).getData(),RankName,C4MaxName);
|
||||
}
|
||||
|
||||
BOOL C4PlayerInfoCore::CheckPromotion(C4RankSystem &rRanks)
|
||||
bool C4PlayerInfoCore::CheckPromotion(C4RankSystem &rRanks)
|
||||
{
|
||||
if (Score>=rRanks.Experience(Rank+1))
|
||||
{
|
||||
Promote(Rank+1,rRanks);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4PlayerInfoCore::CompileFunc(StdCompiler *pComp)
|
||||
|
@ -470,23 +470,23 @@ bool C4ObjectInfoCore::GetNextRankInfo(C4RankSystem &rDefaultRanks, int32_t *piN
|
|||
return iNextRankExp != C4RankSystem::EXP_NoPromotion;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoCore::Load(C4Group &hGroup)
|
||||
bool C4ObjectInfoCore::Load(C4Group &hGroup)
|
||||
{
|
||||
StdStrBuf Source;
|
||||
return hGroup.LoadEntryString(C4CFN_ObjectInfoCore, Source) &&
|
||||
Compile(Source.getData());
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoCore::Save(C4Group &hGroup, C4DefList *pDefs)
|
||||
bool C4ObjectInfoCore::Save(C4Group &hGroup, C4DefList *pDefs)
|
||||
{
|
||||
// rank overload by def: Update any NextRank-stuff
|
||||
if (pDefs) UpdateCustomRanks(pDefs);
|
||||
char *Buffer; size_t BufferSize;
|
||||
if (!Decompile(&Buffer,&BufferSize))
|
||||
return FALSE;
|
||||
if (!hGroup.Add(C4CFN_ObjectInfoCore,Buffer,BufferSize,FALSE,TRUE) )
|
||||
{ delete [] Buffer; return FALSE; }
|
||||
return TRUE;
|
||||
return false;
|
||||
if (!hGroup.Add(C4CFN_ObjectInfoCore,Buffer,BufferSize,false,true) )
|
||||
{ delete [] Buffer; return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectInfoCore::CompileFunc(StdCompiler *pComp)
|
||||
|
@ -513,7 +513,7 @@ void C4ObjectInfoCore::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(Physical);
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoCore::Compile(const char *szSource)
|
||||
bool C4ObjectInfoCore::Compile(const char *szSource)
|
||||
{
|
||||
bool ret = CompileFromBuf_LogWarn<StdCompilerINIRead>(
|
||||
mkNamingAdapt(*this, "ObjectInfo"),
|
||||
|
@ -526,7 +526,7 @@ BOOL C4ObjectInfoCore::Compile(const char *szSource)
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoCore::Decompile(char **ppOutput, size_t *ipSize)
|
||||
bool C4ObjectInfoCore::Decompile(char **ppOutput, size_t *ipSize)
|
||||
{
|
||||
StdStrBuf Buf;
|
||||
if(!DecompileToBuf_Log<StdCompilerINIWrite>(
|
||||
|
@ -536,11 +536,11 @@ BOOL C4ObjectInfoCore::Decompile(char **ppOutput, size_t *ipSize)
|
|||
{
|
||||
if(ppOutput) *ppOutput = NULL;
|
||||
if(ipSize) *ipSize = 0;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if(ppOutput) *ppOutput = Buf.GrabPointer();
|
||||
if(ipSize) *ipSize = Buf.getSize();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -147,19 +147,19 @@ class C4ObjectInfoCore
|
|||
char PortraitFile[C4MaxName+2+4+1]; // used portrait
|
||||
C4PhysicalInfo Physical;
|
||||
C4ValueMapData ExtraData;
|
||||
BOOL NoSave; // set for _XYZ-CrewMembers
|
||||
bool NoSave; // set for _XYZ-CrewMembers
|
||||
public:
|
||||
BOOL Save(C4Group &hGroup, class C4DefList *pDefs);
|
||||
BOOL Load(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup, class C4DefList *pDefs);
|
||||
bool Load(C4Group &hGroup);
|
||||
void Default(C4ID n_id=C4ID_None, class C4DefList *pDefs=NULL, const char *cpNames=NULL);
|
||||
//BOOL LoadNext(C4Group &hGroup); Old c4o support disabled...
|
||||
//BOOL Add(C4Group &hGroup);
|
||||
//bool LoadNext(C4Group &hGroup); Old c4o support disabled...
|
||||
//bool Add(C4Group &hGroup);
|
||||
void Promote(int32_t iRank, C4RankSystem &rRanks, bool fForceRankName);
|
||||
bool GetNextRankInfo(C4RankSystem &rDefaultRanks, int32_t *piNextRankExp, StdStrBuf *psNextRankName);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
protected:
|
||||
BOOL Compile(const char *szSource);
|
||||
BOOL Decompile(char **ppOutput, size_t *ipSize);
|
||||
bool Compile(const char *szSource);
|
||||
bool Decompile(char **ppOutput, size_t *ipSize);
|
||||
|
||||
void UpdateCustomRanks(C4DefList *pDefs); // sets NextRankName and NextRankExp
|
||||
};
|
||||
|
@ -208,9 +208,9 @@ class C4PlayerInfoCore
|
|||
public:
|
||||
void Default(C4RankSystem *pRanks=NULL);
|
||||
void Promote(int32_t iRank, C4RankSystem &rRanks);
|
||||
BOOL Load(C4Group &hGroup);
|
||||
BOOL Save(C4Group &hGroup);
|
||||
BOOL CheckPromotion(C4RankSystem &rRanks);
|
||||
bool Load(C4Group &hGroup);
|
||||
bool Save(C4Group &hGroup);
|
||||
bool CheckPromotion(C4RankSystem &rRanks);
|
||||
static DWORD GetPrefColorValue(int32_t iPrefColor);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
};
|
||||
|
|
|
@ -66,13 +66,13 @@ void ApplyFriction(FIXED &tval, int32_t percent)
|
|||
// Compares all Shape.VtxContactCNAT[] CNAT flags to search flag.
|
||||
// Returns true if CNAT match has been found.
|
||||
|
||||
BOOL ContactVtxCNAT(C4Object *cobj, BYTE cnat_dir)
|
||||
bool ContactVtxCNAT(C4Object *cobj, BYTE cnat_dir)
|
||||
{
|
||||
int32_t cnt;
|
||||
BOOL fcontact=FALSE;
|
||||
bool fcontact=false;
|
||||
for (cnt=0; cnt<cobj->Shape.VtxNum; cnt++)
|
||||
if (cobj->Shape.VtxContactCNAT[cnt] & cnat_dir)
|
||||
fcontact=TRUE;
|
||||
fcontact=true;
|
||||
return fcontact;
|
||||
}
|
||||
|
||||
|
@ -117,13 +117,13 @@ const char *CNATName(int32_t cnat)
|
|||
return "Undefined";
|
||||
}
|
||||
|
||||
BOOL C4Object::Contact(int32_t iCNAT)
|
||||
bool C4Object::Contact(int32_t iCNAT)
|
||||
{
|
||||
if (Def->ContactFunctionCalls)
|
||||
{
|
||||
return !! Call(FormatString(PSF_Contact, CNATName(iCNAT)).getData());
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Object::DoMotion(int32_t mx, int32_t my)
|
||||
|
@ -210,7 +210,7 @@ void C4Object::VerticalBounds(int32_t &ctcoy)
|
|||
void C4Object::DoMovement()
|
||||
{
|
||||
int32_t ctcox,ctcoy,ctcor/*,ctx,cty*/,iContact=0;
|
||||
BOOL fAnyContact=FALSE, iContacts = 0;
|
||||
bool fAnyContact=false, iContacts = 0;
|
||||
BYTE fTurned=0,fRedirectYR=0,fNoAttach=0;
|
||||
// Restrictions
|
||||
if (Def->NoHorizontalMove) xdir=0;
|
||||
|
@ -255,7 +255,7 @@ void C4Object::DoMovement()
|
|||
int step = Sign(ctcox - GetX());
|
||||
if (iContact=ContactCheck(GetX() + step, GetY()))
|
||||
{
|
||||
fAnyContact=TRUE; iContacts |= t_contact;
|
||||
fAnyContact=true; iContacts |= t_contact;
|
||||
// Abort horizontal movement
|
||||
ctcox = GetX();
|
||||
new_x = fix_x;
|
||||
|
@ -279,7 +279,7 @@ void C4Object::DoMovement()
|
|||
int step = Sign(ctcoy - GetY());
|
||||
if (iContact=ContactCheck(GetX(), GetY() + step))
|
||||
{
|
||||
fAnyContact=TRUE; iContacts |= t_contact;
|
||||
fAnyContact=true; iContacts |= t_contact;
|
||||
ctcoy=GetY(); new_y = fix_y;
|
||||
// Vertical contact horizontal friction
|
||||
ApplyFriction(xdir,ContactVtxFriction(this));
|
||||
|
@ -328,7 +328,7 @@ void C4Object::DoMovement()
|
|||
// Contact check & evaluation
|
||||
if (iContact=ContactCheck(ctx,cty))
|
||||
{
|
||||
fAnyContact=TRUE; iContacts |= t_contact;
|
||||
fAnyContact=true; iContacts |= t_contact;
|
||||
// Abort movement
|
||||
ctcox=GetX(); new_x = fix_x;
|
||||
ctcoy=GetY(); new_y = fix_y;
|
||||
|
@ -379,7 +379,7 @@ void C4Object::DoMovement()
|
|||
// check for contact
|
||||
if (iContact=ContactCheck(ctx,cty)) // Contact
|
||||
{
|
||||
fAnyContact=TRUE; iContacts |= t_contact;
|
||||
fAnyContact=true; iContacts |= t_contact;
|
||||
// Undo step and abort movement
|
||||
Shape=lshape;
|
||||
r=lcobjr;
|
||||
|
@ -408,14 +408,14 @@ void C4Object::DoMovement()
|
|||
UpdateSolidMask(true);
|
||||
// Misc checks ===========================================================================================
|
||||
// InLiquid check
|
||||
// this equals C4Object::UpdateLiquid, but the "fNoAttach=FALSE;"-line
|
||||
// this equals C4Object::UpdateLiquid, but the "fNoAttach=false;"-line
|
||||
if (IsInLiquidCheck()) // In Liquid
|
||||
{
|
||||
if (!InLiquid) // Enter liquid
|
||||
{
|
||||
if (OCF & OCF_HitSpeed2) if (Mass>3)
|
||||
Splash(GetX(),GetY()+1,Min(Shape.Wdt*Shape.Hgt/10,20),this);
|
||||
fNoAttach=FALSE;
|
||||
fNoAttach=false;
|
||||
InLiquid=1;
|
||||
}
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void C4Object::MovePosition(int32_t dx, int32_t dy)
|
|||
}
|
||||
|
||||
|
||||
BOOL C4Object::ExecMovement() // Every Tick1 by Execute
|
||||
bool C4Object::ExecMovement() // Every Tick1 by Execute
|
||||
{
|
||||
|
||||
// Containment check
|
||||
|
@ -515,11 +515,11 @@ BOOL C4Object::ExecMovement() // Every Tick1 by Execute
|
|||
{
|
||||
CopyMotion(Contained);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// General mobility check
|
||||
if (Category & C4D_StaticBack) return FALSE;
|
||||
if (Category & C4D_StaticBack) return false;
|
||||
|
||||
// Movement execution
|
||||
if (Mobile) // Object is moving
|
||||
|
@ -572,7 +572,7 @@ BOOL C4Object::ExecMovement() // Every Tick1 by Execute
|
|||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimFlight(FIXED &x, FIXED &y, FIXED &xdir, FIXED &ydir, int32_t iDensityMin, int32_t iDensityMax, int32_t iIter)
|
||||
|
@ -609,15 +609,15 @@ bool SimFlight(FIXED &x, FIXED &y, FIXED &xdir, FIXED &ydir, int32_t iDensityMin
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir)
|
||||
bool SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir)
|
||||
{
|
||||
// Start in water?
|
||||
if(DensityLiquid(GBackDensity(fixtoi(fcx), fixtoi(fcy))))
|
||||
if(!SimFlight(fcx, fcy, xdir, ydir, 0, C4M_Liquid - 1, 10))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Hits liquid?
|
||||
if(!SimFlight(fcx, fcy, xdir, ydir, C4M_Liquid, 100, -1))
|
||||
return FALSE;
|
||||
return false;
|
||||
// liquid & deep enough?
|
||||
return GBackLiquid(fixtoi(fcx), fixtoi(fcy)) && GBackLiquid(fixtoi(fcx), fixtoi(fcy) + 9);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -198,10 +198,10 @@ class C4Object: public C4PropList
|
|||
public:
|
||||
void Resort();
|
||||
int32_t GetAudible();
|
||||
void DigOutMaterialCast(BOOL fRequest);
|
||||
void DigOutMaterialCast(bool fRequest);
|
||||
void AddMaterialContents(int32_t iMaterial, int32_t iAmount);
|
||||
void SetCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, C4Object *pTarget2=NULL, BOOL fControl=FALSE, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=NULL);
|
||||
void SetCommand(int32_t iCommand, C4Object *pTarget=NULL, int32_t iTx=0, int32_t iTy=0, C4Object *pTarget2=NULL, BOOL fControl=FALSE, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=NULL)
|
||||
void SetCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, C4Object *pTarget2=NULL, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=NULL);
|
||||
void SetCommand(int32_t iCommand, C4Object *pTarget=NULL, int32_t iTx=0, int32_t iTy=0, C4Object *pTarget2=NULL, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=NULL)
|
||||
{ SetCommand(iCommand, pTarget, C4VInt(iTx), iTy, pTarget2, fControl, iData, iRetries, szText); }
|
||||
bool AddCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=NULL, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=NULL, int32_t iBaseMode=0);
|
||||
bool AddCommand(int32_t iCommand, C4Object *pTarget=NULL, int32_t iTx=0, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=NULL, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=NULL, int32_t iBaseMode=0)
|
||||
|
@ -215,25 +215,25 @@ class C4Object: public C4PropList
|
|||
void SetSolidMask(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iTX, int32_t iTY);
|
||||
bool CheckSolidMaskRect(); // clip bounds of SolidMask in graphics - return whether the solidmask still exists
|
||||
C4Object *ComposeContents(C4ID id);
|
||||
BOOL MenuCommand(const char *szCommand);
|
||||
bool MenuCommand(const char *szCommand);
|
||||
|
||||
BOOL CallControl(C4Player *pPlr, BYTE byCom, C4AulParSet *pPars = 0);
|
||||
bool CallControl(C4Player *pPlr, BYTE byCom, C4AulParSet *pPars = 0);
|
||||
C4Value Call(const char *szFunctionCall, C4AulParSet *pPars = 0, bool fPassError = false);
|
||||
|
||||
|
||||
BOOL ContainedControl(BYTE byCom);
|
||||
bool ContainedControl(BYTE byCom);
|
||||
|
||||
void Clear();
|
||||
void ClearInfo(C4ObjectInfo *pInfo);
|
||||
BOOL AssignInfo();
|
||||
BOOL ValidateOwner();
|
||||
BOOL AssignPlrViewRange();
|
||||
void DrawPicture(C4Facet &cgo, BOOL fSelected=FALSE, C4RegionList *pRegions=NULL);
|
||||
bool AssignInfo();
|
||||
bool ValidateOwner();
|
||||
bool AssignPlrViewRange();
|
||||
void DrawPicture(C4Facet &cgo, bool fSelected=false, C4RegionList *pRegions=NULL);
|
||||
void Picture2Facet(C4FacetSurface &cgo); // set picture to facet, or create facet in current size and draw if specific states are being needed
|
||||
void DenumeratePointers();
|
||||
void EnumeratePointers();
|
||||
void Default();
|
||||
BOOL Init(C4PropList *ndef, C4Object *pCreator,
|
||||
bool Init(C4PropList *ndef, C4Object *pCreator,
|
||||
int32_t owner, C4ObjectInfo *info,
|
||||
int32_t nx, int32_t ny, int32_t nr,
|
||||
FIXED nxdir, FIXED nydir, FIXED nrdir, int32_t iController);
|
||||
|
@ -246,8 +246,8 @@ class C4Object: public C4PropList
|
|||
void DrawCommand(C4Facet &cgoBar, int32_t iAlign, const char *szFunctionFormat,
|
||||
int32_t iCom, C4RegionList *pRegions, int32_t iPlayer, const char *szDesc=NULL,
|
||||
C4Facet *pfctImage=NULL);
|
||||
BOOL SetPhase(int32_t iPhase);
|
||||
void AssignRemoval(BOOL fExitContents=FALSE);
|
||||
bool SetPhase(int32_t iPhase);
|
||||
void AssignRemoval(bool fExitContents=false);
|
||||
enum DrawMode { ODM_Normal=0, ODM_Overlay=1, ODM_BaseOnly=2, };
|
||||
void Draw(C4TargetFacet &cgo, int32_t iByPlayer = -1, DrawMode eDrawMode=ODM_Normal);
|
||||
void DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer = -1, DrawMode eDrawMode=ODM_Normal);
|
||||
|
@ -255,11 +255,11 @@ class C4Object: public C4PropList
|
|||
void DrawFace(C4TargetFacet &cgo, float offX, float offY, int32_t iPhaseX=0, int32_t iPhaseY=0);
|
||||
void Execute();
|
||||
void ClearPointers(C4Object *ptr);
|
||||
BOOL ExecMovement();
|
||||
BOOL ExecFire(int32_t iIndex, int32_t iCausedByPlr);
|
||||
bool ExecMovement();
|
||||
bool ExecFire(int32_t iIndex, int32_t iCausedByPlr);
|
||||
void ExecAction();
|
||||
BOOL ExecLife();
|
||||
BOOL ExecuteCommand();
|
||||
bool ExecLife();
|
||||
bool ExecuteCommand();
|
||||
void ExecBase();
|
||||
void AssignDeath(bool fForced); // assigns death - if forced, it's killed even if an effect stopped this
|
||||
void ContactAction();
|
||||
|
@ -274,52 +274,52 @@ class C4Object: public C4PropList
|
|||
void UpdateMass();
|
||||
void ComponentConCutoff();
|
||||
void ComponentConGain();
|
||||
BOOL ChangeDef(C4ID idNew);
|
||||
bool ChangeDef(C4ID idNew);
|
||||
void UpdateFace(bool bUpdateShape, bool fTemp=false);
|
||||
void UpdateGraphics(bool fGraphicsChanged, bool fTemp=false); // recreates solidmasks (if fGraphicsChanged), validates Color
|
||||
void UpdateFlipDir(); // applies new flipdir to draw transform matrix; creates/deletes it if necessary
|
||||
BOOL At(int32_t ctx, int32_t cty);
|
||||
BOOL At(int32_t ctx, int32_t cty, DWORD &ocf);
|
||||
bool At(int32_t ctx, int32_t cty);
|
||||
bool At(int32_t ctx, int32_t cty, DWORD &ocf);
|
||||
void GetOCFForPos(int32_t ctx, int32_t cty, DWORD &ocf);
|
||||
BOOL CloseMenu(bool fForce);
|
||||
BOOL ActivateMenu(int32_t iMenu, int32_t iMenuSelect=0, int32_t iMenuData=0, int32_t iMenuPosition=0, C4Object *pTarget=NULL);
|
||||
bool CloseMenu(bool fForce);
|
||||
bool ActivateMenu(int32_t iMenu, int32_t iMenuSelect=0, int32_t iMenuData=0, int32_t iMenuPosition=0, C4Object *pTarget=NULL);
|
||||
void AutoContextMenu(int32_t iMenuSelect);
|
||||
int32_t ContactCheck(int32_t atx, int32_t aty);
|
||||
BOOL Contact(int32_t cnat);
|
||||
bool Contact(int32_t cnat);
|
||||
void TargetBounds(int32_t &ctco, int32_t limit_low, int32_t limit_hi, int32_t cnat_low, int32_t cnat_hi);
|
||||
enum { SAC_StartCall = 1, SAC_EndCall = 2, SAC_AbortCall = 4, };
|
||||
BOOL SetAction(C4PropList * Act, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
|
||||
bool SetAction(C4PropList * Act, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
|
||||
bool SetActionByName(C4String * ActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
|
||||
bool SetActionByName(const char * szActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
|
||||
void SetDir(int32_t tdir);
|
||||
void SetCategory(int32_t Category) { this->Category = Category; Resort(); SetOCF(); }
|
||||
int32_t GetProcedure();
|
||||
BOOL Enter(C4Object *pTarget, BOOL fCalls=TRUE, bool fCopyMotion=true, bool *pfRejectCollect=NULL);
|
||||
BOOL Exit(int32_t iX=0, int32_t iY=0, int32_t iR=0, FIXED iXDir=Fix0, FIXED iYDir=Fix0, FIXED iRDir=Fix0, BOOL fCalls=TRUE);
|
||||
bool Enter(C4Object *pTarget, bool fCalls=true, bool fCopyMotion=true, bool *pfRejectCollect=NULL);
|
||||
bool Exit(int32_t iX=0, int32_t iY=0, int32_t iR=0, FIXED iXDir=Fix0, FIXED iYDir=Fix0, FIXED iRDir=Fix0, bool fCalls=true);
|
||||
void CopyMotion(C4Object *from);
|
||||
void ForcePosition(int32_t tx, int32_t ty);
|
||||
void MovePosition(int32_t dx, int32_t dy);
|
||||
void DoMotion(int32_t mx, int32_t my);
|
||||
BOOL ActivateEntrance(int32_t by_plr, C4Object *by_obj);
|
||||
BOOL Incinerate(int32_t iCausedBy, BOOL fBlasted=FALSE, C4Object *pIncineratingObject=NULL);
|
||||
BOOL Extinguish(int32_t iFireNumber);
|
||||
bool ActivateEntrance(int32_t by_plr, C4Object *by_obj);
|
||||
bool Incinerate(int32_t iCausedBy, bool fBlasted=false, C4Object *pIncineratingObject=NULL);
|
||||
bool Extinguish(int32_t iFireNumber);
|
||||
void DoDamage(int32_t iLevel, int32_t iCausedByPlr, int32_t iCause);
|
||||
void DoEnergy(int32_t iChange, bool fExact, int32_t iCause, int32_t iCausedByPlr);
|
||||
void UpdatLastEnergyLossCause(int32_t iNewCausePlr);
|
||||
void DoBreath(int32_t iChange);
|
||||
void DoCon(int32_t iChange, BOOL fInitial=FALSE, bool fNoComponentChange=false);
|
||||
void DoCon(int32_t iChange, bool fInitial=false, bool fNoComponentChange=false);
|
||||
int32_t GetCon() { return Con; }
|
||||
void DoExperience(int32_t change);
|
||||
BOOL Promote(int32_t torank, BOOL exception, bool fForceRankName);
|
||||
bool Promote(int32_t torank, bool exception, bool fForceRankName);
|
||||
void Explode(int32_t iLevel, C4ID idEffect=0, const char *szEffect=NULL);
|
||||
void Blast(int32_t iLevel, int32_t iCausedBy);
|
||||
BOOL Build(int32_t iLevel, C4Object *pBuilder);
|
||||
BOOL Chop(C4Object *pByObject);
|
||||
BOOL Push(FIXED txdir, FIXED dforce, BOOL fStraighten);
|
||||
BOOL Lift(FIXED tydir, FIXED dforce);
|
||||
bool Build(int32_t iLevel, C4Object *pBuilder);
|
||||
bool Chop(C4Object *pByObject);
|
||||
bool Push(FIXED txdir, FIXED dforce, bool fStraighten);
|
||||
bool Lift(FIXED tydir, FIXED dforce);
|
||||
void Fling(FIXED txdir, FIXED tydir, bool fAddSpeed); // set/add given speed to current, setting jump/tumble-actions
|
||||
C4Object* CreateContents(C4PropList *);
|
||||
BOOL CreateContentsByList(C4IDList &idlist);
|
||||
bool CreateContentsByList(C4IDList &idlist);
|
||||
BYTE GetArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt);
|
||||
inline int32_t addtop() { return Max<int32_t>(18-Shape.Hgt,0); } // Minimum top action size for build check
|
||||
inline int32_t Left() { return GetX()+Shape.x; } // left border of shape
|
||||
|
@ -338,10 +338,10 @@ class C4Object: public C4PropList
|
|||
void DirectCom(BYTE byCom, int32_t iData);
|
||||
void AutoStopDirectCom(BYTE byCom, int32_t iData);
|
||||
void AutoStopUpdateComDir();
|
||||
BOOL BuyEnergy();
|
||||
bool BuyEnergy();
|
||||
void AutoSellContents();
|
||||
BOOL SetOwner(int32_t iOwner);
|
||||
BOOL SetPlrViewRange(int32_t iToRange);
|
||||
bool SetOwner(int32_t iOwner);
|
||||
bool SetPlrViewRange(int32_t iToRange);
|
||||
void SetOnFire(bool OnFire) { this->OnFire = OnFire; SetOCF(); }
|
||||
bool GetOnFire() { return OnFire; }
|
||||
void SetAlive(bool Alive) { this->Alive = Alive; SetOCF(); }
|
||||
|
@ -353,9 +353,9 @@ class C4Object: public C4PropList
|
|||
void PrepareDrawing(); // set blit modulation and/or additive blitting
|
||||
void FinishedDrawing(); // reset any modulation
|
||||
void DrawSolidMask(C4TargetFacet &cgo); // draw topface image only
|
||||
BOOL Collect(C4Object *pObj); // add object to contents if it can be carried - no OCF and range checks are done!
|
||||
BOOL GrabInfo(C4Object *pFrom); // grab info object from other object
|
||||
BOOL ShiftContents(BOOL fShiftBack, BOOL fDoCalls); // rotate through contents
|
||||
bool Collect(C4Object *pObj); // add object to contents if it can be carried - no OCF and range checks are done!
|
||||
bool GrabInfo(C4Object *pFrom); // grab info object from other object
|
||||
bool ShiftContents(bool fShiftBack, bool fDoCalls); // rotate through contents
|
||||
void DirectComContents(C4Object *pTarget, bool fDoCalls); // direct com: scroll contents to given ID
|
||||
inline void TargetPos(float &riTx, float &riTy, const C4Facet &fctViewport) // update scroll pos applying parallaxity
|
||||
{ if (Category & C4D_Parallax) ApplyParallaxity(riTx, riTy, fctViewport); }
|
||||
|
@ -374,8 +374,8 @@ class C4Object: public C4PropList
|
|||
{ SideBounds(ctcox); VerticalBounds(ctcoy); }
|
||||
|
||||
public:
|
||||
bool DoSelect(BOOL fCursor=FALSE); // select in crew (or just set cursor) if not disabled
|
||||
void UnSelect(BOOL fCursor=FALSE); // unselect in crew (or just task away cursor)
|
||||
bool DoSelect(bool fCursor=false); // select in crew (or just set cursor) if not disabled
|
||||
void UnSelect(bool fCursor=false); // unselect in crew (or just task away cursor)
|
||||
void GetViewPos(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport) // get position this object is seen at (for given scroll)
|
||||
{ if (Category & C4D_Parallax) GetViewPosPar(riX, riY, tx, ty, fctViewport); else { riX=float(GetX()); riY=float(GetY()); } }
|
||||
void GetViewPosPar(float &riX, float &riY, float tx, float ty, const C4Facet &fctViewport); // get position this object is seen at, calculating parallaxity
|
||||
|
|
|
@ -42,144 +42,144 @@
|
|||
#include <C4GameObjects.h>
|
||||
#endif
|
||||
|
||||
BOOL SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir);
|
||||
BOOL CreateConstructionSite(int32_t ctx, int32_t bty, C4ID strid, int32_t owner, C4Object *pByObj);
|
||||
bool SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir);
|
||||
bool CreateConstructionSite(int32_t ctx, int32_t bty, C4ID strid, int32_t owner, C4Object *pByObj);
|
||||
|
||||
BOOL ObjectActionWalk(C4Object *cObj)
|
||||
bool ObjectActionWalk(C4Object *cObj)
|
||||
{
|
||||
if (!cObj->SetActionByName("Walk")) return FALSE;
|
||||
if (!cObj->SetActionByName("Walk")) return false;
|
||||
cObj->xdir=cObj->ydir=0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionStand(C4Object *cObj)
|
||||
bool ObjectActionStand(C4Object *cObj)
|
||||
{
|
||||
cObj->Action.ComDir=COMD_Stop;
|
||||
if (!ObjectActionWalk(cObj)) return FALSE;
|
||||
return TRUE;
|
||||
if (!ObjectActionWalk(cObj)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionJump(C4Object *cObj, FIXED xdir, FIXED ydir, bool fByCom)
|
||||
bool ObjectActionJump(C4Object *cObj, FIXED xdir, FIXED ydir, bool fByCom)
|
||||
{
|
||||
// scripted jump?
|
||||
assert(cObj);
|
||||
C4AulParSet pars(C4VInt(fixtoi(xdir, 100)), C4VInt(fixtoi(ydir, 100)), C4VBool(fByCom));
|
||||
if (!!cObj->Call(PSF_OnActionJump, &pars)) return TRUE;
|
||||
if (!!cObj->Call(PSF_OnActionJump, &pars)) return true;
|
||||
// hardcoded jump by action
|
||||
if (!cObj->SetActionByName("Jump")) return FALSE;
|
||||
if (!cObj->SetActionByName("Jump")) return false;
|
||||
cObj->xdir=xdir; cObj->ydir=ydir;
|
||||
cObj->Mobile=1;
|
||||
// unstick from ground, because jump command may be issued in an Action-callback,
|
||||
// where attach-values have already been determined for that frame
|
||||
cObj->Action.t_attach&=~CNAT_Bottom;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionDive(C4Object *cObj, FIXED xdir, FIXED ydir)
|
||||
bool ObjectActionDive(C4Object *cObj, FIXED xdir, FIXED ydir)
|
||||
{
|
||||
if (!cObj->SetActionByName("Dive")) return FALSE;
|
||||
if (!cObj->SetActionByName("Dive")) return false;
|
||||
cObj->xdir=xdir; cObj->ydir=ydir;
|
||||
cObj->Mobile=1;
|
||||
// unstick from ground, because jump command may be issued in an Action-callback,
|
||||
// where attach-values have already been determined for that frame
|
||||
cObj->Action.t_attach&=~CNAT_Bottom;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionTumble(C4Object *cObj, int32_t dir, FIXED xdir, FIXED ydir)
|
||||
bool ObjectActionTumble(C4Object *cObj, int32_t dir, FIXED xdir, FIXED ydir)
|
||||
{
|
||||
if (!cObj->SetActionByName("Tumble")) return FALSE;
|
||||
if (!cObj->SetActionByName("Tumble")) return false;
|
||||
cObj->SetDir(dir);
|
||||
cObj->xdir=xdir; cObj->ydir=ydir;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionGetPunched(C4Object *cObj, FIXED xdir, FIXED ydir)
|
||||
bool ObjectActionGetPunched(C4Object *cObj, FIXED xdir, FIXED ydir)
|
||||
{
|
||||
if (!cObj->SetActionByName("GetPunched")) return FALSE;
|
||||
if (!cObj->SetActionByName("GetPunched")) return false;
|
||||
cObj->xdir=xdir; cObj->ydir=ydir;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionKneel(C4Object *cObj)
|
||||
bool ObjectActionKneel(C4Object *cObj)
|
||||
{
|
||||
if (!cObj->SetActionByName("KneelDown")) return FALSE;
|
||||
if (!cObj->SetActionByName("KneelDown")) return false;
|
||||
cObj->xdir=cObj->ydir=0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionFlat(C4Object *cObj, int32_t dir)
|
||||
bool ObjectActionFlat(C4Object *cObj, int32_t dir)
|
||||
{
|
||||
if (!cObj->SetActionByName("FlatUp")) return FALSE;
|
||||
if (!cObj->SetActionByName("FlatUp")) return false;
|
||||
cObj->xdir=cObj->ydir=0;
|
||||
cObj->SetDir(dir);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionScale(C4Object *cObj, int32_t dir)
|
||||
bool ObjectActionScale(C4Object *cObj, int32_t dir)
|
||||
{
|
||||
if (!cObj->SetActionByName("Scale")) return FALSE;
|
||||
if (!cObj->SetActionByName("Scale")) return false;
|
||||
cObj->xdir=cObj->ydir=0;
|
||||
cObj->SetDir(dir);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionHangle(C4Object *cObj, int32_t dir)
|
||||
bool ObjectActionHangle(C4Object *cObj, int32_t dir)
|
||||
{
|
||||
if (!cObj->SetActionByName("Hangle")) return FALSE;
|
||||
if (!cObj->SetActionByName("Hangle")) return false;
|
||||
cObj->xdir=cObj->ydir=0;
|
||||
cObj->SetDir(dir);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionThrow(C4Object *cObj, C4Object *pThing)
|
||||
bool ObjectActionThrow(C4Object *cObj, C4Object *pThing)
|
||||
{
|
||||
// No object specified, first from contents
|
||||
if (!pThing) pThing = cObj->Contents.GetObject();
|
||||
// Nothing to throw
|
||||
if (!pThing) return FALSE;
|
||||
if (!pThing) return false;
|
||||
// Force and direction
|
||||
FIXED pthrow=ValByPhysical(400, cObj->GetPhysical()->Throw);
|
||||
int32_t iDir=1; if (cObj->Action.Dir==DIR_Left) iDir=-1;
|
||||
// Set action
|
||||
if (!cObj->SetActionByName("Throw")) return FALSE;
|
||||
if (!cObj->SetActionByName("Throw")) return false;
|
||||
// Exit object
|
||||
pThing->Exit(cObj->GetX(),
|
||||
cObj->GetY()+cObj->Shape.y-1,
|
||||
Random(360),
|
||||
pthrow*iDir,-pthrow,pthrow*iDir);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionDig(C4Object *cObj)
|
||||
bool ObjectActionDig(C4Object *cObj)
|
||||
{
|
||||
if (!cObj->SetActionByName("Dig")) return FALSE;
|
||||
if (!cObj->SetActionByName("Dig")) return false;
|
||||
cObj->Action.Data=0; // Material Dig2Object request
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectActionBuild(C4Object *cObj, C4Object *target)
|
||||
bool ObjectActionBuild(C4Object *cObj, C4Object *target)
|
||||
{
|
||||
return cObj->SetActionByName("Build",target);
|
||||
}
|
||||
|
||||
BOOL ObjectActionPush(C4Object *cObj, C4Object *target)
|
||||
bool ObjectActionPush(C4Object *cObj, C4Object *target)
|
||||
{
|
||||
return cObj->SetActionByName("Push",target);
|
||||
}
|
||||
|
||||
BOOL ObjectActionFight(C4Object *cObj, C4Object *target)
|
||||
bool ObjectActionFight(C4Object *cObj, C4Object *target)
|
||||
{
|
||||
return cObj->SetActionByName("Fight",target);
|
||||
}
|
||||
|
||||
BOOL ObjectActionChop(C4Object *cObj, C4Object *target)
|
||||
bool ObjectActionChop(C4Object *cObj, C4Object *target)
|
||||
{
|
||||
return cObj->SetActionByName("Chop",target);
|
||||
}
|
||||
|
||||
BOOL CornerScaleOkay(C4Object *cObj, int32_t iRangeX, int32_t iRangeY)
|
||||
bool CornerScaleOkay(C4Object *cObj, int32_t iRangeX, int32_t iRangeY)
|
||||
{
|
||||
int32_t ctx,cty;
|
||||
cty=cObj->GetY()-iRangeY;
|
||||
|
@ -190,33 +190,33 @@ BOOL CornerScaleOkay(C4Object *cObj, int32_t iRangeX, int32_t iRangeY)
|
|||
if (!(cObj->t_contact & CNAT_Left))
|
||||
if (!(cObj->t_contact & CNAT_Right))
|
||||
if (!(cObj->t_contact & CNAT_Bottom))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL CheckCornerScale(C4Object *cObj, int32_t &iRangeX, int32_t &iRangeY)
|
||||
bool CheckCornerScale(C4Object *cObj, int32_t &iRangeX, int32_t &iRangeY)
|
||||
{
|
||||
for (iRangeX=CornerRange; iRangeX>=1; iRangeX--)
|
||||
for (iRangeY=CornerRange; iRangeY>=1; iRangeY--)
|
||||
if (CornerScaleOkay(cObj,iRangeX,iRangeY))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectActionCornerScale(C4Object *cObj)
|
||||
bool ObjectActionCornerScale(C4Object *cObj)
|
||||
{
|
||||
int32_t iRangeX,iRangeY;
|
||||
// Scaling: check range max to min
|
||||
if (cObj->GetProcedure()==DFA_SCALE)
|
||||
{
|
||||
if (!CheckCornerScale(cObj,iRangeX,iRangeY)) return FALSE;
|
||||
if (!CheckCornerScale(cObj,iRangeX,iRangeY)) return false;
|
||||
}
|
||||
// Swimming: check range min to max
|
||||
else
|
||||
{
|
||||
iRangeY=2;
|
||||
while (!CornerScaleOkay(cObj,iRangeY,iRangeY))
|
||||
{ iRangeY++; if (iRangeY>CornerRange) return FALSE; }
|
||||
{ iRangeY++; if (iRangeY>CornerRange) return false; }
|
||||
iRangeX=iRangeY;
|
||||
}
|
||||
// Do corner scale
|
||||
|
@ -227,10 +227,10 @@ BOOL ObjectActionCornerScale(C4Object *cObj)
|
|||
if (cObj->Action.Dir==DIR_Left) cObj->fix_x-=itofix(iRangeX);
|
||||
else cObj->fix_x+=itofix(iRangeX);
|
||||
cObj->fix_y-=itofix(iRangeY);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectComMovement(C4Object *cObj, int32_t comdir)
|
||||
bool ObjectComMovement(C4Object *cObj, int32_t comdir)
|
||||
{
|
||||
cObj->Action.ComDir=comdir;
|
||||
|
||||
|
@ -246,21 +246,21 @@ BOOL ObjectComMovement(C4Object *cObj, int32_t comdir)
|
|||
cObj->SetDir(DIR_Right);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectComTurn(C4Object *cObj)
|
||||
bool ObjectComTurn(C4Object *cObj)
|
||||
{
|
||||
// turn around, if standing still
|
||||
if (!cObj->xdir && cObj->GetProcedure() == DFA_WALK)
|
||||
{
|
||||
cObj->SetDir(1-cObj->Action.Dir);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComStop(C4Object *cObj)
|
||||
bool ObjectComStop(C4Object *cObj)
|
||||
{
|
||||
// Cease current action
|
||||
cObj->SetActionByName("Idle");
|
||||
|
@ -268,18 +268,18 @@ BOOL ObjectComStop(C4Object *cObj)
|
|||
return ObjectActionStand(cObj);
|
||||
}
|
||||
|
||||
BOOL ObjectComGrab(C4Object *cObj, C4Object *pTarget)
|
||||
bool ObjectComGrab(C4Object *cObj, C4Object *pTarget)
|
||||
{
|
||||
if (!pTarget) return FALSE;
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return FALSE;
|
||||
if (!ObjectActionPush(cObj,pTarget)) return FALSE;
|
||||
if (!pTarget) return false;
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return false;
|
||||
if (!ObjectActionPush(cObj,pTarget)) return false;
|
||||
cObj->Call(PSF_Grab, &C4AulParSet(C4VObj(pTarget), C4VBool(true)));
|
||||
if (pTarget->Status && cObj->Status)
|
||||
pTarget->Call(PSF_Grabbed, &C4AulParSet(C4VObj(cObj), C4VBool(true)));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectComUnGrab(C4Object *cObj)
|
||||
bool ObjectComUnGrab(C4Object *cObj)
|
||||
{
|
||||
// Only if pushing, -> stand
|
||||
if (cObj->GetProcedure() == DFA_PUSH)
|
||||
|
@ -287,21 +287,21 @@ BOOL ObjectComUnGrab(C4Object *cObj)
|
|||
C4Object *pTarget = cObj->Action.Target;
|
||||
if (ObjectActionStand(cObj))
|
||||
{
|
||||
if (!cObj->CloseMenu(false)) return FALSE;
|
||||
if (!cObj->CloseMenu(false)) return false;
|
||||
cObj->Call(PSF_Grab, &C4AulParSet(C4VObj(pTarget), C4VBool(false)));
|
||||
if (pTarget && pTarget->Status && cObj->Status)
|
||||
pTarget->Call(PSF_Grabbed, &C4AulParSet(C4VObj(cObj), C4VBool(false)));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
|
||||
bool ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
|
||||
{
|
||||
// Only if walking
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return FALSE;
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return false;
|
||||
// Calculate direction & forces
|
||||
FIXED TXDir=Fix0;
|
||||
C4PhysicalInfo *pPhysical=cObj->GetPhysical();
|
||||
|
@ -323,37 +323,37 @@ BOOL ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
|
|||
if(cObj->Shape.ContactDensity > C4M_Liquid)
|
||||
if (SimFlightHitsLiquid(x,y,TXDir,-iPhysicalJump))
|
||||
if (ObjectActionDive(cObj,TXDir,-iPhysicalJump))
|
||||
return TRUE;
|
||||
return true;
|
||||
// Regular jump
|
||||
return ObjectActionJump(cObj,TXDir,-iPhysicalJump,true);
|
||||
}
|
||||
|
||||
BOOL ObjectComLetGo(C4Object *cObj, int32_t xdirf)
|
||||
bool ObjectComLetGo(C4Object *cObj, int32_t xdirf)
|
||||
{ // by ACTSCALE, ACTHANGLE or ExecCMDFMoveTo
|
||||
return ObjectActionJump(cObj,itofix(xdirf),Fix0,true);
|
||||
}
|
||||
|
||||
BOOL ObjectComEnter(C4Object *cObj) // by pusher
|
||||
bool ObjectComEnter(C4Object *cObj) // by pusher
|
||||
{
|
||||
if (!cObj) return FALSE;
|
||||
if (!cObj) return false;
|
||||
|
||||
// NoPushEnter
|
||||
if (cObj->Def->NoPushEnter) return FALSE;
|
||||
if (cObj->Def->NoPushEnter) return false;
|
||||
|
||||
// Check object entrance, try command enter
|
||||
C4Object *pTarget;
|
||||
DWORD ocf=OCF_Entrance;
|
||||
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
|
||||
if (ocf & OCF_Entrance)
|
||||
{ cObj->SetCommand(C4CMD_Enter,pTarget); return TRUE; }
|
||||
{ cObj->SetCommand(C4CMD_Enter,pTarget); return true; }
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
BOOL ObjectComUp(C4Object *cObj) // by DFA_WALK or DFA_SWIM
|
||||
bool ObjectComUp(C4Object *cObj) // by DFA_WALK or DFA_SWIM
|
||||
{
|
||||
if (!cObj) return FALSE;
|
||||
if (!cObj) return false;
|
||||
|
||||
// Check object entrance, try command enter
|
||||
C4Object *pTarget;
|
||||
|
@ -366,18 +366,18 @@ BOOL ObjectComUp(C4Object *cObj) // by DFA_WALK or DFA_SWIM
|
|||
if (cObj->GetProcedure()==DFA_WALK)
|
||||
return PlayerObjectCommand(cObj->Owner,C4CMD_Jump);
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComDig(C4Object *cObj) // by DFA_WALK
|
||||
bool ObjectComDig(C4Object *cObj) // by DFA_WALK
|
||||
{
|
||||
C4PhysicalInfo *phys=cObj->GetPhysical();
|
||||
if (!phys->CanDig || !ObjectActionDig(cObj))
|
||||
{
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NODIG"),cObj->GetName()).getData(),cObj);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Object *CreateLine(C4ID idType, int32_t iOwner, C4Object *pFrom, C4Object *pTo)
|
||||
|
@ -395,7 +395,7 @@ C4Object *CreateLine(C4ID idType, int32_t iOwner, C4Object *pFrom, C4Object *pTo
|
|||
return pLine;
|
||||
}
|
||||
|
||||
BOOL ObjectComLineConstruction(C4Object *cObj)
|
||||
bool ObjectComLineConstruction(C4Object *cObj)
|
||||
{
|
||||
C4Object *linekit,*tstruct,*cline;
|
||||
DWORD ocf;
|
||||
|
@ -405,7 +405,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
// Check physical
|
||||
if (!cObj->GetPhysical()->CanConstruct)
|
||||
{
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOLINECONSTRUCT"),cObj->GetName()).getData(),cObj); return FALSE;
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOLINECONSTRUCT"),cObj->GetName()).getData(),cObj); return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - Line pickup - - - - - - - - - - - - - - - - -
|
||||
|
@ -414,27 +414,27 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
if (!(linekit=cObj->Contents.Find(C4ID_Linekit)))
|
||||
{
|
||||
// Check for collection limit
|
||||
if (cObj->Def->CollectionLimit && (cObj->Contents.ObjectCount()>=cObj->Def->CollectionLimit) ) return FALSE;
|
||||
if (cObj->Def->CollectionLimit && (cObj->Contents.ObjectCount()>=cObj->Def->CollectionLimit) ) return false;
|
||||
// Check line pickup
|
||||
ocf=OCF_LineConstruct;
|
||||
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;
|
||||
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
|
||||
if ( (cline->Action.Target && (cline->Action.Target->Def->id==C4ID_Linekit))
|
||||
|| (cline->Action.Target2 && (cline->Action.Target2->Def->id==C4ID_Linekit)) )
|
||||
{
|
||||
StartSoundEffect("Error",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NODOUBLEKIT"),cline->GetName()).getData(),cObj); return FALSE;
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NODOUBLEKIT"),cline->GetName()).getData(),cObj); return false;
|
||||
}
|
||||
// Create new linekit
|
||||
if (!(linekit=Game.CreateObject(C4ID_Linekit,cObj,cline->Owner))) return FALSE;
|
||||
if (!(linekit=Game.CreateObject(C4ID_Linekit,cObj,cline->Owner))) return false;
|
||||
// Enter linekit into clonk
|
||||
bool fRejectCollect;
|
||||
if (!linekit->Enter(cObj, TRUE, true, &fRejectCollect))
|
||||
if (!linekit->Enter(cObj, true, true, &fRejectCollect))
|
||||
{
|
||||
// Enter failed: abort operation
|
||||
linekit->AssignRemoval(); return FALSE;
|
||||
linekit->AssignRemoval(); return false;
|
||||
}
|
||||
// Attach line to collected linekit
|
||||
StartSoundEffect("Connect",false,100,cObj);
|
||||
|
@ -442,7 +442,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
if (cline->Action.Target2==tstruct) cline->Action.Target2=linekit;
|
||||
// Message
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_DISCONNECT"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - Active construction - - - - - - - - - - - - - - - - -
|
||||
|
@ -459,7 +459,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
{
|
||||
// No connect
|
||||
StartSoundEffect("Error",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOCONNECT")).getData(),cObj); return FALSE;
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOCONNECT")).getData(),cObj); return false;
|
||||
}
|
||||
|
||||
// Check short circuit -> removal
|
||||
|
@ -469,28 +469,28 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
StartSoundEffect("Connect",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_LINEREMOVAL"),cline->GetName()).getData(),tstruct);
|
||||
cline->AssignRemoval();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for correct connection type
|
||||
BOOL connect_okay=FALSE;
|
||||
bool connect_okay=false;
|
||||
switch (cline->Def->Line)
|
||||
{
|
||||
case C4D_Line_Power:
|
||||
if (tstruct->Def->LineConnect & C4D_Power_Input) connect_okay=TRUE;
|
||||
if (tstruct->Def->LineConnect & C4D_Power_Output) connect_okay=TRUE;
|
||||
if (tstruct->Def->LineConnect & C4D_Power_Input) connect_okay=true;
|
||||
if (tstruct->Def->LineConnect & C4D_Power_Output) connect_okay=true;
|
||||
break;
|
||||
case C4D_Line_Source:
|
||||
if (tstruct->Def->LineConnect & C4D_Liquid_Output) connect_okay=TRUE; break;
|
||||
if (tstruct->Def->LineConnect & C4D_Liquid_Output) connect_okay=true; break;
|
||||
case C4D_Line_Drain:
|
||||
if (tstruct->Def->LineConnect & C4D_Liquid_Input) connect_okay=TRUE; break;
|
||||
default: return FALSE; // Undefined line type
|
||||
if (tstruct->Def->LineConnect & C4D_Liquid_Input) connect_okay=true; break;
|
||||
default: return false; // Undefined line type
|
||||
}
|
||||
if (!connect_okay)
|
||||
{
|
||||
StartSoundEffect("Error",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOCONNECTTYPE"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Connect line to structure
|
||||
|
@ -502,7 +502,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_CONNECT"),cline->GetName(),tstruct->GetName()).getData(),tstruct);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - New line - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -513,7 +513,7 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
if (!tstruct || !(ocf & OCF_LineConstruct))
|
||||
{
|
||||
StartSoundEffect("Error",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NONEWLINE")).getData(),cObj); return FALSE;
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NONEWLINE")).getData(),cObj); return false;
|
||||
}
|
||||
|
||||
// Determine new line type
|
||||
|
@ -536,17 +536,17 @@ BOOL ObjectComLineConstruction(C4Object *cObj)
|
|||
if (linetype==C4ID_None)
|
||||
{
|
||||
StartSoundEffect("Error",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NONEWLINE")).getData(),cObj); return FALSE;
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NONEWLINE")).getData(),cObj); return false;
|
||||
}
|
||||
|
||||
// Create new line
|
||||
C4Object *newline=CreateLine(linetype,cObj->Owner,
|
||||
tstruct,linekit);
|
||||
if (!newline) return FALSE;
|
||||
if (!newline) return false;
|
||||
StartSoundEffect("Connect",false,100,cObj);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NEWLINE"),newline->GetName()).getData(),tstruct);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DFA_SWIM
|
||||
|
@ -592,28 +592,28 @@ void ObjectComDigDouble(C4Object *cObj) // "Activation" by DFA_WALK, DFA_DIG, DF
|
|||
|
||||
}
|
||||
|
||||
BOOL ObjectComDownDouble(C4Object *cObj) // by DFA_WALK
|
||||
bool ObjectComDownDouble(C4Object *cObj) // by DFA_WALK
|
||||
{
|
||||
C4Object *pTarget;
|
||||
DWORD ocf= OCF_Construct | OCF_Grab;
|
||||
if ((pTarget=::Objects.AtObject(cObj->GetX(),cObj->GetY(),ocf,cObj)))
|
||||
{
|
||||
if (ocf & OCF_Construct)
|
||||
{ PlayerObjectCommand(cObj->Owner,C4CMD_Build,pTarget); return TRUE; }
|
||||
{ PlayerObjectCommand(cObj->Owner,C4CMD_Build,pTarget); return true; }
|
||||
if (ocf & OCF_Grab)
|
||||
{ PlayerObjectCommand(cObj->Owner,C4CMD_Grab,pTarget); return TRUE; }
|
||||
{ PlayerObjectCommand(cObj->Owner,C4CMD_Grab,pTarget); return true; }
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing)
|
||||
bool ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing)
|
||||
{
|
||||
// No object specified, first from contents
|
||||
if (!pThing) pThing = cObj->Contents.GetObject();
|
||||
// Nothing to put
|
||||
if (!pThing) return FALSE;
|
||||
if (!pThing) return false;
|
||||
// No target
|
||||
if (!pTarget) return FALSE;
|
||||
if (!pTarget) return false;
|
||||
// Grabbing: check C4D_Grab_Put
|
||||
if (pTarget!=cObj->Contained)
|
||||
if (!(pTarget->Def->GrabPutGet & C4D_Grab_Put))
|
||||
|
@ -623,44 +623,44 @@ BOOL ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing)
|
|||
if (::Players.Get(cObj->Owner)->LastComDownDouble)
|
||||
return ObjectComDrop(cObj, pThing);
|
||||
// No grab put: fail
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Target no fullcon
|
||||
if (!(pTarget->OCF & OCF_FullCon)) return FALSE;
|
||||
if (!(pTarget->OCF & OCF_FullCon)) return false;
|
||||
// Check target collection limit
|
||||
if (pTarget->Def->CollectionLimit && (pTarget->Contents.ObjectCount()>=pTarget->Def->CollectionLimit)) return FALSE;
|
||||
if (pTarget->Def->CollectionLimit && (pTarget->Contents.ObjectCount()>=pTarget->Def->CollectionLimit)) return false;
|
||||
// Transfer thing
|
||||
bool fRejectCollect;
|
||||
if (!pThing->Enter(pTarget, TRUE, true, &fRejectCollect)) return FALSE;
|
||||
if (!pThing->Enter(pTarget, true, true, &fRejectCollect)) return false;
|
||||
// Put call to object script
|
||||
cObj->Call(PSF_Put);
|
||||
// Target collection call
|
||||
pTarget->Call(PSF_Collection,&C4AulParSet(C4VObj(pThing), C4VBool(TRUE)));
|
||||
pTarget->Call(PSF_Collection,&C4AulParSet(C4VObj(pThing), C4VBool(true)));
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectComThrow(C4Object *cObj, C4Object *pThing)
|
||||
bool ObjectComThrow(C4Object *cObj, C4Object *pThing)
|
||||
{
|
||||
// No object specified, first from contents
|
||||
if (!pThing) pThing = cObj->Contents.GetObject();
|
||||
// Nothing to throw
|
||||
if (!pThing) return FALSE;
|
||||
if (!pThing) return false;
|
||||
// Throw com
|
||||
switch (cObj->GetProcedure())
|
||||
{
|
||||
case DFA_WALK: return ObjectActionThrow(cObj,pThing);
|
||||
}
|
||||
// Failure
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComDrop(C4Object *cObj, C4Object *pThing)
|
||||
bool ObjectComDrop(C4Object *cObj, C4Object *pThing)
|
||||
{
|
||||
// No object specified, first from contents
|
||||
if (!pThing) pThing = cObj->Contents.GetObject();
|
||||
// Nothing to throw
|
||||
if (!pThing) return FALSE;
|
||||
if (!pThing) return false;
|
||||
// Force and direction
|
||||
// When dropping diagonally, drop from edge of shape
|
||||
// When doing a diagonal forward drop during flight, exit a bit closer to the Clonk to allow planned tumbling
|
||||
|
@ -690,35 +690,35 @@ BOOL ObjectComDrop(C4Object *cObj, C4Object *pThing)
|
|||
// Ungrab
|
||||
ObjectComUnGrab(cObj);
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL ObjectComChop(C4Object *cObj, C4Object *pTarget)
|
||||
bool ObjectComChop(C4Object *cObj, C4Object *pTarget)
|
||||
{
|
||||
if (!pTarget) return FALSE;
|
||||
if (!pTarget) return false;
|
||||
if (!cObj->GetPhysical()->CanChop)
|
||||
{
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_NOCHOP"),cObj->GetName()).getData(),cObj);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return FALSE;
|
||||
if (cObj->GetProcedure()!=DFA_WALK) return false;
|
||||
return ObjectActionChop(cObj,pTarget);
|
||||
}
|
||||
|
||||
BOOL ObjectComBuild(C4Object *cObj, C4Object *pTarget)
|
||||
bool ObjectComBuild(C4Object *cObj, C4Object *pTarget)
|
||||
{
|
||||
if (!pTarget) return FALSE;
|
||||
if (!pTarget) return false;
|
||||
// Needs to be idle or walking
|
||||
if (cObj->Action.pActionDef)
|
||||
if (cObj->GetProcedure()!=DFA_WALK)
|
||||
return FALSE;
|
||||
return false;
|
||||
return ObjectActionBuild(cObj,pTarget);
|
||||
}
|
||||
|
||||
BOOL ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing) // by C4CMD_Throw
|
||||
bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing) // by C4CMD_Throw
|
||||
{ // by C4CMD_Drop
|
||||
// Valid checks
|
||||
if (!pTarget) return FALSE;
|
||||
if (!pTarget) return false;
|
||||
// No object specified, first from contents
|
||||
if (!pThing) pThing = cObj->Contents.GetObject();
|
||||
// Has thing, put to target
|
||||
|
@ -734,56 +734,56 @@ BOOL ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing) // by
|
|||
return cObj->ActivateMenu(C4MN_Get,0,0,0,pTarget);
|
||||
}
|
||||
// Failure
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// carlo
|
||||
BOOL ObjectComTake(C4Object *cObj) // by C4CMD_Take
|
||||
bool ObjectComTake(C4Object *cObj) // by C4CMD_Take
|
||||
{
|
||||
return cObj->ActivateMenu(C4MN_Activate);
|
||||
}
|
||||
|
||||
// carlo
|
||||
BOOL ObjectComTake2(C4Object *cObj) // by C4CMD_Take2
|
||||
bool ObjectComTake2(C4Object *cObj) // by C4CMD_Take2
|
||||
{
|
||||
return cObj->ActivateMenu(C4MN_Get,0,0,0,cObj->Contained);
|
||||
}
|
||||
|
||||
BOOL ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t punch)
|
||||
bool ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t punch)
|
||||
{
|
||||
if (!cObj || !pTarget) return FALSE;
|
||||
if (!cObj || !pTarget) return false;
|
||||
if (!punch)
|
||||
if (pTarget->GetPhysical()->Fight)
|
||||
punch=BoundBy<int32_t>(5*cObj->GetPhysical()->Fight/pTarget->GetPhysical()->Fight,0,10);
|
||||
if (!punch) return TRUE;
|
||||
if (!punch) return true;
|
||||
bool fBlowStopped = !!pTarget->Call(PSF_QueryCatchBlow,&C4AulParSet(C4VObj(cObj)));
|
||||
if (fBlowStopped && punch>1) punch=punch/2; // half damage for caught blow, so shield+armor help in fistfight and vs monsters
|
||||
pTarget->DoEnergy(-punch, false, C4FxCall_EngGetPunched, cObj->Controller);
|
||||
int32_t tdir=+1; if (cObj->Action.Dir==DIR_Left) tdir=-1;
|
||||
pTarget->Action.ComDir=COMD_Stop;
|
||||
// No tumbles when blow was caught
|
||||
if (fBlowStopped) return FALSE;
|
||||
if (fBlowStopped) return false;
|
||||
// Hard punch
|
||||
if (punch>=10)
|
||||
if (ObjectActionTumble(pTarget,pTarget->Action.Dir,FIXED100(150)*tdir,itofix(-2)))
|
||||
{ pTarget->Call(PSF_CatchBlow,&C4AulParSet(C4VInt(punch),
|
||||
C4VObj(cObj)));
|
||||
return TRUE; }
|
||||
return true; }
|
||||
|
||||
// Regular punch
|
||||
if (ObjectActionGetPunched(pTarget,FIXED100(250)*tdir,Fix0))
|
||||
{ pTarget->Call(PSF_CatchBlow,&C4AulParSet(C4VInt(punch),
|
||||
C4VObj(cObj)));
|
||||
return TRUE; }
|
||||
return true; }
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ObjectComCancelAttach(C4Object *cObj)
|
||||
bool ObjectComCancelAttach(C4Object *cObj)
|
||||
{
|
||||
if (cObj->GetProcedure()==DFA_ATTACH)
|
||||
return cObj->SetAction(0);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ObjectComStopDig(C4Object *cObj)
|
||||
|
@ -925,15 +925,15 @@ bool ComDirLike(int32_t iComDir, int32_t iSample)
|
|||
return false;
|
||||
}
|
||||
|
||||
void DrawCommandKey(C4Facet &cgo, int32_t iCom, BOOL fPressed, const char *szText)
|
||||
void DrawCommandKey(C4Facet &cgo, int32_t iCom, bool fPressed, const char *szText)
|
||||
{
|
||||
// Draw key
|
||||
::GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed);
|
||||
::GraphicsResource.fctKey.Draw(cgo,false,fPressed);
|
||||
// Draw control symbol
|
||||
if (iCom == COM_PlayerMenu)
|
||||
::GraphicsResource.fctOKCancel.Draw(cgo,TRUE,1,1);
|
||||
::GraphicsResource.fctOKCancel.Draw(cgo,true,1,1);
|
||||
else
|
||||
::GraphicsResource.fctCommand.Draw(cgo,TRUE,Com2Control(iCom),((iCom & COM_Double)!=0));
|
||||
::GraphicsResource.fctCommand.Draw(cgo,true,Com2Control(iCom),((iCom & COM_Double)!=0));
|
||||
// Use smaller font on smaller buttons
|
||||
CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? ::GraphicsResource.FontTiny : ::GraphicsResource.FontRegular;
|
||||
// Draw text
|
||||
|
@ -941,12 +941,12 @@ void DrawCommandKey(C4Facet &cgo, int32_t iCom, BOOL fPressed, const char *szTex
|
|||
Application.DDraw->TextOut(szText, rFont, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt-rFont.iLineHgt-2,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter);
|
||||
}
|
||||
|
||||
void DrawControlKey(C4Facet &cgo, int32_t iControl, BOOL fPressed, const char *szText)
|
||||
void DrawControlKey(C4Facet &cgo, int32_t iControl, bool fPressed, const char *szText)
|
||||
{
|
||||
// Draw key
|
||||
::GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed);
|
||||
::GraphicsResource.fctKey.Draw(cgo,false,fPressed);
|
||||
// Draw control symbol
|
||||
::GraphicsResource.fctCommand.Draw(cgo,TRUE,iControl);
|
||||
::GraphicsResource.fctCommand.Draw(cgo,true,iControl);
|
||||
// Use smaller font on smaller buttons
|
||||
CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? ::GraphicsResource.FontRegular : ::GraphicsResource.FontTiny;
|
||||
// Draw text
|
||||
|
@ -954,26 +954,26 @@ void DrawControlKey(C4Facet &cgo, int32_t iControl, BOOL fPressed, const char *s
|
|||
Application.DDraw->TextOut(szText, rFont, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt-rFont.iLineHgt-2,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter);
|
||||
}
|
||||
|
||||
BOOL SellFromBase(int32_t iPlr, C4Object *pBaseObj, C4ID id, C4Object *pSellObj)
|
||||
bool SellFromBase(int32_t iPlr, C4Object *pBaseObj, C4ID id, C4Object *pSellObj)
|
||||
{
|
||||
C4Object *pThing;
|
||||
// Valid checks
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
if (!pBaseObj || !ValidPlr(pBaseObj->Base)) return FALSE;
|
||||
if (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Sell) return FALSE;
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
if (!pBaseObj || !ValidPlr(pBaseObj->Base)) return false;
|
||||
if (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Sell) return false;
|
||||
// Base owner eliminated
|
||||
if (::Players.Get(pBaseObj->Base)->Eliminated)
|
||||
{
|
||||
StartSoundEffect("Error",false,100,pBaseObj);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_ELIMINATED"),::Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Base owner hostile
|
||||
if (Hostile(iPlr,pBaseObj->Base))
|
||||
{
|
||||
StartSoundEffect("Error",false,100,pBaseObj);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),::Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// check validity of sell object, if specified
|
||||
if (pThing = pSellObj)
|
||||
|
@ -981,39 +981,39 @@ BOOL SellFromBase(int32_t iPlr, C4Object *pBaseObj, C4ID id, C4Object *pSellObj)
|
|||
pThing = NULL;
|
||||
// Get object from home pBaseObj via selected id, if no or an anvalid thing has been specified
|
||||
if (!pThing)
|
||||
if (!(pThing=pBaseObj->Contents.Find(id))) return FALSE;
|
||||
if (!(pThing=pBaseObj->Contents.Find(id))) return false;
|
||||
// check definition NoSell
|
||||
if (pThing->Def->NoSell) return FALSE;
|
||||
if (pThing->Def->NoSell) return false;
|
||||
// Sell object (pBaseObj owner gets the money)
|
||||
return ::Players.Get(pBaseObj->Base)->Sell2Home(pThing);
|
||||
}
|
||||
|
||||
BOOL Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, BOOL fShowErrors)
|
||||
bool Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, bool fShowErrors)
|
||||
{
|
||||
C4Object *pThing;
|
||||
// Validity
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
if (!pBase || !ValidPlr(pBase->Base)) return FALSE;
|
||||
if (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Buy) return FALSE;
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
if (!pBase || !ValidPlr(pBase->Base)) return false;
|
||||
if (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Buy) return false;
|
||||
// Base owner hostile
|
||||
if (Hostile(iPlr,pBase->Base))
|
||||
{
|
||||
if (!fShowErrors) return FALSE;
|
||||
if (!fShowErrors) return false;
|
||||
StartSoundEffect("Error",false,100,pBase);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),::Players.Get(pBase->Base)->GetName()).getData(),iPlr); return FALSE;
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),::Players.Get(pBase->Base)->GetName()).getData(),iPlr); return false;
|
||||
}
|
||||
// buy
|
||||
if (!(pThing=::Players.Get(pBase->Base)->Buy(id, fShowErrors, iPlr, pBase))) return FALSE;
|
||||
if (!(pThing=::Players.Get(pBase->Base)->Buy(id, fShowErrors, iPlr, pBase))) return false;
|
||||
// Object enter target object
|
||||
pThing->Enter(pBase);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget, int32_t tx, int32_t ty)
|
||||
bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget, int32_t tx, int32_t ty)
|
||||
{
|
||||
C4Player *pPlr=::Players.Get(plr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (!pPlr) return false;
|
||||
int32_t iAddMode = C4P_Command_Set;
|
||||
// Adjust for old-style keyboard throw/drop control: add & in range
|
||||
if (cmdf==C4CMD_Throw || cmdf==C4CMD_Drop) iAddMode = C4P_Command_Add | C4P_Command_Range;
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include <C4Id.h>
|
||||
|
||||
void DrawCommandKey(C4Facet &cgo, int32_t iCom,
|
||||
BOOL fPressed = FALSE,
|
||||
bool fPressed = false,
|
||||
const char *szText = NULL);
|
||||
|
||||
void DrawControlKey(C4Facet &cgo, int32_t iControl,
|
||||
BOOL fPressed = FALSE,
|
||||
bool fPressed = false,
|
||||
const char *szText = NULL);
|
||||
|
||||
int32_t Control2Com(int32_t iControl, bool fUp);
|
||||
|
@ -42,55 +42,55 @@ StdStrBuf PlrControlKeyName(int32_t iPlayer, int32_t iControl, bool fShort);
|
|||
|
||||
const int32_t ComOrderNum = 24;
|
||||
|
||||
BOOL PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget=NULL, int32_t tx=0, int32_t ty=0);
|
||||
bool PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget=NULL, int32_t tx=0, int32_t ty=0);
|
||||
|
||||
BOOL ObjectActionWalk(C4Object *cObj);
|
||||
BOOL ObjectActionStand(C4Object *cObj);
|
||||
BOOL ObjectActionJump(C4Object *cObj, FIXED xdir, FIXED ydir, bool fByCom);
|
||||
BOOL ObjectActionDive(C4Object *cObj, FIXED xdir, FIXED ydir);
|
||||
BOOL ObjectActionTumble(C4Object *cObj, int32_t dir, FIXED xdir, FIXED ydir);
|
||||
BOOL ObjectActionGetPunched(C4Object *cObj, FIXED xdir, FIXED ydir);
|
||||
BOOL ObjectActionKneel(C4Object *cObj);
|
||||
BOOL ObjectActionFlat(C4Object *cObj, int32_t dir);
|
||||
BOOL ObjectActionScale(C4Object *cObj, int32_t dir);
|
||||
BOOL ObjectActionHangle(C4Object *cObj, int32_t dir);
|
||||
BOOL ObjectActionThrow(C4Object *cObj, C4Object *pThing=NULL);
|
||||
BOOL ObjectActionDig(C4Object *cObj);
|
||||
BOOL ObjectActionBuild(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectActionPush(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectActionChop(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectActionCornerScale(C4Object *cObj);
|
||||
BOOL ObjectActionFight(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectActionWalk(C4Object *cObj);
|
||||
bool ObjectActionStand(C4Object *cObj);
|
||||
bool ObjectActionJump(C4Object *cObj, FIXED xdir, FIXED ydir, bool fByCom);
|
||||
bool ObjectActionDive(C4Object *cObj, FIXED xdir, FIXED ydir);
|
||||
bool ObjectActionTumble(C4Object *cObj, int32_t dir, FIXED xdir, FIXED ydir);
|
||||
bool ObjectActionGetPunched(C4Object *cObj, FIXED xdir, FIXED ydir);
|
||||
bool ObjectActionKneel(C4Object *cObj);
|
||||
bool ObjectActionFlat(C4Object *cObj, int32_t dir);
|
||||
bool ObjectActionScale(C4Object *cObj, int32_t dir);
|
||||
bool ObjectActionHangle(C4Object *cObj, int32_t dir);
|
||||
bool ObjectActionThrow(C4Object *cObj, C4Object *pThing=NULL);
|
||||
bool ObjectActionDig(C4Object *cObj);
|
||||
bool ObjectActionBuild(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectActionPush(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectActionChop(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectActionCornerScale(C4Object *cObj);
|
||||
bool ObjectActionFight(C4Object *cObj, C4Object *pTarget);
|
||||
|
||||
BOOL ObjectComMovement(C4Object *cObj, int32_t iComDir);
|
||||
BOOL ObjectComTurn(C4Object *cObj);
|
||||
BOOL ObjectComStop(C4Object *cObj);
|
||||
BOOL ObjectComGrab(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
BOOL ObjectComThrow(C4Object *cObj, C4Object *pThing=NULL);
|
||||
BOOL ObjectComDrop(C4Object *cObj, C4Object *pThing=NULL);
|
||||
BOOL ObjectComUnGrab(C4Object *cObj);
|
||||
BOOL ObjectComJump(C4Object *cObj);
|
||||
BOOL ObjectComLetGo(C4Object *cObj, int32_t xdirf);
|
||||
BOOL ObjectComUp(C4Object *cObj);
|
||||
BOOL ObjectComDig(C4Object *cObj);
|
||||
BOOL ObjectComChop(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectComBuild(C4Object *cObj, C4Object *pTarget);
|
||||
BOOL ObjectComEnter(C4Object *cObj);
|
||||
BOOL ObjectComDownDouble(C4Object *cObj);
|
||||
BOOL ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
BOOL ObjectComTake(C4Object *cObj, C4ID id);
|
||||
BOOL ObjectComTake(C4Object *cObj); // carlo
|
||||
BOOL ObjectComTake2(C4Object *cObj); // carlo
|
||||
BOOL ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t iPunch=0);
|
||||
BOOL ObjectComCancelAttach(C4Object *cObj);
|
||||
bool ObjectComMovement(C4Object *cObj, int32_t iComDir);
|
||||
bool ObjectComTurn(C4Object *cObj);
|
||||
bool ObjectComStop(C4Object *cObj);
|
||||
bool ObjectComGrab(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
bool ObjectComThrow(C4Object *cObj, C4Object *pThing=NULL);
|
||||
bool ObjectComDrop(C4Object *cObj, C4Object *pThing=NULL);
|
||||
bool ObjectComUnGrab(C4Object *cObj);
|
||||
bool ObjectComJump(C4Object *cObj);
|
||||
bool ObjectComLetGo(C4Object *cObj, int32_t xdirf);
|
||||
bool ObjectComUp(C4Object *cObj);
|
||||
bool ObjectComDig(C4Object *cObj);
|
||||
bool ObjectComChop(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectComBuild(C4Object *cObj, C4Object *pTarget);
|
||||
bool ObjectComEnter(C4Object *cObj);
|
||||
bool ObjectComDownDouble(C4Object *cObj);
|
||||
bool ObjectComPutTake(C4Object *cObj, C4Object *pTarget, C4Object *pThing=NULL);
|
||||
bool ObjectComTake(C4Object *cObj, C4ID id);
|
||||
bool ObjectComTake(C4Object *cObj); // carlo
|
||||
bool ObjectComTake2(C4Object *cObj); // carlo
|
||||
bool ObjectComPunch(C4Object *cObj, C4Object *pTarget, int32_t iPunch=0);
|
||||
bool ObjectComCancelAttach(C4Object *cObj);
|
||||
void ObjectComDigDouble(C4Object *cObj);
|
||||
void ObjectComStopDig(C4Object *cObj);
|
||||
|
||||
C4Object *Buy(int32_t iPlr, C4ID id, C4Object *pBase, BOOL fShowErrors=TRUE);
|
||||
BOOL Sell(int32_t iPlr, C4Object *pObj, BOOL fShowErrors=TRUE);
|
||||
BOOL Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, BOOL fShowErrors=TRUE);
|
||||
BOOL SellFromBase(int32_t iPlr, C4Object *pBase, C4ID id, C4Object *pSellObj);
|
||||
C4Object *Buy(int32_t iPlr, C4ID id, C4Object *pBase, bool fShowErrors=true);
|
||||
bool Sell(int32_t iPlr, C4Object *pObj, bool fShowErrors=true);
|
||||
bool Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, bool fShowErrors=true);
|
||||
bool SellFromBase(int32_t iPlr, C4Object *pBase, C4ID id, C4Object *pSellObj);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,10 +54,10 @@ C4ObjectInfo::~C4ObjectInfo()
|
|||
|
||||
void C4ObjectInfo::Default()
|
||||
{
|
||||
WasInAction=FALSE;
|
||||
InAction=FALSE;
|
||||
WasInAction=false;
|
||||
InAction=false;
|
||||
InActionTime=0;
|
||||
HasDied=FALSE;
|
||||
HasDied=false;
|
||||
ControlCount=0;
|
||||
Filename[0]=0;
|
||||
Next=NULL;
|
||||
|
@ -67,7 +67,7 @@ void C4ObjectInfo::Default()
|
|||
pCustomPortrait = NULL;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait)
|
||||
bool C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait)
|
||||
{
|
||||
|
||||
// New version
|
||||
|
@ -77,24 +77,24 @@ BOOL C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname, bool fLoadPor
|
|||
if (hChild.OpenAsChild(&hMother,szEntryname))
|
||||
{
|
||||
if (!C4ObjectInfo::Load(hChild, fLoadPortrait))
|
||||
{ hChild.Close(); return FALSE; }
|
||||
{ hChild.Close(); return false; }
|
||||
// resolve definition, if possible
|
||||
// only works in game, but is not needed in frontend or startup editing anyway
|
||||
pDef = C4Id2Def(id);
|
||||
hChild.Close();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
|
||||
bool C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
|
||||
{
|
||||
// Store group file name
|
||||
SCopy(GetFilename(hGroup.GetName()),Filename,_MAX_FNAME);
|
||||
// Load core
|
||||
if (!C4ObjectInfoCore::Load(hGroup)) return FALSE;
|
||||
if (!C4ObjectInfoCore::Load(hGroup)) return false;
|
||||
// Load portrait - always try linking, even if fLoadPortrait is false (doesn't cost mem anyway)
|
||||
// evaluate portrait string in info
|
||||
bool fPortraitFileChecked=false;
|
||||
|
@ -160,10 +160,10 @@ BOOL C4ObjectInfo::Load(C4Group &hGroup, bool fLoadPortrait)
|
|||
else if (Config.Graphics.AddNewCrewPortraits)
|
||||
// assign a new random crew portrait
|
||||
SetRandomPortrait(0, true, false);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
|
||||
bool C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
|
||||
{
|
||||
// Set group file name; rename if necessary
|
||||
char szTempGroup[_MAX_PATH+1];
|
||||
|
@ -202,8 +202,8 @@ BOOL C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
|
|||
}
|
||||
// Open group
|
||||
C4Group hTemp;
|
||||
if (!hTemp.OpenAsChild(&hGroup, Filename, FALSE, TRUE))
|
||||
return FALSE;
|
||||
if (!hTemp.OpenAsChild(&hGroup, Filename, false, true))
|
||||
return false;
|
||||
// New portrait present, or old portrait not saved yet (old player begin updated)?
|
||||
if (!fStoreTiny && Config.Graphics.SaveDefaultPortraits) if (pNewPortrait || (Config.Graphics.AddNewCrewPortraits && Portrait.GetGfx() && !hTemp.FindEntry(C4CFN_Portrait)))
|
||||
{
|
||||
|
@ -277,11 +277,11 @@ BOOL C4ObjectInfo::Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs)
|
|||
|
||||
// Save info to temp group
|
||||
if (!C4ObjectInfoCore::Save(hTemp, pDefs))
|
||||
{ hTemp.Close(); return FALSE; }
|
||||
{ hTemp.Close(); return false; }
|
||||
// Close temp group
|
||||
hTemp.Close();
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectInfo::Evaluate()
|
||||
|
@ -298,7 +298,7 @@ void C4ObjectInfo::Clear()
|
|||
pDef=NULL;
|
||||
}
|
||||
|
||||
void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Object *pOfObj)
|
||||
void C4ObjectInfo::Draw(C4Facet &cgo, bool fShowPortrait, bool fCaptain, C4Object *pOfObj)
|
||||
{
|
||||
|
||||
int iX=0;
|
||||
|
@ -314,7 +314,7 @@ void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Objec
|
|||
DWORD dwColor = 0xFFFFFFFF;
|
||||
if (pOfObj && ::Players.Get(pOfObj->Owner))
|
||||
dwColor = ::Players.Get(pOfObj->Owner)->ColorDw;
|
||||
pPortraitGfx->DrawClr(ccgo, TRUE, dwColor);
|
||||
pPortraitGfx->DrawClr(ccgo, true, dwColor);
|
||||
iX+=4*cgo.Hgt/3;
|
||||
}
|
||||
}
|
||||
|
@ -357,8 +357,8 @@ void C4ObjectInfo::Recruit()
|
|||
{
|
||||
// already recruited?
|
||||
if (InAction) return;
|
||||
WasInAction=TRUE;
|
||||
InAction=TRUE;
|
||||
WasInAction=true;
|
||||
InAction=true;
|
||||
InActionTime=Game.Time;
|
||||
// rank name overload by def?
|
||||
C4Def *pDef=::Definitions.ID2Def(id);
|
||||
|
@ -374,7 +374,7 @@ void C4ObjectInfo::Retire()
|
|||
// not recruited?
|
||||
if (!InAction) return;
|
||||
// retire
|
||||
InAction=FALSE;
|
||||
InAction=false;
|
||||
TotalPlayingTime+=(Game.Time-InActionTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ class C4ObjectInfo: public C4ObjectInfoCore
|
|||
C4ObjectInfo();
|
||||
~C4ObjectInfo();
|
||||
public:
|
||||
BOOL WasInAction;
|
||||
BOOL InAction;
|
||||
bool WasInAction;
|
||||
bool InAction;
|
||||
int32_t InActionTime;
|
||||
BOOL HasDied;
|
||||
bool HasDied;
|
||||
int32_t ControlCount;
|
||||
class C4Def *pDef; // definition to ID - only eresolved if defs were loaded at object info loading time
|
||||
C4Portrait Portrait; // portrait link (usually to def graphics)
|
||||
|
@ -51,10 +51,10 @@ class C4ObjectInfo: public C4ObjectInfoCore
|
|||
void Retire();
|
||||
void Recruit();
|
||||
void SetBirthday();
|
||||
void Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fShowCaptain, C4Object *pOfObj);
|
||||
BOOL Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs);
|
||||
BOOL Load(C4Group &hGroup, bool fLoadPortrait);
|
||||
BOOL Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait);
|
||||
void Draw(C4Facet &cgo, bool fShowPortrait, bool fShowCaptain, C4Object *pOfObj);
|
||||
bool Save(C4Group &hGroup, bool fStoreTiny, C4DefList *pDefs);
|
||||
bool Load(C4Group &hGroup, bool fLoadPortrait);
|
||||
bool Load(C4Group &hMother, const char *szEntryname, bool fLoadPortrait);
|
||||
bool SetRandomPortrait(C4ID idSourceDef, bool fAssignPermanently, bool fCopyFile);
|
||||
bool SetPortrait(const char *szPortraitName, C4Def *pSourceDef, bool fAssignPermanently, bool fCopyFile);
|
||||
bool SetPortrait(C4PortraitGraphics *pNewPortraitGfx, bool fAssignPermanently, bool fCopyFile);
|
||||
|
|
|
@ -92,12 +92,12 @@ int32_t C4ObjectInfoList::Load(C4Group &hGroup, bool fLoadPortraits)
|
|||
return infn;
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoList::Add(C4ObjectInfo *pInfo)
|
||||
bool C4ObjectInfoList::Add(C4ObjectInfo *pInfo)
|
||||
{
|
||||
if (!pInfo) return FALSE;
|
||||
if (!pInfo) return false;
|
||||
pInfo->Next=First;
|
||||
First=pInfo;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectInfoList::MakeValidName(char *sName)
|
||||
|
@ -111,13 +111,13 @@ void C4ObjectInfoList::MakeValidName(char *sName)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoList::NameExists(const char *szName)
|
||||
bool C4ObjectInfoList::NameExists(const char *szName)
|
||||
{
|
||||
C4ObjectInfo *cinf;
|
||||
for (cinf=First; cinf; cinf=cinf->Next)
|
||||
if (SEqualNoCase(szName,cinf->Name))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
C4ObjectInfo* C4ObjectInfoList::GetIdle(C4ID c_id, C4DefList &rDefs)
|
||||
|
@ -162,7 +162,7 @@ C4ObjectInfo* C4ObjectInfoList::New(C4ID n_id, C4DefList *pDefs)
|
|||
C4Def *pDef = NULL;
|
||||
if (pDefs)
|
||||
if (!(pDef = pDefs->ID2Def(n_id)))
|
||||
{ delete pInfo; return FALSE; }
|
||||
{ delete pInfo; return false; }
|
||||
// Set name source
|
||||
const char *cpNames = Game.Names.GetData();
|
||||
if (pDef->pClonkNames) cpNames = pDef->pClonkNames->GetData();
|
||||
|
@ -188,7 +188,7 @@ void C4ObjectInfoList::Evaluate()
|
|||
cinf->Evaluate();
|
||||
}
|
||||
|
||||
BOOL C4ObjectInfoList::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4DefList *pDefs)
|
||||
bool C4ObjectInfoList::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4DefList *pDefs)
|
||||
{
|
||||
// Save in opposite order (for identical crew order on load)
|
||||
C4ObjectInfo *pInfo;
|
||||
|
@ -202,9 +202,9 @@ BOOL C4ObjectInfoList::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4
|
|||
}
|
||||
// save
|
||||
if (!pInfo->Save(hGroup, fStoreTiny, pDefs))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4ObjectInfo* C4ObjectInfoList::GetIdle(const char *szByName)
|
||||
|
|
|
@ -39,8 +39,8 @@ class C4ObjectInfoList
|
|||
void Evaluate();
|
||||
void DetachFromObjects();
|
||||
int32_t Load(C4Group &hGroup, bool fLoadPortraits);
|
||||
BOOL Add(C4ObjectInfo *pInfo);
|
||||
BOOL Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4DefList *pDefs);
|
||||
bool Add(C4ObjectInfo *pInfo);
|
||||
bool Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny, C4DefList *pDefs);
|
||||
C4ObjectInfo* New(C4ID n_id, C4DefList *pDefs);
|
||||
C4ObjectInfo* GetIdle(C4ID c_id, C4DefList &rDefs);
|
||||
C4ObjectInfo* GetIdle(const char *szByName);
|
||||
|
@ -49,7 +49,7 @@ class C4ObjectInfoList
|
|||
void Strip(C4DefList &rDefs);
|
||||
public:
|
||||
void MakeValidName(char *sName);
|
||||
BOOL NameExists(const char *szName);
|
||||
bool NameExists(const char *szName);
|
||||
protected:
|
||||
C4ObjectInfo *GetLast();
|
||||
C4ObjectInfo *GetPrevious(C4ObjectInfo *pInfo);
|
||||
|
|
|
@ -116,10 +116,10 @@ int C4ObjectList::ListIDCount(int32_t dwCategory)
|
|||
|
||||
|
||||
|
||||
BOOL C4ObjectList::Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted)
|
||||
bool C4ObjectList::Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted)
|
||||
{
|
||||
C4ObjectLink *nLnk;
|
||||
if (!nObj || !nObj->Def || !nObj->Status) return FALSE;
|
||||
if (!nObj || !nObj->Def || !nObj->Status) return false;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (eSort==stMain)
|
||||
|
@ -137,7 +137,7 @@ BOOL C4ObjectList::Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted)
|
|||
assert(pLstSorted != this);
|
||||
|
||||
// Allocate new link
|
||||
if (!(nLnk=new C4ObjectLink)) return FALSE;
|
||||
if (!(nLnk=new C4ObjectLink)) return false;
|
||||
// Set link
|
||||
nLnk->Obj=nObj;
|
||||
|
||||
|
@ -247,17 +247,17 @@ BOOL C4ObjectList::Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted)
|
|||
// Add mass
|
||||
Mass+=nObj->Mass;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::Remove(C4Object *pObj)
|
||||
bool C4ObjectList::Remove(C4Object *pObj)
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
|
||||
// Find link
|
||||
for (cLnk=First; cLnk; cLnk=cLnk->Next)
|
||||
if (cLnk->Obj==pObj) break;
|
||||
if (!cLnk) return FALSE;
|
||||
if (!cLnk) return false;
|
||||
|
||||
// Fix iterators
|
||||
for (iterator * i = FirstIter; i; i = i->Next)
|
||||
|
@ -278,7 +278,7 @@ BOOL C4ObjectList::Remove(C4Object *pObj)
|
|||
if (GetLink(pObj)) BREAKPOINT_HERE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Object* C4ObjectList::Find(C4ID id, int owner, DWORD dwOCF)
|
||||
|
@ -356,7 +356,7 @@ int C4ObjectList::MassCount()
|
|||
void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
|
||||
C4DefList &rDefs, int32_t dwCategory,
|
||||
C4RegionList *pRegions, int iRegionCom,
|
||||
BOOL fDrawOneCounts)
|
||||
bool fDrawOneCounts)
|
||||
{
|
||||
// Calculations & variables
|
||||
/*int iSections = cgo.GetSectionCount();
|
||||
|
@ -474,23 +474,23 @@ bool C4ObjectList::IsContained(C4Object *pObj)
|
|||
return false;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::IsClear() const
|
||||
bool C4ObjectList::IsClear() const
|
||||
{
|
||||
return (ObjectCount()==0);
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::DenumerateRead()
|
||||
bool C4ObjectList::DenumerateRead()
|
||||
{
|
||||
if(!pEnumerated) return FALSE;
|
||||
if(!pEnumerated) return false;
|
||||
// Denumerate all object pointers
|
||||
for(std::list<int32_t>::const_iterator pNum = pEnumerated->begin(); pNum != pEnumerated->end(); ++pNum)
|
||||
Add(::Objects.ObjectPointer(*pNum), stNone); // Add to tail, unsorted
|
||||
// Delete old list
|
||||
delete pEnumerated; pEnumerated = NULL;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::Write(char *szTarget)
|
||||
bool C4ObjectList::Write(char *szTarget)
|
||||
{
|
||||
char ostr[25];
|
||||
szTarget[0]=0;
|
||||
|
@ -501,7 +501,7 @@ BOOL C4ObjectList::Write(char *szTarget)
|
|||
sprintf(ostr,"%d;",cLnk->Obj->Number);
|
||||
SAppend(ostr,szTarget);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectList::Denumerate()
|
||||
|
@ -595,16 +595,16 @@ StdStrBuf C4ObjectList::GetNameList(C4DefList &rDefs, DWORD dwCategory)
|
|||
return Buf;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::ValidateOwners()
|
||||
bool C4ObjectList::ValidateOwners()
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
for (cLnk=First; cLnk; cLnk=cLnk->Next)
|
||||
if (cLnk->Obj->Status)
|
||||
cLnk->Obj->ValidateOwner();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::AssignInfo()
|
||||
bool C4ObjectList::AssignInfo()
|
||||
{
|
||||
// the list seems to be traced backwards here, to ensure crew objects are added in correct order
|
||||
// (or semi-correct, because this will work only if the crew order matches the main object list order)
|
||||
|
@ -613,7 +613,7 @@ BOOL C4ObjectList::AssignInfo()
|
|||
for (cLnk=Last; cLnk; cLnk=cLnk->Prev)
|
||||
if (cLnk->Obj->Status)
|
||||
cLnk->Obj->AssignInfo();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectList::ClearInfo(C4ObjectInfo *pInfo)
|
||||
|
@ -647,17 +647,17 @@ void C4ObjectList::DrawList(C4Facet &cgo, int iSelection, DWORD dwCategory)
|
|||
void C4ObjectList::Sort()
|
||||
{
|
||||
C4ObjectLink *cLnk;
|
||||
BOOL fSorted;
|
||||
bool fSorted;
|
||||
// Sort by id
|
||||
do
|
||||
{
|
||||
fSorted = TRUE;
|
||||
fSorted = true;
|
||||
for (cLnk=First; cLnk && cLnk->Next; cLnk=cLnk->Next)
|
||||
if (cLnk->Obj->id > cLnk->Next->Obj->id)
|
||||
{
|
||||
RemoveLink(cLnk);
|
||||
InsertLink(cLnk,cLnk->Next);
|
||||
fSorted = FALSE;
|
||||
fSorted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -769,17 +769,17 @@ void C4ObjectList::Default()
|
|||
pEnumerated=NULL;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::OrderObjectBefore(C4Object *pObj1, C4Object *pObj2)
|
||||
bool C4ObjectList::OrderObjectBefore(C4Object *pObj1, C4Object *pObj2)
|
||||
{
|
||||
// safety
|
||||
if (pObj1->Status != C4OS_NORMAL || pObj2->Status != C4OS_NORMAL) return FALSE;
|
||||
if (pObj1->Status != C4OS_NORMAL || pObj2->Status != C4OS_NORMAL) return false;
|
||||
// get links (and check whether the objects are part of this list!)
|
||||
C4ObjectLink *pLnk1=GetLink(pObj1); if (!pLnk1) return FALSE;
|
||||
C4ObjectLink *pLnk2=GetLink(pObj2); if (!pLnk2) return FALSE;
|
||||
C4ObjectLink *pLnk1=GetLink(pObj1); if (!pLnk1) return false;
|
||||
C4ObjectLink *pLnk2=GetLink(pObj2); if (!pLnk2) return false;
|
||||
// check if requirements are already fulfilled
|
||||
C4ObjectLink *pLnk=pLnk1;
|
||||
while (pLnk=pLnk->Next) if (pLnk==pLnk2) break;
|
||||
if (pLnk) return TRUE;
|
||||
if (pLnk) return true;
|
||||
// if not, reorder pLnk1 directly before pLnk2
|
||||
// unlink from current position
|
||||
// no need to check pLnk1->Prev here, because pLnk1 cannot be first in the list
|
||||
|
@ -789,20 +789,20 @@ BOOL C4ObjectList::OrderObjectBefore(C4Object *pObj1, C4Object *pObj2)
|
|||
if (pLnk1->Prev=pLnk2->Prev) pLnk2->Prev->Next=pLnk1; else First=pLnk1;
|
||||
pLnk1->Next=pLnk2; pLnk2->Prev=pLnk1;
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::OrderObjectAfter(C4Object *pObj1, C4Object *pObj2)
|
||||
bool C4ObjectList::OrderObjectAfter(C4Object *pObj1, C4Object *pObj2)
|
||||
{
|
||||
// safety
|
||||
if (pObj1->Status != C4OS_NORMAL || pObj2->Status != C4OS_NORMAL) return FALSE;
|
||||
if (pObj1->Status != C4OS_NORMAL || pObj2->Status != C4OS_NORMAL) return false;
|
||||
// get links (and check whether the objects are part of this list!)
|
||||
C4ObjectLink *pLnk1=GetLink(pObj1); if (!pLnk1) return FALSE;
|
||||
C4ObjectLink *pLnk2=GetLink(pObj2); if (!pLnk2) return FALSE;
|
||||
C4ObjectLink *pLnk1=GetLink(pObj1); if (!pLnk1) return false;
|
||||
C4ObjectLink *pLnk2=GetLink(pObj2); if (!pLnk2) return false;
|
||||
// check if requirements are already fulfilled
|
||||
C4ObjectLink *pLnk=pLnk1;
|
||||
while (pLnk=pLnk->Prev) if (pLnk==pLnk2) break;
|
||||
if (pLnk) return TRUE;
|
||||
if (pLnk) return true;
|
||||
// if not, reorder pLnk1 directly after pLnk2
|
||||
// unlink from current position
|
||||
// no need to check pLnk1->Next here, because pLnk1 cannot be last in the list
|
||||
|
@ -812,16 +812,16 @@ BOOL C4ObjectList::OrderObjectAfter(C4Object *pObj1, C4Object *pObj2)
|
|||
if (pLnk1->Next=pLnk2->Next) pLnk2->Next->Prev=pLnk1; else Last=pLnk1;
|
||||
pLnk1->Prev=pLnk2; pLnk2->Next=pLnk1;
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4ObjectList::ShiftContents(C4Object *pNewFirst)
|
||||
bool C4ObjectList::ShiftContents(C4Object *pNewFirst)
|
||||
{
|
||||
// get link of new first (this ensures list is not empty)
|
||||
C4ObjectLink *pNewFirstLnk = GetLink(pNewFirst);
|
||||
if (!pNewFirstLnk) return FALSE;
|
||||
if (!pNewFirstLnk) return false;
|
||||
// already at front?
|
||||
if (pNewFirstLnk == First) return TRUE;
|
||||
if (pNewFirstLnk == First) return true;
|
||||
// sort it there:
|
||||
// 1. Make cyclic list
|
||||
Last->Next = First; First->Prev = Last;
|
||||
|
@ -831,7 +831,7 @@ BOOL C4ObjectList::ShiftContents(C4Object *pNewFirst)
|
|||
// 3. Uncycle list
|
||||
First->Prev = Last->Next = NULL;
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4ObjectList::DeleteObjects()
|
||||
|
@ -924,7 +924,7 @@ struct C4ObjectListDumpHelper
|
|||
ALLOW_TEMP_TO_REF(C4ObjectListDumpHelper)
|
||||
};
|
||||
|
||||
BOOL C4ObjectList::CheckSort(C4ObjectList *pList)
|
||||
bool C4ObjectList::CheckSort(C4ObjectList *pList)
|
||||
{
|
||||
C4ObjectLink *cLnk = First, *cLnk2 = pList->First;
|
||||
while (cLnk && cLnk->Obj->Unsorted) cLnk = cLnk->Next;
|
||||
|
|
|
@ -96,7 +96,7 @@ class C4ObjectList
|
|||
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 DrawIDList(C4Facet &cgo, int iSelection, C4DefList &rDefs, int32_t dwCategory, C4RegionList *pRegions=NULL, int iRegionCom=COM_None, bool fDrawOneCounts=true);
|
||||
void DrawSelectMark(C4TargetFacet &cgo, float Zoom);
|
||||
void CloseMenus();
|
||||
void UpdateGraphics(bool fGraphicsChanged);
|
||||
|
@ -105,16 +105,16 @@ class C4ObjectList
|
|||
|
||||
typedef int SortProc(C4Object *, C4Object *);
|
||||
|
||||
BOOL Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted = NULL);
|
||||
bool Add(C4Object *nObj, SortType eSort, C4ObjectList *pLstSorted = NULL);
|
||||
bool AddSortCustom(C4Object *nObj, SortProc &pSortProc);
|
||||
BOOL Remove(C4Object *pObj);
|
||||
bool Remove(C4Object *pObj);
|
||||
|
||||
BOOL AssignInfo();
|
||||
BOOL ValidateOwners();
|
||||
bool AssignInfo();
|
||||
bool ValidateOwners();
|
||||
StdStrBuf GetNameList(C4DefList &rDefs, DWORD dwCategory=C4D_All);
|
||||
BOOL IsClear() const;
|
||||
BOOL DenumerateRead();
|
||||
BOOL Write(char *szTarget);
|
||||
bool IsClear() const;
|
||||
bool DenumerateRead();
|
||||
bool Write(char *szTarget);
|
||||
void CompileFunc(StdCompiler *pComp, bool fSaveRefs = true, bool fSkipPlayerObjects = false);
|
||||
|
||||
bool IsContained(C4Object *pObj);
|
||||
|
@ -131,16 +131,16 @@ class C4ObjectList
|
|||
|
||||
C4ID GetListID(int32_t dwCategory, int Index);
|
||||
|
||||
BOOL OrderObjectBefore(C4Object *pObj1, C4Object *pObj2); // order pObj1 before pObj2
|
||||
BOOL OrderObjectAfter(C4Object *pObj1, C4Object *pObj2); // order pObj1 after pObj2
|
||||
bool OrderObjectBefore(C4Object *pObj1, C4Object *pObj2); // order pObj1 before pObj2
|
||||
bool OrderObjectAfter(C4Object *pObj1, C4Object *pObj2); // order pObj1 after pObj2
|
||||
|
||||
BOOL ShiftContents(C4Object *pNewFirst); // cycle list so pNewFirst is at front
|
||||
bool ShiftContents(C4Object *pNewFirst); // cycle list so pNewFirst is at front
|
||||
|
||||
void DeleteObjects(); // delete all objects and links
|
||||
|
||||
void UpdateScriptPointers(); // update pointers to C4AulScript *
|
||||
|
||||
BOOL CheckSort(C4ObjectList *pList); // check that all objects of this list appear in the other list in the same order
|
||||
bool CheckSort(C4ObjectList *pList); // check that all objects of this list appear in the other list in the same order
|
||||
void CheckCategorySort(); // assertwhether sorting by category is done right
|
||||
|
||||
protected:
|
||||
|
|
|
@ -128,7 +128,7 @@ C4Object* C4ObjectMenu::GetParentObject()
|
|||
void C4ObjectMenu::SetRefillObject(C4Object *pObj)
|
||||
{
|
||||
RefillObject=pObj;
|
||||
NeedRefill=TRUE;
|
||||
NeedRefill=true;
|
||||
Refill();
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// Refill target
|
||||
if (!(pTarget=RefillObject)) return false;
|
||||
// Add base owner's homebase material
|
||||
if (!(pPlayer = ::Players.Get(pTarget->Base))) return FALSE;
|
||||
if (!(pPlayer = ::Players.Get(pTarget->Base))) return false;
|
||||
C4Player *pBuyPlayer = Object ? ::Players.Get(Object->Owner) : NULL;
|
||||
C4ID idDef;
|
||||
for (cnt=0; idDef=pPlayer->HomeBaseMaterial.GetID(::Definitions,C4D_All,cnt,&iCount); cnt++)
|
||||
|
@ -331,7 +331,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Right, C4FCT_Top);
|
||||
Object->Contents.GetObject(0)->DrawPicture(fctTarget);
|
||||
fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom);
|
||||
::GraphicsResource.fctHand.Draw(fctTarget, TRUE, 0);
|
||||
::GraphicsResource.fctHand.Draw(fctTarget, true, 0);
|
||||
// Add menu item
|
||||
Add(LoadResStr("IDS_CON_PUT2"), fctSymbol, szCommand, C4MN_Item_NoCount, NULL, NULL, C4ID_None, szCommand2);
|
||||
// Preserve symbol
|
||||
|
@ -382,7 +382,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
if (pTarget->OCF & OCF_Construct && Object->r==0 && (Game.Rules & C4RULE_ConstructionNeedsMaterial))
|
||||
{
|
||||
sprintf(szCommand, "PlayerMessage(GetOwner(), Object(%d)->GetNeededMatStr(), Object(%d))", pTarget->Number, pTarget->Number);
|
||||
fctSymbol.Create(16,16); GfxR->fctConstruction.Draw(fctSymbol,TRUE);
|
||||
fctSymbol.Create(16,16); GfxR->fctConstruction.Draw(fctSymbol,true);
|
||||
Add(LoadResStr("IDS_CON_BUILDINFO"),fctSymbol,szCommand);
|
||||
fctSymbol.Default();
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom);
|
||||
pTarget->DrawPicture(fctTarget);
|
||||
C4Facet fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Right, C4FCT_Top);
|
||||
GfxR->fctOKCancel.Draw(fctTarget, TRUE, 0, 1);
|
||||
GfxR->fctOKCancel.Draw(fctTarget, true, 0, 1);
|
||||
// Command
|
||||
sprintf(szCommand,"ShowInfo(Object(%d))",pTarget->Number);
|
||||
// Add item
|
||||
|
@ -433,7 +433,7 @@ void C4ObjectMenu::Execute()
|
|||
// Immediate refill check by RefillObject contents count check
|
||||
if (RefillObject)
|
||||
if (RefillObject->Contents.ObjectCount()!=RefillObjectContentsCount)
|
||||
{ NeedRefill=TRUE; RefillObjectContentsCount=RefillObject->Contents.ObjectCount(); }
|
||||
{ NeedRefill=true; RefillObjectContentsCount=RefillObject->Contents.ObjectCount(); }
|
||||
// inherited
|
||||
C4Menu::Execute();
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand,"ProtectedCall(Object(%d),\"%s\",this,Object(%d))",cObj->Number,pFunction->Name,pTarget->Number);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, FALSE, 0, NULL, pFunction->iImagePhase);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, false, 0, NULL, pFunction->iImagePhase);
|
||||
Add(pFunction->DescText.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,NULL,pFunction->DescLong.getData());
|
||||
iResult++;
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand,"ProtectedCall(Object(%d),\"%s\",Object(%d),%d,Object(%d),%s)",pEff->pCommandTarget->Number,pFunction->Name,pTarget->Number,(int)pEff->iNumber,Object->Number,C4IdText(pFunction->idImage));
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, FALSE, 0, NULL, pFunction->iImagePhase);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, false, 0, NULL, pFunction->iImagePhase);
|
||||
Add(pFunction->DescText.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,NULL,pFunction->DescLong.getData());
|
||||
fctSymbol.Default();
|
||||
iResult++;
|
||||
|
@ -568,7 +568,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand,"ProtectedCall(Object(%d),\"%s\",this,Object(%d))",cObj->Number,pFunction->Name,pTarget->Number);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, FALSE, 0, NULL, pFunction->iImagePhase);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, false, 0, NULL, pFunction->iImagePhase);
|
||||
Add(pFunction->DescText.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,NULL,pFunction->DescLong.getData());
|
||||
fctSymbol.Default();
|
||||
iResult++;
|
||||
|
@ -607,7 +607,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
sprintf(szCommand,"ProtectedCall(Object(%d),\"%s\",this)",pTarget->Number,pFunction->Name);
|
||||
// Symbol
|
||||
fctSymbol.Create(16,16);
|
||||
if (pDef = C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, FALSE, 0, NULL, pFunction->iImagePhase);
|
||||
if (pDef = C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, false, 0, NULL, pFunction->iImagePhase);
|
||||
else pTarget->DrawPicture(fctSymbol);
|
||||
// Add menu item
|
||||
Add(strDescText, fctSymbol, szCommand, C4MN_Item_NoCount, NULL, pFunction->DescLong.getData());
|
||||
|
@ -624,7 +624,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand,"ProtectedCall(Object(%d),\"%s\",this)",pTarget->Number,pFunction->Name);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, FALSE, 0, NULL, pFunction->iImagePhase);
|
||||
fctSymbol.Create(16,16); if (pDef=C4Id2Def(pFunction->idImage)) pDef->Draw(fctSymbol, false, 0, NULL, pFunction->iImagePhase);
|
||||
Add(pFunction->DescText.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,NULL,pFunction->DescLong.getData());
|
||||
fctSymbol.Default();
|
||||
iResult++;
|
||||
|
@ -653,7 +653,7 @@ int32_t C4ObjectMenu::AddContextFunctions(C4Object *pTarget, bool fCountOnly)
|
|||
if (!fCountOnly)
|
||||
{
|
||||
sprintf(szCommand, "SetCommand(this,\"Context\",0,0,0,this)&&ExecuteCommand()");
|
||||
fctSymbol.Create(16,16); Object->Def->Draw(fctSymbol, FALSE, Object->Color);
|
||||
fctSymbol.Create(16,16); Object->Def->Draw(fctSymbol, false, Object->Color);
|
||||
Add(Object->Def->GetName(), fctSymbol, szCommand, C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CONTEXTSUBCLONKDESC"));
|
||||
fctSymbol.Default();
|
||||
iResult++;
|
||||
|
|
|
@ -283,14 +283,14 @@ C4LSector *C4LArea::Next(C4LSector *pPrev) const
|
|||
return pOut;
|
||||
}
|
||||
|
||||
BOOL C4LArea::Contains(C4LSector *pSct) const
|
||||
bool C4LArea::Contains(C4LSector *pSct) const
|
||||
{
|
||||
assert(pSct);
|
||||
// no area
|
||||
if (!pFirst) return FALSE;
|
||||
if (!pFirst) return false;
|
||||
// outside?
|
||||
if (pSct == pOut) return TRUE;
|
||||
if (pFirst == pOut) return FALSE;
|
||||
if (pSct == pOut) return true;
|
||||
if (pFirst == pOut) return false;
|
||||
// check bounds
|
||||
return (pSct->x>=pFirst->x && pSct->y>=pFirst->y && pSct->x<=xL && pSct->y<=yL);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class C4LArea
|
|||
|
||||
// void MoveObject(C4Object *pObj, const C4LArea &toArea); // store object into new area
|
||||
|
||||
BOOL Contains(C4LSector *pSct) const; // return whether sector is contained in area
|
||||
bool Contains(C4LSector *pSct) const; // return whether sector is contained in area
|
||||
|
||||
inline C4ObjectList *FirstObjects(C4LSector **ppSct) // get first object list of this area
|
||||
{ *ppSct=NULL; return NextObjects(NULL, ppSct); }
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
#include <C4Landscape.h>
|
||||
#endif
|
||||
|
||||
BOOL C4Shape::AddVertex(int32_t iX, int32_t iY)
|
||||
bool C4Shape::AddVertex(int32_t iX, int32_t iY)
|
||||
{
|
||||
if (VtxNum>=C4D_MaxVertex) return FALSE;
|
||||
if (VtxNum>=C4D_MaxVertex) return false;
|
||||
VtxX[VtxNum]=iX; VtxY[VtxNum]=iY;
|
||||
VtxNum++;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Shape::Default()
|
||||
|
@ -179,12 +179,12 @@ void C4Shape::GetVertexOutline(C4Rect &rRect)
|
|||
}
|
||||
|
||||
|
||||
BOOL C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
|
||||
bool C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
|
||||
{
|
||||
// Adjust given position to one pixel before contact
|
||||
// at vertices matching CNAT request.
|
||||
|
||||
BOOL fAttached=FALSE;
|
||||
bool fAttached=false;
|
||||
|
||||
|
||||
int32_t vtx,xcnt,ycnt,xcrng,ycrng,xcd,ycd;
|
||||
|
@ -287,13 +287,13 @@ BOOL C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
|
|||
}
|
||||
|
||||
|
||||
BOOL C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy)
|
||||
bool C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy)
|
||||
{
|
||||
|
||||
if (VtxNum<2) return FALSE;
|
||||
if (VtxNum<2) return false;
|
||||
|
||||
// No modification
|
||||
if ((VtxX[cvtx]==tx) && (VtxY[cvtx]==ty)) return TRUE;
|
||||
if ((VtxX[cvtx]==tx) && (VtxY[cvtx]==ty)) return true;
|
||||
|
||||
// Check new path
|
||||
int32_t ix,iy;
|
||||
|
@ -301,7 +301,7 @@ BOOL C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int3
|
|||
{
|
||||
// Okay, set vertex
|
||||
VtxX[cvtx]=tx; VtxY[cvtx]=ty;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -328,67 +328,67 @@ BOOL C4Shape::LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int3
|
|||
ciy = oldy;
|
||||
if (!PathFreeIgnoreVehicle(cix,ciy,tx,ty) || !PathFreeIgnoreVehicle(cix,ciy,VtxX[cvtx+ld],VtxY[cvtx+ld]))
|
||||
if (!PathFreeIgnoreVehicle(cix,ciy,tx,ty) || !PathFreeIgnoreVehicle(cix,ciy,VtxX[cvtx+ld],VtxY[cvtx+ld]))
|
||||
return FALSE; // Found no bend vertex
|
||||
return false; // Found no bend vertex
|
||||
}
|
||||
// Insert bend vertex
|
||||
if (ld>0)
|
||||
{
|
||||
if (!InsertVertex(cvtx+1,cix,ciy)) return FALSE;
|
||||
if (!InsertVertex(cvtx+1,cix,ciy)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!InsertVertex(cvtx,cix,ciy)) return FALSE;
|
||||
if (!InsertVertex(cvtx,cix,ciy)) return false;
|
||||
cvtx++;
|
||||
}
|
||||
// Okay, set vertex
|
||||
VtxX[cvtx]=tx; VtxY[cvtx]=ty;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4Shape::InsertVertex(int32_t iPos, int32_t tx, int32_t ty)
|
||||
bool C4Shape::InsertVertex(int32_t iPos, int32_t tx, int32_t ty)
|
||||
{
|
||||
if (VtxNum+1>C4D_MaxVertex) return FALSE;
|
||||
if (VtxNum+1>C4D_MaxVertex) return false;
|
||||
// Insert vertex before iPos
|
||||
for (int32_t cnt=VtxNum; cnt>iPos; cnt--)
|
||||
{ VtxX[cnt]=VtxX[cnt-1]; VtxY[cnt]=VtxY[cnt-1]; }
|
||||
VtxX[iPos]=tx; VtxY[iPos]=ty;
|
||||
VtxNum++;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Shape::RemoveVertex(int32_t iPos)
|
||||
bool C4Shape::RemoveVertex(int32_t iPos)
|
||||
{
|
||||
if (!Inside<int32_t>(iPos,0,VtxNum-1)) return FALSE;
|
||||
if (!Inside<int32_t>(iPos,0,VtxNum-1)) return false;
|
||||
for (int32_t cnt=iPos; cnt+1<VtxNum; cnt++)
|
||||
{ VtxX[cnt]=VtxX[cnt+1]; VtxY[cnt]=VtxY[cnt+1]; }
|
||||
VtxNum--;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Shape::CheckContact(int32_t cx, int32_t cy)
|
||||
bool C4Shape::CheckContact(int32_t cx, int32_t cy)
|
||||
{
|
||||
// Check all vertices at given object position.
|
||||
// Return TRUE on any contact.
|
||||
// Return true on any contact.
|
||||
|
||||
|
||||
for (int32_t cvtx=0; cvtx<VtxNum; cvtx++)
|
||||
if (!(VtxCNAT[cvtx] & CNAT_NoCollision))
|
||||
if (GBackDensity(cx+VtxX[cvtx],cy+VtxY[cvtx]) >= ContactDensity)
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4Shape::ContactCheck(int32_t cx, int32_t cy)
|
||||
bool C4Shape::ContactCheck(int32_t cx, int32_t cy)
|
||||
{
|
||||
// Check all vertices at given object position.
|
||||
// Set ContactCNAT and ContactCount.
|
||||
// Set VtxContactCNAT and VtxContactMat.
|
||||
// Return TRUE on any contact.
|
||||
// Return true on any contact.
|
||||
|
||||
|
||||
ContactCNAT=CNAT_None;
|
||||
|
|
|
@ -70,13 +70,13 @@ class C4Shape: public C4Rect
|
|||
int32_t GetVertexX(int32_t iVertex);
|
||||
int32_t GetX() { return x; }
|
||||
int32_t GetY() { return y; }
|
||||
BOOL AddVertex(int32_t iX, int32_t iY);
|
||||
BOOL CheckContact(int32_t cx, int32_t cy);
|
||||
BOOL ContactCheck(int32_t cx, int32_t cy);
|
||||
BOOL Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos);
|
||||
BOOL LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy);
|
||||
BOOL InsertVertex(int32_t iPos, int32_t tx, int32_t ty);
|
||||
BOOL RemoveVertex(int32_t iPos);
|
||||
bool AddVertex(int32_t iX, int32_t iY);
|
||||
bool CheckContact(int32_t cx, int32_t cy);
|
||||
bool ContactCheck(int32_t cx, int32_t cy);
|
||||
bool Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos);
|
||||
bool LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy);
|
||||
bool InsertVertex(int32_t iPos, int32_t tx, int32_t ty);
|
||||
bool RemoveVertex(int32_t iPos);
|
||||
void CopyFrom(C4Shape rFrom, bool bCpyVertices, bool fCopyVerticesFromSelf);
|
||||
int32_t GetBottomVertex();
|
||||
int32_t GetVertexContact(int32_t iVtx, DWORD dwCheckMask, int32_t tx, int32_t ty, const C4DensityProvider &rDensityProvider = DefaultDensityProvider); // get CNAT-mask for given vertex - does not check range for iVtx!
|
||||
|
|
|
@ -63,13 +63,13 @@ C4Player::~C4Player()
|
|||
Clear();
|
||||
}
|
||||
|
||||
BOOL C4Player::ObjectInCrew(C4Object *tobj)
|
||||
bool C4Player::ObjectInCrew(C4Object *tobj)
|
||||
{
|
||||
C4Object *cobj; C4ObjectLink *clnk;
|
||||
if (!tobj) return FALSE;
|
||||
if (!tobj) return false;
|
||||
for (clnk=Crew.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
|
||||
if (cobj==tobj) return TRUE;
|
||||
return FALSE;
|
||||
if (cobj==tobj) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Player::ClearPointers(C4Object *pObj, bool fDeath)
|
||||
|
@ -81,7 +81,7 @@ void C4Player::ClearPointers(C4Object *pObj, bool fDeath)
|
|||
// Cursor
|
||||
if (Cursor==pObj)
|
||||
{
|
||||
// object is to be deleted; do NOT do script calls (like in Cursor->UnSelect(TRUE))
|
||||
// object is to be deleted; do NOT do script calls (like in Cursor->UnSelect(true))
|
||||
Cursor=NULL; AdjustCursorCommand(); // also selects and eventually does a script call!
|
||||
}
|
||||
// View-Cursor
|
||||
|
@ -164,7 +164,7 @@ bool C4Player::ScenarioAndTeamInit(int32_t idTeam)
|
|||
if (pPrevTeam) pPrevTeam->RemovePlayerByID(pInfo->GetID());
|
||||
if (pTeam) pTeam->AddPlayer(*pInfo, true);
|
||||
if (!ScenarioInit()) return false;
|
||||
if (!FinalInit(FALSE)) return false;
|
||||
if (!FinalInit(false)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -260,15 +260,15 @@ void C4Player::Execute()
|
|||
if (SelectFlash>0) SelectFlash--;
|
||||
}
|
||||
|
||||
BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName,
|
||||
const char *szFilename, BOOL fScenarioInit, class C4PlayerInfo *pInfo)
|
||||
bool C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName,
|
||||
const char *szFilename, bool fScenarioInit, class C4PlayerInfo *pInfo)
|
||||
{
|
||||
// safety
|
||||
if (!pInfo)
|
||||
{
|
||||
LogF("ERROR: Init player %s failed: No info!", szFilename);
|
||||
assert(false);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Status init
|
||||
Status=PS_Normal;
|
||||
|
@ -291,7 +291,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
// this will prevent portraits from being shown for "remotely controlled"-Clonks of other players
|
||||
bool fLoadPortraits = (AtClient==C4ClientIDUnknown) || SEqualNoCase(AtClientName, Game.Clients.getLocalName());
|
||||
// fLoadPortraits = true
|
||||
if (!Load(Filename, !fScenarioInit, fLoadPortraits)) return FALSE;
|
||||
if (!Load(Filename, !fScenarioInit, fLoadPortraits)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -364,7 +364,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
// 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)));
|
||||
// direct init
|
||||
if (Status != PS_TeamSelection) if (!ScenarioInit()) return FALSE;
|
||||
if (Status != PS_TeamSelection) if (!ScenarioInit()) return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
Team = pInfo->GetTeam();
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// Reset values default-overriden by old runtime data load (safety?)
|
||||
if (Number==C4P_Number_None) Number=iNumber;
|
||||
|
@ -417,14 +417,14 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
// init graphs
|
||||
if (Game.pNetworkStatistics) CreateGraphs();
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::Save()
|
||||
bool C4Player::Save()
|
||||
{
|
||||
C4Group hGroup;
|
||||
// Regular player saving need not be done for script players
|
||||
if (GetType() == C4PT_Script) return FALSE;
|
||||
if (GetType() == C4PT_Script) return false;
|
||||
// Log
|
||||
LogF(LoadResStr("IDS_PRC_SAVEPLR"), Config.AtRelativePath(Filename));
|
||||
::GraphicsSystem.MessageBoard.EnsureLastMessage();
|
||||
|
@ -435,13 +435,13 @@ BOOL C4Player::Save()
|
|||
// so full hard (flgr stupid) disks won't corrupt any player files...
|
||||
C4Group_CopyItem(Filename, szPath);
|
||||
// Open group
|
||||
if (!hGroup.Open(szPath,TRUE))
|
||||
return FALSE;
|
||||
if (!hGroup.Open(szPath,true))
|
||||
return false;
|
||||
// Save
|
||||
if (!Save(hGroup, false, !LocalControl))
|
||||
{ hGroup.Close(); return FALSE; }
|
||||
{ hGroup.Close(); return false; }
|
||||
// Close group
|
||||
if (!hGroup.Close()) return FALSE;
|
||||
if (!hGroup.Close()) return false;
|
||||
// resource
|
||||
C4Network2Res::Ref pRes = ::Network.ResList.getRefRes(Filename),
|
||||
pDRes = NULL;
|
||||
|
@ -449,27 +449,27 @@ BOOL C4Player::Save()
|
|||
if(pRes) pDRes = pRes->Derive();
|
||||
// move back
|
||||
if (ItemExists(Filename)) EraseItem(Filename);
|
||||
if (!C4Group_MoveItem(szPath, Filename)) return FALSE;
|
||||
if (!C4Group_MoveItem(szPath, Filename)) return false;
|
||||
// finish update
|
||||
if(pDRes && fOfficial) pDRes->FinishDerive();
|
||||
// Add to reload list
|
||||
if (LocalControl) SAddModule(Config.Explorer.Reload,Filename);
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny)
|
||||
bool C4Player::Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny)
|
||||
{
|
||||
// Save core
|
||||
if (!C4PlayerInfoCore::Save(hGroup))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Save crew
|
||||
C4DefList *pDefs = &::Definitions;
|
||||
if (!CrewInfoList.Save(hGroup, fSavegame, fStoreTiny, pDefs))
|
||||
{ hGroup.Close(); return FALSE; }
|
||||
{ hGroup.Close(); return false; }
|
||||
// Sort
|
||||
hGroup.Sort(C4FLS_Player);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::PlaceReadyCrew(int32_t tx1, int32_t tx2, int32_t ty, C4Object *FirstBase)
|
||||
|
@ -567,10 +567,10 @@ void C4Player::PlaceReadyCrew(int32_t tx1, int32_t tx2, int32_t ty, C4Object *Fi
|
|||
|
||||
C4Object *CreateLine(C4ID linetype, int32_t owner, C4Object *fobj, C4Object *tobj);
|
||||
|
||||
BOOL CreatePowerConnection(C4Object *fbase, C4Object *tbase)
|
||||
bool CreatePowerConnection(C4Object *fbase, C4Object *tbase)
|
||||
{
|
||||
if (CreateLine(C4ID_PowerLine,fbase->Owner,fbase,tbase)) return TRUE;
|
||||
return FALSE;
|
||||
if (CreateLine(C4ID_PowerLine,fbase->Owner,fbase,tbase)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void C4Player::PlaceReadyBase(int32_t &tx, int32_t &ty, C4Object **pFirstBase)
|
||||
|
@ -588,7 +588,7 @@ void C4Player::PlaceReadyBase(int32_t &tx, int32_t &ty, C4Object **pFirstBase)
|
|||
ctx=tx; cty=ty;
|
||||
if (Game.C4S.PlrStart[PlrStartIndex].EnforcePosition
|
||||
|| FindConSiteSpot(ctx,cty,def->Shape.Wdt,def->Shape.Hgt,def->Category,20))
|
||||
if (cbase=Game.CreateObjectConstruction(C4Id2Def(cid),NULL,Number,ctx,cty,FullCon,TRUE))
|
||||
if (cbase=Game.CreateObjectConstruction(C4Id2Def(cid),NULL,Number,ctx,cty,FullCon,true))
|
||||
{
|
||||
// FirstBase
|
||||
if (!(*pFirstBase)) if (cbase->Def->CanBeBase)
|
||||
|
@ -664,7 +664,7 @@ DWORD RandomPlayerColor() // generate a random player color
|
|||
return RGB(Min(SafeRandom(302), 256), Min(SafeRandom(302), 256), Min(SafeRandom(302), 256));
|
||||
}
|
||||
|
||||
BOOL C4Player::ScenarioInit()
|
||||
bool C4Player::ScenarioInit()
|
||||
{
|
||||
int32_t ptx,pty;
|
||||
|
||||
|
@ -680,7 +680,7 @@ BOOL C4Player::ScenarioInit()
|
|||
Color=iColor;
|
||||
|
||||
C4PlayerInfo *pInfo = GetInfo();
|
||||
if (!pInfo) { assert(false); LogF("Internal error: ScenarioInit for ghost player %s!", GetName()); return FALSE; }
|
||||
if (!pInfo) { assert(false); LogF("Internal error: ScenarioInit for ghost player %s!", GetName()); return false; }
|
||||
|
||||
// set color by player info class
|
||||
// re-setting, because runtime team choice may have altered color
|
||||
|
@ -751,7 +751,7 @@ BOOL C4Player::ScenarioInit()
|
|||
|
||||
if (fFogOfWar && !fFogOfWarInitialized)
|
||||
{
|
||||
fFogOfWarInitialized = TRUE;
|
||||
fFogOfWarInitialized = true;
|
||||
// reset view objects
|
||||
::Objects.AssignPlrViewRange();
|
||||
}
|
||||
|
@ -763,12 +763,12 @@ BOOL C4Player::ScenarioInit()
|
|||
C4VObj(FirstBase),
|
||||
C4VInt(Team),
|
||||
C4VID(GetInfo()->GetScriptPlayerExtraID())));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::FinalInit(BOOL fInitialValue)
|
||||
bool C4Player::FinalInit(bool fInitialValue)
|
||||
{
|
||||
if (!Status) return TRUE;
|
||||
if (!Status) return true;
|
||||
|
||||
// Init player's mouse control
|
||||
if (LocalControl)
|
||||
|
@ -793,12 +793,12 @@ BOOL C4Player::FinalInit(BOOL fInitialValue)
|
|||
// Restore FoW after savegame
|
||||
if (fFogOfWar && !fFogOfWarInitialized)
|
||||
{
|
||||
fFogOfWarInitialized = TRUE;
|
||||
fFogOfWarInitialized = true;
|
||||
// reset view objects
|
||||
::Objects.AssignPlrViewRange();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::SetFoW(bool fEnable)
|
||||
|
@ -811,55 +811,55 @@ void C4Player::SetFoW(bool fEnable)
|
|||
}
|
||||
|
||||
|
||||
C4Object *C4Player::Buy(C4ID id, BOOL fShowErrors, int32_t iForPlr, C4Object *pBuyObj)
|
||||
C4Object *C4Player::Buy(C4ID id, bool fShowErrors, int32_t iForPlr, C4Object *pBuyObj)
|
||||
{
|
||||
int32_t iAvailable; C4Def *pDef; C4Object *pThing;
|
||||
// Base owner eliminated
|
||||
if (Eliminated)
|
||||
{
|
||||
if (!fShowErrors) return FALSE;
|
||||
if (!fShowErrors) return false;
|
||||
StartSoundEffect("Error",false,100,pBuyObj);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_ELIMINATED"),GetName()).getData(),Number); return FALSE;
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_ELIMINATED"),GetName()).getData(),Number); return false;
|
||||
}
|
||||
// Get def (base owner's homebase material)
|
||||
iAvailable = HomeBaseMaterial.GetIDCount(id);
|
||||
if (!(pDef=C4Id2Def(id))) return FALSE;
|
||||
if (!(pDef=C4Id2Def(id))) return false;
|
||||
// Object not available
|
||||
if (iAvailable<=0) return FALSE;
|
||||
if (iAvailable<=0) return false;
|
||||
// get value
|
||||
int32_t iValue = pDef->GetValue(pBuyObj, Number);
|
||||
// Not enough wealth (base owner's wealth)
|
||||
if (iValue>Wealth)
|
||||
{
|
||||
if (!fShowErrors) return FALSE;
|
||||
if (!fShowErrors) return false;
|
||||
GameMsgPlayer(LoadResStr("IDS_PLR_NOWEALTH"),Number);
|
||||
StartSoundEffect("Error",false,100,pBuyObj); return FALSE;
|
||||
StartSoundEffect("Error",false,100,pBuyObj); return false;
|
||||
}
|
||||
// Decrease homebase material count
|
||||
if (!HomeBaseMaterial.DecreaseIDCount(id,FALSE)) return FALSE;
|
||||
if (!HomeBaseMaterial.DecreaseIDCount(id,false)) return false;
|
||||
// Reduce wealth
|
||||
DoWealth(-iValue);
|
||||
// Create object (for player)
|
||||
if (!(pThing=Game.CreateObject(id,pBuyObj,iForPlr))) return FALSE;
|
||||
if (!(pThing=Game.CreateObject(id,pBuyObj,iForPlr))) return false;
|
||||
// Make crew member
|
||||
if (pDef->CrewMember) if (ValidPlr(iForPlr))
|
||||
::Players.Get(iForPlr)->MakeCrewMember(pThing);
|
||||
// success
|
||||
C4AulParSet parset (C4VInt(Number), C4VObj(pBuyObj));
|
||||
pThing->Call(PSF_Purchase, &parset);
|
||||
if (!pThing->Status) return FALSE;
|
||||
if (!pThing->Status) return false;
|
||||
return pThing;
|
||||
}
|
||||
|
||||
|
||||
BOOL C4Player::Sell2Home(C4Object *pObj)
|
||||
bool C4Player::Sell2Home(C4Object *pObj)
|
||||
{
|
||||
C4Object *cObj;
|
||||
// Valid checks
|
||||
if (!pObj || !pObj->Status) return FALSE;
|
||||
if (Eliminated) return FALSE;
|
||||
if (!pObj || !pObj->Status) return false;
|
||||
if (Eliminated) return false;
|
||||
// No crew members
|
||||
if (pObj->OCF & OCF_CrewMember) return FALSE;
|
||||
if (pObj->OCF & OCF_CrewMember) return false;
|
||||
// Sell contents first
|
||||
while (cObj=pObj->Contents.GetObject())
|
||||
{
|
||||
|
@ -881,12 +881,12 @@ BOOL C4Player::Sell2Home(C4Object *pObj)
|
|||
// Remove object, eject any crew members
|
||||
if (pObj->Contained) pObj->Exit();
|
||||
pObj->Call(PSF_Sale, &C4AulParSet(C4VInt(Number)));
|
||||
pObj->AssignRemoval(TRUE);
|
||||
pObj->AssignRemoval(true);
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::DoWealth(int32_t iChange)
|
||||
bool C4Player::DoWealth(int32_t iChange)
|
||||
{
|
||||
Wealth=BoundBy<int32_t>(Wealth+iChange,0,10000);
|
||||
if (LocalControl)
|
||||
|
@ -895,7 +895,7 @@ BOOL C4Player::DoWealth(int32_t iChange)
|
|||
if (iChange<0) StartSoundEffect("UnCash");
|
||||
}
|
||||
ViewWealth = C4ViewDelay;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::SetViewMode(int32_t iMode, C4Object *pTarget)
|
||||
|
@ -955,27 +955,27 @@ void C4Player::Evaluate()
|
|||
void C4Player::Surrender()
|
||||
{
|
||||
if (Surrendered) return;
|
||||
Surrendered=TRUE;
|
||||
Eliminated=TRUE;
|
||||
Surrendered=true;
|
||||
Eliminated=true;
|
||||
RetireDelay=C4RetireDelay;
|
||||
StartSoundEffect("Eliminated");
|
||||
Log(FormatString(LoadResStr("IDS_PRC_PLRSURRENDERED"),GetName()).getData());
|
||||
}
|
||||
|
||||
BOOL C4Player::SetHostility(int32_t iOpponent, int32_t iHostility, BOOL fSilent)
|
||||
bool C4Player::SetHostility(int32_t iOpponent, int32_t iHostility, bool fSilent)
|
||||
{
|
||||
// Check opponent valid
|
||||
if (!ValidPlr(iOpponent) || (iOpponent==Number)) return FALSE;
|
||||
if (!ValidPlr(iOpponent) || (iOpponent==Number)) return false;
|
||||
// Set hostility
|
||||
Hostility.SetIDCount(iOpponent+1,iHostility,TRUE);
|
||||
Hostility.SetIDCount(iOpponent+1,iHostility,true);
|
||||
// no announce in first frame, or if specified
|
||||
if (!Game.FrameCounter || fSilent) return TRUE;
|
||||
if (!Game.FrameCounter || fSilent) return true;
|
||||
// Announce
|
||||
StartSoundEffect("Trumpet");
|
||||
Log(FormatString(LoadResStr(iHostility ? "IDS_PLR_HOSTILITY" : "IDS_PLR_NOHOSTILITY"),
|
||||
GetName(),::Players.Get(iOpponent)->GetName()).getData());
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Object* C4Player::GetHiExpActiveCrew(bool fSelectOnly)
|
||||
|
@ -1023,7 +1023,7 @@ void C4Player::CheckCrewExPromotion()
|
|||
if (hirank->Info)
|
||||
if (hirank->Info->Rank<1) // No Fähnrich -> except. promo.
|
||||
if (hirank=GetHiExpActiveCrew(false))
|
||||
hirank->Promote(1,TRUE,false);
|
||||
hirank->Promote(1,true,false);
|
||||
}
|
||||
|
||||
void C4Player::SetTeamHostility()
|
||||
|
@ -1040,12 +1040,12 @@ void C4Player::SetTeamHostility()
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Player::Message(const char *szMsg)
|
||||
bool C4Player::Message(const char *szMsg)
|
||||
{
|
||||
if (!szMsg) return FALSE;
|
||||
if (!szMsg) return false;
|
||||
SCopy(szMsg,MessageBuf,256);
|
||||
MessageStatus=SLen(szMsg)*2;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::Clear()
|
||||
|
@ -1080,12 +1080,12 @@ void C4Player::Default()
|
|||
Menu.Default();
|
||||
Crew.Default();
|
||||
CrewInfoList.Default();
|
||||
LocalControl=FALSE;
|
||||
LocalControl=false;
|
||||
BigIcon.Default();
|
||||
Next=NULL;
|
||||
fFogOfWar=TRUE; fFogOfWarInitialized=false;
|
||||
fFogOfWar=true; fFogOfWarInitialized=false;
|
||||
FoWViewObjs.Default();
|
||||
LeagueEvaluated=FALSE;
|
||||
LeagueEvaluated=false;
|
||||
GameJoinTime=0; // overwritten in Init
|
||||
pstatControls = pstatActions = NULL;
|
||||
ControlCount = ActionCount = 0;
|
||||
|
@ -1098,14 +1098,14 @@ void C4Player::Default()
|
|||
Evaluated = false;
|
||||
}
|
||||
|
||||
BOOL C4Player::Load(const char *szFilename, bool fSavegame, bool fLoadPortraits)
|
||||
bool C4Player::Load(const char *szFilename, bool fSavegame, bool fLoadPortraits)
|
||||
{
|
||||
C4Group hGroup;
|
||||
// Open group
|
||||
if (!hGroup.Open(szFilename)) return FALSE;
|
||||
if (!hGroup.Open(szFilename)) return false;
|
||||
// Load core
|
||||
if (!C4PlayerInfoCore::Load(hGroup))
|
||||
{ hGroup.Close(); return FALSE; }
|
||||
{ hGroup.Close(); return false; }
|
||||
// Load BigIcon
|
||||
if (hGroup.FindEntry(C4CFN_BigIcon)) BigIcon.Load(hGroup, C4CFN_BigIcon);
|
||||
// Load crew info list
|
||||
|
@ -1113,15 +1113,15 @@ BOOL C4Player::Load(const char *szFilename, bool fSavegame, bool fLoadPortraits)
|
|||
// Close group
|
||||
hGroup.Close();
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::Strip(const char *szFilename, bool fAggressive)
|
||||
bool C4Player::Strip(const char *szFilename, bool fAggressive)
|
||||
{
|
||||
// Opem group
|
||||
C4Group Grp;
|
||||
if(!Grp.Open(szFilename))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Which type of stripping?
|
||||
if(!fAggressive)
|
||||
{
|
||||
|
@ -1140,20 +1140,20 @@ BOOL C4Player::Strip(const char *szFilename, bool fAggressive)
|
|||
C4PlayerInfoCore PlrInfoCore;
|
||||
C4ObjectInfoList CrewInfoList;
|
||||
if(!PlrInfoCore.Load(Grp) || !CrewInfoList.Load(Grp, false))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Strip crew info list (remove object infos that are invalid for this scenario)
|
||||
CrewInfoList.Strip(::Definitions);
|
||||
// Create a new group that receives the bare essentials
|
||||
Grp.Close();
|
||||
if(!EraseItem(szFilename) ||
|
||||
!Grp.Open(szFilename, TRUE))
|
||||
return FALSE;
|
||||
!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, &::Definitions))
|
||||
return FALSE;
|
||||
return false;
|
||||
Grp.Close();
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::DrawHostility(C4Facet &cgo, int32_t iIndex)
|
||||
|
@ -1166,7 +1166,7 @@ void C4Player::DrawHostility(C4Facet &cgo, int32_t iIndex)
|
|||
pPlr->BigIcon.Draw(cgo);
|
||||
// Standard player image
|
||||
else
|
||||
::GraphicsResource.fctCrewClr.DrawClr(cgo, TRUE, pPlr->ColorDw);
|
||||
::GraphicsResource.fctCrewClr.DrawClr(cgo, true, pPlr->ColorDw);
|
||||
// Other player and hostile
|
||||
if (pPlr != this)
|
||||
if (Hostility.GetIDCount(pPlr->Number+1))
|
||||
|
@ -1174,10 +1174,10 @@ void C4Player::DrawHostility(C4Facet &cgo, int32_t iIndex)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Player::MakeCrewMember(C4Object *pObj, bool fForceInfo, bool fDoCalls)
|
||||
bool C4Player::MakeCrewMember(C4Object *pObj, bool fForceInfo, bool fDoCalls)
|
||||
{
|
||||
C4ObjectInfo *cInf = NULL;
|
||||
if (!pObj || !pObj->Def->CrewMember || !pObj->Status) return FALSE;
|
||||
if (!pObj || !pObj->Def->CrewMember || !pObj->Status) return false;
|
||||
|
||||
// only if info is not yet assigned
|
||||
if (!pObj->Info && fForceInfo)
|
||||
|
@ -1190,7 +1190,7 @@ BOOL C4Player::MakeCrewMember(C4Object *pObj, bool fForceInfo, bool fDoCalls)
|
|||
if (!cInf)
|
||||
while (!( cInf = CrewInfoList.GetIdle(pObj->id,::Definitions) ))
|
||||
if (!CrewInfoList.New(pObj->id,&::Definitions))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
// Set object info
|
||||
pObj->Info = cInf;
|
||||
|
@ -1214,7 +1214,7 @@ BOOL C4Player::MakeCrewMember(C4Object *pObj, bool fForceInfo, bool fDoCalls)
|
|||
pObj->Call(PSF_OnJoinCrew, &parset);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::ExecuteControl()
|
||||
|
@ -1260,9 +1260,9 @@ void C4Player::AdjustCursorCommand()
|
|||
UpdateView();
|
||||
}
|
||||
// UnSelect previous cursor
|
||||
if (pPrev && pPrev != Cursor) pPrev->UnSelect(TRUE);
|
||||
if (pPrev && pPrev != Cursor) pPrev->UnSelect(true);
|
||||
// We have a cursor: do select it
|
||||
if (Cursor) { /*Cursor->DoSelect(TRUE);*/ Cursor->DoSelect(); } // Hmm, why DoSelect() twice? I hope the second one is the correct one...
|
||||
if (Cursor) { /*Cursor->DoSelect(true);*/ Cursor->DoSelect(); } // Hmm, why DoSelect() twice? I hope the second one is the correct one...
|
||||
// Updates
|
||||
CursorFlash=30;
|
||||
}
|
||||
|
@ -1328,10 +1328,10 @@ void C4Player::SelectSingleByCursor()
|
|||
void C4Player::SelectSingle(C4Object *tobj)
|
||||
{
|
||||
// clear previous cursor
|
||||
if (Cursor) Cursor->UnSelect(TRUE);
|
||||
if (Cursor) Cursor->UnSelect(true);
|
||||
// Set cursor
|
||||
Cursor=tobj;
|
||||
if (Cursor) Cursor->DoSelect(TRUE);
|
||||
if (Cursor) Cursor->DoSelect(true);
|
||||
// Now use PlayerSelectSingleByCursor
|
||||
SelectSingleByCursor();
|
||||
}
|
||||
|
@ -1385,15 +1385,15 @@ void C4Player::UpdateSelectionToggleStatus()
|
|||
CursorToggled=0;
|
||||
}
|
||||
|
||||
BOOL C4Player::ObjectCom(BYTE byCom, int32_t iData) // By DirectCom
|
||||
bool C4Player::ObjectCom(BYTE byCom, int32_t iData) // By DirectCom
|
||||
{
|
||||
if (Eliminated) return FALSE;
|
||||
if (Eliminated) return false;
|
||||
#ifdef DEBUGREC_OBJCOM
|
||||
C4RCObjectCom rc = { byCom, iData, Number };
|
||||
AddDbgRec(RCT_PlrCom, &rc, sizeof(C4RCObjectCom));
|
||||
#endif
|
||||
// Hide startup
|
||||
ShowStartup=FALSE;
|
||||
ShowStartup=false;
|
||||
// If regular com, update cursor & selection status
|
||||
if (!(byCom & COM_Single) && !(byCom & COM_Double) && (byCom < COM_ReleaseFirst || byCom > COM_ReleaseLast))
|
||||
UpdateSelectionToggleStatus();
|
||||
|
@ -1406,15 +1406,15 @@ BOOL C4Player::ObjectCom(BYTE byCom, int32_t iData) // By DirectCom
|
|||
Cursor->DirectCom(byCom,iData);
|
||||
}
|
||||
// Done
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4Player::ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode)
|
||||
bool C4Player::ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode)
|
||||
{
|
||||
// Eliminated
|
||||
if (Eliminated) return FALSE;
|
||||
if (Eliminated) return false;
|
||||
// Hide startup
|
||||
if (ShowStartup) ShowStartup=FALSE;
|
||||
if (ShowStartup) ShowStartup=false;
|
||||
// Update selection & toggle status
|
||||
UpdateSelectionToggleStatus();
|
||||
// Apply to all selected crew members (in cursor range) except pTarget.
|
||||
|
@ -1454,15 +1454,15 @@ BOOL C4Player::ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iX, in
|
|||
ObjectCommand2Obj(Cursor, iCommand, pTarget, iX, iY, pTarget2, iData, iMode);
|
||||
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::ObjectCommand2Obj(C4Object *cObj, int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode)
|
||||
{
|
||||
// forward to object
|
||||
if (iMode & C4P_Command_Append) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,TRUE,iData,TRUE,0,NULL,C4CMD_Mode_Base); // append: by Shift-click and for dragging of multiple objects (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Add) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,TRUE,iData,FALSE,0,NULL,C4CMD_Mode_Base); // append: by context menu and keyboard throw command (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Set) cObj->SetCommand(iCommand,pTarget,iX,iY,pTarget2,TRUE,iData);
|
||||
if (iMode & C4P_Command_Append) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,true,iData,true,0,NULL,C4CMD_Mode_Base); // append: by Shift-click and for dragging of multiple objects (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Add) cObj->AddCommand(iCommand,pTarget,iX,iY,0,pTarget2,true,iData,false,0,NULL,C4CMD_Mode_Base); // append: by context menu and keyboard throw command (all independant; thus C4CMD_Mode_Base)
|
||||
else if (iMode & C4P_Command_Set) cObj->SetCommand(iCommand,pTarget,iX,iY,pTarget2,true,iData);
|
||||
}
|
||||
|
||||
void C4Player::DirectCom(BYTE byCom, int32_t iData) // By InCom or ExecuteControl
|
||||
|
@ -1556,8 +1556,8 @@ void C4Player::CompileFunc(StdCompiler *pComp)
|
|||
bool bForceFogOfWar = false;
|
||||
pComp->Value(mkNamingAdapt(bForceFogOfWar, "ForceFogOfWar", false));
|
||||
pComp->Value(mkNamingAdapt(ShowStartup, "ShowStartup", false));
|
||||
pComp->Value(mkNamingAdapt(ShowControl, "ShowControl", FALSE));
|
||||
pComp->Value(mkNamingAdapt(ShowControlPos, "ShowControlPos", FALSE));
|
||||
pComp->Value(mkNamingAdapt(ShowControl, "ShowControl", false));
|
||||
pComp->Value(mkNamingAdapt(ShowControlPos, "ShowControlPos", false));
|
||||
pComp->Value(mkNamingAdapt(Wealth, "Wealth", 0));
|
||||
pComp->Value(mkNamingAdapt(Points, "Points", 0));
|
||||
pComp->Value(mkNamingAdapt(Value, "Value", 0));
|
||||
|
@ -1590,24 +1590,24 @@ void C4Player::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingPtrAdapt( pMsgBoardQuery, "MsgBoardQueries" ));
|
||||
}
|
||||
|
||||
BOOL C4Player::LoadRuntimeData(C4Group &hGroup)
|
||||
bool C4Player::LoadRuntimeData(C4Group &hGroup)
|
||||
{
|
||||
const char *pSource;
|
||||
// Use loaded game text component
|
||||
if (!(pSource = Game.GameText.GetData())) return FALSE;
|
||||
if (!(pSource = Game.GameText.GetData())) return false;
|
||||
// safety: Do nothing if playeer section is not even present (could kill initialized values)
|
||||
if (!SSearch(pSource, FormatString("[Player%i]", ID).getData())) return FALSE;
|
||||
if (!SSearch(pSource, FormatString("[Player%i]", ID).getData())) return false;
|
||||
// Compile (Search player section - runtime data is stored by unique player ID)
|
||||
assert(ID);
|
||||
if(!CompileFromBuf_LogWarn<StdCompilerINIRead>(
|
||||
mkNamingAdapt(*this, FormatString("Player%i", ID).getData()),
|
||||
StdStrBuf(pSource),
|
||||
Game.GameText.GetFilePath()))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Denumerate pointers
|
||||
DenumeratePointers();
|
||||
// Success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::ExecHomeBaseProduction()
|
||||
|
@ -1683,7 +1683,7 @@ void C4Player::DefaultRuntimeData()
|
|||
SCopy("Local",AtClientName);
|
||||
Color=-1;
|
||||
Control=C4P_Control_None;
|
||||
MouseControl=FALSE;
|
||||
MouseControl=false;
|
||||
Position=-1;
|
||||
PlrStartIndex=0;
|
||||
RetireDelay=0;
|
||||
|
@ -1691,7 +1691,7 @@ void C4Player::DefaultRuntimeData()
|
|||
ViewX=ViewY=0;
|
||||
ViewTarget=NULL;
|
||||
CursorSelection=CursorToggled=0;
|
||||
ShowStartup=TRUE;
|
||||
ShowStartup=true;
|
||||
CrewCnt=0;
|
||||
ViewWealth=ViewValue=0;
|
||||
ShowControl=ShowControlPos=0;
|
||||
|
@ -1791,11 +1791,11 @@ void C4Player::NotifyOwnedObjects()
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Player::DoPoints(int32_t iChange)
|
||||
bool C4Player::DoPoints(int32_t iChange)
|
||||
{
|
||||
Points = BoundBy<int32_t>( Points+iChange, -100000, 100000 );
|
||||
ViewValue = C4ViewDelay;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::SetCursor(C4Object *pObj, bool fSelectFlash, bool fSelectArrow)
|
||||
|
@ -1807,9 +1807,9 @@ void C4Player::SetCursor(C4Object *pObj, bool fSelectFlash, bool fSelectArrow)
|
|||
// Set cursor
|
||||
Cursor=pObj;
|
||||
// unselect previous
|
||||
if (pPrev && fChanged) pPrev->UnSelect(TRUE);
|
||||
if (pPrev && fChanged) pPrev->UnSelect(true);
|
||||
// Select object
|
||||
if (Cursor) { Cursor->DoSelect(TRUE); /*Cursor->DoSelect();*/ } // Sven2: why the second DoSelect()? - it breaks cursor-toggle-selection
|
||||
if (Cursor) { Cursor->DoSelect(true); /*Cursor->DoSelect();*/ } // Sven2: why the second DoSelect()? - it breaks cursor-toggle-selection
|
||||
// View flash
|
||||
if (fSelectArrow) CursorFlash=30;
|
||||
if (fSelectFlash) SelectFlash=30;
|
||||
|
@ -1841,10 +1841,10 @@ void C4Player::ScrollView(int32_t iX, int32_t iY, int32_t ViewWdt, int32_t ViewH
|
|||
void C4Player::InitControl()
|
||||
{
|
||||
// Check local control
|
||||
LocalControl = FALSE;
|
||||
LocalControl = false;
|
||||
if (AtClient == ::Control.ClientID())
|
||||
if (!GetInfo() || GetInfo()->GetType() == C4PT_User)
|
||||
LocalControl=TRUE;
|
||||
LocalControl=true;
|
||||
// Set control
|
||||
Control=C4P_Control_None;
|
||||
// Preferred control
|
||||
|
@ -1878,7 +1878,7 @@ void C4Player::InitControl()
|
|||
if (!Game.C4S.Head.DisableMouse)
|
||||
if (Inside<int32_t>(Control, C4P_Control_Keyboard1, C4P_Control_GamePadMax))
|
||||
if (!::Players.MouseControlTaken())
|
||||
MouseControl=TRUE;
|
||||
MouseControl=true;
|
||||
// no controls issued yet
|
||||
ControlCount = ActionCount = 0;
|
||||
LastControlType = PCID_None;
|
||||
|
@ -1981,7 +1981,7 @@ bool C4Player::FoWIsVisible(int32_t x, int32_t y)
|
|||
return fSeen;
|
||||
}
|
||||
|
||||
void C4Player::SelectCrew(C4Object *pObj, BOOL fSelect)
|
||||
void C4Player::SelectCrew(C4Object *pObj, bool fSelect)
|
||||
{
|
||||
// Not a valid crew member
|
||||
if (!pObj || !Crew.GetLink(pObj)) return;
|
||||
|
@ -2003,7 +2003,7 @@ void C4Player::CloseMenu()
|
|||
void C4Player::Eliminate()
|
||||
{
|
||||
if (Eliminated) return;
|
||||
Eliminated=TRUE;
|
||||
Eliminated=true;
|
||||
RetireDelay=C4RetireDelay;
|
||||
StartSoundEffect("Eliminated");
|
||||
Log(FormatString(LoadResStr("IDS_PRC_PLRELIMINATED"),GetName()).getData());
|
||||
|
@ -2053,7 +2053,7 @@ int32_t C4Player::GetSelectedCrewCount()
|
|||
void C4Player::EvaluateLeague(bool fDisconnected, bool fWon)
|
||||
{
|
||||
// already evaluated?
|
||||
if (LeagueEvaluated) return; LeagueEvaluated=TRUE;
|
||||
if (LeagueEvaluated) return; LeagueEvaluated=true;
|
||||
// set fate
|
||||
C4PlayerInfo *pInfo = GetInfo();
|
||||
if(pInfo)
|
||||
|
@ -2065,10 +2065,10 @@ void C4Player::EvaluateLeague(bool fDisconnected, bool fWon)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL C4Player::LocalSync()
|
||||
bool C4Player::LocalSync()
|
||||
{
|
||||
// local sync not necessary for script players
|
||||
if (GetType() == C4PT_Script) return TRUE;
|
||||
if (GetType() == C4PT_Script) return true;
|
||||
// evaluate total playing time
|
||||
TotalPlayingTime+=Game.Time-GameJoinTime;
|
||||
GameJoinTime = Game.Time;
|
||||
|
@ -2081,9 +2081,9 @@ BOOL C4Player::LocalSync()
|
|||
}
|
||||
// save player
|
||||
if (!Save())
|
||||
return FALSE;
|
||||
return false;
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4PlayerInfo *C4Player::GetInfo()
|
||||
|
@ -2091,19 +2091,19 @@ C4PlayerInfo *C4Player::GetInfo()
|
|||
return Game.PlayerInfos.GetPlayerInfoByID(ID);
|
||||
}
|
||||
|
||||
BOOL C4Player::SetObjectCrewStatus(C4Object *pCrew, BOOL fNewStatus)
|
||||
bool C4Player::SetObjectCrewStatus(C4Object *pCrew, bool fNewStatus)
|
||||
{
|
||||
// either add...
|
||||
if (fNewStatus)
|
||||
{
|
||||
// is in crew already?
|
||||
if (Crew.IsContained(pCrew)) return TRUE;
|
||||
if (Crew.IsContained(pCrew)) return true;
|
||||
return MakeCrewMember(pCrew, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// already outside?
|
||||
if (!Crew.IsContained(pCrew)) return TRUE;
|
||||
if (!Crew.IsContained(pCrew)) return true;
|
||||
// ...or remove
|
||||
Crew.Remove(pCrew);
|
||||
// remove info, if assigned to this player
|
||||
|
@ -2117,7 +2117,7 @@ BOOL C4Player::SetObjectCrewStatus(C4Object *pCrew, BOOL fNewStatus)
|
|||
}
|
||||
}
|
||||
// done, success
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Player::CreateGraphs()
|
||||
|
@ -2284,7 +2284,7 @@ void C4Player::ToggleMouseControl()
|
|||
if (!MouseControl && !::Players.MouseControlTaken())
|
||||
{
|
||||
::MouseControl.Init(Number);
|
||||
MouseControl=TRUE;
|
||||
MouseControl=true;
|
||||
}
|
||||
// Deactivate mouse control
|
||||
else if (MouseControl)
|
||||
|
|
|
@ -144,7 +144,7 @@ class C4Player: public C4PlayerInfoCore
|
|||
|
||||
public:
|
||||
void Eliminate();
|
||||
void SelectCrew(C4Object *pObj, BOOL fSelect);
|
||||
void SelectCrew(C4Object *pObj, bool fSelect);
|
||||
void Default();
|
||||
void Clear();
|
||||
void ClearPointers(C4Object *tptr, bool fDeath);
|
||||
|
@ -173,27 +173,27 @@ class C4Player: public C4PlayerInfoCore
|
|||
void UpdateSelectionToggleStatus();
|
||||
void DirectCom(BYTE byCom, int32_t iData);
|
||||
void InCom(BYTE byCom, int32_t iData);
|
||||
BOOL ObjectCom(BYTE byCom, int32_t iData);
|
||||
BOOL ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iTx, int32_t iTy, C4Object *pTarget2=NULL, C4Value iData=C4VNull, int32_t iAddMode=C4P_Command_Set);
|
||||
bool ObjectCom(BYTE byCom, int32_t iData);
|
||||
bool ObjectCommand(int32_t iCommand, C4Object *pTarget, int32_t iTx, int32_t iTy, C4Object *pTarget2=NULL, C4Value iData=C4VNull, int32_t iAddMode=C4P_Command_Set);
|
||||
void ObjectCommand2Obj(C4Object *cObj, int32_t iCommand, C4Object *pTarget, int32_t iX, int32_t iY, C4Object *pTarget2, C4Value iData, int32_t iMode);
|
||||
BOOL DoPoints(int32_t iChange);
|
||||
BOOL Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName, const char *szFilename, BOOL fScenarioInit, class C4PlayerInfo *pInfo);
|
||||
bool DoPoints(int32_t iChange);
|
||||
bool Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName, const char *szFilename, bool fScenarioInit, class C4PlayerInfo *pInfo);
|
||||
bool ScenarioAndTeamInit(int32_t idTeam);
|
||||
BOOL ScenarioInit();
|
||||
BOOL FinalInit(BOOL fInitialValue);
|
||||
BOOL Save();
|
||||
BOOL Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny);
|
||||
BOOL MakeCrewMember(C4Object *pObj, bool fForceInfo=true, bool fDoCalls=true);
|
||||
BOOL Load(const char *szFilename, bool fSavegame, bool fLoadPortraits);
|
||||
static BOOL Strip(const char *szFilename, bool fAggressive);
|
||||
BOOL Message(const char *szMsg);
|
||||
BOOL ObjectInCrew(C4Object *tobj);
|
||||
C4Object *Buy(C4ID id, BOOL fShowErrors, int32_t iForPlr, C4Object *pBuyObj=NULL); // buy object of player's wealth
|
||||
BOOL Sell2Home(C4Object *tobj);
|
||||
BOOL DoWealth(int32_t change);
|
||||
BOOL SetHostility(int32_t iOpponent, int32_t iHostility, BOOL fSilent=FALSE);
|
||||
bool ScenarioInit();
|
||||
bool FinalInit(bool fInitialValue);
|
||||
bool Save();
|
||||
bool Save(C4Group &hGroup, bool fSavegame, bool fStoreTiny);
|
||||
bool MakeCrewMember(C4Object *pObj, bool fForceInfo=true, bool fDoCalls=true);
|
||||
bool Load(const char *szFilename, bool fSavegame, bool fLoadPortraits);
|
||||
static bool Strip(const char *szFilename, bool fAggressive);
|
||||
bool Message(const char *szMsg);
|
||||
bool ObjectInCrew(C4Object *tobj);
|
||||
C4Object *Buy(C4ID id, bool fShowErrors, int32_t iForPlr, C4Object *pBuyObj=NULL); // buy object of player's wealth
|
||||
bool Sell2Home(C4Object *tobj);
|
||||
bool DoWealth(int32_t change);
|
||||
bool SetHostility(int32_t iOpponent, int32_t iHostility, bool fSilent=false);
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
BOOL LoadRuntimeData(C4Group &hGroup);
|
||||
bool LoadRuntimeData(C4Group &hGroup);
|
||||
bool ActivateMenuMain();
|
||||
bool ActivateMenuTeamSelection(bool fFromMain);
|
||||
void DoTeamSelection(int32_t idTeam);
|
||||
|
@ -202,8 +202,8 @@ class C4Player: public C4PlayerInfoCore
|
|||
void SetFoW(bool fEnable);
|
||||
int32_t ActiveCrewCount();
|
||||
int32_t GetSelectedCrewCount();
|
||||
BOOL LocalSync(); // sync InAction et. al. back o local player file
|
||||
BOOL SetObjectCrewStatus(C4Object *pCrew, BOOL fNewStatus); // add/remove object from crew
|
||||
bool LocalSync(); // sync InAction et. al. back o local player file
|
||||
bool SetObjectCrewStatus(C4Object *pCrew, bool fNewStatus); // add/remove object from crew
|
||||
bool IsChosingTeam() const { return Status==PS_TeamSelection || Status==PS_TeamSelectionPending; }
|
||||
bool IsInvisible() const;
|
||||
protected:
|
||||
|
|
|
@ -79,24 +79,24 @@ void C4PlayerList::ClearPointers(C4Object *pObj)
|
|||
pPlr->ClearPointers(pObj, false);
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Valid(int iPlayer) const
|
||||
bool C4PlayerList::Valid(int iPlayer) const
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->Number==iPlayer)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Hostile(int iPlayer1, int iPlayer2) const
|
||||
bool C4PlayerList::Hostile(int iPlayer1, int iPlayer2) const
|
||||
{
|
||||
C4Player *pPlr1=Get(iPlayer1);
|
||||
C4Player *pPlr2=Get(iPlayer2);
|
||||
if (!pPlr1 || !pPlr2) return FALSE;
|
||||
if (pPlr1->Number==pPlr2->Number) return FALSE;
|
||||
if (!pPlr1 || !pPlr2) return false;
|
||||
if (pPlr1->Number==pPlr2->Number) return false;
|
||||
if ( pPlr1->Hostility.GetIDCount(pPlr2->Number+1)
|
||||
|| pPlr2->Hostility.GetIDCount(pPlr1->Number+1) )
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool C4PlayerList::HostilityDeclared(int iPlayer1, int iPlayer2) const
|
||||
|
@ -111,20 +111,20 @@ bool C4PlayerList::HostilityDeclared(int iPlayer1, int iPlayer2) const
|
|||
return false;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::PositionTaken(int iPosition) const
|
||||
bool C4PlayerList::PositionTaken(int iPosition) const
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->Position==iPosition)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::ColorTaken(int iColor) const
|
||||
bool C4PlayerList::ColorTaken(int iColor) const
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->Color==iColor)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int C4PlayerList::CheckColorDw(DWORD dwColor, C4Player *pExclude)
|
||||
|
@ -146,13 +146,13 @@ int C4PlayerList::CheckColorDw(DWORD dwColor, C4Player *pExclude)
|
|||
return iDiff;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::ControlTaken(int iControl) const
|
||||
bool C4PlayerList::ControlTaken(int iControl) const
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->Control==iControl)
|
||||
if (pPlr->LocalControl)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
C4Player* C4PlayerList::Get(int iNumber) const
|
||||
|
@ -225,19 +225,19 @@ int C4PlayerList::GetCount(C4PlayerType eType) const
|
|||
int C4PlayerList::GetFreeNumber() const
|
||||
{
|
||||
int iNumber=-1;
|
||||
BOOL fFree;
|
||||
bool fFree;
|
||||
do
|
||||
{
|
||||
iNumber++; fFree=TRUE;
|
||||
iNumber++; fFree=true;
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->Number==iNumber)
|
||||
fFree=FALSE;
|
||||
fFree=false;
|
||||
}
|
||||
while (!fFree);
|
||||
return iNumber;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Remove(int iPlayer, bool fDisconnect, bool fNoCalls)
|
||||
bool C4PlayerList::Remove(int iPlayer, bool fDisconnect, bool fNoCalls)
|
||||
{
|
||||
return Remove(Get(iPlayer), fDisconnect, fNoCalls);
|
||||
}
|
||||
|
@ -249,13 +249,13 @@ bool C4PlayerList::RemoveUnjoined(int32_t iPlayer)
|
|||
for (C4ObjectLink *clnk=::Objects.First; clnk && (pObj=clnk->Obj); clnk=clnk->Next)
|
||||
if (pObj->Status)
|
||||
if (pObj->IsPlayerObject(iPlayer))
|
||||
pObj->AssignRemoval(TRUE);
|
||||
pObj->AssignRemoval(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
|
||||
bool C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
|
||||
{
|
||||
if (!pPlr) return FALSE;
|
||||
if (!pPlr) return false;
|
||||
|
||||
// inform script
|
||||
if (!fNoCalls)
|
||||
|
@ -304,10 +304,10 @@ BOOL C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
|
|||
|
||||
// Update console
|
||||
Console.UpdateMenus();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Player* C4PlayerList::Join(const char *szFilename, BOOL fScenarioInit, int iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo)
|
||||
C4Player* C4PlayerList::Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo)
|
||||
{
|
||||
assert(pInfo);
|
||||
|
||||
|
@ -345,7 +345,7 @@ C4Player* C4PlayerList::Join(const char *szFilename, BOOL fScenarioInit, int iAt
|
|||
return pPlr;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::CtrlJoinLocalNoNetwork(const char *szFilename, int iAtClient, const char *szAtClientName)
|
||||
bool C4PlayerList::CtrlJoinLocalNoNetwork(const char *szFilename, int iAtClient, const char *szAtClientName)
|
||||
{
|
||||
assert(!::Network.isEnabled());
|
||||
// Create temp copy of player file without portraits
|
||||
|
@ -356,7 +356,7 @@ BOOL C4PlayerList::CtrlJoinLocalNoNetwork(const char *szFilename, int iAtClient,
|
|||
if (!Config.Network.SendPortraits)
|
||||
{
|
||||
SCopy(Config.AtTempPath(GetFilename(szFilename)), szTempFilename, _MAX_PATH);
|
||||
if (!CopyItem(szFilename, szTempFilename)) return FALSE;
|
||||
if (!CopyItem(szFilename, szTempFilename)) return false;
|
||||
C4Group hGroup;
|
||||
if (hGroup.Open(szTempFilename))
|
||||
{
|
||||
|
@ -368,11 +368,11 @@ BOOL C4PlayerList::CtrlJoinLocalNoNetwork(const char *szFilename, int iAtClient,
|
|||
// pack - not needed for new res system
|
||||
/*if(DirectoryExists(szFilename))
|
||||
if(!C4Group_PackDirectory(szFilename))
|
||||
return FALSE;*/
|
||||
return false;*/
|
||||
// security
|
||||
if(!ItemExists(szFilename)) return FALSE;
|
||||
if(!ItemExists(szFilename)) return false;
|
||||
// join via player info
|
||||
BOOL fSuccess = Game.PlayerInfos.DoLocalNonNetworkPlayerJoin(szFilename);
|
||||
bool fSuccess = Game.PlayerInfos.DoLocalNonNetworkPlayerJoin(szFilename);
|
||||
// Delete temp player file
|
||||
/*if(*szTempFilename) EraseItem(szTempFilename);*/
|
||||
|
||||
|
@ -395,10 +395,10 @@ void SetClientPrefix(char *szFilename, const char *szClient)
|
|||
SAppend(szTemp,szFilename);
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Save(C4Group &hGroup, bool fStoreTiny, const C4PlayerInfoList &rStoreList)
|
||||
bool C4PlayerList::Save(C4Group &hGroup, bool fStoreTiny, const C4PlayerInfoList &rStoreList)
|
||||
{
|
||||
StdStrBuf sTempFilename;
|
||||
bool fSuccess = TRUE;
|
||||
bool fSuccess = true;
|
||||
// Save to external player files and add to group
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
{
|
||||
|
@ -412,43 +412,43 @@ BOOL C4PlayerList::Save(C4Group &hGroup, bool fStoreTiny, const C4PlayerInfoList
|
|||
sTempFilename.Copy(Config.AtTempPath(pNfo->GetFilename()));
|
||||
if(fStoreOnOriginal)
|
||||
if(!C4Group_CopyItem(pPlr->Filename, sTempFilename.getData()))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Open group
|
||||
C4Group PlrGroup;
|
||||
if(!PlrGroup.Open(sTempFilename.getData(), !fStoreOnOriginal))
|
||||
return FALSE;
|
||||
return false;
|
||||
// Save player
|
||||
if (!pPlr->Save(PlrGroup, true, fStoreOnOriginal)) return FALSE;
|
||||
if (!pPlr->Save(PlrGroup, true, fStoreOnOriginal)) return false;
|
||||
PlrGroup.Close();
|
||||
// Add temp file to group
|
||||
if (!hGroup.Move(sTempFilename.getData(), pNfo->GetFilename())) return FALSE;
|
||||
if (!hGroup.Move(sTempFilename.getData(), pNfo->GetFilename())) return false;
|
||||
}
|
||||
return fSuccess;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Save(bool fSaveLocalOnly)
|
||||
bool C4PlayerList::Save(bool fSaveLocalOnly)
|
||||
{
|
||||
// do not save in replays
|
||||
if (Game.C4S.Head.Replay) return TRUE;
|
||||
if (Game.C4S.Head.Replay) return true;
|
||||
// Save to external player files
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->GetType() != C4PT_Script)
|
||||
if (!fSaveLocalOnly || pPlr->LocalControl)
|
||||
if (!pPlr->Save())
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Evaluate()
|
||||
bool C4PlayerList::Evaluate()
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
pPlr->Evaluate();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::Retire(C4Player *pPlr)
|
||||
bool C4PlayerList::Retire(C4Player *pPlr)
|
||||
{
|
||||
if (!pPlr) return FALSE;
|
||||
if (!pPlr) return false;
|
||||
|
||||
if (!pPlr->Evaluated)
|
||||
{
|
||||
|
@ -457,7 +457,7 @@ BOOL C4PlayerList::Retire(C4Player *pPlr)
|
|||
}
|
||||
Remove(pPlr, false, false);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int C4PlayerList::AverageValueGain() const
|
||||
|
@ -481,13 +481,13 @@ C4Player* C4PlayerList::GetByName(const char *szName, int iExcluding) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::FileInUse(const char *szFilename) const
|
||||
bool C4PlayerList::FileInUse(const char *szFilename) const
|
||||
{
|
||||
// Check original player files
|
||||
C4Player *cPlr=First;
|
||||
for (; cPlr; cPlr=cPlr->Next)
|
||||
if (ItemIdentical(cPlr->Filename,szFilename))
|
||||
return TRUE;
|
||||
return true;
|
||||
// Compare to any network path player files with prefix (hack)
|
||||
if (::Network.isEnabled())
|
||||
{
|
||||
|
@ -496,10 +496,10 @@ BOOL C4PlayerList::FileInUse(const char *szFilename) const
|
|||
SetClientPrefix(szWithPrefix, Game.Clients.getLocalName());
|
||||
for (cPlr=First; cPlr; cPlr=cPlr->Next)
|
||||
if (SEqualNoCase(GetFilename(cPlr->Filename),szWithPrefix))
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
// Not in use
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
C4Player* C4PlayerList::GetLocalByIndex(int iIndex) const
|
||||
|
@ -514,7 +514,7 @@ C4Player* C4PlayerList::GetLocalByIndex(int iIndex) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::RemoveAtClient(int iClient, bool fDisconnect)
|
||||
bool C4PlayerList::RemoveAtClient(int iClient, bool fDisconnect)
|
||||
{
|
||||
C4Player *pPlr;
|
||||
// Get players
|
||||
|
@ -525,10 +525,10 @@ BOOL C4PlayerList::RemoveAtClient(int iClient, bool fDisconnect)
|
|||
// Remove
|
||||
Remove(pPlr, fDisconnect, false);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::RemoveAtClient(const char *szName, bool fDisconnect)
|
||||
bool C4PlayerList::RemoveAtClient(const char *szName, bool fDisconnect)
|
||||
{
|
||||
C4Player *pPlr;
|
||||
// Get players
|
||||
|
@ -539,34 +539,34 @@ BOOL C4PlayerList::RemoveAtClient(const char *szName, bool fDisconnect)
|
|||
// Remove
|
||||
Remove(pPlr, fDisconnect, false);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::CtrlRemove(int iPlayer, bool fDisconnect)
|
||||
bool C4PlayerList::CtrlRemove(int iPlayer, bool fDisconnect)
|
||||
{
|
||||
// Add packet to input
|
||||
Game.Input.Add(CID_RemovePlr, new C4ControlRemovePlr(iPlayer, fDisconnect));
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::CtrlRemoveAtClient(int iClient, bool fDisconnect)
|
||||
bool C4PlayerList::CtrlRemoveAtClient(int iClient, bool fDisconnect)
|
||||
{
|
||||
// Get players
|
||||
for(C4Player *pPlr = First; pPlr; pPlr = pPlr->Next)
|
||||
if(pPlr->AtClient == iClient)
|
||||
if(!CtrlRemove(pPlr->Number, fDisconnect))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::CtrlRemoveAtClient(const char *szName, bool fDisconnect)
|
||||
bool C4PlayerList::CtrlRemoveAtClient(const char *szName, bool fDisconnect)
|
||||
{
|
||||
// Get players
|
||||
for(C4Player *pPlr = First; pPlr; pPlr = pPlr->Next)
|
||||
if(SEqual(pPlr->AtClientName, szName))
|
||||
if(!CtrlRemove(pPlr->Number, fDisconnect))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Player* C4PlayerList::GetAtClient(int iClient, int iIndex) const
|
||||
|
@ -593,7 +593,7 @@ C4Player* C4PlayerList::GetAtClient(const char *szName, int iIndex) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::RemoveAtRemoteClient(bool fDisconnect, bool fNoCalls)
|
||||
bool C4PlayerList::RemoveAtRemoteClient(bool fDisconnect, bool fNoCalls)
|
||||
{
|
||||
C4Player *pPlr;
|
||||
// Get players
|
||||
|
@ -604,7 +604,7 @@ BOOL C4PlayerList::RemoveAtRemoteClient(bool fDisconnect, bool fNoCalls)
|
|||
// Remove
|
||||
Remove(pPlr, fDisconnect, fNoCalls);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
C4Player* C4PlayerList::GetAtRemoteClient(int iIndex) const
|
||||
|
@ -619,7 +619,7 @@ C4Player* C4PlayerList::GetAtRemoteClient(int iIndex) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
|
||||
bool C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
|
||||
{
|
||||
// (used by league system the set local fate)
|
||||
C4Player *pPlr;
|
||||
|
@ -635,7 +635,7 @@ BOOL C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
|
|||
}
|
||||
while(pPlr);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4PlayerList::EnumeratePointers()
|
||||
|
@ -659,13 +659,13 @@ int C4PlayerList::ControlTakenBy(int iControl) const
|
|||
return NO_OWNER;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::MouseControlTaken() const
|
||||
bool C4PlayerList::MouseControlTaken() const
|
||||
{
|
||||
for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
|
||||
if (pPlr->MouseControl)
|
||||
if (pPlr->LocalControl)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int C4PlayerList::GetCountNotEliminated() const
|
||||
|
@ -677,7 +677,7 @@ int C4PlayerList::GetCountNotEliminated() const
|
|||
return iCount;
|
||||
}
|
||||
|
||||
BOOL C4PlayerList::SynchronizeLocalFiles()
|
||||
bool C4PlayerList::SynchronizeLocalFiles()
|
||||
{
|
||||
// message
|
||||
Log(LoadResStr("IDS_PRC_SYNCPLRS"));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue