소스 검색

- Updated the 'unit walk' to functions so they stop your attack if it's possible to walk.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9837 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 년 전
부모
커밋
b09a064281
3개의 변경된 파일20개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 0
      Changelog-Trunk.txt
  2. 0 1
      src/map/clif.c
  3. 18 4
      src/map/unit.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/02/09
+	* Updated the 'unit walk' to functions so they stop your attack if it's
+	  possible to walk.
 	* Fixed char server SQL not sending the guild info update to other map
 	  servers when a new member is added.
 2007/02/08

+ 0 - 1
src/map/clif.c

@@ -8359,7 +8359,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
 	if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1)
 		return;
 
-	pc_stop_attack(sd);
 	pc_delinvincibletimer(sd);
 
 	cmd = RFIFOW(fd,0);

+ 18 - 4
src/map/unit.c

@@ -43,6 +43,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl) {
 	return NULL;
 }
 
+static int unit_attack_timer(int tid,unsigned int tick,int id,int data);
 static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data);
 
 int unit_walktoxy_sub(struct block_list *bl)
@@ -309,9 +310,14 @@ int unit_walktoxy( struct block_list *bl, int x, int y, int flag) {
 		// timer関数からunit_walktoxy_subを呼ぶようにする
 		ud->state.change_walk_target = 1;
 		return 1;
-	} else {
-		return unit_walktoxy_sub(bl);
 	}
+
+	if (ud->attacktimer != -1) {
+		delete_timer( ud->attacktimer, unit_attack_timer );
+		ud->attacktimer = -1;
+	}
+
+	return unit_walktoxy_sub(bl);
 }
 
 static int unit_walktobl_sub(int tid,unsigned int tick,int id,int data)
@@ -366,13 +372,21 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
 		ud->state.change_walk_target = 1;
 		return 1;
 	}
+
 	if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
 	{	//Can't move, wait a bit before invoking the movement.
 		add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
 		return 1;
-	} else if (!unit_can_move(bl))
+	}
+
+	if (!unit_can_move(bl))
 		return 0;
-	
+
+	if (ud->attacktimer != -1) {
+		delete_timer( ud->attacktimer, unit_attack_timer );
+		ud->attacktimer = -1;
+	}
+
 	return unit_walktoxy_sub(bl);
 }