summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-05 19:49:38 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-05 19:49:38 +0000
commit0fb0df3a0fa3ac24f9f068d0c1ac664beec03354 (patch)
treedb71917a103760aab874f5ff37c4546f0124d04f /src/map
parentb6e528890886089169555661a769fc14361dddb0 (diff)
downloadhercules-0fb0df3a0fa3ac24f9f068d0c1ac664beec03354.tar.gz
hercules-0fb0df3a0fa3ac24f9f068d0c1ac664beec03354.tar.bz2
hercules-0fb0df3a0fa3ac24f9f068d0c1ac664beec03354.tar.xz
hercules-0fb0df3a0fa3ac24f9f068d0c1ac664beec03354.zip
- Corrected SC_INTRAVISION not starting.
- Small cleanups (line terminators, indenting) - Fixed crash when attempting to read a Label as a string on a script (thanks to End of Exam) - Fixed possible crash when changing a chat-room's owner (thanks to End of Exam) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8639 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chat.c11
-rw-r--r--src/map/clif.c63
-rw-r--r--src/map/mob.h2
-rw-r--r--src/map/npc.c1
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/script.c21
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/status.c6
8 files changed, 54 insertions, 54 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 6d84aca4c..a1bb7a293 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -145,16 +145,18 @@ int chat_leavechat(struct map_session_data *sd)
pc_setchatid(sd,0);
if(cd->users == 0 && (*cd->owner)->type==BL_PC){
- // 全員居なくなった&PCのチャットなので消す
+ //Delete empty chatroom
clif_clearchat(cd,0);
- map_delobject(cd->bl.id); // freeまでしてくれる
+ map_delobject(cd->bl.id);
} else {
for(i=leavechar;i < cd->users;i++)
cd->usersd[i] = cd->usersd[i+1];
if(leavechar==0 && (*cd->owner)->type==BL_PC){
- // PCのチャットなので所有者が抜けたので位置変更
+ //Adjust Chat location after owner has been changed.
+ map_delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
+ map_addblock( &cd->bl );
}
clif_dispchat(cd,0);
}
@@ -197,9 +199,10 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername)
cd->usersd[0] = cd->usersd[nextowner];
cd->usersd[nextowner] = tmp_sd;
- // 新しい所有者の位置へ変更
+ map_delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
+ map_addblock( &cd->bl );
// 再度表示
clif_dispchat(cd,0);
diff --git a/src/map/clif.c b/src/map/clif.c
index 8018cbf82..a1942d5fc 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11707,39 +11707,40 @@ int clif_parse(int fd) {
if ((int)RFIFOREST(fd) < packet_len)
return 0; // まだ1パケット分データが揃ってない
- #if DUMP_ALL_PACKETS
+#if DUMP_ALL_PACKETS
+ {
+ int i;
+ FILE *fp;
+ char packet_txt[256] = "save/packet.txt";
+ time_t now;
dump = 1;
- int i;
- FILE *fp;
- char packet_txt[256] = "save/packet.txt";
- time_t now;
- dump = 1;
-
- if ((fp = fopen(packet_txt, "a")) == NULL) {
- ShowError("clif.c: cant write [%s] !!! data is lost !!!\n", packet_txt);
- return 1;
- } else {
- time(&now);
- if (sd && sd->state.auth) {
- if (sd->status.name != NULL)
- fprintf(fp, "%sPlayer with account ID %d (character ID %d, player name %s) sent packet:\n",
- asctime(localtime(&now)), sd->status.account_id, sd->status.char_id, sd->status.name);
- else
- fprintf(fp, "%sPlayer with account ID %d sent wrong packet:\n", asctime(localtime(&now)), sd->bl.id);
- } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
- fprintf(fp, "%sPlayer with account ID %d sent wrong packet:\n", asctime(localtime(&now)), sd->bl.id);
- fprintf(fp, "\tsession #%d, packet 0x%04x, length %d, version %d\n", fd, cmd, packet_len, packet_ver);
- fprintf(fp, "\t---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
- for(i = 0; i < packet_len; i++) {
- if ((i & 15) == 0)
- fprintf(fp, "\n\t%04X ", i);
- fprintf(fp, "%02X ", RFIFOB(fd,i));
- }
- fprintf(fp, "\n\n");
- fclose(fp);
- }
- #endif
+ if ((fp = fopen(packet_txt, "a")) == NULL) {
+ ShowError("clif.c: cant write [%s] !!! data is lost !!!\n", packet_txt);
+ return 1;
+ } else {
+ time(&now);
+ if (sd && sd->state.auth) {
+ if (sd->status.name != NULL)
+ fprintf(fp, "%sPlayer with account ID %d (character ID %d, player name %s) sent packet:\n",
+ asctime(localtime(&now)), sd->status.account_id, sd->status.char_id, sd->status.name);
+ else
+ fprintf(fp, "%sPlayer with account ID %d sent wrong packet:\n", asctime(localtime(&now)), sd->bl.id);
+ } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
+ fprintf(fp, "%sPlayer with account ID %d sent wrong packet:\n", asctime(localtime(&now)), sd->bl.id);
+
+ fprintf(fp, "\tsession #%d, packet 0x%04x, length %d, version %d\n", fd, cmd, packet_len, packet_ver);
+ fprintf(fp, "\t---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
+ for(i = 0; i < packet_len; i++) {
+ if ((i & 15) == 0)
+ fprintf(fp, "\n\t%04X ", i);
+ fprintf(fp, "%02X ", RFIFOB(fd,i));
+ }
+ fprintf(fp, "\n\n");
+ fclose(fp);
+ }
+ }
+#endif
if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) { // 切断待ちの場合パケットを処理しない
diff --git a/src/map/mob.h b/src/map/mob.h
index 4c83e14c6..bb4e1ac57 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -144,7 +144,7 @@ int mobdb_searchname(const char *str);
int mobdb_searchname_array(struct mob_db** data, int size, const char *str);
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,
+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,
short x,short y,const char *mobname,int class_,int amount,const char *event);
diff --git a/src/map/npc.c b/src/map/npc.c
index 16affe0eb..6971313c8 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -52,7 +52,6 @@ static int npc_mob=0;
static int npc_delay_mob=0;
static int npc_cache_mob=0;
char *current_file = NULL;
-//int dummy_npc_id=0;
int npc_get_new_npc_id(void){ return npc_id++; }
static struct dbt *ev_db;
diff --git a/src/map/npc.h b/src/map/npc.h
index 8e8949cc5..94de8064a 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -81,8 +81,6 @@ int npc_unload(struct npc_data *nd);
int npc_reload(void);
int npc_script_event(TBL_PC* sd, int type);
-extern int dummy_npc_id;
-
extern char *current_file;
struct npc_data *fake_nd;
diff --git a/src/map/script.c b/src/map/script.c
index f881a5548..168cfb857 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -559,8 +559,7 @@ unsigned char* parse_simpleexpr(unsigned char *p)
int c,l;
char *p2;
// label , register , function etc
- //From what I read, jA figured a better way to handle empty parenthesis '()'
- if(skip_word(p)==p/* && !(*p==')' && p[-1]=='(')*/){
+ if(skip_word(p)==p){
disp_error_message("unexpected character",p);
exit(1);
}
@@ -1494,7 +1493,6 @@ static void read_constdb(void)
type=0;
if(sscanf(line,"%[A-Za-z0-9_],%[0-9xXA-Fa-f],%d",name,val,&type)>=2 ||
sscanf(line,"%[A-Za-z0-9_] %[0-9xXA-Fa-f] %d",name,val,&type)>=2){
-
for(i=0;name[i];i++)
name[i]=tolower(name[i]);
n=add_str((const unsigned char *) name);
@@ -1929,12 +1927,13 @@ char* conv_str(struct script_state *st,struct script_data *data)
snprintf(buf,ITEM_NAME_LENGTH, "%d",data->u.num);
data->type=C_STR;
data->u.str=buf;
-#if 1
+ } else if(data->type==C_POS) {
+ // Protect form crashes by passing labels to string-expected args [jA2200]
+ data->type = C_CONSTSTR;
+ data->u.str = "** SCRIPT ERROR **";
} else if(data->type==C_NAME){
- // テンポラリ。本来無いはず
data->type=C_CONSTSTR;
data->u.str=str_buf+str_data[data->u.num].str;
-#endif
}
return data->u.str;
}
@@ -2630,10 +2629,10 @@ void run_script_main(struct script_state *st)
if(stack->sp > stack->defsp)
{ //sp > defsp is valid in cases when you invoke functions and don't use the returned value. [Skotlex]
//Since sp is supposed to be defsp in these cases, we could assume the extra stack elements are unneeded.
- if (battle_config.etc_log)
- {
- ShowWarning("Clearing unused stack stack.sp(%d) -> default(%d)\n",stack->sp,stack->defsp);
- report_src(st);
+ if (battle_config.etc_log)
+ {
+ ShowWarning("Clearing unused stack stack.sp(%d) -> default(%d)\n",stack->sp,stack->defsp);
+ report_src(st);
}
pop_stack(stack, stack->defsp, stack->sp); //Clear out the unused stack-section.
} else if(battle_config.error_log)
@@ -2791,7 +2790,6 @@ int mapreg_setreg(int num,int val)
}
}
#endif
- // else
} else { // [zBuffer]
#if !defined(TXT_ONLY) && defined(MAPREGSQL)
if(name[1] != '@') { // Remove from database because it is unused.
@@ -11715,7 +11713,6 @@ int buildin_axtoi(struct script_state *st)
return 0;
}
-
// [zBuffer] List of player cont commands --->
int buildin_rid2name(struct script_state *st){
struct block_list *bl = NULL;
diff --git a/src/map/script.h b/src/map/script.h
index f4bca3569..9970937a5 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -35,7 +35,7 @@ struct script_data {
int num;
char *str;
} u;
- struct linkdb_node** ref; // リファレンス
+ struct linkdb_node** ref;
};
// Moved defsp from script_state to script_stack since
diff --git a/src/map/status.c b/src/map/status.c
index b55773e23..65fcf8f12 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -5561,9 +5561,11 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
if (map[bl->m].flag.pvp)
tick /=2;
break;
+ case SC_INTRAVISION:
case SC_ARMOR_ELEMENT:
- break; // It just change the armor element of the player (used by battle_attr_fix)
- // So it has no SCB and no skill associated (used by potion scripts)
+ //Place here SCs that have no SCB_* data, no skill associated, no ICON
+ //associated, and yet are not wrong/unknown. [Skotlex]
+ break;
default:
if (calc_flag == SCB_NONE &&
StatusSkillChangeTable[type]==0 &&