Remove C4ENGINE define

Most files using it weren't used by c4group-the-application anymore, and
the remaining stuff can be dealt with by using stubs or the same code in
both cases.
Günther Brammer 2010-02-17 22:59:46 +01:00
parent fd07c9e385
commit ff8d950e85
15 changed files with 37 additions and 99 deletions

View File

@ -701,7 +701,7 @@ target_link_libraries(c4group
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
)
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS C4ENGINE GLEW_STATIC)
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS GLEW_STATIC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
############################################################################

View File

@ -60,7 +60,6 @@ AM_CPPFLAGS = \
-I$(srcdir)/src/game/object \
-I$(srcdir)/src/lib/texture \
-I$(srcdir)/src/script \
-DC4ENGINE \
$(GLEW_CFLAGS) $(GTK_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS)
#various hacks to get dependency tracking working with a precompiled C4Include

View File

@ -29,7 +29,7 @@
C4ComponentHost *pCmpHost=NULL;
#if defined(C4ENGINE) && defined(_WIN32)
#ifdef _WIN32
#include "resource.h"
BOOL CALLBACK ComponentDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
@ -313,20 +313,14 @@ bool C4ComponentHost::Save(C4Group &hGroup)
void C4ComponentHost::Open()
{
#ifdef _WIN32
pCmpHost=this;
#if defined(C4ENGINE) && defined(_WIN32)
DialogBox(Application.GetInstance(),
MAKEINTRESOURCE(IDD_COMPONENT),
Application.GetWindowHandle(),
(DLGPROC) ComponentDlgProc);
#endif
pCmpHost=NULL;
}
bool C4ComponentHost::GetLanguageString(const char *szLanguage, StdStrBuf &rTarget)

View File

@ -35,7 +35,6 @@
#include <sys/stat.h>
#ifdef _WIN32
#include <sys/utime.h>
#include <shellapi.h>
#else
#include <utime.h>
#include <fcntl.h>
@ -47,7 +46,6 @@
#include <fcntl.h>
#include <openssl/sha.h>
#include "MacUtility.h"
//------------------------------ File Sort Lists -------------------------------------------
@ -1585,30 +1583,6 @@ bool C4Group::Delete(const char *szFiles, bool fRecursive)
return true; // Would be nicer to return the file count and add up all counts from recursive actions...
}
// delete item to the recycle bin
bool EraseItemSafe(const char *szFilename)
{
#ifdef _WIN32
char Filename[_MAX_PATH+1];
SCopy(szFilename, Filename, _MAX_PATH);
Filename[SLen(Filename)+1]=0;
SHFILEOPSTRUCT shs;
shs.hwnd=0;
shs.wFunc=FO_DELETE;
shs.pFrom=Filename;
shs.pTo=NULL;
shs.fFlags=FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
shs.fAnyOperationsAborted=false;
shs.hNameMappings=0;
shs.lpszProgressTitle=NULL;
return !SHFileOperation(&shs);
#elif defined(USE_SDL_MAINLOOP) && defined(C4ENGINE) && defined(__APPLE__)
MacUtility::sendFileToTrash(szFilename);
#else
return false;
#endif
}
bool C4Group::DeleteEntry(const char *szFilename, bool fRecycle)
{
switch (Status)

View File

@ -88,8 +88,6 @@ 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);
extern const char *C4CFN_FLS[];
extern time_t C4Group_AssumeTimeOffset;

View File

