41 |
using namespace world; |
using namespace world; |
42 |
using namespace enigma; |
using namespace enigma; |
43 |
|
|
44 |
|
// remove comment from define below to switch on verbose messaging |
45 |
|
// note: VERBOSE_MESSAGES is defined in multiple source files! |
46 |
|
// #define VERBOSE_MESSAGES |
47 |
|
|
48 |
/* This function is used by all triggers, switches etc. that perform |
/* This function is used by all triggers, switches etc. that perform |
49 |
some particular action when activated (like opening doors or |
some particular action when activated (like opening doors or |
50 |
switching lasers on and off). */ |
switching lasers on and off). */ |
57 |
o->string_attrib("action", &action); |
o->string_attrib("action", &action); |
58 |
o->string_attrib("target", &target); |
o->string_attrib("target", &target); |
59 |
|
|
60 |
// o->warning("PerformAction action=%s target=%s", action.c_str(), target.c_str()); |
#if defined(VERBOSE_MESSAGES) |
61 |
|
o->warning("PerformAction action=%s target=%s", action.c_str(), target.c_str()); |
62 |
|
#endif // VERBOSE_MESSAGES |
63 |
|
|
64 |
if (action == "callback") { |
if (action == "callback") { |
65 |
lua::CallFunc(target.c_str(), Value(onoff)); |
lua::CallFunc(target.c_str(), Value(onoff)); |
1017 |
void |
void |
1018 |
world::SendMessage(Object *o, const std::string &msg) |
world::SendMessage(Object *o, const std::string &msg) |
1019 |
{ |
{ |
1020 |
if (o) |
if (o) { |
1021 |
|
#if defined(VERBOSE_MESSAGES) |
1022 |
|
o->warning("will be sent message '%s'", msg.c_str()); |
1023 |
|
#endif // VERBOSE_MESSAGES |
1024 |
o->message(msg, Value()); |
o->message(msg, Value()); |
1025 |
|
} |
1026 |
|
#if defined(VERBOSE_MESSAGES) |
1027 |
|
else |
1028 |
|
fprintf(stderr, "Sending message '%s' to NULL-object\n", msg.c_str()); |
1029 |
|
#endif // VERBOSE_MESSAGES |
1030 |
} |
} |
1031 |
|
|
1032 |
void |
void |
1033 |
world::SendMessage(Object *o, const std::string &msg, const Value& value) |
world::SendMessage(Object *o, const std::string &msg, const Value& value) |
1034 |
{ |
{ |
1035 |
if (o) |
if (o) { |
1036 |
|
#if defined(VERBOSE_MESSAGES) |
1037 |
|
o->warning("will be sent message '%s' (with Value)", msg.c_str()); |
1038 |
|
#endif // VERBOSE_MESSAGES |
1039 |
o->message(msg, value); |
o->message(msg, value); |
1040 |
|
} |
1041 |
|
#if defined(VERBOSE_MESSAGES) |
1042 |
|
else |
1043 |
|
fprintf(stderr, "Sending message '%s' to NULL-object\n", msg.c_str()); |
1044 |
|
#endif // VERBOSE_MESSAGES |
1045 |
} |
} |
1046 |
|
|
1047 |
// explosion messages: |
// explosion messages: |