瀏覽代碼

- Simplified npc_gettimerevent_tick so that it should return a tick value even after the last ontimer label has been reached.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6264 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 年之前
父節點
當前提交
35cda692bd
共有 3 個文件被更改,包括 5 次插入19 次删除
  1. 2 0
      Changelog-Trunk.txt
  2. 1 1
      src/common/grfio.c
  3. 2 18
      src/map/npc.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.
 
 2006/04/24
+	* Simplified npc_gettimerevent_tick so that it should return a tick value
+	  even after the last ontimer label has been reached. [Skotlex]
 	* All GMs will be sent to the char server through packet 0x2aff now.
 	  (previously hidden gms were not sent to the char-server as online) [Skotlex]
 	* Made mob_searchname compare versus sprite, name and jname now. [Skotlex]

+ 1 - 1
src/common/grfio.c

@@ -299,7 +299,7 @@ int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char*
 int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) {
 	z_stream stream;
 	int err;
-
+	memset(&stream, 0, sizeof(stream));
 	stream.next_in = (Bytef*)source;
 	stream.avail_in = (uInt)sourceLen;
 	/* Check for source > 64K on 16-bit machine: */

+ 2 - 18
src/map/npc.c

@@ -749,24 +749,8 @@ int npc_gettimerevent_tick(struct npc_data *nd)
 	nullpo_retr(0, nd);
 
 	tick=nd->u.scr.timer;
-
-	if (nd->u.scr.rid) {
-		sd = map_id2sd(nd->u.scr.rid);
-		if (!sd) {
-			if(battle_config.error_log)
-				ShowError("npc_gettimerevent_tick: Attached player not found!\n");
-			return tick;
-		}
-	}
-	//If within a timer, set the tick value to the time passed since the beginning of the timer.
-	if (sd) {
-		if(sd->npc_timer_id != -1)
-			tick += DIFF_TICK(gettick(), nd->u.scr.timertick);
-	} else {
-		if(nd->u.scr.timerid!=-1)
-			tick += DIFF_TICK(gettick(), nd->u.scr.timertick);
-	}
-
+	if (nd->u.scr.timertick)
+		tick+=DIFF_TICK(gettick(), nd->u.scr.timertick);
 	return tick;
 }
 /*==========================================