210 |
// |
// |
211 |
namespace world |
namespace world |
212 |
{ |
{ |
213 |
struct FloorTraits { |
enum FloorFlags { |
214 |
double friction; |
FLOOR_CanCrack = 0x01, |
215 |
double mousefactor; |
FLOOR_ItemsAllowed = 0x02, |
216 |
|
|
217 |
|
FLOOR_Normal = FLOOR_CanCrack | FLOOR_ItemsAllowed |
218 |
}; |
}; |
219 |
|
|
220 |
|
struct FloorTraits { |
221 |
|
FloorTraits (const char *n, double f, double m, FloorFlags fl) |
222 |
|
{ name = n; friction = f; mousefactor = m; flags = fl; } |
223 |
|
|
224 |
|
const char *name; |
225 |
|
double friction; |
226 |
|
double mousefactor; |
227 |
|
FloorFlags flags; |
228 |
|
}; |
229 |
|
|
230 |
class Floor : public TGridObject<GRID_FLOOR> { |
class Floor : public TGridObject<GRID_FLOOR> { |
231 |
public: |
public: |
232 |
Floor(const char *kind, double friction, double mfactor); |
Floor (const FloorTraits &tr); |
233 |
|
Floor (const char *kind, double friction, double mfactor); |
234 |
|
|
235 |
// Object interface |
// Object interface |
236 |
Floor *clone(); |
Floor *clone(); |
249 |
|
|
250 |
void actor_hit(Actor *a) { on_actorhit(a); } |
void actor_hit(Actor *a) { on_actorhit(a); } |
251 |
|
|
252 |
double friction() const { return _friction; } |
double friction() const { return traits.friction; } |
253 |
double mousefactor() const { return _mousefactor; } |
double mousefactor() const { return traits.mousefactor; } |
254 |
private: |
private: |
255 |
virtual void on_actorhit(Actor *a) {} |
virtual void on_actorhit(Actor *a) {} |
256 |
|
|
257 |
double _friction; |
FloorTraits traits; |
|
double _mousefactor; |
|
258 |
}; |
}; |
259 |
} |
} |
260 |
|
|