diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 4 | ||||
-rw-r--r-- | src/map/battle.h | 4 | ||||
-rw-r--r-- | src/map/chat.c | 2 | ||||
-rw-r--r-- | src/map/chat.h | 2 | ||||
-rw-r--r-- | src/map/chrif.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 63 | ||||
-rw-r--r-- | src/map/clif.h | 40 | ||||
-rw-r--r-- | src/map/irc.c | 2 | ||||
-rw-r--r-- | src/map/irc.h | 2 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 6 | ||||
-rw-r--r-- | src/map/mob.h | 6 | ||||
-rw-r--r-- | src/map/npc.c | 14 | ||||
-rw-r--r-- | src/map/npc.h | 4 | ||||
-rw-r--r-- | src/map/npc_chat.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 13 |
17 files changed, 99 insertions, 75 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 756e433ce..9919867e4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3741,7 +3741,7 @@ static const struct battle_data_int { { "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate }, //[orn] }; -int battle_set_value(char *w1, char *w2) { +int battle_set_value(const char* w1, const char* w2) { int i; for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) if (strcmpi(w1, battle_data_short[i].str) == 0) { @@ -3756,7 +3756,7 @@ int battle_set_value(char *w1, char *w2) { return 0; } -int battle_get_value(char *w1) { +int battle_get_value(const char* w1) { int i; for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) if (strcmpi(w1, battle_data_short[i].str) == 0) { diff --git a/src/map/battle.h b/src/map/battle.h index c04fcfbfb..6d94d3fd9 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -441,7 +441,7 @@ void do_final_battle(void); extern int battle_config_read(const char *cfgName); extern void battle_validate_conf(void); extern void battle_set_defaults(void); -extern int battle_set_value(char *, char *); -int battle_get_value(char *); +int battle_set_value(const char* w1, const char* w2); +int battle_get_value(const char* w1); #endif /* _BATTLE_H_ */ diff --git a/src/map/chat.c b/src/map/chat.c index eb77fdd89..28ddbe8c4 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -276,7 +276,7 @@ int chat_kickchat(struct map_session_data *sd,char *kickusername) * npcチャットルーム作成 *------------------------------------------ */ -int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,char* title,int titlelen,const char *ev) +int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev) { struct chat_data *cd; diff --git a/src/map/chat.h b/src/map/chat.h index bfb1a0a80..db7b21b15 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -13,7 +13,7 @@ int chat_changechatowner(struct map_session_data *,char *); int chat_changechatstatus(struct map_session_data *,int,int,char*,char*,int); int chat_kickchat(struct map_session_data *,char *); -int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,char* title,int titlelen,const char *ev); +int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev); int chat_deletenpcchat(struct npc_data *nd); int chat_enableevent(struct chat_data *cd); int chat_disableevent(struct chat_data *cd); diff --git a/src/map/chrif.c b/src/map/chrif.c index 6a90b14ea..87517f40c 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -377,6 +377,7 @@ int chrif_changemapserver(struct map_session_data *sd, short map, int x, int y, int chrif_changemapserverack(int fd) { struct map_session_data *sd; + char mapname[MAP_NAME_LENGTH+1]; RFIFOHEAD(fd); sd = map_id2sd(RFIFOL(fd,2)); @@ -389,7 +390,8 @@ int chrif_changemapserverack(int fd) clif_authfail_fd(sd->fd, 0); return 0; } - clif_changemapserver(sd, (char*)mapindex_id2name(RFIFOW(fd,18)), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); + sprintf(mapname, "%s.gat", mapindex_id2name(RFIFOW(fd,18))); + clif_changemapserver(sd, mapname, RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); //Player has been saved already, remove him from memory. [Skotlex] map_quit(sd); diff --git a/src/map/clif.c b/src/map/clif.c index 808733458..f7b018a31 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -113,7 +113,7 @@ static void clif_hpmeter_single(int fd, struct map_session_data *sd); * map鯖のip設定 *------------------------------------------ */ -int clif_setip(char *ip) +int clif_setip(const char* ip) { char ip_str[16]; map_ip = resolve_hostbyname(ip,NULL,ip_str); @@ -127,7 +127,7 @@ int clif_setip(char *ip) return 1; } -void clif_setbindip(char *ip) +void clif_setbindip(const char* ip) { unsigned char ip_str[4]; bind_ip = resolve_hostbyname(ip,ip_str,NULL); @@ -293,7 +293,7 @@ int clif_send_sub(struct block_list *bl, va_list ap) * *------------------------------------------ */ -int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) { +int clif_send (const unsigned char *buf, int len, struct block_list *bl, int type) { int i; struct map_session_data *sd = NULL; struct party_data *p = NULL; @@ -1548,6 +1548,25 @@ int clif_movepc(struct map_session_data *sd) { return 0; } +/// Move the unit (does nothing if the client has no info about the unit) +/// Note: unit must not be self +//##TODO make sure insight/outsight code is solid enough before using this [FlavioJS] +/* +void clif_moveunit(int fd, struct unit_data* ud) +{ + struct block_list* bl; + + bl = ud->bl; + + WFIFOHEAD(fd, packet_len(0x86)); + WFIFOW(fd,0)=0x86; + WFIFOL(fd,2)=bl->id; + WFIFOPOS2(fd,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); + WFIFOL(fd,12)=gettick(); + WFIFOSET(fd, packet_len(0x86)); +} +*/ + /*========================================== * *------------------------------------------ @@ -1685,7 +1704,7 @@ int clif_changemap(struct map_session_data *sd, short map, int x, int y) { * *------------------------------------------ */ -int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int y, int ip, int port) { +int clif_changemapserver(struct map_session_data* sd, const char* mapname, int x, int y, int ip, int port) { int fd; nullpo_retr(0, sd); @@ -1892,7 +1911,7 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) { * *------------------------------------------ */ -int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) { +int clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { int fd = sd->fd; int slen = strlen(mes) + 8; struct block_list *bl = NULL; @@ -1986,7 +2005,7 @@ int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int * *------------------------------------------ */ -int clif_cutin(struct map_session_data *sd, char *image, int type) { +int clif_cutin(struct map_session_data* sd, const char* image, int type) { int fd; nullpo_retr(0, sd); @@ -3391,7 +3410,7 @@ int clif_leavechat(struct chat_data* cd,struct map_session_data *sd) * 取り引き要請受け *------------------------------------------ */ -int clif_traderequest(struct map_session_data *sd,char *name) +int clif_traderequest(struct map_session_data* sd, const char* name) { int fd; @@ -4864,7 +4883,7 @@ int clif_status_change(struct block_list *bl,int type,int flag) * Send message (modified by [Yor]) *------------------------------------------ */ -int clif_displaymessage(const int fd, char* mes) +int clif_displaymessage(const int fd, const char* mes) { // invalid pointer? nullpo_retr(-1, mes); @@ -4891,7 +4910,7 @@ int clif_displaymessage(const int fd, char* mes) * 天の声を送信する *------------------------------------------ */ -int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag) +int clif_GMmessage(struct block_list* bl, const char* mes, int len, int flag) { unsigned char *buf; int lp; @@ -4921,7 +4940,7 @@ int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag) * グローバルメッセージ *------------------------------------------ */ -void clif_GlobalMessage(struct block_list *bl,char *message) +void clif_GlobalMessage(struct block_list* bl, const char* message) { char buf[100]; int len; @@ -4944,7 +4963,7 @@ void clif_GlobalMessage(struct block_list *bl,char *message) * Send main chat message [LuzZza] *------------------------------------------ */ -void clif_MainChatMessage(char* message) { +void clif_MainChatMessage(const char* message) { char buf[200]; int len; @@ -4968,7 +4987,7 @@ void clif_MainChatMessage(char* message) { * Does an announce message in the given color. *------------------------------------------ */ -int clif_announce(struct block_list *bl, char* mes, int len, unsigned long color, int flag) +int clif_announce(struct block_list* bl, const char* mes, int len, unsigned long color, int flag) { unsigned char *buf; buf = (unsigned char*)aMallocA((len + 16)*sizeof(unsigned char)); @@ -5114,7 +5133,7 @@ int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val) * Wisp/page is transmitted to the destination player *------------------------------------------ */ -int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len>.w <nick>.24B <message>.?B +int clif_wis_message(int fd, const char* nick, const char* mes, int mes_len) // R 0097 <len>.w <nick>.24B <message>.?B { // printf("clif_wis_message(%d, %s, %s)\n", fd, nick, mes); @@ -5492,7 +5511,7 @@ int clif_openvendingreq(struct map_session_data *sd,int num) * 露店看板表示 *------------------------------------------ */ -int clif_showvendingboard(struct block_list* bl,char *message,int fd) +int clif_showvendingboard(struct block_list* bl, const char* message, int fd) { unsigned char buf[128]; @@ -5780,7 +5799,7 @@ int clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) * 4 -> char of the same account already joined the party *------------------------------------------ */ -int clif_party_inviteack(struct map_session_data *sd,char *nick,int flag) +int clif_party_inviteack(struct map_session_data* sd, const char* nick, int flag) { int fd; @@ -5829,7 +5848,7 @@ int clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) * パーティ脱退(脱退前に呼ぶこと) *------------------------------------------ */ -int clif_party_leaved(struct party_data *p,struct map_session_data *sd,int account_id,char *name,int flag) +int clif_party_leaved(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) { unsigned char buf[64]; int i; @@ -5860,7 +5879,7 @@ int clif_party_leaved(struct party_data *p,struct map_session_data *sd,int accou * パーティメッセージ送信 *------------------------------------------ */ -int clif_party_message(struct party_data *p,int account_id,char *mes,int len) +int clif_party_message(struct party_data* p, int account_id, const char* mes, int len) { struct map_session_data *sd; int i; @@ -7207,7 +7226,7 @@ void clif_emotion(struct block_list *bl,int type) * トーキーボックス *------------------------------------------ */ -void clif_talkiebox(struct block_list *bl,char* talkie) +void clif_talkiebox(struct block_list* bl, const char* talkie) { unsigned char buf[86]; @@ -7292,7 +7311,7 @@ void clif_marriage_process(struct map_session_data *sd) * Notice of divorce *------------------------------------------ */ -void clif_divorced(struct map_session_data *sd, char *name) +void clif_divorced(struct map_session_data* sd, const char* name) { int fd; nullpo_retv(sd); @@ -7366,7 +7385,7 @@ int clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len) * Displays a message using the guild-chat colors to the specified targets. [Skotlex] *------------------------------------------ */ -void clif_disp_message(struct block_list *src, char *mes, int len, int type) +void clif_disp_message(struct block_list* src, const char* mes, int len, int type) { unsigned char buf[1024]; if (!len) return; @@ -7789,7 +7808,7 @@ int clif_slide(struct block_list *bl, int x, int y){ * @me command by lordalfa, rewritten implementation by Skotlex *------------------------------------------ */ -int clif_disp_overhead(struct map_session_data *sd, char* mes) +int clif_disp_overhead(struct map_session_data *sd, const char* mes) { unsigned char buf[256]; //This should be more than sufficient, the theorical max is CHAT_SIZE + 8 (pads and extra inserted crap) int len_mes = strlen(mes)+1; //Account for \0 @@ -8623,7 +8642,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) return; } -int clif_message(struct block_list *bl, char* msg) +int clif_message(struct block_list *bl, const char* msg) { unsigned short msg_len = strlen(msg) + 1; unsigned char buf[256]; diff --git a/src/map/clif.h b/src/map/clif.h index fba601fce..6a0e51da8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -50,8 +50,8 @@ enum { #define packet_len(x) packet_db[SERVER][x].len extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB]; -int clif_setip(char*); -void clif_setbindip(char*); +int clif_setip(const char* ip); +void clif_setbindip(const char* ip); void clif_setport(int); unsigned long clif_getip_long(void); @@ -75,7 +75,7 @@ int clif_spawn(struct block_list*); //area int clif_walkok(struct map_session_data*); // self int clif_move(struct block_list*); // area int clif_changemap(struct map_session_data*,short,int,int); //self -int clif_changemapserver(struct map_session_data*,char*,int,int,int,int); //self +int clif_changemapserver(struct map_session_data* sd, const char* mapname, int x, int y, int ip, int port); //self int clif_blown(struct block_list *); // area int clif_slide(struct block_list *,int,int); // area int clif_fixpos(struct block_list *); // area @@ -86,10 +86,10 @@ int clif_selllist(struct map_session_data*); //self int clif_scriptmes(struct map_session_data*,int,const char*); //self int clif_scriptnext(struct map_session_data*,int); //self int clif_scriptclose(struct map_session_data*,int); //self -int clif_scriptmenu(struct map_session_data*,int,char*); //self +int clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes); //self int clif_scriptinput(struct map_session_data*,int); //self int clif_scriptinputstr(struct map_session_data *sd,int npcid); // self -int clif_cutin(struct map_session_data*,char*,int); //self +int clif_cutin(struct map_session_data* sd, const char* image, int type); //self int clif_viewpoint(struct map_session_data*,int,int,int,int,int,int); //self int clif_additem(struct map_session_data*,int,int,int); //self int clif_delitem(struct map_session_data*,int,int); //self @@ -110,7 +110,7 @@ int clif_misceffect(struct block_list*,int); // area int clif_misceffect2(struct block_list *bl,int type); int clif_changeoption(struct block_list*); // area int clif_useitemack(struct map_session_data*,int,int,int); // self -void clif_GlobalMessage(struct block_list *bl,char *message); +void clif_GlobalMessage(struct block_list* bl, const char* message); int clif_createchat(struct map_session_data*,int); // self int clif_dispchat(struct chat_data*,int); // area or fd int clif_joinchatfail(struct map_session_data*,int); // self @@ -127,9 +127,9 @@ int clif_fame_alchemist(struct map_session_data *, int); int clif_fame_taekwon(struct map_session_data *, int); void clif_emotion(struct block_list *bl,int type); -void clif_talkiebox(struct block_list *bl,char* talkie); +void clif_talkiebox(struct block_list* bl, const char* talkie); void clif_wedding_effect(struct block_list *bl); -void clif_divorced(struct map_session_data *sd, char *); +void clif_divorced(struct map_session_data* sd, const char* name); //void clif_sitting(int fd, struct map_session_data *sd); //void clif_callpartner(struct map_session_data *sd); void clif_adopt_process(struct map_session_data *sd); @@ -140,7 +140,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, void clif_parse_LoadEndAck(int fd,struct map_session_data *sd); // trade -int clif_traderequest(struct map_session_data *sd,char *name); +int clif_traderequest(struct map_session_data* sd, const char* name); int clif_tradestart(struct map_session_data *sd,int type); int clif_tradeadditem(struct map_session_data *sd,struct map_session_data *tsd,int index,int amount); int clif_tradeitemok(struct map_session_data *sd,int index,int fail); @@ -209,7 +209,7 @@ int clif_changemapcell(int m,int x,int y,int cell_type,int type); int clif_status_load(struct block_list *bl,int type, int flag); int clif_status_change(struct block_list *bl,int type,int flag); -int clif_wis_message(int fd,char *nick,char *mes,int mes_len); +int clif_wis_message(int fd, const char* nick, const char* mes, int mes_len); int clif_wis_end(int fd,int flag); int clif_solved_charname(struct map_session_data *sd,int char_id); @@ -242,7 +242,7 @@ void clif_changed_dir(struct block_list *bl, int area); // vending int clif_openvendingreq(struct map_session_data *sd,int num); -int clif_showvendingboard(struct block_list* bl,char *message,int fd); +int clif_showvendingboard(struct block_list* bl, const char* message, int fd); int clif_closevendingboard(struct block_list* bl,int fd); int clif_vendinglist(struct map_session_data *sd,int id,struct vending *vending); int clif_buyvending(struct map_session_data *sd,int index,int amount,int fail); @@ -256,10 +256,10 @@ int clif_party_created(struct map_session_data *sd,int flag); int clif_party_member_info(struct party_data *p, struct map_session_data *sd); int clif_party_info(struct party_data *p, struct map_session_data *sd); int clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd); -int clif_party_inviteack(struct map_session_data *sd,char *nick,int flag); +int clif_party_inviteack(struct map_session_data* sd, const char* nick, int flag); int clif_party_option(struct party_data *p,struct map_session_data *sd,int flag); -int clif_party_leaved(struct party_data *p,struct map_session_data *sd,int account_id,char *name,int flag); -int clif_party_message(struct party_data *p,int account_id,char *mes,int len); +int clif_party_leaved(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag); +int clif_party_message(struct party_data* p, int account_id, const char* mes, int len); int clif_party_move(struct party *p,struct map_session_data *sd,int online); int clif_party_xy(struct map_session_data *sd); int clif_party_xy_single(int fd, struct map_session_data *sd); @@ -298,9 +298,9 @@ int clif_guild_xy_remove(struct map_session_data *sd); // atcommand int clif_displaymessage(const int fd,const char* mes); int clif_disp_onlyself(struct map_session_data *sd,const char *mes,int len); -void clif_disp_message(struct block_list *src, char *mes, int len, int type); -int clif_GMmessage(struct block_list *bl,char* mes,int len,int flag); -void clif_MainChatMessage(char* message); //luzza +void clif_disp_message(struct block_list* src, const char* mes, int len, int type); +int clif_GMmessage(struct block_list* bl, const char* mes, int len, int flag); +void clif_MainChatMessage(const char* message); //luzza int clif_announce(struct block_list *bl, const char* mes, int len, unsigned long color, int flag); int clif_heal(int fd,int type,int val); int clif_resurrection(struct block_list *bl,int type); @@ -319,7 +319,7 @@ int clif_pet_emotion(struct pet_data *pd,int param); int clif_pet_performance(struct block_list *bl,int param); int clif_pet_equip(struct pet_data *pd); int clif_pet_food(struct map_session_data *sd,int foodid,int fail); -int clif_send(unsigned char *buf, int len, struct block_list *bl, int type); +int clif_send(const unsigned char *buf, int len, struct block_list *bl, int type); //friends list int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap); @@ -330,7 +330,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat int clif_mob_hp(struct mob_data *md); int clif_weather(int m); // [Valaris] int clif_specialeffect(struct block_list *bl,int type, int flag); // special effects [Valaris] -int clif_message(struct block_list *bl, char* msg); // messages (from mobs/npcs) [Valaris] +int clif_message(struct block_list *bl, const char* msg); // messages (from mobs/npcs) [Valaris] int clif_GM_kickack(struct map_session_data *sd,int id); int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int type); @@ -338,7 +338,7 @@ int clif_GM_silence(struct map_session_data *sd,struct map_session_data *tsd,int int clif_timedout(struct map_session_data *sd); int clif_foreachclient(int (*)(struct map_session_data*,va_list),...); -int clif_disp_overhead(struct map_session_data *sd, char* mes); +int clif_disp_overhead(struct map_session_data *sd, const char* mes); int do_final_clif(void); int do_init_clif(void); diff --git a/src/map/irc.c b/src/map/irc.c index 2300dd3ac..7228da81a 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -64,7 +64,7 @@ int irc_connect_timer(int tid, unsigned int tick, int id, int data) return 0; } -void irc_announce(char *buf) +void irc_announce(const char* buf) { char send_string[256]; // memset(send_string,'\0',256); // NOT REQUIRED diff --git a/src/map/irc.h b/src/map/irc.h index 163ac0793..1cf02692c 100644 --- a/src/map/irc.h +++ b/src/map/irc.h @@ -26,7 +26,7 @@ extern short irc_announce_mvp_flag; extern short irc_announce_shop_flag; extern short irc_announce_jobchange_flag; -void irc_announce(char *buf); +void irc_announce(const char* buf); void irc_announce_jobchange(struct map_session_data *sd); void irc_announce_shop(struct map_session_data *sd,int flag); void irc_announce_mvp(struct map_session_data *sd, struct mob_data *md); diff --git a/src/map/map.c b/src/map/map.c index 663085107..7bd04015b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2072,7 +2072,7 @@ void map_removemobs(int m) * map名からmap番?へ?換 *------------------------------------------ */ -int map_mapname2mapid(char *name) { +int map_mapname2mapid(const char* name) { unsigned short map_index; map_index = mapindex_name2id(name); if (!map_index) diff --git a/src/map/map.h b/src/map/map.h index 719ad85c4..4ce73972e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1375,7 +1375,7 @@ struct map_session_data * map_charid2sd(int); struct map_session_data * map_id2sd(int); struct block_list * map_id2bl(int); int map_mapindex2mapid(unsigned short mapindex); -int map_mapname2mapid(char*); +int map_mapname2mapid(const char* name); int map_mapname2ipport(unsigned short,int*,int*); int map_setipport(unsigned short map,unsigned long ip,int port); int map_eraseipport(unsigned short map,unsigned long ip,int port); diff --git a/src/map/mob.c b/src/map/mob.c index da4696620..db519fce9 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -311,7 +311,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, * The MOB appearance for one time (for scripts) *------------------------------------------ */ -int mob_once_spawn (struct map_session_data *sd, char *mapname, +int mob_once_spawn (struct map_session_data *sd, const char *mapname, short x, short y, const char *mobname, int class_, int amount, const char *event) { struct mob_data *md = NULL; @@ -364,7 +364,7 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname, * The MOB appearance for one time (& area specification for scripts) *------------------------------------------ */ -int mob_once_spawn_area(struct map_session_data *sd,char *mapname, +int mob_once_spawn_area(struct map_session_data *sd,const char *mapname, int x0,int y0,int x1,int y1, const char *mobname,int class_,int amount,const char *event) { @@ -459,7 +459,7 @@ static int mob_spawn_guardian_sub(int tid,unsigned int tick,int id,int data) * Summoning Guardians [Valaris] *------------------------------------------ */ -int mob_spawn_guardian(char *mapname,short x,short y,const char *mobname,int class_,const char *event,int guardian) +int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian) { struct mob_data *md=NULL; struct spawn_data data; diff --git a/src/map/mob.h b/src/map/mob.h index 09dfb5a2a..61f0d6345 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -151,13 +151,13 @@ int mobdb_checkid(const int id); struct view_data* mob_get_viewdata(int class_); struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short y, const char *mobname, int class_, const char *event); -int mob_once_spawn(struct map_session_data *sd,char *mapname, +int mob_once_spawn(struct map_session_data *sd,const char *mapname, short x,short y,const char *mobname,int class_,int amount,const char *event); -int mob_once_spawn_area(struct map_session_data *sd,char *mapname, +int mob_once_spawn_area(struct map_session_data *sd,const char *mapname, int x0,int y0,int x1,int y1, const char *mobname,int class_,int amount,const char *event); -int mob_spawn_guardian(char *mapname,short x,short y,const char *mobname,int class_,const char *event,int guardian); // Spawning Guardians [Valaris] +int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian); // Spawning Guardians [Valaris] int mob_guardian_guildchange(struct block_list *bl,va_list ap); //Change Guardian's ownership. [Skotlex] int mob_randomwalk(struct mob_data *md,int tick); diff --git a/src/map/npc.c b/src/map/npc.c index 695037b8d..70fac3c5c 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -914,13 +914,13 @@ int npc_event (struct map_session_data *sd, const unsigned char *eventname, int int npc_command_sub(DBKey key,void *data,va_list ap) { - unsigned char *p = key.str; + const char* p = (const char*)key.str; struct event_data *ev=(struct event_data *)data; - unsigned char *npcname=va_arg(ap,char *); - char *command=va_arg(ap,char *); + const char* npcname = va_arg(ap, const char*); + const char* command = va_arg(ap, const char*); unsigned char temp[100]; - if(strcmp(ev->nd->name,npcname)==0 && (p=strchr(p,':')) && p && strnicmp("::OnCommand",p,10)==0 ){ + if(strcmp(ev->nd->name,npcname)==0 && (p=strchr(p,':')) && strnicmp("::OnCommand",p,10)==0 ){ sscanf(&p[11],"%s",temp); if (strcmp(command,temp)==0) @@ -930,9 +930,9 @@ int npc_command_sub(DBKey key,void *data,va_list ap) return 0; } -int npc_command(struct map_session_data *sd,const unsigned char *npcname,char *command) +int npc_command(struct map_session_data* sd, const char* npcname, const char* command) { - ev_db->foreach(ev_db,npc_command_sub,npcname,command); + ev_db->foreach(ev_db, npc_command_sub, npcname, command); return 0; } @@ -1152,7 +1152,7 @@ TBL_NPC *npc_checknear(struct map_session_data *sd,struct block_list *bl) * NPCのオープンチャット発言 *------------------------------------------ */ -int npc_globalmessage(const char *name,char *mes) +int npc_globalmessage(const char *name,const char *mes) { struct npc_data *nd=(struct npc_data *) strdb_get(npcname_db,(unsigned char*)name); char temp[100]; diff --git a/src/map/npc.h b/src/map/npc.h index 86bce296c..0a1025040 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -38,7 +38,7 @@ int npc_event_dequeue(struct map_session_data *sd); int npc_event_timer(int tid,unsigned int tick,int id,int data); int npc_event(struct map_session_data *sd,const unsigned char *npcname,int); int npc_timer_event(const unsigned char *eventname); // Added by RoVeRT -int npc_command(struct map_session_data *sd,const unsigned char *npcname,char *command); +int npc_command(struct map_session_data* sd, const char* npcname, const char* command); int npc_touch_areanpc(struct map_session_data *,int,int,int); int npc_touch_areanpc2(struct block_list *bl); // [Skotlex] int npc_check_areanpc(int flag,int m,int x,int y,int range); @@ -52,7 +52,7 @@ int npc_selllist(struct map_session_data *,int,unsigned short *); int npc_parse_mob(char *w1,char *w2,char *w3,char *w4); int npc_parse_mob2 (struct spawn_data*, int index); // [Wizputer] int npc_parse_warp(char *w1,char *w2,char *w3,char *w4); -int npc_globalmessage(const char *name,char *mes); +int npc_globalmessage(const char *name,const char *mes); int npc_enable(const char *name,int flag); int npc_changename(const char *name, const char *newname, short look); // [Lance] diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index f7c955257..e77c93020 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -479,8 +479,8 @@ int mob_chat_sub(struct block_list *bl, va_list ap){ int buildin_defpattern(struct script_state *st) { int setid=conv_num(st,& (st->stack->stack_data[st->start+2])); - char *pattern=conv_str(st,& (st->stack->stack_data[st->start+3])); - char *label=conv_str(st,& (st->stack->stack_data[st->start+4])); + const char *pattern=conv_str(st,& (st->stack->stack_data[st->start+3])); + const char *label=conv_str(st,& (st->stack->stack_data[st->start+4])); struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid); npc_chat_def_pattern(nd, setid, pattern, label); diff --git a/src/map/script.c b/src/map/script.c index 57a738d28..eb1bc4609 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4245,7 +4245,7 @@ BUILDIN_FUNC(callfunc) struct script_code *scr, *oldscr; const char *str=conv_str(st,& (st->stack->stack_data[st->start+2])); - if( (scr=strdb_get(userfunc_db,str)) ){ + if( (scr=strdb_get(userfunc_db,(unsigned char*)str)) ){ int i,j; struct linkdb_node **oldval = st->stack->var_function; for(i=st->start+3,j=0;i<st->end;i++,j++) @@ -9141,12 +9141,14 @@ BUILDIN_FUNC(getcastlename) BUILDIN_FUNC(getcastledata) { - const char *mapname=conv_str(st,& (st->stack->stack_data[st->start+2])); + char mapname[MAP_NAME_LENGTH+1]; int index=conv_num(st,& (st->stack->stack_data[st->start+3])); const char *event=NULL; struct guild_castle *gc; int i,j; + strncpy(mapname, conv_str(st,script_getdata(st,2)), MAP_NAME_LENGTH); + mapname[MAP_NAME_LENGTH] = '\0'; map_normalize_name(mapname); if( st->end>st->start+4 && index==0){ @@ -9206,12 +9208,14 @@ BUILDIN_FUNC(getcastledata) BUILDIN_FUNC(setcastledata) { - const char *mapname=conv_str(st,& (st->stack->stack_data[st->start+2])); + char mapname[MAP_NAME_LENGTH+1]; int index=conv_num(st,& (st->stack->stack_data[st->start+3])); int value=conv_num(st,& (st->stack->stack_data[st->start+4])); struct guild_castle *gc; int i; + strncpy(mapname, conv_str(st,script_getdata(st,2)), MAP_NAME_LENGTH); + mapname[MAP_NAME_LENGTH] = '\0'; map_normalize_name(mapname); for(i=0;i<MAX_GUILDCASTLE;i++){ @@ -11751,7 +11755,6 @@ BUILDIN_FUNC(compare) { const char *message; const char *cmpstring; - int j; message = conv_str(st,& (st->stack->stack_data[st->start+2])); cmpstring = conv_str(st,& (st->stack->stack_data[st->start+3])); push_val(st->stack,C_INT,(stristr(message,cmpstring) != NULL)); @@ -12374,7 +12377,7 @@ BUILDIN_FUNC(checkchatting) // check chatting [Marka] return 0; } -int axtoi(char *hexStg) +int axtoi(const char *hexStg) { int n = 0; // position in string int m = 0; // position in digit[] to shift |