diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html index d59ec3571..74f842950 100644 --- a/doc/ChangeLog.html +++ b/doc/ChangeLog.html @@ -824,6 +824,7 @@ <UL> <LI>Fixed bug: Wrapper script looses all command line options (from Josef Spillner). + <LI>MacOS compile fixed and project builder project added (from Ben Hines). </UL> </UL> diff --git a/doc/freecraft.html b/doc/freecraft.html index de1fde15a..cc8950280 100644 --- a/doc/freecraft.html +++ b/doc/freecraft.html @@ -826,6 +826,7 @@ Without any order: <LI>Flavio Silvestrow <LI>Daniel Burrows <LI>Dave Turner + <LI>Ben Hines </UL> <P><EM>And to all I have forgot to write up!</EM><BR> Please drop me an email, if I forgot you. diff --git a/src/ai/ai_resource.cpp b/src/ai/ai_resource.cpp index 6d4d92e0a..fee00451b 100644 --- a/src/ai/ai_resource.cpp +++ b/src/ai/ai_resource.cpp @@ -885,9 +885,10 @@ local int AiHarvest(Unit * unit) static const int xoffset[]={ 0,-1,+1, 0, -1,+1,-1,+1 }; static const int yoffset[]={ -1, 0, 0,+1, -1,-1,+1,+1 }; struct { - unsigned short X; - unsigned short Y; - } points[MaxMapWidth*MaxMapHeight/4]; + unsigned short X; + unsigned short Y; + } * points; + int size; int x; int y; int rx; @@ -910,7 +911,9 @@ local int AiHarvest(Unit * unit) x=unit->X; y=unit->Y; - + points=alloca(TheMap.Width*TheMap.Height/4); + size=TheMap.Width*TheMap.Height/sizeof(*points); + // // Find the nearest wood depot // @@ -974,17 +977,17 @@ local int AiHarvest(Unit * unit) *m=1; points[wp].X=x; // push the point points[wp].Y=y; - if( ++wp>=sizeof(points)/sizeof(*points) ) {// round about - wp=0; - } + if( ++wp>=size ) { // round about + wp=0; + } } else { // unreachable *m=99; } } - if( ++rp>=sizeof(points)/sizeof(*points) ) { // round about - rp=0; - } + if( ++rp>=size ) { // round about + rp=0; + } } // diff --git a/src/include/freecraft.h b/src/include/freecraft.h index c2faa94ce..f1344dcd8 100644 --- a/src/include/freecraft.h +++ b/src/include/freecraft.h @@ -509,7 +509,7 @@ extern char* strdcat3(const char* l, const char *m, const char* r); #if !defined(BSD) || defined(__APPLE__) /// case insensitive strstr extern char* strcasestr(char* str, const char* substr); -#endif // BSD +#endif // !BSD || APPLE /*============================================================================ == Misc diff --git a/src/main.cpp b/src/main.cpp index 50f2dde5f..912d437d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,7 +32,7 @@ ** This combination didn't likes if main is in the freecraft lib. */ -#if defined(_MSC_VER) && !defined(_WIN32_WCE) && defined(USE_SDL) +#if defined(USE_SDL) #include "SDL.h" #endif diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp index d760f33e8..687186f96 100644 --- a/src/stratagus/stratagus.cpp +++ b/src/stratagus/stratagus.cpp @@ -1133,7 +1133,7 @@ map is relative to FreeCraftLibPath=datapath, use ./map for relative to cwd\n\ ** @param argc Number of arguments. ** @param argv Vector of arguments. */ -#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined(_MSC_VER) && !defined(_WIN32_WCE)) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__APPLE__) || (defined(_MSC_VER) && !defined(_WIN32_WCE)) global int mymain(int argc,char** argv) #else global int main(int argc,char** argv) diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp index 03e847672..7328ff8aa 100644 --- a/src/unit/unit.cpp +++ b/src/unit/unit.cpp @@ -2627,9 +2627,10 @@ global int FindWoodInSight(const Unit* unit,int* px,int* py) static const int xoffset[]={ 0,-1,+1, 0, -1,+1,-1,+1 }; static const int yoffset[]={ -1, 0, 0,+1, -1,-1,+1,+1 }; struct { - unsigned short X; - unsigned short Y; - } points[MaxMapWidth*MaxMapHeight/4]; + unsigned short X; + unsigned short Y; + } * points; + int size; int x; int y; int rx; @@ -2652,6 +2653,9 @@ global int FindWoodInSight(const Unit* unit,int* px,int* py) destx=x=unit->X; desty=y=unit->Y; + points=alloca(TheMap.Width*TheMap.Height/4); + size=TheMap.Width*TheMap.Height/sizeof(*points); + // // Find the nearest wood depot @@ -2728,17 +2732,16 @@ global int FindWoodInSight(const Unit* unit,int* px,int* py) *m=1; points[wp].X=x; // push the point points[wp].Y=y; - if( ++wp>=sizeof(points)/sizeof(*points) ) {// round about - wp=0; - } + if( ++wp>=size ) { // round about + wp=0; + } } else { // unreachable *m=99; } } - - if( ++rp>=sizeof(points)/sizeof(*points) ) { // round about - rp=0; - } + if( ++rp>=size ) { // round about + rp=0; + } } //