[DM-dev] lines of communication between objects
Brought to you by:
acdalton,
henningsen
From: Stephan B. <ste...@ei...> - 2001-04-25 10:57:38
|
Good morning! For the upcoming changes we'll need to define some lines of=20 communication between the various objects. I mean, we'll need to decide=20 which objects know about each other, and how they interact. If we can=20 abstract this a bit (like by subclassing Rooms and Crawlers from a more=20 generic DungeonElement) they we will get the most extendability out of=20 it. These are my initial thoughts about who has to know about who=20 (denoted by arrows pointing to/from the classes): For example: Rooms <--- Walls This means that Rooms need to know about walls, but walls don't need to=20 know about rooms. Crawler <---> ??? DungeonMaker <---- Rooms DungeonMaker <---- Crawler (??? <--- DungeonMaker) All <---- Config (config is a bad word for this, because it implies ini=20 file, when it's really more generic than that - suggestions for a=20 better name?) Once this is agreed upon I can start with the containers for holding=20 these objects (will use STL classes like maps, vectors, lists and=20 pairs), and the APIs for moving/copying them between objects (i.e., the=20 various AddXXX() methods). Speaking of rooms: The way I envision the basic Room API is something like this (of=20 course, completely up for change, though): Remove/AddWall( Wall );=20 AddWall( int x1, int y1, int x2, int y2 )=20 // creates a Wall and calls AddWall( wall ) // must assert that x1=3D=3Dx2 OR y1=3D=3Dy2 (no diagonal walls), but thi= s will=20 be done in Wall, and Wall will have a bool IsStraight() method which=20 returns false if the wall is not "straight". typdef list<Wall *> WallList; WallList GetWalls(); // DM can use this to actually lay out the room. Various other STL-like iterator methods will also be supplied, for=20 looping through the walls. Ideas? ----- Stephan Beal Generic Universal Computer Guy ste...@ei... - http://www.einsurance.de Office: +49 (89) 552 92 862 Handy: +49 (179) 211 97 67 "Belief makes a hollow place. Something has to roll in to fill it." -- Terry Pratchet |