diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 14 | ||||
-rw-r--r-- | src/char/char.h | 4 | ||||
-rw-r--r-- | src/char/int_elemental.c | 14 | ||||
-rw-r--r-- | src/char/int_guild.c | 16 | ||||
-rw-r--r-- | src/char/int_guild.h | 2 | ||||
-rw-r--r-- | src/char/int_homun.c | 21 | ||||
-rw-r--r-- | src/char/int_mercenary.c | 11 | ||||
-rw-r--r-- | src/char/int_party.c | 14 | ||||
-rw-r--r-- | src/char/int_pet.c | 2 | ||||
-rw-r--r-- | src/char/int_quest.c | 3 | ||||
-rw-r--r-- | src/char/int_storage.c | 2 | ||||
-rw-r--r-- | src/char/int_storage.h | 2 | ||||
-rw-r--r-- | src/char/inter.c | 6 | ||||
-rw-r--r-- | src/char/mapif.c | 50 | ||||
-rw-r--r-- | src/char/mapif.h | 50 |
15 files changed, 115 insertions, 96 deletions
diff --git a/src/char/char.c b/src/char/char.c index e8709c5b9..1e477ba6e 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1657,7 +1657,8 @@ int char_check_char_name(char * name, char * esc_name) * -5: 'Symbols in Character Names are forbidden' * char_id: Success **/ -int char_make_new_char_sql(struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) { +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) +{ char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; int char_id, flag, k, l; @@ -3289,7 +3290,7 @@ void char_parse_frommap_char_select_req(int fd) } } -void char_change_map_server_ack(int fd, uint8 *data, bool ok) +void char_change_map_server_ack(int fd, const uint8 *data, bool ok) { WFIFOHEAD(fd,30); WFIFOW(fd,0) = 0x2b06; @@ -4971,11 +4972,10 @@ void char_login_map_server_ack(int fd, uint8 flag) void char_parse_char_login_map_server(int fd, uint32 ipl) { - char* l_user = (char*)RFIFOP(fd,2); - char* l_pass = (char*)RFIFOP(fd,26); + char l_user[24], l_pass[24]; int i; - l_user[23] = '\0'; - l_pass[23] = '\0'; + safestrncpy(l_user, (char *)RFIFOP(fd,2), 24); + safestrncpy(l_pass, (char *)RFIFOP(fd,26), 24); ARR_FIND( 0, ARRAYLENGTH(chr->server), i, chr->server[i].fd <= 0 ); if (core->runflag != CHARSERVER_ST_RUNNING || @@ -5286,7 +5286,7 @@ int char_parse_char(int fd) return 0; } -int mapif_sendall(unsigned char *buf, unsigned int len) +int mapif_sendall(const unsigned char *buf, unsigned int len) { int i, c; diff --git a/src/char/char.h b/src/char/char.h index ff46e4353..6d8a9815c 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -137,7 +137,7 @@ struct char_interface { bool (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); int (*rename_char_sql) (struct char_session_data *sd, int char_id); int (*check_char_name) (char * name, char * esc_name); - int (*make_new_char_sql) (struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style); int (*divorce_char_sql) (int partner_id1, int partner_id2); int (*count_users) (void); int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); @@ -189,7 +189,7 @@ struct char_interface { void (*parse_frommap_save_character) (int fd, int id); void (*select_ack) (int fd, int account_id, uint8 flag); void (*parse_frommap_char_select_req) (int fd); - void (*change_map_server_ack) (int fd, uint8 *data, bool ok); + void (*change_map_server_ack) (int fd, const uint8 *data, bool ok); void (*parse_frommap_change_map_server) (int fd); void (*parse_frommap_remove_friend) (int fd); void (*char_name_ack) (int fd, int char_id); diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c index 8d868bc06..70275725d 100644 --- a/src/char/int_elemental.c +++ b/src/char/int_elemental.c @@ -155,10 +155,15 @@ void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { WFIFOSET(fd,size); } -void mapif_parse_elemental_create(int fd, struct s_elemental *ele) +void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) { - bool result = mapif->elemental_create(ele); - mapif->elemental_send(fd, ele, result); + struct s_elemental ele_; + bool result; + + memcpy(&ele_, ele, sizeof(ele_)); + + result = mapif->elemental_create(&ele_); + mapif->elemental_send(fd, &ele_, result); } void mapif_parse_elemental_load(int fd, int ele_id, int char_id) { @@ -186,7 +191,8 @@ void mapif_elemental_saved(int fd, unsigned char flag) { WFIFOSET(fd,3); } -void mapif_parse_elemental_save(int fd, struct s_elemental* ele) { +void mapif_parse_elemental_save(int fd, const struct s_elemental *ele) +{ bool result = mapif->elemental_save(ele); mapif->elemental_saved(fd, result); } diff --git a/src/char/int_guild.c b/src/char/int_guild.c index c78b6b04f..04de75a20 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -767,7 +767,7 @@ void inter_guild_sql_final(void) } // Get guild_id by its name. Returns 0 if not found, -1 on error. -int inter_guild_search_guildname(char *str) +int inter_guild_search_guildname(const char *str) { int guild_id; char esc_name[NAME_LENGTH*2+1]; @@ -1006,7 +1006,7 @@ int mapif_guild_broken(int guild_id, int flag) } // Send guild message -int mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) +int mapif_guild_message(int guild_id, int account_id, const char *mes, int len, int sfd) { unsigned char buf[512]; nullpo_ret(mes); @@ -1139,7 +1139,7 @@ int mapif_guild_master_changed(struct guild *g, int aid, int cid) return 0; } -int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids) +int mapif_guild_castle_dataload(int fd, int sz, const int *castle_ids) { struct guild_castle *gc = NULL; int num = (sz - 4) / sizeof(int); @@ -1163,7 +1163,7 @@ int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids) // Guild creation request -int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member *master) +int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const struct guild_member *master) { struct guild *g; int i=0; @@ -1259,7 +1259,7 @@ int mapif_parse_GuildInfo(int fd, int guild_id) } // Add member to guild -int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) +int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m) { struct guild * g; int i; @@ -1455,7 +1455,7 @@ int mapif_parse_BreakGuild(int fd, int guild_id) } // Forward Guild message to others map servers -int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len) +int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len) { return mapif->guild_message(guild_id,account_id,mes,len, fd); } @@ -1670,7 +1670,7 @@ int inter_guild_charname_changed(int guild_id, int account_id, int char_id, char } // Change a position desc -int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p) +int mapif_parse_GuildPosition(int fd, int guild_id, int idx, const struct guild_position *p) { // Could make some improvement in speed, because only change guild_position struct guild * g; @@ -1809,7 +1809,7 @@ int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char return mapif->guild_emblem(g); } -int mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids) +int mapif_parse_GuildCastleDataLoad(int fd, int len, const int *castle_ids) { return mapif->guild_castle_dataload(fd, len, castle_ids); } diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 1076b3394..40728c3b2 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -60,7 +60,7 @@ struct inter_guild_interface { int (*sql_init) (void); int (*db_final) (DBKey key, DBData *data, va_list ap); void (*sql_final) (void); - int (*search_guildname) (char *str); + int (*search_guildname) (const char *str); bool (*check_empty) (struct guild *g); unsigned int (*nextexp) (int level); int (*checkskill) (struct guild *g, int id); diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 95374a978..1377bfbd8 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -49,7 +49,7 @@ void inter_homunculus_sql_final(void) return; } -void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag) +void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag) { nullpo_retv(sh); WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); @@ -97,7 +97,7 @@ void mapif_homunculus_saved(int fd, int account_id, bool flag) WFIFOSET(fd, 7); } -void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name) +void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name) { nullpo_retv(name); WFIFOHEAD(fd, NAME_LENGTH+12); @@ -279,7 +279,7 @@ bool mapif_homunculus_delete(int homun_id) return true; } -bool mapif_homunculus_rename(char *name) +bool mapif_homunculus_rename(const char *name) { int i; @@ -302,10 +302,15 @@ bool mapif_homunculus_rename(char *name) } -void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus* phd) +void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct s_homunculus *phd) { - bool result = mapif->homunculus_create(phd); - mapif->homunculus_created(fd, account_id, phd, result); + struct s_homunculus shd; + bool result; + + memcpy(&shd, phd, sizeof(shd)); + + result = mapif->homunculus_create(&shd); + mapif->homunculus_created(fd, account_id, &shd, result); } void mapif_parse_homunculus_delete(int fd, int homun_id) @@ -321,13 +326,13 @@ void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) mapif->homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); } -void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus* phd) +void mapif_parse_homunculus_save(int fd, int len, int account_id, const struct s_homunculus *phd) { bool result = mapif->homunculus_save(phd); mapif->homunculus_saved(fd, account_id, result); } -void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char* name) +void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, const char *name) { bool result = mapif->homunculus_rename(name); mapif->homunculus_renamed(fd, account_id, char_id, result, name); diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 133dcf565..671c71278 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -198,10 +198,15 @@ void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) WFIFOSET(fd,size); } -void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc) +void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) { - bool result = mapif->mercenary_create(merc); - mapif->mercenary_send(fd, merc, result); + struct s_mercenary merc_; + bool result; + + memcpy(&merc_, merc, sizeof(merc_)); + + result = mapif->mercenary_create(&merc_); + mapif->mercenary_send(fd, &merc_, result); } void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) diff --git a/src/char/int_party.c b/src/char/int_party.c index 71034a17b..8ff9ca3a2 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -461,7 +461,7 @@ int mapif_party_broken(int party_id, int flag) } //Remarks in the party -int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd) +int mapif_party_message(int party_id, int account_id, const char *mes, int len, int sfd) { unsigned char buf[512]; nullpo_ret(mes); @@ -479,7 +479,7 @@ int mapif_party_message(int party_id, int account_id, char *mes, int len, int sf // Create Party -int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader) +int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const struct party_member *leader) { struct party_data *p; int i; @@ -493,9 +493,11 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorized for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) == NULL) { - if( name[i] == '"' ) { /* client-special-char */ - normalize_name(name,"\""); + if (name[i] == '"') { /* client-special-char */ + char *newname = aStrndup(name, NAME_LENGTH-1); + normalize_name(newname,"\""); mapif->parse_CreateParty(fd,name,item,item2,leader); + aFree(newname); return 0; } mapif->party_created(fd,leader->account_id,leader->char_id,NULL); @@ -547,7 +549,7 @@ void mapif_parse_PartyInfo(int fd, int party_id, int char_id) } // Add a player to party request -int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member) +int mapif_parse_PartyAddMember(int fd, int party_id, const struct party_member *member) { struct party_data *p; int i; @@ -729,7 +731,7 @@ int mapif_parse_BreakParty(int fd, int party_id) } //Party sending the message -int mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len) +int mapif_parse_PartyMessage(int fd, int party_id, int account_id, const char *mes, int len) { return mapif->party_message(party_id,account_id,mes,len, fd); } diff --git a/src/char/int_pet.c b/src/char/int_pet.c index fcf71b255..676ce6ed6 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -222,7 +222,7 @@ int mapif_delete_pet_ack(int fd, int flag) } int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) { nullpo_ret(pet_name); memset(inter_pet->pt, 0, sizeof(struct s_pet)); diff --git a/src/char/int_quest.c b/src/char/int_quest.c index de3fbd000..9478b532d 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -218,7 +218,8 @@ int mapif_parse_quest_save(int fd) { int i, j, k, old_n, new_n = (RFIFOW(fd,2)-8)/sizeof(struct quest); int char_id = RFIFOL(fd,4); - struct quest *old_qd = NULL, *new_qd = NULL; + struct quest *old_qd = NULL; + const struct quest *new_qd = NULL; bool success = true; if (new_n > 0) diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 30647233b..e98f538a2 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -97,7 +97,7 @@ int inter_storage_fromsql(int account_id, struct storage_data* p) } /// Save guild_storage data to sql -int inter_storage_guild_storage_tosql(int guild_id, struct guild_storage* p) +int inter_storage_guild_storage_tosql(int guild_id, const struct guild_storage *p) { nullpo_ret(p); chr->memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 9bf5b5fd5..3c48c00ec 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -32,7 +32,7 @@ struct guild_storage; struct inter_storage_interface { int (*tosql) (int account_id, struct storage_data* p); int (*fromsql) (int account_id, struct storage_data* p); - int (*guild_storage_tosql) (int guild_id, struct guild_storage* p); + int (*guild_storage_tosql) (int guild_id, const struct guild_storage *p); int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); int (*sql_init) (void); void (*sql_final) (void); diff --git a/src/char/inter.c b/src/char/inter.c index 87ecb4e6a..8dec21a77 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -939,7 +939,7 @@ int inter_mapif_init(int fd) //-------------------------------------------------------- // broadcast sending -int mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) +int mapif_broadcast(const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char)); @@ -981,7 +981,7 @@ int mapif_wis_message(struct WisData *wd) return 0; } -void mapif_wis_response(int fd, unsigned char *src, int flag) +void mapif_wis_response(int fd, const unsigned char *src, int flag) { unsigned char buf[27]; nullpo_retv(src); @@ -1261,7 +1261,7 @@ void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int fla int mapif_parse_NameChangeRequest(int fd) { int account_id, char_id, type; - char* name; + const char *name; int i; account_id = RFIFOL(fd,2); diff --git a/src/char/mapif.c b/src/char/mapif.c index 9e37ff528..91bfd884c 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -42,7 +42,7 @@ void mapif_server_reset(int id); void mapif_on_disconnect(int id); void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd); void mapif_char_ban(int char_id, time_t timestamp); -int mapif_sendall(unsigned char *buf, unsigned int len); +int mapif_sendall(const unsigned char *buf, unsigned int len); int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len); int mapif_send(int fd, unsigned char *buf, unsigned int len); void mapif_send_users_count(int users); @@ -62,12 +62,12 @@ bool mapif_elemental_save(const struct s_elemental *ele); bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele); bool mapif_elemental_delete(int ele_id); void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag); -void mapif_parse_elemental_create(int fd, struct s_elemental* ele); +void mapif_parse_elemental_create(int fd, const struct s_elemental *ele); void mapif_parse_elemental_load(int fd, int ele_id, int char_id); void mapif_elemental_deleted(int fd, unsigned char flag); void mapif_parse_elemental_delete(int fd, int ele_id); void mapif_elemental_saved(int fd, unsigned char flag); -void mapif_parse_elemental_save(int fd, struct s_elemental* ele); +void mapif_parse_elemental_save(int fd, const struct s_elemental *ele); int mapif_guild_created(int fd, int account_id, struct guild *g); int mapif_guild_noinfo(int fd, int guild_id); int mapif_guild_info(int fd, struct guild *g); @@ -75,7 +75,7 @@ int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, i int mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); int mapif_guild_memberinfoshort(struct guild *g, int idx); int mapif_guild_broken(int guild_id, int flag); -int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd); +int mapif_guild_message(int guild_id, int account_id, const char *mes, int len, int sfd); int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len); int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len); int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id); @@ -84,40 +84,40 @@ int mapif_guild_position(struct guild *g, int idx); int mapif_guild_notice(struct guild *g); int mapif_guild_emblem(struct guild *g); int mapif_guild_master_changed(struct guild *g, int aid, int cid); -int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids); -int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member *master); +int mapif_guild_castle_dataload(int fd, int sz, const int *castle_ids); +int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const struct guild_member *master); int mapif_parse_GuildInfo(int fd, int guild_id); -int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m); +int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m); int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); int mapif_parse_BreakGuild(int fd, int guild_id); -int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len); +int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len); int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len); int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); -int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p); +int mapif_parse_GuildPosition(int fd, int guild_id, int idx, const struct guild_position *p); int mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max); int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag); int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2); int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data); -int mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids); +int mapif_parse_GuildCastleDataLoad(int fd, int len, const int *castle_ids); int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value); int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len); -void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag); +void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); void mapif_homunculus_deleted(int fd, int flag); void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd); void mapif_homunculus_saved(int fd, int account_id, bool flag); -void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name); +void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name); bool mapif_homunculus_create(struct s_homunculus *hd); bool mapif_homunculus_save(const struct s_homunculus *hd); bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd); bool mapif_homunculus_delete(int homun_id); -bool mapif_homunculus_rename(char *name); -void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus* phd); +bool mapif_homunculus_rename(const char *name); +void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct s_homunculus *phd); void mapif_parse_homunculus_delete(int fd, int homun_id); void mapif_parse_homunculus_load(int fd, int account_id, int homun_id); -void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus* phd); -void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char* name); +void mapif_parse_homunculus_save(int fd, int len, int account_id, const struct s_homunculus *phd); +void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, const char *name); void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md); void mapif_parse_mail_requestinbox(int fd); void mapif_parse_mail_read(int fd); @@ -136,12 +136,12 @@ bool mapif_mercenary_save(const struct s_mercenary *merc); bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc); bool mapif_mercenary_delete(int merc_id); void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag); -void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc); +void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc); void mapif_parse_mercenary_load(int fd, int merc_id, int char_id); void mapif_mercenary_deleted(int fd, unsigned char flag); void mapif_parse_mercenary_delete(int fd, int merc_id); void mapif_mercenary_saved(int fd, unsigned char flag); -void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc); +void mapif_parse_mercenary_save(int fd, const struct s_mercenary *merc); int mapif_party_created(int fd, int account_id, int char_id, struct party *p); void mapif_party_noinfo(int fd, int party_id, int char_id); void mapif_party_info(int fd, struct party* p, int char_id); @@ -150,15 +150,15 @@ int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) int mapif_party_withdraw(int party_id,int account_id, int char_id); int mapif_party_membermoved(struct party *p, int idx); int mapif_party_broken(int party_id, int flag); -int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd); -int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader); +int mapif_party_message(int party_id, int account_id, const char *mes, int len, int sfd); +int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const struct party_member *leader); void mapif_parse_PartyInfo(int fd, int party_id, int char_id); -int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member); +int mapif_parse_PartyAddMember(int fd, int party_id, const struct party_member *member); int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int item); int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id); int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); int mapif_parse_BreakParty(int fd, int party_id); -int mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len); +int mapif_parse_PartyMessage(int fd, int party_id, int account_id, const char *mes, int len); int mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id); int mapif_pet_created(int fd, int account_id, struct s_pet *p); int mapif_pet_info(int fd, int account_id, struct s_pet *p); @@ -166,7 +166,7 @@ int mapif_pet_noinfo(int fd, int account_id); int mapif_save_pet_ack(int fd, int account_id, int flag); int mapif_delete_pet_ack(int fd, int flag); int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); int mapif_load_pet(int fd, int account_id, int char_id, int pet_id); int mapif_save_pet(int fd, int account_id, const struct s_pet *data); int mapif_delete_pet(int fd, int pet_id); @@ -192,9 +192,9 @@ void mapif_parse_ItemBoundRetrieve(int fd); void mapif_parse_accinfo(int fd); void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); -int mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); +int mapif_broadcast(const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); int mapif_wis_message(struct WisData *wd); -void mapif_wis_response(int fd, unsigned char *src, int flag); +void mapif_wis_response(int fd, const unsigned char *src, int flag); int mapif_wis_end(struct WisData *wd, int flag); int mapif_account_reg_reply(int fd,int account_id,int char_id, int type); int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason); diff --git a/src/char/mapif.h b/src/char/mapif.h index 6b8afd4b2..37d9444e2 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -36,7 +36,7 @@ struct mapif_interface { void (*on_disconnect) (int id); void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); void (*char_ban) (int char_id, time_t timestamp); - int (*sendall) (unsigned char *buf, unsigned int len); + int (*sendall) (const unsigned char *buf, unsigned int len); int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); int (*send) (int fd, unsigned char *buf, unsigned int len); void (*send_users_count) (int users); @@ -56,12 +56,12 @@ struct mapif_interface { bool (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); bool (*elemental_delete) (int ele_id); void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); - void (*parse_elemental_create) (int fd, struct s_elemental* ele); + void (*parse_elemental_create) (int fd, const struct s_elemental *ele); void (*parse_elemental_load) (int fd, int ele_id, int char_id); void (*elemental_deleted) (int fd, unsigned char flag); void (*parse_elemental_delete) (int fd, int ele_id); void (*elemental_saved) (int fd, unsigned char flag); - void (*parse_elemental_save) (int fd, struct s_elemental* ele); + void (*parse_elemental_save) (int fd, const struct s_elemental *ele); int (*guild_created) (int fd, int account_id, struct guild *g); int (*guild_noinfo) (int fd, int guild_id); int (*guild_info) (int fd, struct guild *g); @@ -69,7 +69,7 @@ struct mapif_interface { int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); int (*guild_memberinfoshort) (struct guild *g, int idx); int (*guild_broken) (int guild_id, int flag); - int (*guild_message) (int guild_id,int account_id,char *mes,int len, int sfd); + int (*guild_message) (int guild_id, int account_id, const char *mes, int len, int sfd); int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); @@ -78,40 +78,40 @@ struct mapif_interface { int (*guild_notice) (struct guild *g); int (*guild_emblem) (struct guild *g); int (*guild_master_changed) (struct guild *g, int aid, int cid); - int (*guild_castle_dataload) (int fd, int sz, int *castle_ids); - int (*parse_CreateGuild) (int fd,int account_id,char *name,struct guild_member *master); + int (*guild_castle_dataload) (int fd, int sz, const int *castle_ids); + int (*parse_CreateGuild) (int fd, int account_id, const char *name, const struct guild_member *master); int (*parse_GuildInfo) (int fd, int guild_id); - int (*parse_GuildAddMember) (int fd, int guild_id, struct guild_member *m); + int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m); int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); int (*parse_BreakGuild) (int fd, int guild_id); - int (*parse_GuildMessage) (int fd, int guild_id, int account_id, char *mes, int len); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len); int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); - int (*parse_GuildPosition) (int fd, int guild_id, int idx, struct guild_position *p); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, const struct guild_position *p); int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); - int (*parse_GuildCastleDataLoad) (int fd, int len, int *castle_ids); + int (*parse_GuildCastleDataLoad) (int fd, int len, const int *castle_ids); int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); - void (*homunculus_created) (int fd, int account_id, struct s_homunculus *sh, unsigned char flag); + void (*homunculus_created) (int fd, int account_id, const struct s_homunculus *sh, unsigned char flag); void (*homunculus_deleted) (int fd, int flag); void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); void (*homunculus_saved) (int fd, int account_id, bool flag); - void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, char* name); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, const char *name); bool (*homunculus_create) (struct s_homunculus *hd); bool (*homunculus_save) (const struct s_homunculus *hd); bool (*homunculus_load) (int homun_id, struct s_homunculus* hd); bool (*homunculus_delete) (int homun_id); - bool (*homunculus_rename) (char *name); - void (*parse_homunculus_create) (int fd, int len, int account_id, struct s_homunculus* phd); + bool (*homunculus_rename) (const char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, const struct s_homunculus *phd); void (*parse_homunculus_delete) (int fd, int homun_id); void (*parse_homunculus_load) (int fd, int account_id, int homun_id); - void (*parse_homunculus_save) (int fd, int len, int account_id, struct s_homunculus* phd); - void (*parse_homunculus_rename) (int fd, int account_id, int char_id, char* name); + void (*parse_homunculus_save) (int fd, int len, int account_id, const struct s_homunculus *phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, const char *name); void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); void (*parse_mail_requestinbox) (int fd); void (*parse_mail_read) (int fd); @@ -130,12 +130,12 @@ struct mapif_interface { bool (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); bool (*mercenary_delete) (int merc_id); void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); - void (*parse_mercenary_create) (int fd, struct s_mercenary* merc); + void (*parse_mercenary_create) (int fd, const struct s_mercenary *merc); void (*parse_mercenary_load) (int fd, int merc_id, int char_id); void (*mercenary_deleted) (int fd, unsigned char flag); void (*parse_mercenary_delete) (int fd, int merc_id); void (*mercenary_saved) (int fd, unsigned char flag); - void (*parse_mercenary_save) (int fd, struct s_mercenary* merc); + void (*parse_mercenary_save) (int fd, const struct s_mercenary *merc); int (*party_created) (int fd, int account_id, int char_id, struct party *p); void (*party_noinfo) (int fd, int party_id, int char_id); void (*party_info) (int fd, struct party* p, int char_id); @@ -144,15 +144,15 @@ struct mapif_interface { int (*party_withdraw) (int party_id,int account_id, int char_id); int (*party_membermoved) (struct party *p, int idx); int (*party_broken) (int party_id, int flag); - int (*party_message) (int party_id, int account_id, char *mes, int len, int sfd); - int (*parse_CreateParty) (int fd, char *name, int item, int item2, struct party_member *leader); + int (*party_message) (int party_id, int account_id, const char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, const char *name, int item, int item2, const struct party_member *leader); void (*parse_PartyInfo) (int fd, int party_id, int char_id); - int (*parse_PartyAddMember) (int fd, int party_id, struct party_member *member); + int (*parse_PartyAddMember) (int fd, int party_id, const struct party_member *member); int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); int (*parse_BreakParty) (int fd, int party_id); - int (*parse_PartyMessage) (int fd, int party_id, int account_id, char *mes, int len); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, const char *mes, int len); int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); int (*pet_created) (int fd, int account_id, struct s_pet *p); int (*pet_info) (int fd, int account_id, struct s_pet *p); @@ -160,7 +160,7 @@ struct mapif_interface { int (*save_pet_ack) (int fd, int account_id, int flag); int (*delete_pet_ack) (int fd, int flag); int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); int (*load_pet) (int fd, int account_id, int char_id, int pet_id); int (*save_pet) (int fd, int account_id, const struct s_pet *data); int (*delete_pet) (int fd, int pet_id); @@ -186,9 +186,9 @@ struct mapif_interface { void (*parse_accinfo) (int fd); void (*parse_accinfo2) (bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); - int (*broadcast) (unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*broadcast) (const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); int (*wis_message) (struct WisData *wd); - void (*wis_response) (int fd, unsigned char *src, int flag); + void (*wis_response) (int fd, const unsigned char *src, int flag); int (*wis_end) (struct WisData *wd, int flag); int (*account_reg_reply) (int fd,int account_id,int char_id, int type); int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); |