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

« back to all changes in this revision

Viewing changes to src/stones/YieldingStone.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:
5
5
 * modify it under the terms of the GNU General Public License
6
6
 * as published by the Free Software Foundation; either version 2
7
7
 * of the License, or (at your option) any later version.
8
 
 *  
 
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
10
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
25
namespace enigma {
26
26
    YieldingStone::YieldingStone() : Stone(), yieldedStone (NULL), yieldedModel (NULL) {
27
27
    }
28
 
    
 
28
 
29
29
    void YieldingStone::dispose() {
30
30
         if (yieldedStone != NULL) {
31
31
            SendMessage(yieldedStone, "disconnect");
40
40
 
41
41
    void YieldingStone::yieldStone(Stone *st) {
42
42
        if (st != NULL) {
43
 
            ASSERT(yieldedStone == NULL, XLevelRuntime, "YieldingStone: internal error of double yielding"); 
 
43
            ASSERT(yieldedStone == NULL, XLevelRuntime, "YieldingStone: internal error of double yielding");
44
44
            yieldedStone = st;
45
45
            origin = st->get_pos();
46
46
            yieldedModel = display::YieldModel(GridLoc(GRID_STONES, origin));
48
48
            yieldedStone->setOwnerPos(get_pos());   // the stone id owned at the new position
49
49
        }
50
50
    }
51
 
    
 
51
 
52
52
    void YieldingStone::setStone() {
53
 
        GridPos pos = get_pos();
 
53
        GridPos p = get_pos();
54
54
        SendMessage(this, "disconnect");
55
 
        YieldStone(pos);
 
55
        YieldStone(p);
56
56
        if (yieldedStone != NULL) {
57
 
            int id = yieldedStone->getId();
58
 
            SetStone(pos, yieldedStone);
59
 
            if (Object::getObject(id) != NULL) { // not killed?
60
 
                display::SetModel(GridLoc(GRID_STONES, pos), yieldedModel);
 
57
            int theid = yieldedStone->getId();
 
58
            SetStone(p, yieldedStone);
 
59
            if (Object::getObject(theid) != NULL) { // not killed?
 
60
                display::SetModel(GridLoc(GRID_STONES, p), yieldedModel);
61
61
                yieldedStone->on_move(origin);    // continue animations -- this is buggy if the stone has another
62
62
                                            // model on the new position like st-chameleon
63
 
                if (Object::getObject(id) != NULL)   // not killed?
 
63
                if (Object::getObject(theid) != NULL)   // not killed?
64
64
                    SendMessage(yieldedStone, "_model_reanimated");  // temp fix: reset bad models
65
65
            }
66
66
            yieldedStone = NULL;