835 |
case BREAKING: set_anim("st-stone_break-anim"); break; |
case BREAKING: set_anim("st-stone_break-anim"); break; |
836 |
} |
} |
837 |
} |
} |
838 |
|
|
839 |
void animcb() { |
void animcb() { |
840 |
if( state == ACTIVE) { |
if( state == ACTIVE) { |
841 |
// Spread |
// Spread |
844 |
if( DoubleRand(0, 1) > 0.7) spread (move(p, EAST)); |
if( DoubleRand(0, 1) > 0.7) spread (move(p, EAST)); |
845 |
if( DoubleRand(0, 1) > 0.7) spread (move(p, SOUTH)); |
if( DoubleRand(0, 1) > 0.7) spread (move(p, SOUTH)); |
846 |
if( DoubleRand(0, 1) > 0.7) spread (move(p, WEST)); |
if( DoubleRand(0, 1) > 0.7) spread (move(p, WEST)); |
847 |
|
|
848 |
// Be finished at random time |
// Be finished at random time |
849 |
if( DoubleRand(0, 1) > 0.95) |
if( DoubleRand(0, 1) > 0.95) |
850 |
state = FINISHED; |
state = FINISHED; |
854 |
} |
} |
855 |
} |
} |
856 |
|
|
857 |
void message(const string &msg, const Value &val) { |
void message(const string &msg, const Value &) { |
858 |
if (msg == "trigger") { |
if (msg == "trigger") { |
859 |
if (state == INACTIVE) { |
if (state == INACTIVE) { |
860 |
state = ACTIVE; |
state = ACTIVE; |
862 |
} |
} |
863 |
} |
} |
864 |
} |
} |
865 |
|
|
866 |
void spread( GridPos p) { |
void spread( GridPos p) { |
867 |
Stone *st = GetStone(p); |
Stone *st = GetStone(p); |
868 |
if( !st) { |
if( !st) { |