Debian Codegraph @

smokestack.h

raw symbols SCIP
1 /*
2 * PROPRIETARY INFORMATION. This software is proprietary to POWDER
3 * Development, and is not to be reproduced, transmitted, or disclosed
4 * in any way without written permission.
5 *
6 * Produced by: Jeff Lait
7 *
8 * POWDER Development
9 *
10 * NAME: smokestack.h ( POWDER Library, C++ )
11 *
12 * COMMENTS: This is to provide a simple way to manage all the smoke on
13 * a single level. Currently implemented rather
14 * stupidly - space efficient, but *not* time efficient.
15 */
16
17 #ifndef __smokestack__
18 #define __smokestack__
19
20 #include "mobref.h"
21
22 class SRAMSTREAM;
23
24 // The smoke item consists of the smoke type & position unioned together
25 // as a bitfield, and the owner stored as a MOBREF.
26
27 class SMOKEITEM
28 {
29 public:
30 SMOKEITEM();
31 ~SMOKEITEM();
32
33 // Copy constructor & assignment operators.
34 SMOKEITEM(const SMOKEITEM &smoke);
35 SMOKEITEM &operator=(const SMOKEITEM &smoke);
36
37
38 void setPosition(int x, int y);
39 void setData(SMOKE_NAMES smoke, MOB *owner);
40
41 bool isPosition(int x, int y) const;
42 void getPosition(int &x, int &y) const;
43 void getData(SMOKE_NAMES &smoke, MOB **owner = 0) const;
44
45 void save(SRAMSTREAM &os) const;
46 void load(SRAMSTREAM &is);
47
48 private:
49 u16 myPosSmoke;
50 MOBREF myOwner;
51 };
52
53 class SMOKESTACK
54 {
55 public:
56 SMOKESTACK();
57 ~SMOKESTACK();
58
59 // This will add a new smoke element. If there exists a smoke
60 // element at x,y, it will replace it. If smoke is NONE, it
61 // will be compressed on the next compress call.
62 void set(int x, int y, SMOKE_NAMES smoke, MOB *owner);
63
64 // Returns the value of the smoke at the given coordinate.
65 SMOKE_NAMES get(int x, int y, MOB **owner = 0) const;
66
67 // Number of smokey squares - may be an overestimate as some might
68 // be NONE.
69 int entries() const { return myEntries; }
70
71 // This cleans all of the NONE entries out of the list. It should
72 // be done after extensive processing (ie, moveSmoke)
73 void collapse();
74
75 // Retrieve a specific smoke entry.
76 void getEntry(int idx, SMOKE_NAMES &smoke, MOB **owner = 0);
77
78 void save(SRAMSTREAM &os);
79 void load(SRAMSTREAM &is);
80
81 private:
82 u16 myEntries;
83 u16 mySize;
84
85 SMOKEITEM *mySmoke;
86 };
87
88 #endif
89