[CF-Devel] Uninitialized variable

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Fri Jan 7 02:40:24 CST 2005


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))



Le Vendredi 7 Janvier 2005 00:20, Nicolas Weeger a écrit :
>
     
      Hello.
     
     >
     
     
     >
     
      In server/player.c around line 1385:
     
     >
     
     
     >
     
       for (attacknum=0; attacknum < NROFATTACKS;
     
     >
     
            attacknum++, attacktype = 1<<attacknum)
     
     >
     
           if (arrow->attacktype & attacktype)
     
     >
     
        if (target->arch->clone.resist[attacknum] < 0)
     
     >
     
     
     >
     
      with 'attacktype' not initialized beforehand.
     
     >
     
      Compiler reports use of attacktype without initialization, which is
     
     >
     
      quite plausible as its value is set only after the first loop execution.
     
     >
     
     
     >
     
      Not sure what to put as initial value, though.
     
     >
     
     
     >
     
      Nicolas
     
     >
     
     
     >
     
      _______________________________________________
     
     >
     
      crossfire-devel mailing list
     
     >
     
     
      crossfire-devel at lists.real-time.com
      
      
     >
     
     
      https://mailman.real-time.com/mailman/listinfo/crossfire-devel
      
      
     
_______________________________________________
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