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

« back to all changes in this revision

Viewing changes to src/floors.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:
105
105
        }
106
106
        return GridObject::getAttr(key);
107
107
    }
108
 
    
 
108
 
109
109
    void Floor::on_creation(GridPos p) {
110
110
        if (Value v = GridObject::getAttr("adhesion"))
111
111
            adhesion = v;
112
112
        if (Value v = GridObject::getAttr("friction"))
113
113
            friction = v;
114
114
        GridObject::on_creation(p);
115
 
        
 
115
 
116
116
        if (server::WorldInitialized && has_firetype(flft_initfire))
117
117
            force_fire();
118
118
    }
121
121
//     sinkspeed = raisespeed = 0.0;
122
122
}
123
123
 
124
 
double Floor::get_friction() const 
125
 
126
 
    return friction; 
 
124
double Floor::get_friction() const
 
125
{
 
126
    return friction;
127
127
}
128
128
 
129
 
    double Floor::getAdhesion() const { 
130
 
        return adhesion; 
 
129
    double Floor::getAdhesion() const {
 
130
        return adhesion;
131
131
    }
132
132
 
133
 
bool Floor::is_destructible() const 
 
133
bool Floor::is_destructible() const
134
134
{
135
135
    return true;
136
136
}
137
137
 
138
 
bool Floor::is_freeze_check() const 
 
138
bool Floor::is_freeze_check() const
139
139
{
140
140
    return to_bool(this->getAttr("freeze_check"));
141
141
}
142
142
 
143
 
void Floor::set_model (const std::string &mname) 
 
143
void Floor::set_model (const std::string &mname)
144
144
{
145
145
    display::SetModel (GridLoc(GRID_FLOOR, get_pos()), mname);
146
146
}
147
147
 
148
 
display::Model *Floor::get_model () 
 
148
display::Model *Floor::get_model ()
149
149
{
150
150
    return display::GetModel (GridLoc(GRID_FLOOR, get_pos()));
151
151
}
152
152
 
153
 
void Floor::kill_model (GridPos p) 
 
153
void Floor::kill_model (GridPos p)
154
154
{
155
155
    display::KillModel (GridLoc (GRID_FLOOR, p));
156
156
}
286
286
                if (   (get_fire_countdown() == 0) || (flhf == flhf_message)
287
287
                    || (has_firetype(flft_fastfire))
288
288
                    || (((bool) (flhf & flhf_last)) && has_firetype(flft_secure)))
289
 
                    return force_fire();            
 
289
                    return force_fire();
290
290
                fire_countdown = max(fire_countdown - 1, 0);
291
 
            }        
 
291
            }
292
292
        }
293
293
    } else {  // non-Enigma-mode
294
294
        if (has_firetype(flft_burnable) || flhf == flhf_message) {
304
304
            if (Floor *fl = GetFloor(move(p, sourcedir))) {
305
305
                string sourcekind = fl->getClass();
306
306
                string mykind = this->getClass();
307
 
                if (no_closing_stone && sourcekind == mykind)
 
307
                if (no_closing_stone && sourcekind == mykind) {
308
308
                    if (has_firetype(flft_fastfire))
309
309
                        return force_fire();
310
310
                    else
311
311
                        this->setAttr("burnable", true);
 
312
                }
312
313
            }
313
314
        }
314
315
    }
343
344
    if (doItem)
344
345
        if (Item *it = GetItem(get_pos()))
345
346
            if (to_int(SendMessage(it, "heat", Value(sourcedir))) != 0.0)
346
 
                reaction_happened = true;        
 
347
                reaction_happened = true;
347
348
    // Maybe also transform floor?
348
349
    reaction_happened = on_heattransform(sourcedir, flhf) || reaction_happened;
349
350
    // Maybe transform stone, or stone blocks fire?
388
389
 
389
390
    // is_message indicates use of the stopfire-message,
390
391
    // so we have to check if there is fire at all.
391
 
    if (is_message)
 
392
    if (is_message) {
392
393
        if (Item *it = GetItem(p)) {
393
 
            ItemID id = get_id(it);
394
 
            if (id != it_burnable_burning && id != it_burnable_ignited)
 
394
            ItemID theid = get_id(it);
 
395
            if (theid != it_burnable_burning && theid != it_burnable_ignited)
395
396
                return false;  // no fire
396
397
        } else
397
398
            return false; // no item == no fire
 
399
    }
398
400
 
399
401
    KillItem(p);
400
402
    fire_countdown = 1;
403
405
    // Remember, at this point "this" may be destroyed.
404
406
    if (!GetFloor(p)->has_firetype(flft_noash))
405
407
        SetItem(p, MakeItem("it_burnable_ash"));
406
 
    return true; // fire extinguished  
 
408
    return true; // fire extinguished
407
409
}
408
410
 
409
411
void Floor::on_burnable_animcb(bool justIgnited) {
410
412
    GridPos p = get_pos();
411
 
    // 
 
413
    //
412
414
    SendMessage(GetStone(p), "_fire");
413
415
 
414
416
    // Will we stop this time with burning?
449
451
                return (selector == flft_burnable) && !has_flags(it, itf_fireproof);
450
452
        }
451
453
    }
452
 
    bool dflt = (server::GameCompatibility == GAMET_ENIGMA) 
 
454
    bool dflt = (server::GameCompatibility == GAMET_ENIGMA)
453
455
            && (traits.firetype & selector);
454
456
    // In non-Enigma-modes, without items on them, all floors behave the same:
455
457
    switch (selector) {