Hi! the st-wood stone should skate while it's on ice, right. here's a code snippet which adds this behaviour:
-------------------------------- BEGIN CODE ----------------------------- /* -------------------- Wooden stone -------------------- */ /** \page st-wood Wooden Stone This stone is movable. If moved into abyss, water or swamp it builds a wooden plank. \subsection woode Example \verbatim set_stone("st-wood", 10,10) \endverbatim Note: There are two flavors of st-wood which may be specified by using st-wood1 or st-wood2. \image html st-wood.png */ namespace { class WoodenStone : public Stone, public TimeHandler { CLONEOBJ(WoodenStone); public: WoodenStone(const char *kind) : Stone(kind) {isSkating=false;} private: void fall() { GridPos p = get_pos(); if (world::IsLevelBorder(p)) return; if (Floor *fl = GetFloor(p)) { const string &k = fl->get_kind(); if (k == "fl-abyss" || k=="fl-water" || k=="fl-swamp") { SetFloor(p, MakeFloor(is_kind("st-wood1") ? "fl-stwood1" : "fl-stwood2")); KillStone(p); } } } void message (const string &msg, const Value &) { if (msg == "fall") fall(); } Direction skateDir; bool isSkating; void on_impulse(const Impulse& impulse) { skateDir = impulse.dir; Stone::on_impulse(impulse); } void on_move() { if (server::GameCompatibility == GAMET_OXYD1) fall(); else Stone::on_move(); GridPos p = get_pos(); if (Floor *fl = GetFloor(p)) { const string &k = fl->get_kind(); if (k == "fl-ice" || k=="fl-ice_001") { if(!isSkating) GameTimer.set_alarm(this, 0.1, true); isSkating=true; } else{ if(isSkating){ GameTimer.remove_alarm(this); } isSkating=false; } } } void alarm() { if(!move_stone(skateDir)){ GameTimer.remove_alarm(this); isSkating=false; } } // other oxyds versions: fall everytime the floor changes void on_floor_change() { if (server::GameCompatibility != GAMET_OXYD1) fall(); } bool is_movable () const { return true; } }; /*! When st-wood is created it randomly becomes st-wood1 or st-wood2. */ class RandomWoodenStone : public Stone { public: RandomWoodenStone() : Stone("st-wood") {} private: Stone *clone() { return new WoodenStone (IntegerRand(0, 1) ? "st-wood1" : "st-wood2"); } void dispose() {delete this;} }; } -------------------------------- END CODE ----------------------------- hope this works for you. i tested it, and it worked, but i'm a poor c programmer so it's not granted to work... greets t.p.f.k.a.f. ___________________________________________________________ Was denken Sie über E-Mail? Wir hören auf Ihre Meinung: http://surveylink.yahoo.com/wix/p0379378.aspx _______________________________________________ Enigma-devel mailing list Enigma-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/enigma-devel