73 |
o->string_attrib("action", &action); |
o->string_attrib("action", &action); |
74 |
o->string_attrib("target", &target); |
o->string_attrib("target", &target); |
75 |
|
|
76 |
|
// o->warning("PerformAction action=%s target=%s", action.c_str(), target.c_str()); |
77 |
|
|
78 |
if (action == "callback") { |
if (action == "callback") { |
79 |
lua::CallFunc(target.c_str(), Value(onoff)); |
lua::CallFunc(target.c_str(), Value(onoff)); |
80 |
} |
} |
84 |
else if (Object *o = GetNamedObject(target)) { |
else if (Object *o = GetNamedObject(target)) { |
85 |
SendMessage(o, action); |
SendMessage(o, action); |
86 |
} |
} |
87 |
|
else { |
88 |
|
fprintf(stderr, "Unknown target '%s' for action '%s'\n", target.c_str(), action.c_str()); |
89 |
|
} |
90 |
} |
} |
91 |
|
|
92 |
//---------------------------------------- |
//---------------------------------------- |
198 |
}; |
}; |
199 |
|
|
200 |
void |
void |
201 |
Object::log(const char *format, ...) const { |
Object::warning(const char *format, ...) const { |
202 |
va_list arg_ptr; |
va_list arg_ptr; |
203 |
|
|
204 |
va_start(arg_ptr, format); |
va_start(arg_ptr, format); |
217 |
} |
} |
218 |
|
|
219 |
void |
void |
220 |
GridObject::log(const char *format, ...) const { |
GridObject::warning(const char *format, ...) const { |
221 |
va_list arg_ptr; |
va_list arg_ptr; |
222 |
const GridPos& pos = get_pos(); |
const GridPos& pos = get_pos(); |
223 |
|
|
1692 |
Stone *st = GetStone(next_pos); |
Stone *st = GetStone(next_pos); |
1693 |
|
|
1694 |
if (st) { |
if (st) { |
|
// log("BolderStone sends 'trigger'"); |
|
1695 |
SendMessage(st, "trigger", Value(dir)); |
SendMessage(st, "trigger", Value(dir)); |
1696 |
} |
} |
1697 |
} |
} |
1785 |
case SHRINKING: { |
case SHRINKING: { |
1786 |
Item *it = world::MakeItem("it-blocker-new"); |
Item *it = world::MakeItem("it-blocker-new"); |
1787 |
world::SetItem(get_pos(), it); |
world::SetItem(get_pos(), it); |
1788 |
|
TransferObjectName(this, it); |
1789 |
world::KillStone(get_pos()); |
world::KillStone(get_pos()); |
1790 |
break; |
break; |
1791 |
} |
} |
1796 |
} |
} |
1797 |
|
|
1798 |
void message(const string &msg, const Value &) { |
void message(const string &msg, const Value &) { |
1799 |
if (msg == "trigger") { // e.g from st-bolder |
if (msg == "trigger" || msg == "signal") { |
|
if (state == SOLID) { |
|
|
change_state(SHRINKING); |
|
|
} |
|
|
} |
|
|
else if (msg == "signal") { // e.g from it-trigger |
|
1800 |
if (state == SHRINKING) { |
if (state == SHRINKING) { |
1801 |
change_state(GROWING); |
change_state(GROWING); |
1802 |
} |
} |
2751 |
if (h>=1 && h<=7) |
if (h>=1 && h<=7) |
2752 |
return Holes(h); |
return Holes(h); |
2753 |
else { |
else { |
2754 |
log("Wrong 'holes' attribute (%i)", h); |
warning("Wrong 'holes' attribute (%i)", h); |
2755 |
return SMALL; |
return SMALL; |
2756 |
} |
} |
2757 |
} |
} |