# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/lighta/Documents/Myscript/RO/Servs/ra2 # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: 3rdparty/libconfig/libconfig.c --- 3rdparty/libconfig/libconfig.c Base (BASE) +++ 3rdparty/libconfig/libconfig.c Locally Modified (Based On LOCAL) @@ -300,7 +300,7 @@ if(list) { - int len = list->length; + unsigned int len = list->length; config_setting_t **s; for(s = list->elements; len--; s++) @@ -764,7 +764,7 @@ setting = _new(config_setting_t); setting->parent = parent; setting->name = (name == NULL) ? NULL : strdup(name); - setting->type = type; + setting->type =(short) type; setting->config = parent->config; setting->hook = NULL; setting->line = 0; @@ -1131,8 +1131,7 @@ short config_setting_get_format(const config_setting_t *setting) { - return(setting->format != 0 ? setting->format - : setting->config->default_format); + return((short) (setting->format != 0 ? setting->format: setting->config->default_format) ); } /* ------------------------------------------------------------------------- */ Index: CMakeLists.txt --- CMakeLists.txt Base (BASE) +++ CMakeLists.txt Locally Modified (Based On LOCAL) @@ -14,7 +14,7 @@ # ENABLE_* : option to use an internal feature/code or not # HAVE_* : internal variable indicating if we have and are using something # -# Maintainer: Fl�vio J. Saraiva (feel free to send complaints or suggestions) +# Maintainer: Flávio J. Saraiva (feel free to send complaints or suggestions) # flaviojs @ rAthena forum/irc # flaviojs2005 \A-T/ gmail com # Index: conf/help.txt --- conf/help.txt Base (BASE) +++ conf/help.txt Locally Modified (Based On LOCAL) @@ -96,10 +96,10 @@ "4068 Minstrel 4069 Wanderer 4070 Sura 4071 Genetic\n" "4072 Shadow Chaser\n" "----- 3rd Class (Transcendent) -----\n" - "4060 Rune Knight 4061 Warlock 4062 Ranger 4063 Arch Bishop\n" - "4064 Mechanic 4065 Guillotine Cross 4073 Royal Guard 4074 Sorcerer\n" - "4075 Minstrel 4076 Wanderer 4077 Sura 4078 Genetic\n" - "4079 Shadow Chaser\n" + "4060 Rune Knight T 4061 Warlock T 4062 Ranger T 4063 Arch Bishop T\n" + "4064 Mechanic T 4065 Guillotine Cross T 4073 Royal Guard T 4074 Sorcerer T\n" + "4075 Minstrel T 4076 Wanderer T 4077 Sura T 4078 Genetic T\n" + "4079 Shadow Chaser T\n" "----- Expanded Class -----\n" " 23 Super Novice 24 Gunslinger 25 Ninja 4045 Super Baby\n" "4046 Taekwon 4047 Star Gladiator 4049 Soul Linker 4050 Gangsi\n" Index: configure --- configure Base (BASE) +++ configure Locally Modified (Based On LOCAL) @@ -4423,7 +4423,7 @@ -CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wno-sign-compare" +CFLAGS="$CFLAGS -pipe -ffast-math -Wall" CPPFLAGS="$CPPFLAGS -I../common" @@ -4784,7 +4784,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5 $as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; } OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-unused-parameter" +#CFLAGS="$CFLAGS -Wno-unused-parameter" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -4854,8 +4854,8 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-pointer-sign" >&5 $as_echo_n "checking whether $CC supports -Wno-pointer-sign... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-pointer-sign" +#OLD_CFLAGS="$CFLAGS" +#CFLAGS="$CFLAGS -Wno-pointer-sign" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -4868,7 +4868,7 @@ $as_echo_n "checking whether $CC can actually use -Wno-pointer-sign... " >&6; } # This option causes warnings in C++ mode # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything - CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign" +# CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -4877,13 +4877,13 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wno-pointer-sign" +# CFLAGS="$OLD_CFLAGS -Wno-pointer-sign" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" +# CFLAGS="$OLD_CFLAGS" fi @@ -4893,7 +4893,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" +# CFLAGS="$OLD_CFLAGS" fi @@ -5112,7 +5112,7 @@ CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses" ;; "yes") - CFLAGS="$CFLAGS -g -DDEBUG" + CFLAGS="$CFLAGS -g -DDEBUG -Wconversion" ;; "gdb") CFLAGS="$CFLAGS -ggdb -DDEBUG" @@ -7202,3 +7202,4 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi +echo "Configure finish, CFLAG= $CFLAGS " \ No newline at end of file Index: src/char/char.c --- src/char/char.c Base (BASE) +++ src/char/char.c Locally Modified (Based On LOCAL) @@ -232,13 +232,13 @@ if (login_fd > 0 && !session[login_fd]->flag.eof) { WFIFOHEAD(login_fd,6); WFIFOW(login_fd,0) = 0x272b; - WFIFOL(login_fd,2) = account_id; + WFIFOL(login_fd,2) = (uint32) account_id; WFIFOSET(login_fd,6); } } -void set_char_online(int map_id, int char_id, int account_id) +void set_char_online(short map_id, uint32 char_id, uint32 account_id) { struct online_char_data *character; struct mmo_charstatus *cp; @@ -281,7 +281,7 @@ } } -void set_char_offline(int char_id, int account_id) +void set_char_offline(uint32 char_id, uint32 account_id) { struct online_char_data *character; Index: src/char/inter.c --- src/char/inter.c Base (BASE) +++ src/char/inter.c Locally Modified (Based On LOCAL) @@ -1148,8 +1148,8 @@ WFIFOW(fd, 0) = 0x3806; WFIFOL(fd, 2) = account_id; WFIFOL(fd, 6) = char_id; - WFIFOB(fd,10) = type; - WFIFOB(fd,11) = flag; + WFIFOB(fd,10) =(uint8) type; + WFIFOB(fd,11) =(uint8) flag; memcpy(WFIFOP(fd, 12), name, NAME_LENGTH); WFIFOSET(fd, NAME_LENGTH+13); } Index: src/common/core.c --- src/common/core.c Base (BASE) +++ src/common/core.c Locally Modified (Based On LOCAL) @@ -181,20 +181,22 @@ const char *postfix = "/"EXPAND_AND_QUOTE(SVNNODEPATH)")"; // there should exist only 1 entry like this size_t prefix_len = strlen(prefix); size_t postfix_len = strlen(postfix); - size_t i,j,len; + size_t i,j, slen; + long int len; char *buffer; // read file to buffer fseek(fp, 0, SEEK_END); len = ftell(fp); - buffer = (char *)aMalloc(len + 1); + slen = sizeof(len); + buffer = (char *)aMalloc(slen + 1); fseek(fp, 0, SEEK_SET); - len = fread(buffer, 1, len, fp); - buffer[len] = '\0'; + slen = fread(buffer, 1, slen, fp); + buffer[slen] = '\0'; fclose(fp); // parse buffer - for (i = prefix_len + 1; i + postfix_len <= len; ++i) { + for (i = prefix_len + 1; i + postfix_len <= slen; ++i) { if (buffer[i] != postfix[0] || memcmp(buffer + i, postfix, postfix_len) != 0) continue; // postfix missmatch for (j = i; j > 0; --j) { Index: src/common/grfio.c --- src/common/grfio.c Base (BASE) +++ src/common/grfio.c Locally Modified (Based On LOCAL) @@ -198,7 +198,7 @@ scycle = 7; // so decrypt/de-shuffle periodically - j = -1; // 0, adjusted to fit the ++j step + j =(size_t) -1; // 0, adjusted to fit the ++j step for (i = 20; i < nblocks; ++i) { if (i % dcycle == 0) { // decrypt block @@ -414,7 +414,7 @@ FILELIST *entry = filelist_find(fname); if (entry == NULL || entry->gentry <= 0) { // LocalFileCheck char lfname[256]; - int declen; + unsigned int declen; FILE *in; grfio_localpath_create(lfname, sizeof(lfname), (entry && entry->fnd) ? entry->fnd : fname); @@ -443,7 +443,7 @@ char *grfname = gentry_table[entry->gentry - 1]; FILE *in = fopen(grfname, "rb"); if (in != NULL) { - int fsize = entry->srclen_aligned; + unsigned int fsize = entry->srclen_aligned; unsigned char *buf = (unsigned char *)aMalloc(fsize); fseek(in, entry->srcpos, 0); if (fread(buf, 1, fsize, in) != fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname); @@ -513,7 +513,8 @@ /// @param gentry index of the grf file name in the gentry_table static int grfio_entryread(const char *grfname, int gentry) { - long grf_size,list_size; + long grf_size; + unsigned int list_size; unsigned char grf_header[0x2e]; int entry,entrys,ofs,grf_version; unsigned char *grf_filelist; @@ -578,7 +579,7 @@ #ifdef GRFIO_LOCAL aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck #else - aentry.gentry = gentry+1; // With no first time LocalFileCheck + aentry.gentry =(char) gentry+1; // With no first time LocalFileCheck #endif filelist_modify(&aentry); } @@ -630,13 +631,13 @@ aentry.srclen_aligned = getlong(grf_filelist+ofs2+4); aentry.declen = getlong(grf_filelist+ofs2+8); aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e; - aentry.type = type; + aentry.type =(char) type; safestrncpy(aentry.fn, fname, sizeof(aentry.fn)); aentry.fnd = NULL; #ifdef GRFIO_LOCAL aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck #else - aentry.gentry = gentry+1; // With no first time LocalFileCheck + aentry.gentry =(char) gentry+1; // With no first time LocalFileCheck #endif filelist_modify(&aentry); } Index: src/common/malloc.c --- src/common/malloc.c Base (BASE) +++ src/common/malloc.c Locally Modified (Based On LOCAL) @@ -249,7 +249,7 @@ p->unit_head.block = NULL; p->unit_head.size = 0; p->unit_head.file = file; - p->unit_head.line = line; + p->unit_head.line =(unsigned short) line; p->prev = NULL; if (unit_head_large_first == NULL) p->next = NULL; @@ -318,7 +318,7 @@ head->block = block; head->file = file; - head->line = line; + head->line = (short) line; head->size = (unsigned short)size; *(long *)((char *)head + sizeof(struct unit_head) - sizeof(long) + size) = 0xdeadbeaf; return (char *)head + sizeof(struct unit_head) - sizeof(long); @@ -415,7 +415,7 @@ #ifdef DEBUG_MEMMGR memset(ptr, 0xfd, block->unit_size - sizeof(struct unit_head) + sizeof(long)); head->file = file; - head->line = line; + head->line = (short) line; #endif memmgr_assert(block->unit_used > 0); if (--block->unit_used == 0) { Index: src/common/mapindex.c --- src/common/mapindex.c Base (BASE) +++ src/common/mapindex.c Locally Modified (Based On LOCAL) @@ -117,7 +117,7 @@ unsigned short mapindex_name2id(const char *name) { //TODO: Perhaps use a db to speed this up? [Skotlex] - int i; + unsigned short i; char map_name[MAP_NAME_LENGTH]; mapindex_getmapname(name, map_name); Index: src/common/mmo.h --- src/common/mmo.h Base (BASE) +++ src/common/mmo.h Locally Modified (Based On LOCAL) @@ -283,12 +283,7 @@ unsigned int exp; short rename_flag; short vaporize; //albator - int str ; - int agi ; - int vit ; - int int_ ; - int dex ; - int luk ; + unsigned short str, agi, vit, int_, dex, luk; }; struct s_mercenary { @@ -305,8 +300,9 @@ int char_id; short class_; int mode; - int hp, sp, max_hp, max_sp, str, agi, vit, int_, dex, luk; - int life_time; + unsigned int hp, sp, max_hp, max_sp; + unsigned short str, agi, vit, int_, dex, luk; + unsigned int life_time; }; struct s_friend { Index: src/common/socket.c --- src/common/socket.c Base (BASE) +++ src/common/socket.c Locally Modified (Based On LOCAL) @@ -18,6 +18,9 @@ #include "../common/winapi.h" #else #include +#ifdef __linux__ + #include +#endif #include #include #include Index: src/common/socket.h --- src/common/socket.h Base (BASE) +++ src/common/socket.h Locally Modified (Based On LOCAL) @@ -73,9 +73,9 @@ struct socket_data { struct { - unsigned char eof : 1; - unsigned char server : 1; - unsigned char ping : 2; + int eof : 1; + int server : 1; + int ping : 2; } flag; uint32 client_addr; // remote client address Index: src/login/account_sql.c --- src/login/account_sql.c Base (BASE) +++ src/login/account_sql.c Locally Modified (Based On LOCAL) @@ -279,7 +279,7 @@ else if (strcmpi(key, "codepage") == 0) safestrncpy(db->codepage, value, sizeof(db->codepage)); else if (strcmpi(key, "case_sensitive") == 0) - db->case_sensitive = config_switch(value); + db->case_sensitive =(bool) config_switch(value); else if (strcmpi(key, "account_db") == 0) safestrncpy(db->account_db, value, sizeof(db->account_db)); else if (strcmpi(key, "accreg_db") == 0) Index: src/map/atcommand.c --- src/map/atcommand.c Base (BASE) +++ src/map/atcommand.c Locally Modified (Based On LOCAL) @@ -271,7 +271,7 @@ len=SHRT_MAX-4; // maximum length off=4; } - WFIFOHEAD(fd, len); + WFIFOHEAD(fd, sizeof(len)); WFIFOW(fd,0)=TOW(type); // parse packet contents @@ -415,7 +415,7 @@ // terminate the string if (off < end) { // fill the rest with 0's - memset(WFIFOP(fd,off),0,end-off); + memset(WFIFOP(fd,off),0,sizeof(end)-sizeof(off)); off=end; } } else { @@ -429,12 +429,12 @@ if (packet_db[sd->packet_ver][type].len == -1) { // send dynamic packet WFIFOW(fd,2)=TOW(off); - WFIFOSET(fd,off); + WFIFOSET(fd,sizeof(off)); } else { // send static packet if (off < len) - memset(WFIFOP(fd,off),0,len-off); - WFIFOSET(fd,len); + memset(WFIFOP(fd,off),0,sizeof(len)-sizeof(off)); + WFIFOSET(fd,sizeof(len)); } } else { clif_displaymessage(fd, msg_txt(259)); // Invalid packet @@ -736,7 +736,7 @@ if (sscanf(message, "%199[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) - match_text[j] = TOLOWER(match_text[j]); + match_text[j] =(char) TOLOWER(match_text[j]); count = 0; level = pc_get_group_level(sd); @@ -750,7 +750,7 @@ if (match_text[0]) { memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) - player_name[j] = TOLOWER(player_name[j]); + player_name[j] =(char) TOLOWER(player_name[j]); // search with no case sensitive if (strstr(player_name, match_text) == NULL) continue; @@ -845,19 +845,19 @@ *------------------------------------------*/ ACMD_FUNC(speed) { - int speed; + unsigned short speed; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!message || !*message || sscanf(message, "%d", &speed) < 1) { + if (!message || !*message || sscanf(message, "%hui", &speed) < 1) { sprintf(atcmd_output, msg_txt(918), MIN_WALK_SPEED, MAX_WALK_SPEED); // Please enter a speed value (usage: @speed <%d-%d>). clif_displaymessage(fd, atcmd_output); return -1; } - sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); + sd->base_status.speed =(unsigned short) cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); status_calc_bl(&sd->bl, SCB_SPEED); clif_displaymessage(fd, msg_txt(8)); // Speed changed. return 0; @@ -920,10 +920,11 @@ *------------------------------------------*/ ACMD_FUNC(option) { - int param1 = 0, param2 = 0, param3 = 0; + unsigned short param1 = 0, param2 = 0; + unsigned int param3 = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %d %d", ¶m1, ¶m2, ¶m3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) { + if (!message || !*message || sscanf(message, "%hu %hu %u", ¶m1, ¶m2, ¶m3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) { // failed to match the parameters so inform the user of the options const char *text = NULL; @@ -1092,9 +1093,9 @@ sscanf(message, "%199[^\n]", atcmd_output); if (strstr(command, "l") != NULL) - clif_broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, 0, ALL_SAMEMAP); + clif_broadcast(&sd->bl, atcmd_output,(int)strlen(atcmd_output) + 1, 0, ALL_SAMEMAP); else - intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? 0x10 : 0); + intif_broadcast(atcmd_output,(int)strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? 0x10 : 0); } else { if (!message || !*message || (sscanf(message, "%lx %199[^\n]", &color, atcmd_output) < 2)) { clif_displaymessage(fd, msg_txt(981)); // Please enter color and message (usage: @kamic ). @@ -1105,7 +1106,7 @@ clif_displaymessage(fd, msg_txt(982)); // Invalid color. return -1; } - intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0); + intif_broadcast2(atcmd_output, (int)strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0); } return 0; } @@ -1174,7 +1175,8 @@ ACMD_FUNC(item) { char item_name[100]; - int number = 0, item_id, flag = 0; + int number = 0, flag = 0; + short item_id; struct item item_tmp; struct item_data *item_data; int get_count, i; @@ -1210,7 +1212,7 @@ if (!pet_create_egg(sd, item_id)) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; - item_tmp.identify = 1; + item_tmp.identify = (short) 1; if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif_additem(sd, 0, 0, flag); @@ -1230,18 +1232,19 @@ struct item item_tmp; struct item_data *item_data; char item_name[100]; - int item_id, number = 0; - int identify = 0, refine = 0, attr = 0; - int c1 = 0, c2 = 0, c3 = 0, c4 = 0; + int number = 0; + short c1 = 0, c2 = 0, c3 = 0, c4 = 0; int flag = 0; int loop, get_count, i; + short item_id; + char identify = 0, refine = 0, attr=0; nullpo_retr(-1, sd); memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && - sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 + sscanf(message, "\"%99[^\"]\" %d %c %c %c %hd %hd %hd %hd", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && + sscanf(message, "%99s %d %c %c %c %hd %hd %hd %hd", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 )) { clif_displaymessage(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 clif_displaymessage(fd, msg_txt(985)); // ). @@ -1273,7 +1276,8 @@ refine = MAX_REFINE; } else { identify = 1; - refine = attr = 0; + refine = 0; + attr = 0; } for (i = 0; i < loop; i++) { memset(&item_tmp, 0, sizeof(item_tmp)); @@ -1322,10 +1326,12 @@ *------------------------------------------*/ ACMD_FUNC(baselevelup) { - int level=0, i=0, status_point=0; + unsigned int level=0; + int i=0, status_point=0; nullpo_retr(-1, sd); - level = atoi(message); + sscanf(message, "%ud", &level); + if (!message || !*message || !level) { clif_displaymessage(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup ). return -1; @@ -1336,7 +1342,7 @@ clif_displaymessage(fd, msg_txt(47)); // Base level can't go any higher. return -1; } // End Addition - if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow + if (level > pc_maxbaselv(sd) || level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow level = pc_maxbaselv(sd) - sd->status.base_level; for (i = 0; i < level; i++) status_point += pc_gets_status_point(sd->status.base_level + i); @@ -1352,7 +1358,7 @@ return -1; } level*=-1; - if ((unsigned int)level >= sd->status.base_level) + if (level >= sd->status.base_level) level = sd->status.base_level-1; for (i = 0; i > -level; i--) status_point += pc_gets_status_point(sd->status.base_level + i - 1); @@ -1362,7 +1368,7 @@ sd->status.status_point = 0; else sd->status.status_point -= status_point; - sd->status.base_level -= (unsigned int)level; + sd->status.base_level -= level; clif_displaymessage(fd, msg_txt(22)); // Base level lowered. } sd->status.base_exp = 0; @@ -1826,7 +1832,7 @@ // get possible name of the city map_name[MAP_NAME_LENGTH-1] = '\0'; for (i = 0; map_name[i]; i++) - map_name[i] = TOLOWER(map_name[i]); + map_name[i] = (char) TOLOWER(map_name[i]); // try to identify the map name if (strncmp(map_name, "prontera", 3) == 0) { town = 0; @@ -2083,13 +2089,14 @@ *------------------------------------------*/ ACMD_FUNC(refine) { - int i,j, position = 0, refine = 0, current_position, final_refine; + int i,j, position = 0, current_position; + char final_refine, refine = 0; int count; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { + if (!message || !*message || sscanf(message, "%d %c", &position, &refine) < 2) { clif_displaymessage(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <+/- amount>). sprintf(atcmd_output, msg_txt(997), EQP_HEAD_LOW); // %d: Lower Headgear clif_displaymessage(fd, atcmd_output); @@ -2162,7 +2169,8 @@ ACMD_FUNC(produce) { char item_name[100]; - int item_id, attribute = 0, star = 0; + short attribute = 0, item_id=0; + int star = 0; int flag = 0; struct item_data *item_data; struct item tmp_item; @@ -2172,8 +2180,8 @@ memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 && - sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1 + sscanf(message, "\"%99[^\"]\" %hi %d", item_name, &attribute, &star) < 1 && + sscanf(message, "%99s %hi %d", item_name, &attribute, &star) < 1 )) { clif_displaymessage(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <# of very's>). return -1; @@ -2197,8 +2205,7 @@ tmp_item.amount = 1; tmp_item.identify = 1; tmp_item.card[0] = CARD0_FORGE; - tmp_item.card[1] = item_data->type==IT_WEAPON? - ((star*5) << 8) + attribute:0; + tmp_item.card[1] = ((short) item_data->type==IT_WEAPON?((star*5) << 8) + attribute:0); tmp_item.card[2] = GetWord(sd->status.char_id, 0); tmp_item.card[3] = GetWord(sd->status.char_id, 1); clif_produceeffect(sd, 0, item_id); @@ -2404,7 +2411,8 @@ *------------------------------------------*/ ACMD_FUNC(param) { - int i, value = 0, new_value, max; + int i; + short value = 0, new_value, max; const char *param[] = { "str", "agi", "vit", "int", "dex", "luk" }; short *status[6]; //we don't use direct initialization because it isn't part of the c standard. @@ -2412,7 +2420,7 @@ memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { + if (!message || !*message || sscanf(message, "%hi", &value) < 1 || value == 0) { clif_displaymessage(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). return -1; } @@ -2466,8 +2474,8 @@ *------------------------------------------*/ ACMD_FUNC(stat_all) { - int index, count, value, max, new_value; - short *status[6]; + int index, count; + short *status[6], new_value, value, max; //we don't use direct initialization because it isn't part of the c standard. nullpo_retr(-1, sd); @@ -2478,19 +2486,17 @@ status[4] = &sd->status.dex; status[5] = &sd->status.luk; - if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { + if (!message || !*message || sscanf(message, "%hi", &value) < 1) { value = pc_maxparameter(sd); - max = pc_maxparameter(sd); - } else { + } + if (battle_config.atcommand_max_stat_bypass) max = SHRT_MAX; else max = pc_maxparameter(sd); - } count = 0; for (index = 0; index < ARRAYLENGTH(status); index++) { - if (value > 0 && *status[index] > max - value) new_value = max; else if (value < 0 && *status[index] <= -value) @@ -2621,11 +2627,11 @@ *------------------------------------------*/ ACMD_FUNC(petfriendly) { - int friendly; + short friendly; struct pet_data *pd; nullpo_retr(-1, sd); - if (!message || !*message || (friendly = atoi(message)) < 0) { + if (!message || !*message || sscanf(message, "%hi", &friendly) < 1) { clif_displaymessage(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>). return -1; } @@ -2657,11 +2663,11 @@ *------------------------------------------*/ ACMD_FUNC(pethungry) { - int hungry; + short hungry; struct pet_data *pd; nullpo_retr(-1, sd); - if (!message || !*message || (hungry = atoi(message)) < 0) { + if (!message || !*message || sscanf(message, "%hi", &hungry) < 1) { clif_displaymessage(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>). return -1; } @@ -3214,11 +3220,11 @@ *------------------------------------------*/ ACMD_FUNC(spiritball) { - int max_spiritballs; - int number; + short max_spiritballs; + short number; nullpo_retr(-1, sd); - max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF); + max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), SHRT_MAX); if (!message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs) { char msg[CHAT_SIZE_MAX]; @@ -5262,12 +5268,11 @@ { struct map_session_data *pl_sd = NULL; struct block_list *bl; - int skillnum; - int skilllv; + short skillnum, skilllv; char target[100]; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &skillnum, &skilllv, target) != 3) { + if (!message || !*message || sscanf(message, "%hi %hi %23[^\n]", &skillnum, &skilllv, target) != 3) { clif_displaymessage(fd, msg_txt(1165)); // Usage: @useskill return -1; } @@ -5376,7 +5381,8 @@ // Hand a ring with partners name on it to this char void getring(struct map_session_data *sd) { - int flag, item_id; + int flag; + short item_id; struct item item_tmp; item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F; @@ -5384,7 +5390,7 @@ item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.card[0] = 255; - item_tmp.card[2] = sd->status.partner_id; + item_tmp.card[2] = sd->status.partner_id & 0xF; item_tmp.card[3] = sd->status.partner_id >> 16; if ((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) { @@ -7589,7 +7595,7 @@ *------------------------------------------*/ ACMD_FUNC(invite) { - unsigned int did = sd->duel_group; + int did = sd->duel_group; struct map_session_data *target_sd = map_nick2sd((char *)message); if (did <= 0) { @@ -8284,18 +8290,20 @@ *------------------------------------------*/ ACMD_FUNC(font) { - int font_id; + unsigned short font_id; nullpo_retr(-1,sd); - font_id = atoi(message); + if (!message || !*message || (sscanf(message, "%hui", &font_id) < 1 )) { + clif_displaymessage(fd, msg_txt(1357)); // Use @font <1-9> to change your message font. + clif_displaymessage(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font. + return -1; + } + if (font_id == 0) { if (sd->user_font) { sd->user_font = 0; clif_displaymessage(fd, msg_txt(1356)); // Returning to normal font. clif_font(sd); - } else { - clif_displaymessage(fd, msg_txt(1357)); // Use @font <1-9> to change your message font. - clif_displaymessage(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font. } } else if (font_id < 0 || font_id > 9) clif_displaymessage(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9. Index: src/map/duel.c --- src/map/duel.c Base (BASE) +++ src/map/duel.c Locally Modified (Based On LOCAL) @@ -52,7 +52,7 @@ if (sd->duel_group != ssd->duel_group) return 0; sprintf(output, " %d. %s", ++(*p), sd->status.name); - clif_disp_onlyself(ssd, output, strlen(output)); + clif_disp_onlyself(ssd, output,(int) strlen(output)); return 1; } @@ -73,7 +73,7 @@ duel_list[did].members_count, duel_list[did].members_count + duel_list[did].invites_count); - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output,(int) strlen(output)); map_foreachpc(duel_showinfo_sub, sd, &p); } @@ -92,27 +92,27 @@ duel_list[i].max_players_limit = maxpl; strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --" - clif_disp_onlyself(sd, output, strlen(output)); + clif_disp_onlyself(sd, output, (int) strlen(output)); clif_map_property(sd, MAPPROPERTY_FREEPVPZONE); //clif_misceffect2(&sd->bl, 159); return i; } -void duel_invite(const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd) +void duel_invite(const int did, struct map_session_data *sd, struct map_session_data *target_sd) { char output[256]; // " -- Player %s invites %s to duel --" sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name); - clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS); target_sd->duel_invite = did; duel_list[did].invites_count++; // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --" sprintf(output, msg_txt(374), sd->status.name); - clif_broadcast((struct block_list *)target_sd, output, strlen(output)+1, 0x10, SELF); + clif_broadcast((struct block_list *)target_sd, output,(int) strlen(output)+1, 0x10, SELF); } static int duel_leave_sub(struct map_session_data *sd, va_list va) @@ -129,7 +129,7 @@ // " <- Player %s has left duel --" sprintf(output, msg_txt(375), sd->status.name); - clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS); duel_list[did].members_count--; @@ -154,7 +154,7 @@ // " -> Player %s has accepted duel --" sprintf(output, msg_txt(376), sd->status.name); - clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS); clif_map_property(sd, MAPPROPERTY_FREEPVPZONE); //clif_misceffect2(&sd->bl, 159); @@ -166,7 +166,7 @@ // " -- Player %s has rejected duel --" sprintf(output, msg_txt(377), sd->status.name); - clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS); + clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS); duel_list[did].invites_count--; sd->duel_invite = 0; Index: src/map/duel.h --- src/map/duel.h Base (BASE) +++ src/map/duel.h Locally Modified (Based On LOCAL) @@ -7,7 +7,7 @@ struct duel { int members_count; int invites_count; - int max_players_limit; + unsigned int max_players_limit; }; #define MAX_DUEL 1024 @@ -16,7 +16,7 @@ //Duel functions // [LuzZza] int duel_create(struct map_session_data *sd, const unsigned int maxpl); -void duel_invite(const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd); +void duel_invite(const int did, struct map_session_data *sd, struct map_session_data *target_sd); void duel_accept(const unsigned int did, struct map_session_data *sd); void duel_reject(const unsigned int did, struct map_session_data *sd); void duel_leave(const unsigned int did, struct map_session_data *sd); Index: src/map/elemental.c --- src/map/elemental.c Base (BASE) +++ src/map/elemental.c Locally Modified (Based On LOCAL) @@ -59,7 +59,7 @@ return &elemental_db[i].vd; } -int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime) +int elemental_create(struct map_session_data *sd, short class_, unsigned int lifetime) { struct s_elemental ele; struct s_elemental_db *db; @@ -86,7 +86,7 @@ return 1; } -int elemental_get_lifetime(struct elemental_data *ed) +unsigned int elemental_get_lifetime(struct elemental_data *ed) { const struct TimerData *td; if (ed == NULL || ed->summon_timer == INVALID_TIMER) @@ -566,7 +566,8 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, unsigned int tick) { struct block_list *target = NULL; - int master_dist, view_range, mode; + unsigned int master_dist; + int view_range, mode; nullpo_ret(ed); nullpo_ret(sd); @@ -667,7 +668,8 @@ FILE *fp; char line[1024], *p; char *str[26]; - int i, j = 0, k = 0, ele; + int i, j = 0, k = 0; + unsigned char ele; struct s_elemental_db *db; struct status_data *status; @@ -760,7 +762,8 @@ char *str[4]; struct s_elemental_db *db; int i, j = 0, k = 0, class_; - int skillid, skilllv, skillmode; + unsigned short skillid, skilllv; + short skillmode; sprintf(line, "%s/%s", db_path, "elemental_skill_db.txt"); fp = fopen(line, "r"); Index: src/map/elemental.h --- src/map/elemental.h Base (BASE) +++ src/map/elemental.h Locally Modified (Based On LOCAL) @@ -59,7 +59,7 @@ bool elemental_class(int class_); struct view_data *elemental_get_viewdata(int class_); -int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime); +int elemental_create(struct map_session_data *sd, short class_, unsigned int lifetime); int elemental_data_received(struct s_elemental *ele, bool flag); int elemental_save(struct elemental_data *ed); @@ -72,7 +72,7 @@ int elemental_delete(struct elemental_data *ed, int reply); void elemental_summon_stop(struct elemental_data *ed); -int elemental_get_lifetime(struct elemental_data *ed); +unsigned int elemental_get_lifetime(struct elemental_data *ed); int elemental_unlocktarget(struct elemental_data *ed); int elemental_skillnotok(int skillid, struct elemental_data *ed); Index: src/map/itemdb.h --- src/map/itemdb.h Base (BASE) +++ src/map/itemdb.h Locally Modified (Based On LOCAL) @@ -85,7 +85,7 @@ #define UNKNOWN_ITEM_ID 512 struct item_data { - int nameid; + short nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; //Do not add stuff between value_buy and view_id (see how getiteminfo works) Index: src/map/map.c --- src/map/map.c Base (BASE) +++ src/map/map.c Locally Modified (Based On LOCAL) @@ -176,7 +176,7 @@ /*========================================== * server player count (this mapserver only) *------------------------------------------*/ -int map_usercount(void) +unsigned int map_usercount(void) { return pc_db->size(pc_db); } @@ -363,9 +363,9 @@ * Pass flag as 1 to prevent doing skill_unit_move checks * (which are executed by default on BL_CHAR types) *------------------------------------------*/ -int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) +int map_moveblock(struct block_list *bl, short x1, short y1, unsigned int tick) { - int x0 = bl->x, y0 = bl->y; + short x0 = bl->x, y0 = bl->y; struct status_change *sc = NULL; int moveblock = (x0/BLOCK_SIZE != x1/BLOCK_SIZE || y0/BLOCK_SIZE != y1/BLOCK_SIZE); @@ -469,9 +469,9 @@ /*========================================== * Counts specified number of objects on given cell. *------------------------------------------*/ -int map_count_oncell(int m, int x, int y, int type) +int map_count_oncell(short m, short x, short y, int type) { - int bx,by; + short bx,by; struct block_list *bl; int count = 0; @@ -497,7 +497,7 @@ * Looks for a skill unit on a given cell * flag&1: runs battle_check_target check based on unit->group->target_flag */ -struct skill_unit *map_find_skill_unit_oncell(struct block_list *target,int x,int y,int skill_id,struct skill_unit *out_unit, int flag) { +struct skill_unit *map_find_skill_unit_oncell(struct block_list *target,short x,short y,short skill_id,struct skill_unit *out_unit, int flag) { int m,bx,by; struct block_list *bl; struct skill_unit *unit; @@ -525,7 +525,7 @@ /*========================================== * Adapted from foreachinarea for an easier invocation. [Skotlex] *------------------------------------------*/ -int map_foreachinrange(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int type, ...) +int map_foreachinrange(int (*func)(struct block_list *,va_list), struct block_list *center, short range, int type, ...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -590,7 +590,7 @@ /*========================================== * Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex] *------------------------------------------*/ -int map_foreachinshootrange(int (*func)(struct block_list *,va_list),struct block_list *center, int range, int type,...) +int map_foreachinshootrange(int (*func)(struct block_list *,va_list),struct block_list *center, short range, int type,...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -661,7 +661,7 @@ * Apply *func with ... arguments for the range. * @type = BL_PC/BL_MOB etc.. *------------------------------------------*/ -int map_foreachinarea(int (*func)(struct block_list *,va_list), int m, int x0, int y0, int x1, int y1, int type, ...) +int map_foreachinarea(int (*func)(struct block_list *,va_list), short m, short x0, short y0, short x1, short y1, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -679,8 +679,8 @@ x0 = max(x0, 0); y0 = max(y0, 0); - x1 = min(x1, map[ m ].xs - 1); - y1 = min(y1, map[ m ].ys - 1); + x1 =(short) min(x1, map[ m ].xs - 1); + y1 =(short) min(y1, map[ m ].ys - 1); if (type&~BL_MOB) for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) @@ -715,7 +715,7 @@ /*========================================== * Adapted from forcountinarea for an easier invocation. [pakpil] *------------------------------------------*/ -int map_forcountinrange(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int count, int type, ...) +int map_forcountinrange(int (*func)(struct block_list *,va_list), struct block_list *center, short range, int count, int type, ...) { int bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -777,7 +777,7 @@ bl_list_count = blockcount; return returnCount; //[Skotlex] } -int map_forcountinarea(int (*func)(struct block_list *,va_list), int m, int x0, int y0, int x1, int y1, int count, int type, ...) +int map_forcountinarea(int (*func)(struct block_list *,va_list), short m, short x0, short y0, short x1, short y1, int count, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -795,8 +795,8 @@ x0 = max(x0, 0); y0 = max(y0, 0); - x1 = min(x1, map[ m ].xs - 1); - y1 = min(y1, map[ m ].ys - 1); + x1 =(short) min(x1, map[ m ].xs - 1); + y1 =(short) min(y1, map[ m ].ys - 1); if (type&~BL_MOB) for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) @@ -837,13 +837,13 @@ * Move bl and do func* with va_list while moving. * Mouvement is set by dx dy wich are distance in x and y *------------------------------------------*/ -int map_foreachinmovearea(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int dx, int dy, int type, ...) +int map_foreachinmovearea(int (*func)(struct block_list *,va_list), struct block_list *center, short range, short dx, short dy, int type, ...) { - int bx, by, m; + short bx, by, m; int returnCount = 0; //total sum of returned values of func() [Skotlex] struct block_list *bl; int blockcount = bl_list_count, i; - int x0, x1, y0, y1; + short x0, x1, y0, y1; va_list ap; if (!range) return 0; @@ -877,8 +877,8 @@ x0 = max(x0, 0); y0 = max(y0, 0); - x1 = min(x1, map[ m ].xs - 1); - y1 = min(y1, map[ m ].ys - 1); + x1 =(short) min(x1, map[ m ].xs - 1); + y1 =(short) min(y1, map[ m ].ys - 1); for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { @@ -905,8 +905,8 @@ x0 = max(x0, 0); y0 = max(y0, 0); - x1 = min(x1, map[ m ].xs - 1); - y1 = min(y1, map[ m ].ys - 1); + x1 =(short) min(x1, map[ m ].xs - 1); + y1 =(short) min(y1, map[ m ].ys - 1); for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { @@ -962,7 +962,7 @@ // which only checks the exact single x/y passed to it rather than an // area radius - may be more useful in some instances) // -int map_foreachincell(int (*func)(struct block_list *,va_list), int m, int x, int y, int type, ...) +int map_foreachincell(int (*func)(struct block_list *,va_list), short m, short x, short y, int type, ...) { int bx, by; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -1005,7 +1005,7 @@ /*============================================================ * For checking a path between two points (x0, y0) and (x1, y1) *------------------------------------------------------------*/ -int map_foreachinpath(int (*func)(struct block_list *,va_list),int m,int x0,int y0,int x1,int y1,int range,int length, int type,...) +int map_foreachinpath(int (*func)(struct block_list *,va_list),short m,short x0,short y0,short x1,short y1,short range,int length, int type,...) { int returnCount = 0; //total sum of returned values of func() [Skotlex] ////////////////////////////////////////////////////////////// @@ -1092,8 +1092,8 @@ mx0 = max(mx0, 0); my0 = max(my0, 0); - mx1 = min(mx1, map[ m ].xs - 1); - my1 = min(my1, map[ m ].ys - 1); + mx1 =(short) min(mx1, map[ m ].xs - 1); + my1 =(short) min(my1, map[ m ].ys - 1); range *= range << 8; //Values are shifted later on for higher precision using int math. @@ -1183,7 +1183,7 @@ } // Copy of map_foreachincell, but applied to the whole map. [Skotlex] -int map_foreachinmap(int (*func)(struct block_list *,va_list), int m, int type,...) +int map_foreachinmap(int (*func)(struct block_list *,va_list), short m, int type,...) { int b, bsize; int returnCount = 0; //total sum of returned values of func() [Skotlex] @@ -1300,7 +1300,7 @@ * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success. * x and y are modified with the target cell when successful. *------------------------------------------*/ -int map_searchrandfreecell(int m,int *x,int *y,int stack) +int map_searchrandfreecell(short m,short *x,short *y,int stack) { int free_cell,i,j; int free_cells[9][2]; @@ -1346,10 +1346,10 @@ * &2 = the target should be able to walk to the target tile. * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting) *------------------------------------------*/ -int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx, int ry, int flag) +int map_search_freecell(struct block_list *src, short m, short *x,short *y, short rx, short ry, int flag) { int tries, spawn=0; - int bx, by; + short bx, by; int rx2 = 2*rx+1; int ry2 = 2*ry+1; @@ -1417,7 +1417,7 @@ * @first_charid, @second_charid, @third_charid, looting priority * @flag: &1 MVP item. &2 do stacking check. *------------------------------------------*/ -int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags) +int map_addflooritem(struct item *item_data,int amount,short m,short x,short y,int first_charid,int second_charid,int third_charid,int flags) { int r; struct flooritem_data *fitem=NULL; @@ -1690,7 +1690,7 @@ if (map[sd->bl.m].instance_id) { // Avoid map conflicts and warnings on next login - int m; + short m; struct point *pt; if (map[sd->bl.m].save.map) pt = &map[sd->bl.m].save; @@ -1839,7 +1839,7 @@ /*========================================== * Convext Mirror *------------------------------------------*/ -struct mob_data *map_getmob_boss(int m) { +struct mob_data *map_getmob_boss(short m) { DBIterator *iter; struct mob_data *md = NULL; bool found = false; @@ -2131,9 +2131,9 @@ *-----------------------------------------*/ // Stores the spawn data entry in the mob list. // Returns the index of successful, or -1 if the list was full. -int map_addmobtolist(unsigned short m, struct spawn_data *spawn) +int map_addmobtolist(short m, struct spawn_data *spawn) { - size_t i; + int i; ARR_FIND(0, MAX_MOB_LIST_PER_MAP, i, map[m].moblist[i] == NULL); if (i < MAX_MOB_LIST_PER_MAP) { map[m].moblist[i] = spawn; @@ -2142,7 +2142,7 @@ return -1; } -void map_spawnmobs(int m) +void map_spawnmobs(short m) { int i, k=0; if (map[m].mob_delete_timer != INVALID_TIMER) { @@ -2216,7 +2216,7 @@ return 1; } -void map_removemobs(int m) +void map_removemobs(short m) { if (map[m].mob_delete_timer != INVALID_TIMER) // should never happen return; //Mobs are already scheduled for removal @@ -2306,7 +2306,7 @@ /*========================================== * Returns the direction of the given cell, relative to 'src' *------------------------------------------*/ -uint8 map_calc_dir(struct block_list *src, int x, int y) +uint8 map_calc_dir(struct block_list *src, short x, short y) { unsigned char dir = 0; int dx, dy; @@ -2441,12 +2441,12 @@ /*========================================== * Confirm if celltype in (m,x,y) match the one given in cellchk *------------------------------------------*/ -int map_getcell(int m,int x,int y,cell_chk cellchk) +int map_getcell(short m,short x,short y,cell_chk cellchk) { return (m < 0 || m >= MAX_MAP_PER_SERVER) ? 0 : map_getcellp(&map[m],x,y,cellchk); } -int map_getcellp(struct map_data *m,int x,int y,cell_chk cellchk) +int map_getcellp(struct map_data *m,short x,short y,cell_chk cellchk) { struct mapcell cell; @@ -2522,7 +2522,7 @@ * 'cell' - which flag to modify * 'flag' - true = on, false = off *------------------------------------------*/ -void map_setcell(int m, int x, int y, cell_t cell, bool flag) +void map_setcell(short m, short x, short y, cell_t cell, bool flag) { int j; @@ -2569,7 +2569,7 @@ } } -void map_setgatcell(int m, int x, int y, int gat) +void map_setgatcell(short m, short x, short y, int gat) { int j; struct mapcell cell; @@ -2590,7 +2590,7 @@ *------------------------------------------*/ static DBMap *iwall_db; -void map_iwall_nextxy(int x, int y, int dir, int pos, int *x1, int *y1) +void map_iwall_nextxy(short x, short y, int dir, int pos, short *x1, short *y1) { if (dir == 0 || dir == 4) *x1 = x; // Keep X @@ -2607,7 +2607,7 @@ *y1 = y + pos; } -bool map_iwall_set(int m, int x, int y, int size, int dir, bool shootable, const char *wall_name) +bool map_iwall_set(short m, short x, short y, int size, int dir, bool shootable, const char *wall_name) { struct iwall_data *iwall; int i, x1 = 0, y1 = 0; @@ -3512,7 +3512,8 @@ *------------------------------------------*/ void do_final(void) { - int i, j; + short i; + int j; struct map_session_data *sd; struct s_mapiterator *iter; Index: src/map/map.h --- src/map/map.h Base (BASE) +++ src/map/map.h Locally Modified (Based On LOCAL) @@ -466,20 +466,18 @@ struct mapcell { // terrain flags - unsigned char - walkable : 1, - shootable : 1, - water : 1; + int walkable : 1; + int shootable : 1; + int water : 1; // dynamic flags - unsigned char - npc : 1, - basilica : 1, - landprotector : 1, - novending : 1, - nochat : 1, - maelstrom : 1, - icewall : 1; + int npc : 1; + int basilica : 1; + int landprotector : 1; + int novending : 1; + int nochat : 1; + int maelstrom : 1; + int icewall : 1; #ifdef CELL_NOSTACK unsigned char cell_bl; //Holds amount of bls in this cell. @@ -498,7 +496,7 @@ struct mapcell *cell; // Holds the information of each map cell (NULL if the map is not on this map-server). struct block_list **block; struct block_list **block_mob; - int m; + short m; //mapid short xs,ys; // map dimensions (in cells) short bxs,bys; // map dimensions (in blocks) short bgscore_lion, bgscore_eagle; // Battleground ScoreBoard @@ -596,10 +594,10 @@ uint16 port; }; -int map_getcell(int,int,int,cell_chk); +int map_getcell(short,short,short,cell_chk); int map_getcellp(struct map_data *,int,int,cell_chk); -void map_setcell(int m, int x, int y, cell_t cell, bool flag); -void map_setgatcell(int m, int x, int y, int gat); +void map_setcell(short m, short x, short y, cell_t cell, bool flag); +void map_setgatcell(short m, short x, short y, int gat); extern struct map_data map[]; extern int map_num; @@ -623,7 +621,7 @@ // users void map_setusers(int); int map_getusers(void); -int map_usercount(void); +unsigned int map_usercount(void); // blocklist lock int map_freeblock(struct block_list *bl); @@ -632,22 +630,22 @@ // blocklist manipulation int map_addblock(struct block_list *bl); int map_delblock(struct block_list *bl); -int map_moveblock(struct block_list *, int, int, unsigned int); -int map_foreachinrange(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int type, ...); -int map_foreachinshootrange(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int type, ...); -int map_foreachinarea(int (*func)(struct block_list *,va_list), int m, int x0, int y0, int x1, int y1, int type, ...); -int map_forcountinrange(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int count, int type, ...); -int map_forcountinarea(int (*func)(struct block_list *,va_list), int m, int x0, int y0, int x1, int y1, int count, int type, ...); -int map_foreachinmovearea(int (*func)(struct block_list *,va_list), struct block_list *center, int range, int dx, int dy, int type, ...); -int map_foreachincell(int (*func)(struct block_list *,va_list), int m, int x, int y, int type, ...); -int map_foreachinpath(int (*func)(struct block_list *,va_list), int m, int x0, int y0, int x1, int y1, int range, int length, int type, ...); -int map_foreachinmap(int (*func)(struct block_list *,va_list), int m, int type, ...); +int map_moveblock(struct block_list *, short, short, unsigned int); +int map_foreachinrange(int (*func)(struct block_list *,va_list), struct block_list *center, short range, int type, ...); +int map_foreachinshootrange(int (*func)(struct block_list *,va_list), struct block_list *center, short range, int type, ...); +int map_foreachinarea(int (*func)(struct block_list *,va_list), short m, short x0, short y0, short x1, short y1, int type, ...); +int map_forcountinrange(int (*func)(struct block_list *,va_list), struct block_list *center, short range, int count, int type, ...); +int map_forcountinarea(int (*func)(struct block_list *,va_list), short m, short x0, short y0, short x1, short y1, int count, int type, ...); +int map_foreachinmovearea(int (*func)(struct block_list *,va_list), struct block_list *center, short range, short dx, short dy, int type, ...); +int map_foreachincell(int (*func)(struct block_list *,va_list), short m, short x, short y, int type, ...); +int map_foreachinpath(int (*func)(struct block_list *,va_list), short m, short x0, short y0, short x1, short y1, short range, int length, int type, ...); +int map_foreachinmap(int (*func)(struct block_list *,va_list), short m, int type, ...); //blocklist nb in one cell -int map_count_oncell(int m,int x,int y,int type); -struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int x,int y,int skill_id,struct skill_unit *, int flag); +int map_count_oncell(short m,short x,short y,int type); +struct skill_unit *map_find_skill_unit_oncell(struct block_list *,short x,short y,short skill_id,struct skill_unit *, int flag); // search and creation int map_get_new_object_id(void); -int map_search_freecell(struct block_list *src, int m, short *x, short *y, int rx, int ry, int flag); +int map_search_freecell(struct block_list *src, short m, short *x, short *y, short rx, short ry, int flag); // int map_quit(struct map_session_data *); // npc @@ -657,7 +655,7 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data); int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data); void map_clearflooritem(struct block_list *bl); -int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags); +int map_addflooritem(struct item *item_data,int amount,short m,short x,short y,int first_charid,int second_charid,int third_charid,int flags); // player to map session void map_addnickdb(int charid, const char *nick); @@ -690,7 +688,7 @@ void map_foreachregen(int (*func)(struct block_list *bl, va_list args), ...); void map_foreachiddb(int (*func)(struct block_list *bl, va_list args), ...); struct map_session_data *map_nick2sd(const char *); -struct mob_data *map_getmob_boss(int m); +struct mob_data *map_getmob_boss(short m); struct mob_data *map_id2boss(int id); // reload config file looking only for npcs @@ -716,7 +714,7 @@ #define mapit_geteachiddb() mapit_alloc(MAPIT_NORMAL,BL_ALL) int map_check_dir(int s_dir,int t_dir); -unsigned char map_calc_dir(struct block_list *src,int x,int y); +uint8 map_calc_dir(struct block_list *src,short x,short y); int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex] int cleanup_sub(struct block_list *bl, va_list ap); @@ -728,9 +726,9 @@ void map_iwall_get(struct map_session_data *sd); void map_iwall_remove(const char *wall_name); -int map_addmobtolist(unsigned short m, struct spawn_data *spawn); // [Wizputer] -void map_spawnmobs(int); // [Wizputer] -void map_removemobs(int); // [Wizputer] +int map_addmobtolist(short m, struct spawn_data *spawn); // [Wizputer] +void map_spawnmobs(short); // [Wizputer] +void map_removemobs(short); // [Wizputer] void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex] void map_addmap2db(struct map_data *m); void map_removemapdb(struct map_data *m); Index: src/map/pc.c --- src/map/pc.c Base (BASE) +++ src/map/pc.c Locally Modified (Based On LOCAL) @@ -5924,7 +5924,7 @@ } // Calculates the number of status points PC gets when leveling up (from level to level+1) -int pc_gets_status_point(int level) +unsigned int pc_gets_status_point(int level) { if (battle_config.use_statpoint_table) //Use values from "db/statpoint.txt" return (statp[level+1] - statp[level]); @@ -9003,7 +9003,7 @@ /*========================================== * Memo player sd savepoint. (map,x,y) *------------------------------------------*/ -int pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y) +int pc_setsavepoint(struct map_session_data *sd, unsigned short mapindex,int x,int y) { nullpo_ret(sd); Index: src/map/pc.h --- src/map/pc.h Base (BASE) +++ src/map/pc.h Locally Modified (Based On LOCAL) @@ -475,7 +475,6 @@ // temporary debugging of bug #3504 const char *delunit_prevfile; int delunit_prevline; - }; //Update this max as necessary. 55 is the value needed for Super Baby currently @@ -702,7 +701,7 @@ #define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp) int pc_setpos(struct map_session_data *sd, unsigned short mapindex, int x, int y, clr_type clrtype); -int pc_setsavepoint(struct map_session_data *,short,int,int); +int pc_setsavepoint(struct map_session_data *,unsigned short,int,int); int pc_randomwarp(struct map_session_data *sd,clr_type type); int pc_memo(struct map_session_data *sd, int pos); @@ -765,7 +764,7 @@ unsigned int pc_thisbaseexp(struct map_session_data *); unsigned int pc_nextjobexp(struct map_session_data *); unsigned int pc_thisjobexp(struct map_session_data *); -int pc_gets_status_point(int); +unsigned int pc_gets_status_point(int); int pc_need_status_point(struct map_session_data *,int,int); int pc_statusup(struct map_session_data *,int); int pc_statusup2(struct map_session_data *,int,int); Index: src/map/skill.c --- src/map/skill.c Base (BASE) +++ src/map/skill.c Locally Modified (Based On LOCAL) @@ -12270,7 +12270,6 @@ p_sd[(*c)++] = tsd->bl.id; return 1; } else { - switch (skillid) { case PR_BENEDICTIO: { int dir = map_calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y); @@ -12308,8 +12307,6 @@ !tsd->sc.data[SC_DANCING]) { p_sd[(*c)++]=tsd->bl.id; return skilllv; - } else { - return 0; } } break; Index: src/map/unit.c --- src/map/unit.c Base (BASE) +++ src/map/unit.c Locally Modified (Based On LOCAL) @@ -666,7 +666,8 @@ if (count) { struct map_session_data *sd; struct skill_unit *su = NULL; - int nx, ny, result; + short nx, ny; + int result; sd = BL_CAST(BL_PC, bl); su = BL_CAST(BL_SKILL, bl); @@ -1607,7 +1608,7 @@ /*========================================== * Calculates position of Pet/Mercenary/Homunculus/Elemental *------------------------------------------*/ -int unit_calc_pos(struct block_list *bl, int tx, int ty, int dir) +int unit_calc_pos(struct block_list *bl, short tx, short ty, int dir) { int dx, dy, x, y, i, k; struct unit_data *ud = unit_bl2ud(bl); Index: src/map/unit.h --- src/map/unit.h Base (BASE) +++ src/map/unit.h Locally Modified (Based On LOCAL) @@ -75,7 +75,7 @@ int unit_walktoxy(struct block_list *bl, short x, short y, int easy); int unit_walktobl(struct block_list *bl, struct block_list *target, int range, int easy); int unit_run(struct block_list *bl); -int unit_calc_pos(struct block_list *bl, int tx, int ty, int dir); +int unit_calc_pos(struct block_list *bl, short tx, short ty, int dir); // ���s��~ // type�͈ȉ��̑g�ݍ��킹 : Index: vcproj-10/char-server_sql.vcxproj --- vcproj-10/char-server_sql.vcxproj Base (BASE) +++ vcproj-10/char-server_sql.vcxproj Locally Modified (Based On LOCAL) @@ -66,7 +66,7 @@ - Level3 \ No newline at end of file + Level4 \ No newline at end of file EditAndContinue CompileAsC 4800;%(DisableSpecificWarnings) Index: vcproj-10/login-server_sql.vcxproj --- vcproj-10/login-server_sql.vcxproj Base (BASE) +++ vcproj-10/login-server_sql.vcxproj Locally Modified (Based On LOCAL) @@ -64,7 +64,7 @@ - Level3 \ No newline at end of file + Level4 \ No newline at end of file EditAndContinue CompileAsC 4100;4800;%(DisableSpecificWarnings) Index: vcproj-10/map-server_sql.vcxproj --- vcproj-10/map-server_sql.vcxproj Base (BASE) +++ vcproj-10/map-server_sql.vcxproj Locally Modified (Based On LOCAL) @@ -63,7 +63,7 @@ - Level3 + Level4 \ No newline at end of file EditAndContinue CompileAsC 4018;4100;4800;%(DisableSpecificWarnings) Index: vcproj-10/mapcache.vcxproj --- vcproj-10/mapcache.vcxproj Base (BASE) +++ vcproj-10/mapcache.vcxproj Locally Modified (Based On LOCAL) @@ -62,7 +62,7 @@ - Level3 \ No newline at end of file + Level4 \ No newline at end of file EditAndContinue CompileAsC true Index: vcproj-10/mapcache.vcxproj.filters --- vcproj-10/mapcache.vcxproj.filters Base (BASE) +++ vcproj-10/mapcache.vcxproj.filters Locally Modified (Based On LOCAL) @@ -57,6 +57,7 @@ common + \ No newline at end of file