浏览代码

Fixed mob AI code iterating over non-mob objects without checking, when monster_ai flag 0x20 is set (caused by r11943)
Cleaned up macros that wrap unit_stop_attack() (bugreport:357)

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

ultramage 17 年之前
父节点
当前提交
db3db2c2e5
共有 10 个文件被更改,包括 27 次插入23 次删除
  1. 2 2
      db/packet_db.txt
  2. 17 14
      src/map/atcommand.c
  3. 1 0
      src/map/intif.c
  4. 1 1
      src/map/mercenary.h
  5. 1 1
      src/map/mob.c
  6. 1 1
      src/map/mob.h
  7. 1 1
      src/map/party.c
  8. 1 1
      src/map/pc.h
  9. 1 1
      src/map/pet.h
  10. 1 1
      src/map/skill.c

+ 2 - 2
db/packet_db.txt

@@ -1055,11 +1055,11 @@ packet_ver: 22
 0x029b,80
 
 //2007-11-13aSakexe
-0x015b,-1
+//0x015b,-1
 0x02e1,33
 
 //2007-11-20aSakexe
-0x015b,54,guildexpulsion,2:6:10:14
+//0x015b,54,guildexpulsion,2:6:10:14
 //0x01df,10,gmreqnochatcount,2 <- TODO
 //0x01f3,0
 0x02e2,14

+ 17 - 14
src/map/atcommand.c

@@ -6033,10 +6033,10 @@ int atcommand_partyoption(const int fd, struct map_session_data* sd, const char*
 
 	if(!message || !*message || sscanf(message, "%15s %15s", w1, w2) < 2)
 	{
-		clif_displaymessage(fd, "Command usage: @changeoption <pickup share: yes/no> <item distribution: yes/no>");
+		clif_displaymessage(fd, "Command usage: @partyoption <pickup share: yes/no> <item distribution: yes/no>");
 		return -1;
 	}
-
+	
 	option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0);
 
 	//Change item share type.
@@ -6390,12 +6390,6 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com
 {
 	char mes[100],temp[100];
 	struct pet_data *pd;
-	const char* emo[] = {	 "/!", "/?", "/ho", "/lv", "/swt", "/ic", "/an", "/ag", "/$", "/...",
-				"/scissors", "/rock", "/paper", "/korea", "/lv2", "/thx", "/wah", "/sry", "/heh", "/swt2",
-				"/hmm", "/no1", "/??", "/omg", "/O", "/X", "/hlp", "/go", "/sob", "/gg",
-				"/kis", "/kis2", "/pif", "/ok", "-?-", "-?-", "/bzz", "/rice", "/awsm", "/meh",
-				"/shy", "/pat", "/mp", "/slur", "/com", "/yawn", "/grat", "/hp", "/philippines", "/usa",
-				"/indonesia", "/brazil", "/fsh", "/spin", "/sigh", "/dum", "/crwd", "/desp", "/dice", NULL };
 
 	nullpo_retr(-1, sd);
 
@@ -6415,13 +6409,22 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com
 		return -1;
 	}
 
