Wrapper fuer ReceiveMsg() ueberarbeitet

1) Rueckgabewerte in Containern entfallen
Diese muessten ein (tief) geschachteltes Mapping sein, was vermutlich
niemand mehr auswertet.
2) Alternativen nur versuchen, solange der Fehler von ReceiveMsg()
MSG_SENSE_BLOCK ist - alle anderen Fehler sind sehr wahrscheinlich
"permanent" fuer die Dauer des Aufrufs.
3) Rueckgabewert in Livings geaendert
Der Rueckgabe ist jetzt der Rueckgabewert von ReceiveMsg() fuer die
zuletzt versuchte Meldung. Dies ermoeglicht die Feststellung, dass eine
Meldung zugestellt wurde (wenn auch nicht welche), was das ist, was
die meisten Aufrufer interessieren duerfte. Gleichzeitig ist der Wert
jetzt einfacher auszuwerten.
4) Manpages umstrukturiert und -formuliert
5) ReceiveSay() nur noch Spezialfall von ReceiveMultiSense()

Change-Id: Id9dbe227236f07b577be2626c99a13ff89fd7997
diff --git a/std/living/comm.c b/std/living/comm.c
index b79915a..59749a3 100644
--- a/std/living/comm.c
+++ b/std/living/comm.c
@@ -139,45 +139,6 @@
 }
 
 // Wrapper fuer ReceiveMsg()
-public int* ReceiveSay(string msg, string prefix = 0,
-  struct wave_s* sense_blocked =
-    ({(<wave_s> 
-      msg: "@WER1 bewegt die Lippen, Du hoerst jedoch nichts.",
-      type: MT_LOOK)}))
-{
-  int* res = ({0, -1});
-
-  if(!prefix)
-  {
-    prefix = previous_object().Name(WER, 1) + " sagt: ";
-  }
-
-  res[0] = ReceiveMsg(
-    replace_personal(msg, ({previous_object(), this_player()}) - ({0}), 1),
-    MT_LISTEN | MSG_BS_LEAVE_LFS,
-    MA_SAY,
-    prefix);
-
-  if(res[0] == MSG_SENSE_BLOCK)
-  {
-    // Um eine Nummer zurueckzugeben, ist hier leider eine for-Schleife noetig.
-    for(int i = 0; i < sizeof(sense_blocked); ++i)
-    {
-      res[0] = ReceiveMsg(
-        replace_personal(sense_blocked[i].msg, ({previous_object(),
-                         this_player()}) - ({0}), 1),
-        sense_blocked[i].type | MSG_BS_LEAVE_LFS,
-        MA_SAY,
-        sense_blocked[i].prefix);
-      if(res[0] != MSG_SENSE_BLOCK)
-      {
-        res[1] = i;
-        break;
-      }
-    }
-  }
-  return res;
-}
 
 public int ReceiveNotify(string msg, string action)
 {
@@ -201,24 +162,36 @@
     previous_object().Name(WER, 1) + "teilt Dir mit: ");
 }
 
