#define ELEPATH "/d/Imperium/Nuln/kanaly"
#define ELEPATHN "/d/Imperium/Nuln/kanaly/npce"
#define NULN "/d/Imperium/Nuln"
#define NPATH "/d/Imperium/Nuln/"
#define TP this_player()
#define PNC QCNAME(this_player())
#define PN QNAME(this_player())
#include <stdproperties.h>

/* NO COMMENT :)
 */
void errmsg (string str)
{
  find_living ("elear") -> catch_msg ("ERR: "+str+"\n",this_object());
}


/* prosta procedurka uzalezniajaca tekst od plci gracza
 * 
 * string = plpl ("wszedles","weszlas",object)    dla przykladu
 *    (object mozna pominac, zostanie przyjety this_player() )
 */
varargs string plpl (string mal = "", string fem = "", mixed target = this_player() )
{
  if (!objectp(target)) target = this_player();
  return target->query_gender() ? fem : mal;
}

varargs void e_tell_room (mixed room, mixed str, mixed oblist = 0, object from = TP)
{
    int i;
    int j;
    mixed *plist;
    string stprz;
    string stm;
    string stz;
    string stpo;
    
    if (!room) return;
    
    if (stringp(room))
        if (!(room = find_object(room)))
            return;
    
    if (objectp(oblist))
        oblist = ({ oblist });
    
    plist = all_inventory(room) + ({ room });    
    for (i = 0; i < sizeof (plist); i++)
        if (living(plist[i]) && (member_array(plist[i], oblist) < 0))
        {
            j = 0;
            while (wildmatch("*#*",str) && (j<4))
            {
                sscanf (str,"%s#%s#%s#%s",stprz,stm,stz,stpo);
                str = stprz + plpl(stm,stz,plist[i]) + stpo;
                j++;
            //    errmsg (str);
            }
            plist[i]->catch_msg (str, from);
        }    
}

varargs string lmov (mapping mapa, string difolt = " ** ZGLOS BUGA !! ** ", mixed ob = this_player() )
{
  string s;
  if (!objectp(ob)) ob = this_player();
  s = mapa[ob->query_prop(LIVE_S_LAST_MOVE)];
  if (s==0) s = difolt;
  return s;
}

