Selaa lähdekoodia

- Reverted the dup-label check code since it has a bug that needs to be fixed first (it fails to recognize const.txt values)
- Reverted clif_skill_damage receiving the blewcount value since the whole code update that was involved didn't help any anyway.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9675 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 vuotta sitten
vanhempi
commit
9d049827d7
6 muutettua tiedostoa jossa 44 lisäystä ja 31 poistoa
  1. 2 0
      Changelog-Trunk.txt
  2. 5 22
      src/map/clif.c
  3. 1 1
      src/map/clif.h
  4. 0 1
      src/map/log.c
  5. 32 3
      src/map/script.c
  6. 4 4
      src/map/skill.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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.
 
 2007/01/19
+	* Reverted the dup-label check code since it has a bug that needs to be
+	  fixed first (it fails to recognize const.txt values) [Skotlex]
 	* Fixed a client crash during SQL char selection if you for some reason had
 	  more than 9 characters in your account (thanks to Daegaladh) [ultramage]
 	  - note that the TXT version already guards against this since long ago

+ 5 - 22
src/map/clif.c

@@ -4429,7 +4429,7 @@ int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype)
  *------------------------------------------
  */
 int clif_skill_damage(struct block_list *src,struct block_list *dst,
-	unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type,int flag)
+	unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type)
 {
 	unsigned char buf[64];
 	struct status_change *sc;
@@ -4454,21 +4454,13 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
 	WBUFL(buf,12)=tick;
 	WBUFL(buf,16)=sdelay;
 	WBUFL(buf,20)=ddelay;
-	WBUFW(buf,26)=skill_lv;
-	WBUFW(buf,28)=div;
-#if 0
-	if (flag && dst->type == BL_PC)
-	{	//Needed for appropiate knockback on the receiving client.
-		WBUFW(buf,24)=-30000;
-		WBUFB(buf,30)=6;
-		clif_send(buf,packet_len(0x114),dst,SELF);
-	}
-#endif
 	if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
 		WBUFW(buf,24)=damage?div:0;
 	} else {
 		WBUFW(buf,24)=damage;
 	}
+	WBUFW(buf,26)=skill_lv;
+	WBUFW(buf,28)=div;
 	WBUFB(buf,30)=type;
 	clif_send(buf,packet_len(0x114),src,AREA);
 	if(disguised(src)) {
@@ -4493,21 +4485,13 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
 	WBUFL(buf,12)=tick;
 	WBUFL(buf,16)=sdelay;
 	WBUFL(buf,20)=ddelay;
-	WBUFW(buf,28)=skill_lv;
-	WBUFW(buf,30)=div;
-#if 0
-	if (flag && dst->type == BL_PC)
-	{	//Needed for appropiate knockback on the receiving client.
-		WBUFL(buf,24)=-30000;
-		WBUFB(buf,32)=6;
-		clif_send(buf,packet_len(0x114),dst,SELF);
-	}
-#endif
 	if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
 		WBUFL(buf,24)=damage?div:0;
 	} else {
 		WBUFL(buf,24)=damage;
 	}
+	WBUFW(buf,28)=skill_lv;
+	WBUFW(buf,30)=div;
 	WBUFB(buf,32)=type;
 	clif_send(buf,packet_len(0x1de),src,AREA);
 	if(disguised(src)) {
@@ -8140,7 +8124,6 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd)
 	{// packet version accepted
 		TBL_PC* old_sd;
 		struct block_list* bl;
-
 		if( (bl=map_id2bl(account_id)) != NULL && bl->type != BL_PC )
 		{// non-player object already has that id
 			ShowError("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n", account_id);

+ 1 - 1
src/map/clif.h

@@ -176,7 +176,7 @@ int clif_skillcastcancel(struct block_list* bl);
 int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype);
 int clif_skill_damage(struct block_list *src,struct block_list *dst,
 	unsigned int tick,int sdelay,int ddelay,int damage,int div,
-	int skill_id,int skill_lv,int type, int flag);
+	int skill_id,int skill_lv,int type);
 int clif_skill_damage2(struct block_list *src,struct block_list *dst,
 	unsigned int tick,int sdelay,int ddelay,int damage,int div,
 	int skill_id,int skill_lv,int type);

+ 0 - 1
src/map/log.c

@@ -9,7 +9,6 @@
 #include "../common/strlib.h"
 #include "../common/nullpo.h"
 #include "../common/showmsg.h"
-#include "../common/malloc.h"
 #include "itemdb.h"
 #include "map.h"
 #include "log.h"

+ 32 - 3
src/map/script.c

@@ -140,7 +140,9 @@ static struct {
 		int index;
 		int count;
 		int flag;
+#if 0 
 		struct linkdb_node *case_label;
+#endif
 	} curly[256];		// 右カッコの情報
 	int curly_count;	// 右カッコの数
 	int index;			// スクリプト内で使用した構文の数