-	if (message[0] == '/') {
+	if (message[0] == '/')
+	{// pet emotion processing
+		const char* emo[] = {
+			"/!", "/?", "/ho", "/lv", "/swt", "/ic", "/an", "/ag", "/$", "/...",
+			"/scissors", "/rock", "/paper", "/korea", "/lv2", "/thx", "/wah", "/sry", "/heh", "/swt2",
+			"/hmm", "/no1", "/??", "/omg", "/O", "/X", "/hlp", "/go", "/sob", "/gg",
+			"/kis", "/kis2", "/pif", "/ok", "-?-", "-?-", "/bzz", "/rice", "/awsm", "/meh",
+			"/shy", "/pat", "/mp", "/slur", "/com", "/yawn", "/grat", "/hp", "/philippines", "/usa",
+			"/indonesia", "/brazil", "/fsh", "/spin", "/sigh", "/dum", "/crwd", "/desp", "/dice"
+		};
 		int i;
-		for (i = 0; emo[i] != NULL; i++) {
-			if (!stricmp(message, emo[i])) {
-				clif_emotion(&pd->bl, i);
-				return 0;
-			}
+		ARR_FIND( 0, ARRAYLENGTH(emo), i, stricmp(message, emo[i]) == 0 );
+		if( i < ARRAYLENGTH(emo) )
+		{
+			clif_emotion(&pd->bl, i);
+			return 0;
 		}
 	}
 

+ 1 - 0
src/map/intif.c

@@ -1032,6 +1032,7 @@ int intif_parse_LoadGuildStorage(int fd)
 	gstor=guild2storage(guild_id);
 	if(!gstor) {
 		ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id);
+		return 1;
 	}
 	if (gstor->storage_status == 1) { // Already open.. lets ignore this update
 		ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id);

+ 1 - 1
src/map/mercenary.h

@@ -55,7 +55,7 @@ int merc_hom_hungry_timer_delete(struct homun_data *hd);
 int merc_hom_change_name(struct map_session_data *sd,char *name);
 int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
 #define merc_stop_walking(hd, type) unit_stop_walking(&(hd)->bl, type)
-#define merc_stop_attack(hd) { if((hd)->ud.attacktimer != -1) unit_stop_attack(&(hd)->bl); hd->ud.target = 0; }
+#define merc_stop_attack(hd) unit_stop_attack(&(hd)->bl)
 int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value);
 int merc_hom_decrease_intimacy(struct homun_data * hd, unsigned int value);
 int merc_skill_tree_get_max(int id, int b_class);

+ 1 - 1
src/map/mob.c

@@ -1454,7 +1454,7 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
 {
 
 	if (battle_config.mob_ai&0x20)
-		map_foreachiddb(mob_ai_sub_lazy,tick);
+		map_foreachmob(mob_ai_sub_lazy,tick);
 	else
 		clif_foreachclient(mob_ai_sub_foreachclient,tick);
 

+ 1 - 1
src/map/mob.h

@@ -178,7 +178,7 @@ void mob_revive(struct mob_data *md, unsigned int hp);
 void mob_heal(struct mob_data *md,unsigned int heal);
 
 #define mob_stop_walking(md, type) unit_stop_walking(&(md)->bl, type)
-#define mob_stop_attack(md) { if((md)->ud.attacktimer != -1) unit_stop_attack(&(md)->bl); }
+#define mob_stop_attack(md) unit_stop_attack(&(md)->bl)
 
 void mob_clear_spawninfo();
 int do_init_mob(void);

+ 1 - 1
src/map/party.c

@@ -437,7 +437,7 @@ int party_member_leaved(int party_id, int account_id, int char_id)
 		}
 	}
 
-	if( sd && sd->status.party_id==party_id && sd->status.char_id == char_id )
+	if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id )
 	{
 		sd->status.party_id = 0;
 		sd->state.party_sent = 0;

+ 1 - 1
src/map/pc.h

@@ -119,7 +119,7 @@ enum {
 #define pc_maxparameter(sd)   ( (sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter )
 
 #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
-#define pc_stop_attack(sd) { if((sd)->ud.attacktimer != -1) { unit_stop_attack(&(sd)->bl); (sd)->ud.target = 0; } }
+#define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
 
 //Weapon check considering dual wielding.
 #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \

+ 1 - 1
src/map/pet.h

@@ -59,7 +59,7 @@ int pet_recovery_timer(int tid,unsigned int tick,int id,int data); // [Valaris]
 int pet_heal_timer(int tid,unsigned int tick,int id,int data); // [Valaris]
 
 #define pet_stop_walking(pd, type) unit_stop_walking(&(pd)->bl, type)
-#define pet_stop_attack(pd) { if((pd)->ud.attacktimer != -1) unit_stop_attack(&(pd)->bl); }
+#define pet_stop_attack(pd) unit_stop_attack(&(pd)->bl)
 
 int read_petdb(void);
 int do_init_pet(void);

+ 1 - 1
src/map/skill.c

@@ -4567,7 +4567,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 			if( (su)
 			&&  (sg = su->group)
 			&&  (sg->src_id == src->id || map_flag_vs(bl->m))
-			&&	(skill_get_inf2(sg->skill_id)&INF2_TRAP) )
+			&&  (skill_get_inf2(sg->skill_id)&INF2_TRAP) )
 			{	// prevent picking up expired traps
 				if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) )
 				{