Finally move the Log() declaration where it belongs

In the old days, the code was split in two parts - C4* files in one part
and the other files. Long, long ago, the other files were presumably used
by other programs, but that wasn't true since the GWE at least. But the
split was maintained, except for the Log functions. Now that everything
is one giant bunch anyway, the Log functions can be declared in C4Log.h
again.
stable-5.1
Günther Brammer 2010-03-04 22:16:55 +01:00
parent e30ff99d6a
commit ed66b27cf3
5 changed files with 38 additions and 47 deletions

View File

@ -25,11 +25,12 @@
#define INC_C4Include
#include "Standard.h"
#include "C4Prototypes.h"
#include "Fixed.h"
#include "StdBuf.h"
#include "StdFile.h"
#include "StdResStr2.h"
#include "C4Prototypes.h"
#include "C4Log.h"
#include "C4PlayerControl.h"

View File

@ -22,15 +22,14 @@
#define INC_C4Log
#include <StdBuf.h>
#include <StdCompiler.h>
bool OpenLog();
bool CloseLog();
/* Declared in Standard.h
bool LogSilent(const char *szMessage);
bool Log(const char *szMessage);
bool LogSilent(const char *szMessage);
bool LogF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;
bool LogSilentF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;
bool LogF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;*/
bool DebugLog(const char *strMessage);
bool DebugLogF(const char *strMessage ...) GNUC_FORMAT_ATTRIBUTE;
@ -38,7 +37,6 @@ bool LogFatal(const char *szMessage); // log message and store it as a fatal err
void ResetFatalError(); // clear any fatal error message
const char *GetFatalError(); // return message that was set as fatal error, if any
bool CompileError(bool fWarning, StdCompiler::Exception *Exc);
size_t GetLogPos(); // get current log position;
bool GetLogSection(size_t iStart, size_t iLength, StdStrBuf &rsOut); // re-read log data from file

View File

@ -20,6 +20,9 @@
#include "C4Include.h"
#include <Fixed.h>
#include "StdCompiler.h"
#include "StdAdaptors.h"
#ifdef USE_FIXED
// static table with sinus values from 0.00 degree to 90.00 degree inclusively
@ -9027,3 +9030,31 @@ long SineTable[9001] = {
65536
};
#endif // USE_FIXED
void CompileFunc(FIXED &rValue, StdCompiler *pComp)
{
#ifdef USE_FIXED
char cFormat = 'F';
#else
char cFormat = 'f';
#endif
try {
// Read/write type
pComp->Character(cFormat);
} catch(StdCompiler::NotFoundException *pEx) {
delete pEx;
// Expect old format if not found
cFormat = 'F';
}
// Read value (as int32_t)
pComp->Value(mkCastAdapt<int32_t>(rValue));
// convert, if neccessary
#ifdef USE_FIXED
if(cFormat == 'f')
FLOAT_TO_FIXED(&rValue);
#else
if(cFormat == 'F')
FIXED_TO_FLOAT(&rValue);
#endif
}

View File

@ -38,9 +38,6 @@
#include <math.h>
#include "StdCompiler.h"
#include "StdAdaptors.h"
// activate to switch to classic fixed-point math
#define USE_FIXED 1
#define inline ALWAYS_INLINE
@ -71,7 +68,7 @@ class C4Fixed
#else
friend void FIXED_TO_FLOAT(float *pVal);
#endif
friend inline void CompileFunc(C4Fixed &rValue, StdCompiler *pComp);
friend void CompileFunc(C4Fixed &rValue, StdCompiler *pComp);
public:
int32_t val; // internal value
@ -343,32 +340,6 @@ inline void FIXED_TO_FLOAT(FIXED *pVal)
#undef inline
// CompileFunc for FIXED
inline void CompileFunc(FIXED &rValue, StdCompiler *pComp)
{
#ifdef USE_FIXED
char cFormat = 'F';
#else
char cFormat = 'f';
#endif
try {
// Read/write type
pComp->Character(cFormat);
} catch(StdCompiler::NotFoundException *pEx) {
delete pEx;
// Expect old format if not found
cFormat = 'F';
}
// Read value (as int32_t)
pComp->Value(mkCastAdapt<int32_t>(rValue));
// convert, if neccessary
#ifdef USE_FIXED
if(cFormat == 'f')
FLOAT_TO_FIXED(&rValue);
#else
if(cFormat == 'F')
FIXED_TO_FLOAT(&rValue);
#endif
}
void CompileFunc(FIXED &rValue, StdCompiler *pComp);
#endif //FIXED_H_INC

View File

@ -191,13 +191,6 @@ inline int stricmp(const char *s1, const char *s2) {
#define C4_OS "unknown";
#endif
// These functions have to be provided by the application.
bool Log(const char *szMessage);
bool LogSilent(const char *szMessage);
bool LogF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;
bool LogSilentF(const char *strMessage, ...) GNUC_FORMAT_ATTRIBUTE;
// Color triplets
#define C4RGB(r, g, b) (((DWORD)(0xff)<<24)|(((DWORD)(r)&0xff)<<16)|(((DWORD)(g)&0xff)<<8)|((b)&0xff))
@ -238,9 +231,6 @@ bool ForLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
bool (*fnCallback)(int32_t, int32_t, int32_t), int32_t iPar=0,
int32_t *lastx=NULL, int32_t *lasty=NULL);
// open a weblink in an external browser
bool OpenURL(const char *szURL);
#include <cctype>
inline char CharCapital(char cChar) { return std::toupper(cChar); }
bool IsIdentifier(char cChar);