Re: Re: [CF-Devel] python setquantity()

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Fri Jul 23 10:26:58 CDT 2004


---Woosh---
I changed the 'value' variable from an int to a uint in python_plugin.c and it fixed the problem, however I had some concerns about introducing all sorts of evil I didn't understand.  I sent the patch in for review anyway.
I was also wondering about the money routines (other object references?) in the plugin and if they should be using a uint as well.
While I have your attention - I was also trying to figure out how to add the {}/maps/python path to the python plugin system path so it looks there for modules first.  This would be great so we can access them easier as well as override existing library modules.  I can't find a good example of this in the embedding python documentation.


>
     
      An 'int' values is encoded (on 32bit-based machines) using 32bits, so you can 
     
     >
     
      safely increase that upper limit.
     
     >
     
     
     >
     
      I have to admit that I don't remember anymore why I put an arbitrary limit - 
     
     >
     
      probably that was just a workaround for an obscure bug involving large 
     
     >
     
      quantities of a single object. 
     
     >
     
     
     >
     
      The clean way to correct it is to:
     
     >
     
     
     >
     
      - Include <limits.h> system header (you can do it in the plugin.h specific 
     
     >
     
      plugin header. Since it is theorically part of the ANSI-C definition, it 
     
     >
     
      should exist on Win32 as well);
     
     >
     
     
     >
     
      - Test value against INT_MAX, which holds the maximum acceptable value for the 
     
     >
     
      integer type.
     
     >
     
      -- 
     
     >
     
      Yann Chachkoff
     
     >
     
      -----------------------
     
     >
     
      Garden Dwarf's Best Friend
     
     >
     
      -----------------------
     
     

_______________________________________________
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