diff --git a/src/Jamrules b/src/Jamrules index d2b89abb5..88dd7a0d7 100644 --- a/src/Jamrules +++ b/src/Jamrules @@ -12,6 +12,12 @@ if ! $(CCACHE_DIR) { Echo Compiling with ccache ; } +if $(PROFILE) = 1 { + Echo Compiling with profiler ; + CCFLAGS += -pg ; + LINKFLAGS += -pg ; +} + CCFLAGS += -Wall ; CCFLAGS += -Wwrite-strings diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index f672474bc..a16d7c30e 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -157,7 +157,7 @@ const troop no_troop = {0, 0}; region * fleeregion(const unit * u) { - const region *r = u->region; + region *r = u->region; region *neighbours[MAXDIRECTIONS]; int c = 0; direction_t i; diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index 48ea8e9ec..95579c153 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -279,16 +279,17 @@ runhash(region * r) } region * -r_connect(const region * r, direction_t dir) +r_connect(const region * r, direction_t dir) { static int set = 0; static region * buffer[MAXDIRECTIONS]; static const region * last = NULL; - assert(dirconnect[dir]) return r->connect[dir]; + region * rmodify = (region*)r; + if (r->connect[dir]) return r->connect[dir]; #endif + assert(dirx + delta_x[dir], r->y + delta_y[dir]); set |= (1<connect[dir] = buffer[dir]; + rmodify->connect[dir] = buffer[dir]; #endif return buffer[dir]; } diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 2416c39eb..0a4df6bf1 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -889,20 +889,18 @@ readgame(const char * filename, int backup) #endif if(global.data_version >= SAVEXMLNAME_VERSION) { char basefile[1024]; - char *basearg; + const char *basearg = "(null)"; rs(F, basefile); - if(xmlfile != NULL) { + if (xmlfile != NULL) { basearg = strrchr(xmlfile, '/'); - if(!basearg) { + if (basearg==NULL) { basearg = xmlfile; } else { - basearg++; + ++basearg; } - } else { - basearg = "(null)"; } - if(strcmp(basearg, basefile)) { + if (strcmp(basearg, basefile)!=0) { printf("WARNING: xmlfile mismatch:\n"); printf("WARNING: datafile contains %s\n", basefile); printf("WARNING: argument/default is %s\n", basearg); diff --git a/src/common/modules/Jamfile b/src/common/modules/Jamfile index 9137e971c..d9b6a6636 100644 --- a/src/common/modules/Jamfile +++ b/src/common/modules/Jamfile @@ -14,7 +14,7 @@ SOURCES = gmcmd.c infocmd.c museum.c - oceannames.c +# oceannames.c score.c victoryconditions.c weather.c diff --git a/src/common/modules/oceannames.c b/src/common/modules/oceannames.c index 34c99c427..89b3d794b 100644 --- a/src/common/modules/oceannames.c +++ b/src/common/modules/oceannames.c @@ -38,7 +38,7 @@ namehash names[NMAXHASH]; void nhash(const char * name); typedef struct oceanname { - struct name * next; + struct oceanname * next; struct faction_list * factions; const char * name; } oceanname;