diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-23 03:24:32 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-23 03:24:32 +0000 |
commit | d28762e63974a9dbe1e642829df185cdd40abde5 (patch) | |
tree | 93e3775658baccb87a804d89068c2c27315d1231 /src | |
parent | ec0953fdd84a6b85189e9698118ea8aa62d8bdc1 (diff) | |
download | hercules-d28762e63974a9dbe1e642829df185cdd40abde5.tar.gz hercules-d28762e63974a9dbe1e642829df185cdd40abde5.tar.bz2 hercules-d28762e63974a9dbe1e642829df185cdd40abde5.tar.xz hercules-d28762e63974a9dbe1e642829df185cdd40abde5.zip |
- Moved "#include <limits.h>" to cbasetypes.h to ensure it's included before checking if UINT_MAX has been defined.
- Minor changes in pc_readdb related to max_level being unsigned.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9561 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 2 | ||||
-rw-r--r-- | src/char/int_guild.c | 2 | ||||
-rw-r--r-- | src/char/int_party.c | 2 | ||||
-rw-r--r-- | src/char_sql/char.c | 5 | ||||
-rw-r--r-- | src/char_sql/int_guild.c | 4 | ||||
-rw-r--r-- | src/char_sql/int_party.c | 6 | ||||
-rw-r--r-- | src/common/cbasetypes.h | 11 | ||||
-rw-r--r-- | src/common/timer.c | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/battle.c | 4 | ||||
-rw-r--r-- | src/map/charcommand.c | 2 | ||||
-rw-r--r-- | src/map/charsave.c | 2 | ||||
-rw-r--r-- | src/map/chrif.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 3 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/mercenary.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/party.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 33 | ||||
-rw-r--r-- | src/map/script.c | 3 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 12 |
23 files changed, 54 insertions, 54 deletions
diff --git a/src/char/char.c b/src/char/char.c index a95a1cfda..b6dc3bdba 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -18,8 +18,8 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/strlib.h" #include "../common/core.h" #include "../common/socket.h" diff --git a/src/char/int_guild.c b/src/char/int_guild.c index e6c4105c8..bc17f2ff1 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -4,8 +4,8 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/mmo.h" #include "../common/socket.h" #include "../common/db.h" diff --git a/src/char/int_party.c b/src/char/int_party.c index be8c6a04c..ed4424d5e 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -4,8 +4,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/mmo.h" #include "../common/socket.h" #include "../common/db.h" diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 0333798d1..3ff9adb05 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -21,17 +21,18 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> -#include "char.h" +#include "../common/cbasetypes.h" #include "../common/utils.h" #include "../common/strlib.h" #include "../common/showmsg.h" + #include "itemdb.h" #include "inter.h" #include "db.h" #include "malloc.h" #include "int_guild.h" +#include "char.h" #ifndef TXT_SQL_CONVERT static struct dbt *char_db_; diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index 9132f9ec2..8ef59b62b 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -7,9 +7,8 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#include <limits.h> -#include "char.h" +#include "../common/cbasetypes.h" #include "../common/strlib.h" #include "../common/showmsg.h" // #include "int_storage.h" @@ -19,6 +18,7 @@ #include "socket.h" #include "db.h" #include "malloc.h" +#include "char.h" #define GS_MEMBER_UNMODIFIED 0x00 #define GS_MEMBER_MODIFIED 0x01 diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index e39c826d4..025c14e31 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -7,13 +7,15 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <limits.h> -#include "char.h" + +#include "../common/cbasetypes.h" #include "../common/db.h" #include "../common/strlib.h" #include "../common/socket.h" #include "../common/showmsg.h" +#include "char.h" + #ifndef TXT_SQL_CONVERT struct party_data { struct party party; diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 3a3bde818..76f494851 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -59,6 +59,12 @@ // only Silicon Graphics/Cray goes ILP64 so don't care (and don't support) ////////////////////////////////////////////////////////////////////////// +#include <limits.h> +// ILP64 isn't supported, so always 32 bits? +#ifndef UINT_MAX +#define UINT_MAX 0xffffffff +#endif + ////////////////////////////////////////////////////////////////////////// // Integers with guaranteed _exact_ size. ////////////////////////////////////////////////////////////////////////// @@ -126,11 +132,6 @@ typedef unsigned int uint32; #define SINT16_MAX ((sint16)0x7FFF) #define SINT32_MAX ((sint32)0x7FFFFFFF) -// ILP64 isn't supported, so always 32 bits? -#ifndef UINT_MAX -#define UINT_MAX 0xFFFFFFFF -#endif - ////////////////////////////////////////////////////////////////////////// // Integers with guaranteed _minimum_ size. // These could be larger than you expect, diff --git a/src/common/timer.c b/src/common/timer.c index 63a06acc2..3b4fb1db4 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -13,7 +13,6 @@ #include <sys/time.h> #endif -#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2ee492e53..a6c92a593 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6,8 +6,8 @@ #include <string.h> #include <ctype.h> #include <math.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/mmo.h" #include "../common/timer.h" #include "../common/nullpo.h" diff --git a/src/map/battle.c b/src/map/battle.c index b80861df7..7ff6299e6 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5,9 +5,8 @@ #include <stdlib.h> #include <string.h> #include <math.h> -#include <limits.h> -#include "battle.h" +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/malloc.h" @@ -24,6 +23,7 @@ #include "pet.h" #include "guild.h" #include "party.h" +#include "battle.h" int attr_fix_table[4][ELE_MAX][ELE_MAX]; diff --git a/src/map/charcommand.c b/src/map/charcommand.c index de8668828..7d54fc5a6 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -6,8 +6,8 @@ #include <string.h> #include <ctype.h> #include <math.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/socket.h" #include "../common/timer.h" #include "../common/nullpo.h" diff --git a/src/map/charsave.c b/src/map/charsave.c index abcd7d152..13724cffd 100644 --- a/src/map/charsave.c +++ b/src/map/charsave.c @@ -4,8 +4,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/core.h" #include "../common/socket.h" #include "../common/timer.h" diff --git a/src/map/chrif.c b/src/map/chrif.c index 1e8183641..cbce3b6c8 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -6,8 +6,8 @@ #include <string.h> #include <sys/types.h> #include <time.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/malloc.h" #include "../common/socket.h" #include "../common/timer.h" diff --git a/src/map/clif.c b/src/map/clif.c index 56ea93a6a..803484f8c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9,9 +9,9 @@ #include <stdlib.h> #include <string.h> #include <stdarg.h> -#include <limits.h> #include <time.h> +#include "../common/cbasetypes.h" #include "../common/socket.h" #include "../common/timer.h" #include "../common/malloc.h" @@ -43,7 +43,6 @@ #include "pet.h" #include "mercenary.h" //[orn] #include "log.h" - #include "irc.h" struct Clif_Config { diff --git a/src/map/guild.c b/src/map/guild.c index 60643eede..fc9defdbc 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -4,8 +4,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/malloc.h" diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 0ae731fd3..99ca1017e 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -3,8 +3,8 @@ #include <string.h> #include <ctype.h> #include <math.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/socket.h" #include "../common/timer.h" #include "../common/nullpo.h" diff --git a/src/map/mob.c b/src/map/mob.c index 7405fc7ec..935e80384 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -6,8 +6,8 @@ #include <stdarg.h> #include <string.h> #include <math.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/db.h" #include "../common/nullpo.h" diff --git a/src/map/npc.c b/src/map/npc.c index 4118b79ea..9ce3160f6 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -7,8 +7,8 @@ #include <string.h> #include <math.h> #include <time.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/malloc.h" diff --git a/src/map/party.c b/src/map/party.c index aabd336ff..87bd3ad62 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -4,8 +4,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/socket.h" #include "../common/nullpo.h" diff --git a/src/map/pc.c b/src/map/pc.c index 9aefa3f08..2a8f8487c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6,8 +6,8 @@ #include <string.h> #include <ctype.h> #include <time.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/socket.h" // [Valaris] #include "../common/timer.h" #include "../common/nullpo.h" @@ -7279,7 +7279,7 @@ int pc_readdb(void) while(fgets(line, sizeof(line)-1, fp)){ int jobs[MAX_PC_CLASS], job_count, job; int type; - unsigned int max; + unsigned int ui,maxlv; char *split[4]; if(line[0]=='/' && line[1]=='/') continue; @@ -7299,28 +7299,27 @@ int pc_readdb(void) ShowError("pc_readdb: Invalid type %d (must be 0 for base levels, 1 for job levels).\n", type); continue; } - max = atoi(split[0]); - if (max > MAX_LEVEL) { - ShowWarning("pc_readdb: Specified max level %d for job %d is beyond server's limit (%d).\n ", max, job, MAX_LEVEL); - max = MAX_LEVEL; + maxlv = atoi(split[0]); + if (maxlv > MAX_LEVEL) { + ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%u).\n ", maxlv, job, MAX_LEVEL); + maxlv = MAX_LEVEL; } //We send one less and then one more because the last entry in the exp array should hold 0. - max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',max-1)+1; + max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',maxlv-1)+1; //Reverse check in case the array has a bunch of trailing zeros... [Skotlex] //The reasoning behind the -2 is this... if the max level is 5, then the array //should look like this: //0: x, 1: x, 2: x: 3: x 4: 0 <- last valid value is at 3. - while ((i = max_level[job][type]-2) >= 0 && exp_table[job][type][i] <= 0) + while ((ui = max_level[job][type]) >= 2 && exp_table[job][type][ui-2] <= 0) max_level[job][type]--; - if (max_level[job][type] < max) { - ShowWarning("pc_readdb: Specified max %d for job %d, but that job's exp table only goes up to level %d.\n", max, job, max_level[job][type]); + if (max_level[job][type] < maxlv) { + ShowWarning("pc_readdb: Specified max %u for job %d, but that job's exp table only goes up to level %u.\n", maxlv, job, max_level[job][type]); ShowInfo("Filling the missing values with the last exp entry.\n"); //Fill the requested values with the last entry. - i = max_level[job][type]-2; - if (i < 0) i = 0; - for (; i < max-2; i++) - exp_table[job][type][i] = exp_table[job][type][i-1]; - max_level[job][type] = max; + ui = (max_level[job][type] <= 2? 0: max_level[job][type]-2); + for (; ui+2 < maxlv; ui++) + exp_table[job][type][ui] = exp_table[job][type][ui-1]; + max_level[job][type] = maxlv; } // ShowDebug("%s - Class %d: %d\n", type?"Job":"Base", job, max_level[job][type]); for (i = 1; i < job_count; i++) { @@ -7330,8 +7329,8 @@ int pc_readdb(void) continue; } memcpy(exp_table[job][type], exp_table[jobs[0]][type], sizeof(exp_table[0][0])); - max_level[job][type] = max; -// ShowDebug("%s - Class %d: %d\n", type?"Job":"Base", job, max_level[job][type]); + max_level[job][type] = maxlv; +// ShowDebug("%s - Class %d: %u\n", type?"Job":"Base", job, max_level[job][type]); } } fclose(fp); diff --git a/src/map/script.c b/src/map/script.c index 919c22917..48ac823d8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10,7 +10,6 @@ #include <string.h> #include <ctype.h> #include <math.h> -#include <limits.h> #ifndef _WIN32 #include <sys/time.h> @@ -2991,7 +2990,7 @@ static int script_load_mapreg(void) ShowInfo("Freeing results...\n"); mysql_free_result(sql_res); mapreg_dirty=0; - perfomance = (time(NULL) - perfomance); + perfomance = (((unsigned int)time(NULL)) - perfomance); ShowInfo("SQL Mapreg Loading Completed Under %d Seconds.\n",perfomance); return 0; #endif /* TXT_ONLY */ diff --git a/src/map/skill.c b/src/map/skill.c index 33e02296a..9695a1f76 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5,8 +5,8 @@ #include <stdlib.h> #include <string.h> #include <time.h> -#include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/malloc.h" diff --git a/src/map/status.c b/src/map/status.c index dfd5279d3..c287321b8 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -7,7 +7,12 @@ #include <stdlib.h> #include <memory.h> #include <string.h> -#include <limits.h> + +#include "../common/cbasetypes.h" +#include "../common/timer.h" +#include "../common/nullpo.h" +#include "../common/showmsg.h" +#include "../common/malloc.h" #include "pc.h" #include "map.h" @@ -25,11 +30,6 @@ #include "unit.h" #include "mercenary.h" -#include "../common/timer.h" -#include "../common/nullpo.h" -#include "../common/showmsg.h" -#include "../common/malloc.h" - //For specifying where in the SkillStatusChangeTableArray the "out of bounds" skills get stored. [Skotlex] #define SC_HM_BASE 800 #define SC_GD_BASE 900 |