From d28762e63974a9dbe1e642829df185cdd40abde5 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Sat, 23 Dec 2006 03:24:32 +0000 Subject: - Moved "#include " 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 --- src/map/atcommand.c | 2 +- src/map/battle.c | 4 ++-- src/map/charcommand.c | 2 +- src/map/charsave.c | 2 +- src/map/chrif.c | 2 +- src/map/clif.c | 3 +-- src/map/guild.c | 2 +- src/map/mercenary.c | 2 +- src/map/mob.c | 2 +- src/map/npc.c | 2 +- src/map/party.c | 2 +- src/map/pc.c | 33 ++++++++++++++++----------------- src/map/script.c | 3 +-- src/map/skill.c | 2 +- src/map/status.c | 12 ++++++------ 15 files changed, 36 insertions(+), 39 deletions(-) (limited to 'src/map') 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 #include #include -#include +#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 #include #include -#include -#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include #include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include +#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 #include #include -#include #ifndef _WIN32 #include @@ -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 #include #include -#include +#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 #include #include -#include + +#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 -- cgit v1.2.3-60-g2f50