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

« back to all changes in this revision

Viewing changes to src/items/BurnableItem.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:
6
6
 * modify it under the terms of the GNU General Public License
7
7
 * as published by the Free Software Foundation; either version 2
8
8
 * of the License, or (at your option) any later version.
9
 
 *  
 
9
 *
10
10
 * This program is distributed in the hope that it will be useful,
11
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
28
    BurnableItem::BurnableItem(int type) {
29
29
        state = type;
30
30
    }
31
 
    
 
31
 
32
32
    std::string BurnableItem::getClass() const {
33
33
        return "it_burnable";
34
34
    }
35
 
    
 
35
 
36
36
    Value BurnableItem::message(const Message &m) {
37
37
        if (m.message == "extinguish") {   // stop / never start burning
38
38
            state = FIREPROOF;
39
39
            init_model();
40
40
            return Value();
41
 
        } else if (m.message == "_brush" && (state == ASH || state == FIREPROOF) ||
42
 
                (m.message == "_freeze" && state != OIL)) {
 
41
        } else if ((m.message == "_brush" && (state == ASH || state == FIREPROOF)) ||
 
42
                   (m.message == "_freeze" && state != OIL)) {
43
43
            kill();   // The brush cleans the floor
44
44
            return Value();
45
45
        } else if (Floor *fl = GetFloor(get_pos())) {
48
48
        }
49
49
        return Item::message(m);
50
50
    }
51
 
    
 
51
 
52
52
    void BurnableItem::setState(int extState) {
53
53
        // ignore set state attempts
54
54
    }
55
 
    
 
55
 
56
56
    void BurnableItem::init_model() {
57
57
        if (state == OIL) {
58
58
            set_model(ecl::strf("it_burnable_oil%d", IntegerRand(1, 4)));  // TODO store and keep model subtyp!
59
59
        } else
60
60
            Item::init_model();
61
61
    }
62
 
    
 
62
 
63
63
    void BurnableItem::animcb() {
64
64
        if(Floor *fl = GetFloor(get_pos()))
65
65
            fl->on_burnable_animcb(state == IGNITE);
66
66
    }
67
 
    
 
67
 
68
68
    bool BurnableItem::actor_hit(Actor *a) {
69
69
        if (state == IGNITE || state == BURNING)
70
70
            SendMessage(a, "_shatter");
74
74
    int BurnableItem::traitsIdx() const {
75
75
        return state;
76
76
    }
77
 
    
 
77
 
78
78
    ItemTraits BurnableItem::traits[6] = {
79
79
        {"it_burnable_invisible", it_burnable_invisible, itf_static, 0.0},
80
80
        {"it_burnable_oil",       it_burnable_oil,       itf_static | itf_freezable, 0.0},