Source Code (Use browser search to find items of interest.)
Class Index
ksokoban'MapDelta (./kdegames/ksokoban/MapDelta.H:27)
class MapDelta : private Map {
public:
MapDelta (Map *m);
void start ();
void end ();
bool hasChanged (int x, int y) {
assert (ended_);
return map (x, y) == 1;
}
private:
Map *source_;
bool ended_;
};
ksokoban'MapDelta::MapDelta() (./kdegames/ksokoban/MapDelta.C:25)
MapDelta::MapDelta (Map *m) {
source_ = m;
ended_ = true;
start ();
}
void
ksokoban'MapDelta::start() (./kdegames/ksokoban/MapDelta.C:32)
MapDelta::start () {
assert (ended_);
((Map &) *this) = *source_;
#if 0
memcpy (map_, source_->currentMap_, (MAX_Y+3)*(MAX_X+3)*sizeof (int));
for (int y=1; y<MAX_Y+2; y++) {
for (int x=1; x<MAX_X+2; x++) {
map_[y][x] = source_->currentMap_[y][x];
}
}
xpos_ = source_->xpos_;
ypos_ = source_->ypos_;
#endif
ended_ = false;
}
void
ksokoban'MapDelta::end() (./kdegames/ksokoban/MapDelta.C:51)
MapDelta::end () {
assert (!ended_);
for (int y=0; y<=MAX_Y; y++) {
for (int x=0; x<=MAX_X; x++) {
map (x, y, map (x, y) != source_->map (x, y));
}
}
if (xpos_ != source_->xpos_ || ypos_ != source_->ypos_) {
map (xpos_, ypos_, 1);
map (source_->xpos_, source_->ypos_, 1);
}
ended_ = true;
}