#4663: removeTimer
-------------------------------------------------+-------------------------
        Reporter:  Prot                          |      Owner:
            Type:  patch (an actual patch, not   |     Status:  new
  a request for one)                             |  Milestone:  unspecified
        Priority:  normal                        |    Version:  3.2 and
       Component:  Engine: Scripting / AI        |  master
Operating System:  All/Non-Specific              |
-------------------------------------------------+-------------------------
 Function removeTimer() - not remove timer in "this scope", but remove the
 timer with same name in first matched bot-player.
 For example: we are create simple bot-player, who eveery second send
 message with his number player:
 {{{
 function eventStartLevel(){
     queue("init", 1000);
     queue("stopTimer", 5000);
 }

 function init(){
     setTimer("debugMsg", 1000);
 }

 function stopTimer(){
     if(me==2){
         removeTimer("debugMsg");
         debug("["+(Math.floor(gameTime/1000))+"] i'm #"+me+",
 stopTimer()");
     } else {
         debug("["+(Math.floor(gameTime/1000))+"] i'm #"+me+", continue");
     }
 }

 function debugMsg(){
     debug("["+(Math.floor(gameTime/1000))+"] I'm #"+me);
 }
 }}}

 Then after 5 second we removeTimer only on second bot-player, and we see
 this result:
 {{{
 [2] I'm #1
 [2] I'm #2
 [2] I'm #3
 [3] I'm #1
 [3] I'm #2
 [3] I'm #3
 [4] I'm #1
 [4] I'm #2
 [4] I'm #3
 [5] i'm #1, continue
 [5] i'm #2, stopTimer()
 [5] i'm #3, continue
 [5] I'm #1
 [5] I'm #2
 [5] I'm #3
 [6] I'm #2
 [6] I'm #3
 [7] I'm #2
 [7] I'm #3
 [8] I'm #2
 [8] I'm #3
 [9] I'm #2
 [9] I'm #3
 [10] I'm #2
 [10] I'm #3
 }}}
 As we can see, the player 2 try to remove his timer, but timer stop on
 player 1 only.
 Problem has in 3.1.5, 3.2.3 and master version.
 I found the problem in qtscript.cpp and make this patch

--
Ticket URL: <http://developer.wz2100.net/ticket/4663>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to