diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 19 | ||||
-rw-r--r-- | src/map/battle.c | 3 | ||||
-rw-r--r-- | src/map/charcommand.c | 6 | ||||
-rw-r--r-- | src/map/chrif.c | 3 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/guild.c | 6 | ||||
-rw-r--r-- | src/map/irc.c | 3 | ||||
-rw-r--r-- | src/map/itemdb.c | 15 | ||||
-rw-r--r-- | src/map/log.c | 3 | ||||
-rw-r--r-- | src/map/map.c | 6 | ||||
-rw-r--r-- | src/map/mercenary.c | 6 | ||||
-rw-r--r-- | src/map/mob.c | 14 | ||||
-rw-r--r-- | src/map/npc.c | 9 | ||||
-rw-r--r-- | src/map/pc.c | 14 | ||||
-rw-r--r-- | src/map/pet.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 9 | ||||
-rw-r--r-- | src/map/skill.c | 31 | ||||
-rw-r--r-- | src/map/status.c | 14 |
18 files changed, 104 insertions, 63 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 642a1f97e..87bf2a4d5 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -822,7 +822,8 @@ int msg_config_read(const char *cfgName) if ((--called) == 0) memset(msg_table, 0, sizeof(msg_table[0]) * MAX_MSG); - while(fgets(line, sizeof(line)-1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) { @@ -884,7 +885,8 @@ int atcommand_config_read(const char *cfgName) return 1; } - while (fgets(line, sizeof(line)-1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; @@ -2713,7 +2715,7 @@ int atcommand_help(const int fd, struct map_session_data* sd, const char* comman if ((fp = fopen(help_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); // Help commands: gm_level = pc_isGM(sd); - while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { + while(fgets(buf, sizeof(buf), fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { @@ -2751,7 +2753,7 @@ int atcommand_help2(const int fd, struct map_session_data* sd, const char* comma if ((fp = fopen(help2_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); // Help commands: gm_level = pc_isGM(sd); - while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { + while(fgets(buf, sizeof(buf), fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { @@ -7778,13 +7780,14 @@ int atcommand_gmotd(const int fd, struct map_session_data* sd, const char* comma char buf[256]; FILE *fp; nullpo_retr(-1, sd); - if( (fp = fopen(motd_txt, "r"))!=NULL){ - while (fgets(buf, 250, fp) != NULL){ + if((fp = fopen(motd_txt, "r"))!=NULL){ + while(fgets(buf, sizeof(buf), fp) != NULL) + { int i; if (buf[0] == '/' && buf[1] == '/') continue; - for( i=0; buf[i]; i++){ - if( buf[i]=='\r' || buf[i]=='\n'){ + for(i=0; buf[i]; i++){ + if(buf[i]=='\r' || buf[i]=='\n'){ buf[i]=0; break; } diff --git a/src/map/battle.c b/src/map/battle.c index cee92d515..06329b3bb 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4304,7 +4304,8 @@ int battle_config_read(const char *cfgName) ShowError("File not found: %s\n", cfgName); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; if (sscanf(line, "%[^:]:%s", w1, w2) != 2) diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 7d4151b64..7f0f9b089 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -379,7 +379,8 @@ int charcommand_config_read(const char *cfgName) return 1; } - while (fgets(line, sizeof(line)-1, fp)) { + while (fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; @@ -1852,7 +1853,8 @@ int charcommand_help(const int fd, struct map_session_data* sd, const char* comm if ((fp = fopen(charhelp_txt, "r")) != NULL) { clif_displaymessage(fd, msg_txt(26)); /* Help commands: */ gm_level = pc_isGM(sd); - while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { + while(fgets(buf, sizeof(buf), fp) != NULL) + { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { diff --git a/src/map/chrif.c b/src/map/chrif.c index 1adee71a9..4b5dde218 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1246,7 +1246,8 @@ int chrif_load_scdata(int fd) WFIFOW(char_fd,6) = drop_rate; if ((fp = fopen(motd_txt, "r")) != NULL) { - if (fgets(buf, 250, fp) != NULL) { + if (fgets(buf, sizeof(buf), fp) != NULL) + { for(i = 0; buf[i]; i++) { if (buf[i] == '\r' || buf[i] == '\n') { buf[i] = 0; diff --git a/src/map/clif.c b/src/map/clif.c index a4ffc3b6b..4cc6da374 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11924,7 +11924,7 @@ static int packetdb_readdb(void) clif_config.packet_db_ver = MAX_PACKET_VER; packet_ver = MAX_PACKET_VER; // read into packet_db's version by default - while( fgets(line,sizeof(line),fp) ) + while( fgets(line, sizeof(line), fp) ) { ln++; if(line[0]=='/' && line[1]=='/') diff --git a/src/map/guild.c b/src/map/guild.c index 857eeffb0..c6dbe7515 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -99,7 +99,8 @@ int guild_read_guildskill_tree_db(void) ShowError("can't read %s\n", line); return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; if(line[0]=='/' && line[1]=='/') continue; @@ -165,7 +166,8 @@ static int guild_read_castledb(void) return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; memset(str,0,sizeof(str)); diff --git a/src/map/irc.c b/src/map/irc.c index e74b89efa..c9ca87202 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -515,7 +515,8 @@ int irc_read_conf(char *file) return 0; } - while(fgets(row,1023,fp)!=NULL) { + while(fgets(row, sizeof(row), fp) != NULL) + { if(row[0]=='/'&&row[1]=='/') continue; sscanf(row,"%[^:]: %255[^\r\n]",w1,w2); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 7e450fe4d..bf23c5280 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -404,7 +404,8 @@ static int itemdb_read_itemavail (void) return -1; } - while (fgets(line, sizeof(line) - 1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; memset(str, 0, sizeof(str)); @@ -449,7 +450,8 @@ static void itemdb_read_itemgroup_sub(const char* filename) return; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { ln++; if(line[0]=='/' && line[1]=='/') continue; @@ -523,7 +525,8 @@ static int itemdb_read_noequip(void) ShowError("can't read %s\n", line); return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; memset(str,0,sizeof(str)); @@ -567,7 +570,8 @@ static int itemdb_read_itemtrade(void) return -1; } - while (fgets(line, sizeof(line) - 1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; memset(str, 0, sizeof(str)); @@ -819,7 +823,8 @@ static int itemdb_readdb(void) } lines=0; - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { lines++; if(line[0]=='/' && line[1]=='/') continue; diff --git a/src/map/log.c b/src/map/log.c index 5ee1a2d83..97726bb6e 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -1,7 +1,6 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -// Logging functions by Azndragon & Codemaster #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -419,7 +418,7 @@ int log_config_read(char *cfgName) return 1; } - while(fgets(line, sizeof(line) -1, fp)) + while(fgets(line, sizeof(line), fp)) { if(line[0] == '/' && line[1] == '/') continue; diff --git a/src/map/map.c b/src/map/map.c index 6df33fe26..1acee0c9b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2777,7 +2777,8 @@ int map_config_read(char *cfgName) ShowFatalError("Map configuration file not found at: %s\n", cfgName); exit(1); } - while(fgets(line, sizeof(line) -1, fp)) { + while(fgets(line, sizeof(line), fp)) + { if (line[0] == '/' && line[1] == '/') continue; @@ -2877,7 +2878,8 @@ int inter_config_read(char *cfgName) ShowError("File not found: '%s'.\n",cfgName); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0] == '/' && line[1] == '/') continue; i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2); diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 899764ec8..4f39607b1 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -823,7 +823,7 @@ int read_homunculusdb(void) return -1; } - while(fgets(line,sizeof(line)-1,fp) && j < MAX_HOMUNCULUS_CLASS) + while(fgets(line, sizeof(line), fp) && j < MAX_HOMUNCULUS_CLASS) { if(line[0] == '/' && line[1] == '/') continue; @@ -924,7 +924,7 @@ int read_homunculus_skilldb(void) return 1; } - while(fgets(line, sizeof(line)-1, fp)) + while(fgets(line, sizeof(line), fp)) { int minJobLevelPresent = 0; @@ -993,7 +993,7 @@ void read_homunculus_expdb(void) ShowError("can't read %s\n",line); return; } - while(fgets(line,sizeof(line)-1,fp) && j < MAX_LEVEL) + while(fgets(line, sizeof(line), fp) && j < MAX_LEVEL) { if(line[0] == '/' && line[1] == '/') continue; diff --git a/src/map/mob.c b/src/map/mob.c index 79ae84435..74c658109 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3427,7 +3427,7 @@ static int mob_readdb(void) return -1; } - while(fgets(line, 1020, fp)) + while(fgets(line, sizeof(line), fp)) { char *str[38+2*MAX_MOB_DROP], *p, *np; @@ -3511,7 +3511,8 @@ static int mob_readdb_mobavail(void) return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; memset(str,0,sizeof(str)); @@ -3589,7 +3590,8 @@ static int mob_read_randommonster(void) ShowError("can't read %s\n",line); return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { int class_,per; if(line[0] == '/' && line[1] == '/') continue; @@ -3708,7 +3710,8 @@ static int mob_readskilldb(void) ShowError("can't read %s\n",line); continue; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *sp[20],*p; int mob_id; struct mob_skill *ms, gms; @@ -3919,7 +3922,8 @@ static int mob_readdb_race(void) return -1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; memset(str,0,sizeof(str)); diff --git a/src/map/npc.c b/src/map/npc.c index 61a8ef093..eca640b1f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1900,7 +1900,7 @@ static int npc_skip_script (char *w1,char *w2,char *w3,char *w4,char *first_line srcbuf[0] = 0; npc_parse_script_line(srcbuf,&curly_count,*lines); while (curly_count > 0) { - fgets ((char *)line, 1020, fp); + fgets ((char *)line, sizeof(line), fp); (*lines)++; npc_parse_script_line(line,&curly_count,*lines); if (feof(fp)) @@ -1964,7 +1964,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line srcbuf[0] = 0; npc_parse_script_line(srcbuf,&curly_count,*lines); while (curly_count > 0) { - fgets ((char *)line, 1020, fp); + fgets((char *)line, sizeof(line), fp); (*lines)++; npc_parse_script_line(line,&curly_count,*lines); if (feof(fp)) @@ -2272,7 +2272,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir npc_parse_script_line(srcbuf,&curly_count,*lines); while (curly_count > 0) { - fgets(line, sizeof(line) - 1, fp); + fgets(line, sizeof(line), fp); (*lines)++; npc_parse_script_line(line,&curly_count,*lines); if (feof(fp)) @@ -2780,7 +2780,8 @@ void npc_parsesrcfile(const char* name) } current_file = name; - while (fgets(line, sizeof(line) - 1, fp)) { + while (fgets(line, sizeof(line), fp)) + { char w1[2048], w2[2048], w3[2048], w4[2048], mapname[2048]; int i, w4pos, count; lines++; diff --git a/src/map/pc.c b/src/map/pc.c index 22dad96f0..8692599f1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7344,7 +7344,8 @@ int pc_readdb(void) ShowError("can't read %s\n", line); return 1; } - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { int jobs[MAX_PC_CLASS], job_count, job; int type; unsigned int ui,maxlv; @@ -7422,7 +7423,8 @@ int pc_readdb(void) return 1; } - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; int f=0, m=3; if(line[0]=='/' && line[1]=='/') @@ -7472,7 +7474,8 @@ int pc_readdb(void) ShowError("can't read %s\n", line); return 1; } - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[10]; int lv,n; if(line[0]=='/' && line[1]=='/') @@ -7486,7 +7489,7 @@ int pc_readdb(void) n=atoi(split[1]); for(i=0;i<n && i<ELE_MAX;){ - if( !fgets(line, sizeof(line)-1, fp) ) + if( !fgets(line, sizeof(line), fp) ) break; if(line[0]=='/' && line[1]=='/') continue; @@ -7517,7 +7520,8 @@ int pc_readdb(void) ShowStatus("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line); //return 1; } else { - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; if ((j=atoi(line))<0) diff --git a/src/map/pet.c b/src/map/pet.c index 82168ac48..866d8ca67 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1299,8 +1299,8 @@ int read_petdb() return -1; } lines = 0; - while(fgets(line,1020,fp) && j < MAX_PET_DB){ - + while(fgets(line, sizeof(line), fp) && j < MAX_PET_DB) + { lines++; if(line[0] == '/' && line[1] == '/') diff --git a/src/map/script.c b/src/map/script.c index 46042f085..56e8174ae 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1680,7 +1680,8 @@ static void read_constdb(void) ShowError("can't read %s\n", line); return ; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0]=='/' && line[1]=='/') continue; type=0; @@ -3079,7 +3080,8 @@ static int script_load_mapreg(void) if( (fp=fopen(mapreg_txt,"rt"))==NULL ) return -1; - while(fgets(line,sizeof(line),fp)){ + while(fgets(line,sizeof(line),fp)) + { char buf1[256],buf2[1024],*p; int n,v,s,i; if( sscanf(line,"%255[^,],%d\t%n",buf1,&i,&n)!=2 && @@ -3273,7 +3275,8 @@ int script_config_read_sub(char *cfgName) ShowError("file not found: [%s]\n", cfgName); return 1; } - while(fgets(line,sizeof(line)-1,fp)){ + while(fgets(line, sizeof(line), fp)) + { if(line[0] == '/' && line[1] == '/') continue; i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2); diff --git a/src/map/skill.c b/src/map/skill.c index 0fff9ba0c..efadefe9c 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -859,7 +859,7 @@ int skillnotok (int skillid, struct map_session_data *sd) return 1; if (battle_config.gm_skilluncond && pc_isGM(sd) >= battle_config.gm_skilluncond) - return 0; // gm's can do anything damn thing they want + return 0; // GMs can do any damn thing they want if (sd->blockskill[i] > 0) return 1; @@ -8726,7 +8726,7 @@ int skill_castfix_sc (struct block_list *bl, int time) } /*========================================== - * Does delay reductions based on dex, + * Does delay reductions based on dex, sc data, item bonuses, ... *------------------------------------------*/ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv) { @@ -11186,7 +11186,8 @@ int skill_readdb (void) ShowError("can't read %s\n", path); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; if(line[0]=='/' && line[1]=='/') continue; @@ -11248,7 +11249,8 @@ int skill_readdb (void) ShowError("can't read %s\n", path); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; if(line[0]=='/' && line[1]=='/') continue; @@ -11335,7 +11337,8 @@ int skill_readdb (void) } l=0; - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; l++; memset(split,0,sizeof(split)); // [Valaris] thanks to fov @@ -11373,7 +11376,8 @@ int skill_readdb (void) return 1; } k = 0; - while (fgets(line,1020,fp)) { + while (fgets(line, sizeof(line), fp)) + { char *split[50]; if (line[0]=='/' && line[1]=='/') continue; @@ -11434,7 +11438,8 @@ int skill_readdb (void) ShowError("can't read %s\n",path); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[7 + MAX_PRODUCE_RESOURCE * 2]; int x,y; if(line[0]=='/' && line[1]=='/') @@ -11475,7 +11480,8 @@ int skill_readdb (void) return 1; } k=0; - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[16]; int x,y; if(line[0]=='/' && line[1]=='/') @@ -11509,7 +11515,8 @@ int skill_readdb (void) return 1; } k=0; - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[16]; if(line[0]=='/' && line[1]=='/') continue; @@ -11537,7 +11544,8 @@ int skill_readdb (void) ShowError("can't read %s\n", path); return 1; } - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[50]; if(line[0]=='/' && line[1]=='/') continue; @@ -11566,7 +11574,8 @@ int skill_readdb (void) return 1; } k=0; - while(fgets(line,1020,fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[16]; if(line[0]=='/' && line[1]=='/') continue; diff --git a/src/map/status.c b/src/map/status.c index 54b6db02e..27b18fbbc 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -7282,7 +7282,8 @@ int status_readdb(void) return 1; } i = 0; - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[MAX_WEAPON_TYPE + 5]; i++; if(line[0]=='/' && line[1]=='/') @@ -7317,8 +7318,9 @@ int status_readdb(void) ShowError("can't read %s\n", path); return 1; } - while(fgets(line, sizeof(line)-1, fp)){ - char *split[MAX_LEVEL+1]; //Job Level is limited to MAX_LEVEL, so the bonuses should likewise be limited to it. [Skotlex] + while(fgets(line, sizeof(line), fp)) + { + char *split[MAX_LEVEL+1]; //Job Level is limited to MAX_LEVEL, so the bonuses should likewise be limited to it. [Skotlex] if(line[0]=='/' && line[1]=='/') continue; for(j=0,p=line;j<MAX_LEVEL+1 && p;j++){ @@ -7345,7 +7347,8 @@ int status_readdb(void) return 1; } i=0; - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[MAX_WEAPON_TYPE]; if(line[0]=='/' && line[1]=='/') continue; @@ -7380,7 +7383,8 @@ int status_readdb(void) return 1; } i=0; - while(fgets(line, sizeof(line)-1, fp)){ + while(fgets(line, sizeof(line), fp)) + { char *split[MAX_REFINE+4]; if(line[0]=='/' && line[1]=='/') continue; |