~ubuntu-branches/ubuntu/trusty/enigma/trusty-proposed

« back to all changes in this revision

Viewing changes to src/stones.cc

  • Committer: Package Import Robot
  • Author(s): Erich Schubert
  • Date: 2013-04-06 14:54:02 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130406145402-jgjrtk7hac8gtvza
Tags: 1.20-dfsg.1-1
* New upstream release (Closes: #704595)
  (Repacked: dropped zipios++ source and main menu music)
* Update watch file, sf.net again.
* Fix documentation links (Closes: #653508)
* Conflict with enigma-level-previews to encourage deinstallation
  (Pregenerated level previews were only used with version 1.01)
* Use dh7 for building instead of CDBS
* Update to policy 3.9.4.0 (no changes)
* Register documentation with doc-base

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
/*! Determine whether the actor hitting the stone can move stone
60
60
  and return either the direction the stone should move or NODIR. */
61
 
Direction get_push_direction (const StoneContact &sc) 
 
61
Direction get_push_direction (const StoneContact &sc)
62
62
{
63
63
    ActorInfo *ai  = sc.actor->get_actorinfo();
64
64
    Direction  dir = contact_face(sc);
72
72
 
73
73
/* Move a stone (by sending an impulse) Called when an actor hits a
74
74
   stone. */
75
 
bool maybe_push_stone (const StoneContact &sc) 
 
75
bool maybe_push_stone (const StoneContact &sc)
76
76
{
77
77
    Direction dir = get_push_direction(sc);
78
78
    if (dir != enigma::NODIR) {
111
111
}
112
112
 
113
113
 
114
 
void Stone::actor_hit(const StoneContact &sc) 
 
114
void Stone::actor_hit(const StoneContact &sc)
115
115
{
116
116
    if (is_movable())
117
117
        maybe_push_stone (sc);
122
122
 
123
123
void Stone::on_impulse(const Impulse& impulse) {
124
124
    if (is_movable()) {
125
 
        int id = getId();
 
125
        int theid = getId();
126
126
        move_stone(impulse.dir);    // may kill the stone!
127
 
        
128
 
        if (Object::getObject(id) != NULL)   // not killed?
 
127
 
 
128
        if (Object::getObject(theid) != NULL)   // not killed?
129
129
            propagateImpulse(impulse);
130
130
    }
131
131
}
156
156
bool Stone::move_stone(GridPos newPos, const char *soundevent) {
157
157
    if (isDisplayable()) {
158
158
        GridPos p      = get_pos();
159
 
    
 
159
 
160
160
        if (!GetStone(newPos)) {
161
161
            sound_event (soundevent);
162
 
    
 
162
 
163
163
            MoveStone(p, newPos);
164
164
            server::IncMoveCounter();
165
 
    
 
165
 
166
166
            if (on_move(p)) {
167
167
                if (Item *it = GetItem(newPos))
168
168
                    it->on_stonehit(this);
169
169
            }
170
 
    
 
170
 
171
171
            return true;
172
172
        }
173
173
        return false;
179
179
}
180
180
 
181
181
bool Stone::on_move(const GridPos &origin) {
182
 
    if (!is_floating()) 
 
182
    if (!is_floating())
183
183
        ShatterActorsInsideField (get_pos());
184
184
    return true;
185
185
}
227
227
            }
228
228
        }
229
229
    }
230
 
    
 
230
 
231
231
    void Stone::autoLeaveCluster() {
232
232
        GridPos p = get_pos();
233
233
        for (int i = WEST; i <= NORTH; i++) {
254
254
 
255
255
FreezeStatusBits Stone::get_freeze_bits(GridPos p) {
256
256
    Stone *st = GetStone(p);
257
 
    if(st == NULL) 
 
257
    if(st == NULL)
258
258
        return FREEZEBIT_NO_STONE;
259
259
    return st->get_freeze_bits();
260
260
}
289
289
    //
290
290
    // First block: #    Centered at the box "$", there are four orientations
291
291
    //              $#   of this pattern.
292
 
    // 
 
292
    //
293
293
    // Second block: $$  Each of the "$" can be movable or persistent.
294
294
    //               $$  Centered at one of them, there are again four
295
295
    //                   different orientation.
310
310
       || ((ms_n & p) && (ms_w & p))
311
311
       || ((ms_s & p) && (ms_e & p))
312
312
       || ((ms_s & p) && (ms_w & p))
313
 
       
 
313
 
314
314
       || ((ms_n & pm) && (ms_nw & pm) && (ms_w & pm))
315
315
       || ((ms_n & pm) && (ms_ne & pm) && (ms_e & pm))
316
316
       || ((ms_s & pm) && (ms_sw & pm) && (ms_w & pm))
317
317
       || ((ms_s & pm) && (ms_se & pm) && (ms_e & pm))
318
 
       
 
318
 
319
319
       || ((ms_n & pm) && (ms_e & p) && (ms_nw & p))
320
320
       || ((ms_n & pm) && (ms_w & p) && (ms_ne & p))
321
321
       || ((ms_s & pm) && (ms_e & p) && (ms_sw & p))