@@ -958,7 +960,9 @@ const char* parse_curly_close(const char* p) {
 		sprintf(label,"__SW%x_FIN",syntax.curly[pos].index);
 		l=add_str(label);
 		set_label(l,script_pos, p);
+#if 0 
 		linkdb_final(&syntax.curly[pos].case_label);	// free the list of case label
+#endif
 		syntax.curly_count--;
 		return p+1;
 	} else {
@@ -1022,9 +1026,14 @@ const char* parse_syntax(const char* p) {
 				disp_error_message("parse_syntax: unexpected 'case' ",p);
 				return p+1;
 			} else {
-				char *np;
 				char label[256];
+#if 0 //See next #if 0
 				int  l,v;
+				char *np;
+#else
+				int len;
+				int  l;
+#endif
 				if(syntax.curly[pos].count != 1) {
 					// FALLTHRU 用のジャンプ
 					sprintf(label,"goto __SW%x_%xJ;",syntax.curly[pos].index,syntax.curly[pos].count);
@@ -1042,6 +1051,8 @@ const char* parse_syntax(const char* p) {
 				if(p == p2) {
 					disp_error_message("parse_syntax: expect space ' '",p);
 				}
+#if 0
+				//TODO: This is incomplete as it doesn't takes into account const.txt entries!
 				// check whether case label is integer or not
 				v = strtol(p,&np,0);
 				if(np == p)
@@ -1056,6 +1067,20 @@ const char* parse_syntax(const char* p) {
 					disp_error_message("parse_syntax: expect ':'",p);
 				sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;",
 					v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1);
+#else
+				p2 = p;
+				if((*p == '-' || *p == '+') && isdigit(p[1]))	// pre-skip because '-' can not skip_word
+					p++;
+				p = skip_word(p);
+				len = p-p2; // length of word at p2
+				p = skip_space(p);
+				if(*p != ':')
+					disp_error_message("parse_syntax: expect ':'",p);
+				memcpy(label,"if(",3);
+				memcpy(label+3,p2,len);
+				sprintf(label+3+len," != $@__SW%x_VAL) goto __SW%x_%x;",
+					syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1);
+#endif
 				syntax.curly[syntax.curly_count++].type = TYPE_NULL;
 				// 2回parse しないとダメ
 				p2 = parse_line(label);
@@ -1067,12 +1092,12 @@ const char* parse_syntax(const char* p) {
 					l=add_str(label);
 					set_label(l,script_pos,p);
 				}
-
+#if 0 //TODO: pending fix on converting constants to numbers.
 				// check duplication of case label [Rayce]
 				if(linkdb_search(&syntax.curly[pos].case_label, (void*)v) != NULL)
 					disp_error_message("parse_syntax: dup 'case'",p);
 				linkdb_insert(&syntax.curly[pos].case_label, (void*)v, (void*)1);
-				
+#endif			
 				sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
 				syntax.curly[syntax.curly_count++].type = TYPE_NULL;
 			
@@ -1709,7 +1734,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
 	if( setjmp( error_jump ) != 0 ) {
 		//Restore program state when script has problems. [from jA]
 		int i;
+#if 0 
 		const int size = sizeof(syntax.curly)/sizeof(syntax.curly[0]);
+#endif
 		if( error_report )
 			script_error(src,file,line,error_msg,error_pos);
 		aFree( error_msg );
@@ -1719,8 +1746,10 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
 		script_buf  = NULL;
 		for(i=LABEL_START;i<str_num;i++)
 			if(str_data[i].type == C_NOP) str_data[i].type = C_NAME;
+#if 0 
 		for(i=0; i<size; i++)
 			linkdb_final(&syntax.curly[i].case_label);
+#endif
 		return NULL;
 	}
 

+ 4 - 4
src/map/skill.c

@@ -2035,7 +2035,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 	//Display damage.
 	switch(skillid){
 	case PA_GOSPEL: //Should look like Holy Cross [Skotlex]
-		dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, CR_HOLYCROSS, -1, 5, dmg.blewcount);
+		dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, CR_HOLYCROSS, -1, 5);
 		break;
 	//Skills that need be passed as a normal attack for the client to display correctly.
 	case HVAN_EXPLOSION:
@@ -2055,7 +2055,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 		//Disabling skill animation doesn't works on multi-hit.
 		dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion,
 			damage, dmg.div_, skillid, flag&SD_LEVEL?-1:skilllv,
-			(flag&SD_ANIMATION && dmg.div_ < 2?5:type), dmg.blewcount);
+			(flag&SD_ANIMATION && dmg.div_ < 2?5:type));
 		break;
 	}
 	
@@ -3217,7 +3217,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
 		ShowWarning("skill_castend_damage_id: Unknown skill used:%d\n",skillid);
 		clif_skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion,
 			0, abs(skill_get_num(skillid, skilllv)),
-			skillid, skilllv, skill_get_hit(skillid), 0);
+			skillid, skilllv, skill_get_hit(skillid));
 		map_freeblock_unlock();
 		return 1;
 	}
@@ -5726,7 +5726,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 			if (unit_movepos(src, src->x+dx, src->y+dy, 1, 1))
 			{	//Display movement + animation.
 				clif_slide(src,src->x,src->y);
-				clif_skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skillid, ud->skilllv, 5, 0);
+				clif_skill_damage(src,target,tick,sd->battle_status.amotion,0,0,1,ud->skillid, ud->skilllv, 5);
 			}
 			clif_skill_fail(sd,ud->skillid,0,0);
 		}