[CF-Devel] Ingame map 'building' / modification: full patch

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Nov 11 23:36:08 CST 2003


Nicolas Weeger wrote:

>>
     
       seems to be a bit of redundant code to check to see if the direction 
     
     >>
     
      is buildable - perhaps reduce that redundancy into one function like 
     
     >>
     
      'check_buildability(....)?  That would seem to be useful if additional 
     
     >>
     
      buildable options is added.
     
     >
     
     
     >
     
     
     >
     
      Probably. But building functions don't always check the same thing, or 
     
     >
     
      keep some variables for later use (item below floor, for instance, when 
     
     >
     
      building a floor).
     
     
  Ok.   I didn't look really close at the exact details, but it seemed to be 
some amount of duplication of 'is this within map bounds, is there a flag 
buildable, etc'.  Maybe the amount to be reduced isn't so great.  OTOH, perhaps 
a flag can be passed into the check function which also has some indication what 
to find and what to return.


>
     
      Those messages are supposed to never happen. If this message ever comes, 
     
     >
     
      it means there may be some issue with the map (or i forgot something in 
     
     >
     
      the tests, quite possible). For instance if you build a floor in a 
     
     >
     
      direction, there should _always_ be something there (wall, floor, 
     
     >
     
      anything). Because if nothing, it's an undefined square, and the player 
     
     >
     
      is standing next to it...
     
     
  If that's the case, then it should also generate a LOG() message.

>
     
      Ok, even though i do this to avoid mistaking for the evil 'if (op->type 
     
     >
     
      = WALL)'.
     
     
  gcc at least will catch those and print a warning.  But it's just easier to me 
(and really in the style of the rest of the code) that the constant comes second.




_______________________________________________
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