소스 검색

Invincible timer clean
* Remove a possible timer even if passing an invalid time value.

aleos 1 년 전
부모
커밋
772c6f33ff
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/map/pc.cpp

+ 6 - 1
src/map/pc.cpp

@@ -776,8 +776,13 @@ static TIMER_FUNC(pc_invincible_timer){
 void pc_setinvincibletimer(map_session_data* sd, int val) {
 	nullpo_retv(sd);
 
-	if (val <= 0)
+	if (val <= 0) {
+		if (sd->invincible_timer != INVALID_TIMER) {
+			delete_timer(sd->invincible_timer, pc_invincible_timer);
+			sd->invincible_timer = INVALID_TIMER;
+		}
 		return;
+	}
 
 	if( sd->invincible_timer != INVALID_TIMER )
 		delete_timer(sd->invincible_timer,pc_invincible_timer);