notify_fail: string|closure akzeptieren
Als Meldung nur noch string|closure akzeptieren, dafuer
laesst sich dann die eigene Typpruefung einsparen, weil
der Driver prueft.
_notify_fail() akzeptiert nun auch string|closure.
Change-Id: I69dd8a8d64023bae267a65fad1a37a38bb7a1ffb
diff --git a/secure/simul_efun/simul_efun.c b/secure/simul_efun/simul_efun.c
index d4a6428..9424b06 100644
--- a/secure/simul_efun/simul_efun.c
+++ b/secure/simul_efun/simul_efun.c
@@ -1574,22 +1574,18 @@
return efun::garbage_collection();
}
-varargs void notify_fail(mixed nf, int prio) {
+varargs void notify_fail(string|closure nf, int prio)
+{
object po,oldo;
int oldprio;
-
- if (!PL || !objectp(po=previous_object())) return;
- if (!stringp(nf) && !closurep(nf)) {
- set_this_object(po);
- raise_error(sprintf(
- "Only strings and closures allowed for notify_fail! "
- "Argument was: %.50O...\n",nf));
- }
+
+ if (!PL || !objectp(po=previous_object()))
+ return;
// falls ein Objekt bereits nen notify_fail() setzte, Prioritaeten abschaetzen
// und vergleichen.
if (objectp(oldo=query_notify_fail(1)) && po!=oldo) {
- if (!prio) {
+ if (!prio) {
//Prioritaet dieses notify_fail() 'abschaetzen'
if (po==PL) // Spieler-interne (soul-cmds)
prio=NF_NL_OWN;
@@ -1614,7 +1610,7 @@
oldprio=NF_NL_NONE;
//vergleichen und ggf. setzen
- if (prio >= oldprio) {
+ if (prio >= oldprio) {
set_this_object(po);
efun::notify_fail(nf);
}
@@ -1622,7 +1618,7 @@
return;
}
-void _notify_fail(string str)
+void _notify_fail(string|closure str)
{
//query_notify_fail() benutzen, um das Objekt
//des letzten notify_fail() zu ermitteln
diff --git a/secure/simul_efun/spare/simul_efun.c b/secure/simul_efun/spare/simul_efun.c
index d4a6428..9424b06 100644
--- a/secure/simul_efun/spare/simul_efun.c
+++ b/secure/simul_efun/spare/simul_efun.c
@@ -1574,22 +1574,18 @@
return efun::garbage_collection();
}
-varargs void notify_fail(mixed nf, int prio) {
+varargs void notify_fail(string|closure nf, int prio)
+{
object po,oldo;
int oldprio;
-
- if (!PL || !objectp(po=previous_object())) return;
- if (!stringp(nf) && !closurep(nf)) {
- set_this_object(po);
- raise_error(sprintf(
- "Only strings and closures allowed for notify_fail! "
- "Argument was: %.50O...\n",nf));
- }
+
+ if (!PL || !objectp(po=previous_object()))
+ return;
// falls ein Objekt bereits nen notify_fail() setzte, Prioritaeten abschaetzen
// und vergleichen.
if (objectp(oldo=query_notify_fail(1)) && po!=oldo) {
- if (!prio) {
+ if (!prio) {
//Prioritaet dieses notify_fail() 'abschaetzen'
if (po==PL) // Spieler-interne (soul-cmds)
prio=NF_NL_OWN;
@@ -1614,7 +1610,7 @@
oldprio=NF_NL_NONE;
//vergleichen und ggf. setzen
- if (prio >= oldprio) {
+ if (prio >= oldprio) {
set_this_object(po);
efun::notify_fail(nf);
}
@@ -1622,7 +1618,7 @@
return;
}
-void _notify_fail(string str)
+void _notify_fail(string|closure str)
{
//query_notify_fail() benutzen, um das Objekt
//des letzten notify_fail() zu ermitteln