diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 37 | ||||
-rw-r--r-- | src/char/int_guild.c | 22 | ||||
-rw-r--r-- | src/char/int_homun.c | 2 | ||||
-rw-r--r-- | src/char/int_party.c | 2 | ||||
-rw-r--r-- | src/char/int_pet.c | 4 |
5 files changed, 34 insertions, 33 deletions
diff --git a/src/char/char.c b/src/char/char.c index f1476bbb3..d5b4bbb37 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -43,7 +43,7 @@ #include <stdlib.h> #ifndef TXT_SQL_CONVERT -struct mmo_map_server{ +struct mmo_map_server { uint32 ip; uint16 port; int users; @@ -57,16 +57,16 @@ char passwd[24]; char server_name[20]; char wisp_server_name[NAME_LENGTH] = "Server"; char login_ip_str[128]; -uint32 login_ip; +uint32 login_ip = 0; uint16 login_port = 6900; char char_ip_str[128]; -uint32 char_ip; +uint32 char_ip = 0; char bind_ip_str[128]; uint32 bind_ip = INADDR_ANY; uint16 char_port = 6121; -int char_maintenance; -int char_new; -int char_new_display; +int char_maintenance = 0; +int char_new = 1; +int char_new_display = 0; int email_creation = 0; // disabled by default #endif char char_txt[1024]="save/athena.txt"; @@ -364,7 +364,7 @@ void set_char_offline(int char_id, int account_id) character->waiting_disconnect = -1; } } - + if (login_fd > 0 && !session[login_fd]->eof) { WFIFOHEAD(login_fd,6); @@ -652,7 +652,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg tmp_int[46] = mapindex_name2id(tmp_str[2]); } // Char structure of version 1500 (homun + mapindex maps) - memcpy(p->name, tmp_str[0], NAME_LENGTH-1); //Overflow protection [Skotlex] + memcpy(p->name, tmp_str[0], NAME_LENGTH); //Overflow protection [Skotlex] p->char_id = tmp_int[0]; p->account_id = tmp_int[1]; p->char_num = tmp_int[2]; @@ -1946,7 +1946,7 @@ int parse_tologin(int fd) struct char_session_data *sd; // only login-server can have an access to here. - // so, if it isn't the login-server, we disconnect the session (fd != login_fd). + // so, if it isn't the login-server, we disconnect the session. if (fd != login_fd) set_eof(fd); if(session[fd]->eof) { @@ -2360,7 +2360,7 @@ int parse_tologin(int fd) if (GM_num == 0) { gm_account = (struct gm_account*)aMalloc(sizeof(struct gm_account)); } else { - gm_account = (struct gm_account*)aRealloc(gm_account, sizeof(struct gm_account) * (GM_num + 1)); + gm_account = (struct gm_account*)aRealloc(gm_account, sizeof(struct gm_account) * (GM_num + 1)); } gm_account[GM_num].account_id = RFIFOL(fd,2); gm_account[GM_num].level = (int)RFIFOB(fd,6); @@ -3005,7 +3005,7 @@ int parse_frommap(int fd) { char character_name[NAME_LENGTH]; int acc = RFIFOL(fd,2); // account_id of who ask (-1 if nobody) - memcpy(character_name, RFIFOP(fd,6), NAME_LENGTH-1); + memcpy(character_name, RFIFOP(fd,6), NAME_LENGTH); character_name[NAME_LENGTH-1] = '\0'; // prepare answer WFIFOHEAD(fd,34); @@ -3155,7 +3155,7 @@ int parse_frommap(int fd) // Find the position where the player has to be inserted for(i = 0; i < size && fame < list[i].fame; i++); - if(i >= size) break;//Out of ranking. + if(i >= size) break; //Out of ranking. // When found someone with less or as much fame, insert just above memmove(list+i+1, list+i, (size-i-1) * sizeof(struct fame_list)); list[i].id = cid; @@ -3190,7 +3190,7 @@ int parse_frommap(int fd) set_all_offline(id); RFIFOSKIP(fd,2); break; - + case 0x2b19: // Character set online [Wizputer] if (RFIFOREST(fd) < 6) return 0; @@ -3239,8 +3239,8 @@ int parse_frommap(int fd) break; default: - // inter server - packet { + // inter server - packet int r = inter_parse_frommap(fd); if (r == 1) break; // processed if (r == 2) return 0; // need more packet @@ -3252,6 +3252,7 @@ int parse_frommap(int fd) } } // switch } // while + return 0; } @@ -3566,7 +3567,7 @@ int parse_char(int fd) if (i < 0) { WFIFOHEAD(fd,3); - WFIFOW(fd, 0) = 0x6e; + WFIFOW(fd,0) = 0x6e; switch (i) { case -1: WFIFOB(fd,2) = 0x00; break; case -2: WFIFOB(fd,2) = 0x02; break; @@ -3891,7 +3892,7 @@ static int send_accounts_tologin_sub(DBKey key, void* data, va_list ap) return 0; //This is an error that shouldn't happen.... if(character->server > -1) { WFIFOHEAD(login_fd,8+count*4); - WFIFOL(login_fd, 8+(*i)*4) =character->account_id; + WFIFOL(login_fd,8+(*i)*4) = character->account_id; (*i)++; return 1; } @@ -3939,7 +3940,7 @@ int check_connect_login_server(int tid, unsigned int tick, int id, int data) memcpy(WFIFOP(login_fd,60), server_name, 20); WFIFOW(login_fd,80) = 0; WFIFOW(login_fd,82) = char_maintenance; - WFIFOW(login_fd,84) = char_new_display; //only display (New) if they want to [Kevin] + WFIFOW(login_fd,84) = char_new_display; //only display (New) if they want to [Kevin] WFIFOSET(login_fd,86); return 1; @@ -4206,7 +4207,7 @@ int char_config_read(const char *cfgName) } fclose(fp); - ShowInfo("done reading %s.\n", cfgName); + ShowInfo("Done reading %s.\n", cfgName); return 0; } diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 14297712f..2cf8b8b91 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -123,8 +123,8 @@ int inter_guild_fromstr(char *str, struct guild *g) { #ifndef TXT_SQL_CONVERT g->castle_id = tmp_int[5]; #endif - memcpy(g->name, tmp_str[0], NAME_LENGTH-1); - memcpy(g->master, tmp_str[1], NAME_LENGTH-1); + memcpy(g->name, tmp_str[0], NAME_LENGTH); + memcpy(g->master, tmp_str[1], NAME_LENGTH); memcpy(g->mes1, tmp_str[2], 60); memcpy(g->mes2, tmp_str[3], 120); g->mes1[strlen(g->mes1)-1] = 0; @@ -152,7 +152,7 @@ int inter_guild_fromstr(char *str, struct guild *g) { m->exp = exp; m->exp_payper = tmp_int[8]; m->position = tmp_int[9]; - memcpy(m->name, tmp_str[0], NAME_LENGTH-1); + memcpy(m->name, tmp_str[0], NAME_LENGTH); for(j = 0; j < 2 && str != NULL; j++) // 位置スキップ str = strchr(str + 1, '\t'); @@ -167,7 +167,7 @@ int inter_guild_fromstr(char *str, struct guild *g) { p->mode = tmp_int[0]; p->exp_mode = tmp_int[1]; tmp_str[0][strlen(tmp_str[0])-1] = 0; - memcpy(p->name, tmp_str[0], NAME_LENGTH-1); + memcpy(p->name, tmp_str[0], NAME_LENGTH); for(j = 0; j < 2 && str != NULL; j++) // 位置スキップ str = strchr(str+1, '\t'); @@ -204,7 +204,7 @@ int inter_guild_fromstr(char *str, struct guild *g) { return 1; a->guild_id = tmp_int[0]; a->opposition = tmp_int[1]; - memcpy(a->name, tmp_str[0], NAME_LENGTH-1); + memcpy(a->name, tmp_str[0], NAME_LENGTH); for(j = 0; j < 2 && str != NULL; j++) // 位置スキップ str = strchr(str + 1, '\t'); @@ -224,7 +224,7 @@ int inter_guild_fromstr(char *str, struct guild *g) { e->rsv1 = tmp_int[1]; e->rsv2 = tmp_int[2]; e->rsv3 = tmp_int[3]; - memcpy(e->name, tmp_str[0], NAME_LENGTH-1); + memcpy(e->name, tmp_str[0], NAME_LENGTH); memcpy(e->acc, tmp_str[1], 24); tmp_str[2][strlen(tmp_str[2])-1] = 0; memcpy(e->mes, tmp_str[2], 40); @@ -980,8 +980,8 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem } // memset(g, 0, sizeof(struct guild)); Meh... g->guild_id = guild_newid++; - memcpy(g->name, name, NAME_LENGTH-1); - memcpy(g->master, master->name, NAME_LENGTH-1); + memcpy(g->name, name, NAME_LENGTH); + memcpy(g->master, master->name, NAME_LENGTH); memcpy(&g->member[0], master, sizeof(struct guild_member)); g->position[0].mode = 0x11; @@ -1071,8 +1071,8 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in j = MAX_GUILDEXPULSION - 1; } g->expulsion[j].account_id = account_id; - memcpy(g->expulsion[j].acc, "dummy", NAME_LENGTH-1); - memcpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH-1); + strncpy(g->expulsion[j].acc, "dummy", NAME_LENGTH); + memcpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH); memcpy(g->expulsion[j].mes, mes, 40); } @@ -1344,7 +1344,7 @@ int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_ for(j = 0; j < MAX_GUILDALLIANCE; j++) if (g[i]->alliance[j].guild_id == 0) { g[i]->alliance[j].guild_id = g[1-i]->guild_id; - memcpy(g[i]->alliance[j].name, g[1-i]->name, NAME_LENGTH-1); + memcpy(g[i]->alliance[j].name, g[1-i]->name, NAME_LENGTH); g[i]->alliance[j].opposition = flag & 1; break; } diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 492d8a76e..43d56359d 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -68,7 +68,7 @@ int inter_homun_fromstr(char *str,struct s_homunculus *p) p->hom_id = tmp_int[0]; p->class_ = tmp_int[1]; - memcpy(p->name, tmp_str, NAME_LENGTH-1); + memcpy(p->name, tmp_str, NAME_LENGTH); p->char_id = tmp_int[2]; p->hp = tmp_int[3]; diff --git a/src/char/int_party.c b/src/char/int_party.c index 50a33295b..2c18f29ab 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -132,7 +132,7 @@ int inter_party_fromstr(char *str, struct party *p) { return 1; p->party_id = tmp_int[0]; - memcpy(p->name, tmp_str, NAME_LENGTH-1); + memcpy(p->name, tmp_str, NAME_LENGTH); p->exp = tmp_int[1]?1:0; p->item = tmp_int[2]; // printf("%d [%s] %d %d\n", tmp_int[0], tmp_str[0], tmp_int[1], tmp_int[2]); diff --git a/src/char/int_pet.c b/src/char/int_pet.c index c49150a9c..4eb3f5b49 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -58,7 +58,7 @@ int inter_pet_fromstr(char *str,struct s_pet *p) p->pet_id = tmp_int[0]; p->class_ = tmp_int[1]; - memcpy(p->name,tmp_str,NAME_LENGTH-1); + memcpy(p->name,tmp_str,NAME_LENGTH); p->account_id = tmp_int[2]; p->char_id = tmp_int[3]; p->level = tmp_int[4]; @@ -234,7 +234,7 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet } // memset(p,0,sizeof(struct s_pet)); unnecessary after aCalloc [Skotlex] p->pet_id = pet_newid++; - memcpy(p->name,pet_name,NAME_LENGTH-1); + memcpy(p->name,pet_name,NAME_LENGTH); if(incuvate == 1) p->account_id = p->char_id = 0; else { |