- 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://svn.code.sf.net/p/rathena/svn/trunk@8639 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-09-05 19:49:38 +00:00
parent d0563b1951
commit 4e9c745bdf
9 changed files with 58 additions and 53 deletions

View File

@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/09/05
* Corrected SC_INTRAVISION not starting. [Skotlex]
* Fixed crash when attempting to read a Label as a string on a script
(thanks to End of Exam) [Skotlex]
* Fixed possible crash when changing a chat-room's owner (thanks to End of
Exam) [Skotlex]
* Fixed dispell removing SC_NOCHAT [Skotlex]
* Small fix which should correct skill_attack damaging hidden characters
when it shouldn't. [Skotlex]

View File

@ -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 );
// <20>Ä“x•\ަ
clif_dispchat(cd,0);

View File

@ -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);
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
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) { // 切断待ちの場合パケットを処理しない

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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 &&