[CF-Devel] Uninitialized variable

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Sun Jan 9 22:33:36 CST 2005


tchize wrote:
>
     
      Looking at code part you gave, seems it checks all attacktype (0->NROFATTACKS)
     
     >
     
      look if corresponding byte in arrow attacktype is activated and check if 
     
     >
     
      target has resit on it. so, logical behaviour of attacktype looks like
     
     >
     
     
     >
     
     
     >
     
      00000010   (equals 1 << (attacknum=1))
     
     >
     
      00000100   (equals 1 << (attacknum=2))
     
     >
     
      00001000   (equals 1 << (attacknum=3))
     
     >
     
      00010000   (equals 1 << (attacknum=4))
     
     >
     
      00100000   (equals 1 << (attacknum=5))
     
     >
     
      and so on
     
     >
     
     
     >
     
      I'll say initial value should be 
     
     >
     
     
     >
     
      attacktype= 1; (equals 1<< (attacknum=0))
     
     
  Actually, the logic there is fine - it is just the presumption by the code 
author was that that the  attacktype = 1<<attacknum would get executed on the 
first iteration.  That is the problem.

  The simplest fix is to just move that statement out of the for loop and put is 
right below it - there isn't any reason it needs to be in the if statement that 
I can see.

  I'll fix that up since I have some other fixes to commit anyways.


_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list