[DM-dev] finally!! how does this sound?
Brought to you by:
acdalton,
henningsen
From: Stephan B. <st...@wa...> - 2001-06-10 11:50:01
|
class Dungeon DungeonElement * add( DungeonElement *de ); /*** returns the passed object, or NULL if it refuses to add it for some reason. Could also use booleans, but this approach allows us to chain calls: dungeon.add( new DungeonElement() )->doSomethingToTheDungeonElement(); the default impl. will never return NULL. it's there for future functionality. **/ Then we have various convenience functions in Dungeon: DungeonElement * addRoom( x, y, w, h ); DungeonElement * addDoor( x, y, w, h ); DungeonElement * addWall( w, y, w, h ); etc. These are all functionaly identical except that they set the square type, so they'll all just call: DungeonElement * add( x, y, w, h, squaretype ) which simply calls add( DungeonElement ) on the created element. I'm working on the new save/load code now. The STL does have some cool classes for this kind of thing, and the C++ ref I have covers them all in gory detail. I'm gonna try it first using sscanf(), but eventually I'd like to switch to overloaded << and >> operators. Perl is still better at this kind of thing, though ;). See ya! ----- Stephan Beal - st...@wa... http://qub.sourceforge.net - http://gwm.rootonfire.org http://byoo.rootonfire.org - http://dungeonmaker.sourceforge.net "Now I'm not normally the kind of person who likes to trespass, but sometimes you just find yourself over the line." -- Bob Dylan |