114 |
|
|
115 |
const char *get_kind() const; |
const char *get_kind() const; |
116 |
|
|
117 |
|
void send_impulse(const GridPos& dest, Direction dir); |
118 |
|
|
119 |
// Object interface |
// Object interface |
120 |
virtual void message(const string& msg, const Value &val); |
virtual void message(const string& msg, const Value &val); |
121 |
virtual void set_attrib(const string& key, const Value &val); |
virtual void set_attrib(const string& key, const Value &val); |
132 |
}; |
}; |
133 |
} |
} |
134 |
|
|
135 |
|
/* |
136 |
|
* Impulse is used to transfer force from one Object to another Object |
137 |
|
* (currently only Stones can be the destination of Impulse's) |
138 |
|
*/ |
139 |
|
namespace world { |
140 |
|
struct Impulse { |
141 |
|
Object *sender; |
142 |
|
GridPos dest; |
143 |
|
Direction dir; |
144 |
|
|
145 |
|
Impulse(Object *sender_, const GridPos& dest_, Direction dir_) |
146 |
|
: sender(sender_), dest(dest_), dir(dir_) {} |
147 |
|
}; |
148 |
|
}; |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
/* |
/* |
153 |
* GridObject is the base class for everything that can only be placed |
* GridObject is the base class for everything that can only be placed |
352 |
virtual bool is_movable() { return false;} |
virtual bool is_movable() { return false;} |
353 |
|
|
354 |
virtual void on_move() {} |
virtual void on_move() {} |
355 |
virtual void on_impulse(Direction dir) { if (is_movable()) move_stone(dir); } |
virtual void on_impulse(const Impulse& impulse) { if (is_movable()) move_stone(impulse.dir); } |
356 |
|
|
357 |
virtual const char *collision_sound(); |
virtual const char *collision_sound(); |
358 |
|
|