[CF-Devel] More questions about the plugin code

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Thu Nov 11 01:53:14 CST 2004


Andreas Kirschbaum wrote:
>
     
      I'm currently updating the Python documentation doc/Developers/python
     
     >
     
      and checking that the Python functions are working.
     
     >
     
     
     >
     
      Currently, I have the following questions:
     
     >
     
     
     >
     
       - CFPython.SetQuantity() allows to set ob->nrof=0. I tried this with a
     
     >
     
         random object ("cloak"), but it did not work very well: most objects
     
     >
     
         did not merge anymore, other objects just disappeared after picking
     
     >
     
         up or dropping.
     
     >
     
     
     >
     
         Therefore: should the function CFPython.SetQuantity() make sure that
     
     >
     
         "nrof>0" or is "nrof=0" actually useful for some kind of objects?
     
     
  At some level, the script writers should be allowed to shoot themselves in the 
foot.

  That said, nrof of 0 is valid for some objects - this is used for objects that 
are not supposed to merge, like sacks for example (the number of non mergable 
objects tend to get lower and lower as time passes).

  So nrof=0 is useful for some objects.

>
     
     
     >
     
       - CFPython.SetName() sets ob->name only, but I think it should set
     
     >
     
         ob->name_pl as well. For example, the IPO script creates objects
     
     >
     
         named "mailscroll: T: xxx F: yyy" but two of these objects are called
     
     >
     
         "scrolls".
     
     >
     
     
     >
     
         I'd like to add another (optional) parameter to CFPython.SetName():
     
     >
     
     
     >
     
            # set obj->name="single" and obj->name_pl="multiple"
     
     >
     
            CFPython.SetName(obj, "single", "multiple")
     
     >
     
     
     >
     
            # set obj->name=obj->name_pl="name"
     
     >
     
            CFPython.SetName(obj, "name")
     
     >
     
     
     >
     
         This solution would not break existing scripts but allows (new)
     
     >
     
         scripts to generate proper plural names.
     
     
  That looks good to me.

>
     
     
     >
     
       - The functions CFPython.SetPreviousObject(who, what) and
     
     >
     
         CFPython.SetNextObject(who, what) basically do
     
     >
     
         "who->above=what" and "who->below=what".
     
     >
     
     
     >
     
         I think, this interface is (too) dangerous because it is difficult to
     
     >
     
         use correctly but it allows a script to (easily) create loops in the
     
     >
     
         linked list or link objects from different environments into one
     
     >
     
         list.
     
     >
     
     
     >
     
         Therefore I'd like to remove (or at least disable) these functions
     
     >
     
         from the Python script interface. (No existing script in
     
     >
     
         maps-bigworld uses these functions.)
     
     
  I agree.  The only case where I could really see those needed (vs just the 
standard insert object functions) is if the script really wanted to insert the 
new object above or below some specific object.  That really shouldn't come up 
that often, and even if so, a function that does just that could be done instead.

_______________________________________________
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