-public int* ReceiveMultisense(struct wave_s* msgs,
+public int ReceiveMultiSense(struct wave_s *msgs,
     string action = 0, int commontypes = 0)
 {
-  int* res = ({0, -1});
-
-  // Um eine Nummer zurueckzugeben, ist hier leider eine for-Schleife noetig.
-  for(int i = 0; i < sizeof(msgs); ++i)
+  int res;
+  foreach(struct wave_s wave : msgs)
   {
-    res[0] = ReceiveMsg(
-      replace_personal(msgs[i].msg, ({previous_object(), this_player()}), 1),
-      msgs[i].type | MSG_BS_LEAVE_LFS | commontypes,
-      action,
-      msgs[i].prefix);
-    if(res[0] == MSG_DELIVERED)
+    // Pruefung auf != MSG_SENSE_BLOCK statt Erfolg, weil ein anderer Fehler
+    // (insb. aufgrund ignoriere) fuer alle Alternativen ebenso auftritt.
+    res = ReceiveMsg(
+          replace_personal(wave.msg, ({previous_object(), this_player()}),1),
+          wave.type | MSG_BS_LEAVE_LFS | commontypes, action, wave.prefix);
+    if (res != MSG_SENSE_BLOCK)
     {
-      res[1] = i;
       break;
     }
   }
   return res;
 }
+
+public int ReceiveSay(string msg,
+    string prefix = previous_object().Name(WER, 1) + " sagt: ",
+    struct wave_s *alt =
+        ({(<wave_s>
+            msg: "@WER1 bewegt die Lippen, Du hoerst jedoch nichts.",
+            type: MT_LOOK)})
+        )
+{
+  // Nachricht in struct konvertieren, ans Anfang vom Array stellen
+  alt = ({(<wave_s> msg: msg, prefix: prefix, type: MT_LISTEN)}) + alt;
+  // Rest macht ReceiveMultiSense()
+  return ReceiveMultiSense(alt, MA_SAY, MSG_BS_LEAVE_LFS);
+}
+
diff --git a/std/room/comm.c b/std/room/comm.c
index ae57bbe..664fb9b 100644
--- a/std/room/comm.c
+++ b/std/room/comm.c
@@ -2,49 +2,35 @@
 #pragma no_clone
 
 #include <thing/language.h>
+#include <living/comm.h>
 
 // Per Default nur an alle Items im Inventar weiterleiten.
-public varargs int ReceiveMsg(string msg, int msg_type, string msg_action,
+public varargs void ReceiveMsg(string msg, int msg_type, string msg_action,
                               string msg_prefix, object origin)
 {
-  int *res = ({int*})all_inventory()->ReceiveMsg(msg, msg_type, msg_action,
-                                         msg_prefix,
-                                         origin || previous_object());
-  if (sizeof(res))
-    return min(res);
-  return 0;
-}
-
-// Sortierfunktion um das Array mit dem kleinsten Wert auszugeben
-
-private int* _minarr(int** arr)
-{
-  if(!sizeof(arr)) return 0;
-  return sort_array(&arr,
-    function int(int* a, int* b)
-    {
-      return a[0] > b[0];
-    })[0];
+  all_inventory()->ReceiveMsg(msg, msg_type, msg_action,
+                              msg_prefix, origin || previous_object());
 }
 
 // Wrapper fuer ReceiveMsg()
 
-public varargs int* ReceiveSay(string msg, string prefix,
-  struct wave_s sense_blocked)
+public void ReceiveMultiSense(struct wave_s *msgs, string action=0,
+    int commontypes=0)
 {
-  // Das muss schon hier passieren, damit previous_object() stimmt
-  if(!prefix)
-  {
-    prefix = ({string})previous_object().Name(WER, 1) + " sagt: ";
-  }
-
-  int** res = ({int**})all_inventory()->ReceiveSay(msg, prefix, sense_blocked);
-  return _minarr(res);
+  all_inventory()->ReceiveMultisense(msgs, action, commontypes);
 }
 
-public varargs int* ReceiveMultisense(struct wave_s msgs,
-  string action, int commontypes)
+public void ReceiveSay(string msg,
+    string prefix = ({string})previous_object().Name(WER, 1) + " sagt: ",
+    struct wave_s *alt =
+        ({(<wave_s>
+            msg: "@WER1 bewegt die Lippen, Du hoerst jedoch nichts.",
+            type: MT_LOOK)})
+    )
 {
-  int** res = ({int**})all_inventory()->ReceiveMultisense(msgs, action, commontypes);
-  return _minarr(res);
+  // Nachricht in struct konvertieren, ans Anfang vom Array stellen
+  alt = ({(<wave_s> msg: msg, prefix: prefix, type: MT_LISTEN)}) + alt;
+  // Rest macht ReceiveMultiSense()
+  ReceiveMultiSense(alt, MA_SAY, MSG_BS_LEAVE_LFS);
 }
+