@ -106,7 +106,7 @@ bool C4GroupSet::RegisterGroup(C4Group &rGroup, bool fOwnGrp, int32_t Priority,
pNewNode->Priority = Priority;
pNewNode->Contents = Contents;
#if defined(C4ENGINE) && !defined(USE_CONSOLE)
#if !defined(USE_CONSOLE)
// always add fonts directly
if (Contents & C4GSCnt_FontDefs)
Game.FontLoader.LoadDefs(rGroup, Config);

View File

@ -56,6 +56,10 @@ char strExecuteAtEnd[_MAX_PATH + 1] = "";
int iResult = 0;
bool EraseItemSafe(const char *szFilename) {
return false;
}
bool Log(const char *msg) {
if (!fQuiet)
printf("%s\n", msg);

View File

@ -56,7 +56,7 @@ bool isGermanSystem()
{
#ifdef _WIN32
if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_GERMAN) return true;
#elif defined(__APPLE__) and defined(C4ENGINE)
#elif defined(__APPLE__)
return MacUtility::isGerman();
#else
if (strstr(setlocale(LC_MESSAGES, 0), "de")) return true;

View File

@ -411,11 +411,6 @@ C4Def::C4Def()
void C4Def::Default()
{
DefaultDefCore();
#if !defined(C4ENGINE) && !defined(C4GROUP)
Picture=NULL;
Image=NULL;
#endif
Next=NULL;
Temporary=false;
Maker[0]=0;
@ -536,42 +531,6 @@ bool C4Def::Load(C4Group &hGroup,
return false;
}
#if !defined(C4ENGINE) && !defined(C4GROUP)
// Override PictureRect if PictureRectFE is given
if (PictureRectFE.Wdt > 0)
PictureRect = PictureRectFE;
// Read picture section (this option is currently unused...)
if (dwLoadWhat & C4D_Load_Picture)
// Load from PNG graphics
if (!hGroup.AccessEntry(C4CFN_DefGraphicsPNG)
|| !hGroup.ReadPNGSection(&Picture,NULL,PictureRect.x,PictureRect.y,PictureRect.Wdt,PictureRect.Hgt))
// Load from BMP graphics
if (!hGroup.AccessEntry(C4CFN_DefGraphics)
|| !hGroup.ReadDDBSection(&Picture,NULL,PictureRect.x,PictureRect.y,PictureRect.Wdt,PictureRect.Hgt))
// None loaded
return false;
// Read picture section for use in image list
if (dwLoadWhat & C4D_Load_Image)
// Load from PNG title
if (!hGroup.AccessEntry(C4CFN_ScenarioTitlePNG)
|| !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))
// 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))
// None loaded
return false;
#endif
// Read script
if (dwLoadWhat & C4D_Load_Script)
{

View File

@ -239,11 +239,6 @@ class C4Def: public C4PropList
C4Def();
~C4Def();
public:
#if defined(_WIN32) && !defined(C4ENGINE) && !defined(C4GROUP)
HBITMAP Picture;
HBITMAP Image;
#endif
char Maker[C4MaxName+1];
char Filename[_MAX_FNAME+1];
int32_t Creation;

View File

@ -23,14 +23,7 @@
#include "C4Include.h"
#include <Standard.h>
#if defined(HAVE_PTHREAD) && defined(C4ENGINE)
// c4group is single-threaded
#include <StdSync.h>
#endif
#ifdef _WIN32
#include <shellapi.h>
#endif
#include <math.h>
#include <sys/timeb.h>
@ -796,7 +789,7 @@ const char* SGetParameter(const char *strCommandLine, int iParameter, char *strT
/* Some part of the Winapi */
#if defined(HAVE_PTHREAD) && defined(C4ENGINE) && defined(NEED_FALLBACK_ATOMIC_FUNCS)
#ifdef NEED_FALLBACK_ATOMIC_FUNCS
static CStdCSec SomeMutex;
long InterlockedIncrement(long * var)
{

View File

@ -357,6 +357,7 @@ template <typename T>
// open a weblink in an external browser
bool OpenURL(const char *szURL);
bool EraseItemSafe(const char *szFilename);
#endif // INC_STANDARD

View File

@ -441,7 +441,7 @@ void C4Facet::Set(CSurface &rSfc)
#ifdef _WIN32
void C4Facet::Draw(HWND hWnd, int32_t iTx, int32_t iTy, int32_t iTWdt, int32_t iTHgt, bool fAspect, int32_t iPhaseX, int32_t iPhaseY)
{
#if defined(C4ENGINE) && defined(USE_DIRECTX)
#if defined(USE_DIRECTX)
if (!pD3D || !Surface || !hWnd || !Wdt || !Hgt) return;
if (fAspect)

View File

@ -3139,11 +3139,7 @@ void C4NetIOUDP::DoCheck() // (mt-safe)
#endif
void C4NetIOUDP::OpenDebugLog()
{
#if defined C4ENGINE //&& 0
const char *szFileBase = Config.AtExePath("NetIOUDP%d.log");
#else
const char *szFileBase = "NetIOUDP%d.log";
#endif
char szFilePath[_MAX_PATH + 1];
for(int i = 0; i < 1000; i++)
{

View File

@ -63,3 +63,28 @@ bool OpenURL(const char *szURL)
// operating system not supported, or all opening method(s) failed
return false;
}
// delete item to the recycle bin
bool EraseItemSafe(const char *szFilename)
{
#ifdef _WIN32
char Filename[_MAX_PATH+1];
SCopy(szFilename, Filename, _MAX_PATH);
Filename[SLen(Filename)+1]=0;
SHFILEOPSTRUCT shs;
shs.hwnd=0;
shs.wFunc=FO_DELETE;
shs.pFrom=Filename;
shs.pTo=NULL;
shs.fFlags=FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
shs.fAnyOperationsAborted=false;
shs.hNameMappings=0;
shs.lpszProgressTitle=NULL;
return !SHFileOperation(&shs);
#endif
#ifdef __APPLE__
return MacUtility::sendFileToTrash(szFilename);
#endif
return false;
}