Adapted to Mingw. Still some elements must adapted.

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@167 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-07-25 16:27:11 +00:00
parent 476a64065b
commit 406e29984f
8 changed files with 14 additions and 24 deletions

View File

@@ -14,7 +14,7 @@
#include <time.h>
#ifdef WIN32
#ifdef WIN32__
void RaiseDebugger() {
#ifdef DEBUG
@@ -119,7 +119,7 @@ void RaiseDebugger() {
#endif
#ifdef WIN32
#ifdef WIN32__
#include "AuxLib.h" // for Windows.h
@@ -355,7 +355,7 @@ void OlxWriteCoreDump(const char* fileName)
#endif
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
//#include <sys/wait.h>
#include <cstring>
#include <cstdio>
@@ -373,7 +373,7 @@ static void GdbWriteCoreDump(const char* fname) {
if(p) {
fprintf(p, "%s", gdbparam);
fflush(p);
int status = 0; wait(&status);
//int status = 0; wait(&status);
pclose(p);
}
}
@@ -447,7 +447,7 @@ void DumpCallstack(void (*PrintOutFct) (const std::string&)) {
free(strs);
}
#elif defined(WIN32)
#elif defined(WIN32__)
#include "StackWalker.h" // Call Luke Stackwalker for help
@@ -489,7 +489,7 @@ void DumpCallstack(void (*LineOutFct) (const std::string&))
#else
#warning No DumpCallstack implementation for this arch/sys
//#warning No DumpCallstack implementation for this arch/sys
void DumpCallstackPrintf(void* callpnt) {
printf("DumpCallstackPrintf not implemented\n");

View File

@@ -507,6 +507,7 @@ size_t FileSize(const std::string& path)
return size;
}
#define uchar unsigned char
// Checks if the given path is absolute
bool IsAbsolutePath(const std::string& path)
{

View File

@@ -154,7 +154,7 @@ std::string Utf16ToUtf8(const Utf16String& str);
Utf16String Utf8ToUtf16(const std::string& str);
std::string UnicodeToUtf8(const UnicodeString& str);
UnicodeString Utf8ToUnicode(const std::string& str);
#ifdef WIN32
#ifdef WIN32__
std::string Utf8ToSystemNative(const std::string& utf8str);
std::string SystemNativeToUtf8(const std::string& natstr);
#else // Other platforms use natively utf8 (at least we suppose so)

View File

@@ -111,10 +111,10 @@ reprocess: ;
{
if (objects[o].ai.vortelite.timesincefire > VORTELITE_MIN_TIME_BETWEEN_FIRE)
{
if (rnd()%VORTELITE_FIRE_PROB == (VORTELITE_FIRE_PROB/2))
if (rand()%VORTELITE_FIRE_PROB == (VORTELITE_FIRE_PROB/2))
{ // let's fire
// usually shoot toward keen
if (rnd()%5 != 0)
if (rand()%5 != 0)
{
if (objects[o].x < player[primaryplayer].x)
{
@@ -295,7 +295,7 @@ void vortelite_initiatejump(int o)
objects[o].ai.vortelite.frame = 0;
objects[o].ai.vortelite.animtimer = 0;
objects[o].ai.vortelite.inertiay = \
-((rnd()%(VORTELITE_MAX_JUMP_HEIGHT-VORTELITE_MIN_JUMP_HEIGHT))+VORTELITE_MIN_JUMP_HEIGHT);
-((rand()%(VORTELITE_MAX_JUMP_HEIGHT-VORTELITE_MIN_JUMP_HEIGHT))+VORTELITE_MIN_JUMP_HEIGHT);
if (objects[o].ai.vortelite.movedir==RIGHT)
{

View File

@@ -3,8 +3,6 @@ char spawn_object(int x, int y, int otype);
unsigned int getmaptileat(unsigned int x, unsigned int y);
uint rnd(void);
void vortelite_ai(int o);
void vortelite_initiatejump(int o);

View File

@@ -55,7 +55,7 @@ void CPatcher::patchMemory()
TrimSpaces(newbuf);
size_t p = newbuf.find(' ');
if(p != std::string::npos) {
size_t offset = 0;
long offset = 0;
sscanf(newbuf.substr(0,p).c_str(), "%lx", &offset); // Only hexadecimal numbers supported
std::string patch_file_name = newbuf.substr(p+1);
TrimSpaces(patch_file_name);
@@ -125,7 +125,7 @@ bool CPatcher::loadPatchfile()
return true;
}
void CPatcher::patchMemfromFile(const std::string& patch_file_name, int offset)
void CPatcher::patchMemfromFile(const std::string& patch_file_name, long offset)
{
unsigned char *buf_to_patch;
unsigned char byte;

View File

@@ -17,7 +17,7 @@ public:
virtual ~CPatcher();
void patchMemory();
void patchMemfromFile(const std::string& patch_file_name, int offset);
void patchMemfromFile(const std::string& patch_file_name, long offset);
private:

View File

@@ -1102,15 +1102,6 @@ int dlgX,dlgY,dlgW,dlgH;
} while(1);
}
// a random number generator
ulong random_seed;
void srnd(ulong newseed) { random_seed = newseed; }
uint rnd(void)
{
random_seed = random_seed * 1103515245 + 12345;
return (uint)(random_seed / 65536) % 32768;
}
int endsequence(stCloneKeenPlus *pCKP)
{