info.c-Dateireferenz

#include <thing/description.h>
#include <thing/properties.h>
#include <npc.h>
#include <language.h>
#include <defines.h>
#include <config.h>
#include <exploration.h>
Include-Abhängigkeitsdiagramm für info.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define NEED_PROTOTYPES

Funktionen

protected void create ()
void init ()
static void smart_npc_log (string str)
public int frage (string str)
static mixed _query_pre_info ()
static string infoDefaultReplace (string pstring, object pl)
static mixed * GetInfoArr (string str)
public int do_frage (string text)
public varargs void AddInfo (mixed key, mixed info, string indent, mixed silent, mixed casebased)
public varargs void AddSpecialInfo (mixed keys, string functionname, string indent, mixed silent, mixed casebased)
public void RemoveInfo (string key)
static varargs void _set_default_info (mixed info)
public varargs mixed GetInfo (string str)
static mapping _query_npc_info ()
static mapping _set_npc_info (mapping map_ldfied)

Variablen

nosave mapping infos

Makro-Dokumentation

#define NEED_PROTOTYPES

Definiert in Zeile 53 der Datei info.c.


Dokumentation der Funktionen

static mapping _query_npc_info (  )  [static]

Definiert in Zeile 314 der Datei info.c.

Benutzt infos.

00315 {
00316     return deep_copy(infos);
00317 }

static mixed _query_pre_info (  )  [static]

Definiert in Zeile 141 der Datei info.c.

Benutzt P_PRE_INFO und QueryProp().

Wird benutzt von do_frage().

00142 {
00143   return QueryProp(P_PRE_INFO);
00144 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static varargs void _set_default_info ( mixed  info  )  [static]

Definiert in Zeile 299 der Datei info.c.

Benutzt AddInfo() und DEFAULT_INFO.

00300 {
00301   if (pointerp(info))
00302     apply(#'AddInfo/*'*/,DEFAULT_INFO,info);
00303   else
00304     AddInfo(DEFAULT_INFO,info);
00305 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static mapping _set_npc_info ( mapping  map_ldfied  )  [static]

Definiert in Zeile 320 der Datei info.c.

Benutzt infos.

00321 {
00322     if ( !mappingp(map_ldfied) )
00323         return 0;
00324 
00325     return infos = map_ldfied;
00326 }

public varargs void AddInfo ( mixed  key,
mixed  info,
string  indent,
mixed  silent,
mixed  casebased 
)

Definiert in Zeile 268 der Datei info.c.

Benutzt i und infos.

Wird benutzt von _set_default_info() und AddSpecialInfo().

00269                                                             {
00270 
00271   if (stringp(casebased))
00272     casebased=symbol_function(casebased,this_object());
00273 
00274   if( pointerp( key ) ) {
00275     int i;
00276     for ( i=sizeof( key )-1; i>=0; i-- )
00277       infos += ([ key[i]: info; indent; silent; casebased ]);
00278   }
00279   else
00280     infos += ([ key: info; indent; silent; casebased ]);
00281 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

public varargs void AddSpecialInfo ( mixed  keys,
string  functionname,
string  indent,
mixed  silent,
mixed  casebased 
)

Definiert in Zeile 283 der Datei info.c.

Benutzt AddInfo(), cl und i.

00285 {
00286   int i;
00287   closure cl;
00288 
00289   if(!(cl=symbol_function(functionname,this_object()))) return;
00290   return AddInfo(keys,cl,indent,silent,casebased);
00291 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

protected void create (  ) 

Definiert in Zeile 68 der Datei info.c.

Benutzt DEFAULT_INFO, DEFAULT_NOINFO und infos.

00069 {
00070     // Initialisierung nur wenn noetig, damit beim virtuellen Erben von
00071     // /std/npc in npc1 und npc2 dann in npc3 beim npc1::create();
00072     // npc2:create(); im zweiten create() die Infos nicht
00073     // ueberschrieben/geloescht werden.
00074     if (!mappingp(infos)) {
00075         infos = ([
00076             DEFAULT_INFO:"schaut Dich fragend an.\n";0;
00077             "schaut @WEN fragend an.\n";0,
00078             DEFAULT_NOINFO:"moechte Dir nicht antworten.\n";0;
00079             "verweigert @WEM die Antwort.\n";1
00080             ]);
00081     }
00082 }

public int do_frage ( string  text  ) 

Definiert in Zeile 175 der Datei info.c.

Benutzt _query_pre_info(), break_string(), DEFAULT_INFO, DEFAULT_NOINFO, GetInfoArr(), info, infoDefaultReplace(), name, P_LOG_INFO, process_string(), QueryProp(), smart_npc_log(), WEM und WER.

Wird benutzt von frage().

00176 {
00177   string indent,answer;
00178   mixed silent, preinfo, noanswer;
00179   mixed *info;
00180 
00181   if (stringp(preinfo = _query_pre_info()))
00182    {
00183      tell_object(this_player(),
00184                  break_string(capitalize(name(WER,2))+" "+preinfo,78));
00185      say(break_string(capitalize(name(WER,2))+" ist nicht gewillt, "
00186                      +capitalize(this_player()->name(WEM,2))+" zu antworten.\n",78),
00187         ({ this_player() }) );
00188      return 1;
00189    }
00190   else
00191    if (intp(preinfo) && preinfo > 0) return 1;
00192 
00193   info=GetInfoArr(text);
00194   if (!info[0])
00195   {
00196     if( this_interactive() && QueryProp(P_LOG_INFO) )
00197       smart_npc_log(text);
00198     text = DEFAULT_INFO;
00199     info=GetInfoArr(text);
00200   }
00201 
00202   if (closurep(info[0]) ) {
00203     answer=funcall(info[0]);
00204     if( !answer || answer=="") return 1;
00205   } else {
00206     answer=process_string(info[0]);
00207   }
00208 
00209   if (closurep(info[3]) )
00210    {
00211     noanswer=funcall(info[3]);
00212     if ( intp(noanswer) && noanswer > 0)
00213      {
00214        text = DEFAULT_NOINFO;
00215        if (closurep(info[0]) ) {
00216          answer=funcall(info[0]);
00217          if( !answer || answer=="") return 1;
00218        } else {
00219          answer=process_string(info[0]);
00220        }
00221      }
00222     else if ( stringp(noanswer) )
00223       answer = noanswer;
00224    }
00225 
00226   silent=info[2];
00227 
00228   // Replacements gehen auch in der Antwort des NPC. Das gibt den Antworten 
00229   // eine persoenliche Note, und so teuer is das auch nicht :)
00230   answer = infoDefaultReplace(answer, this_player());
00231   
00232   if( indent=info[1] )
00233     if (stringp(silent) || (intp(silent) && silent > 0) )
00234      {  // Persoenliche Antwort mit indent
00235        tell_object(this_player(),
00236                    break_string( answer,78,capitalize(name(WER,2))+" "+indent,1) );
00237        if (stringp(silent))
00238         {
00239           silent=infoDefaultReplace(silent, this_player());
00240           say( capitalize(name(WER,2))+" "+silent, ({ this_player() }) );
00241         }
00242      }
00243     else // "normale Antwort" mit Indent
00244       say( break_string( answer,78,
00245              capitalize(name(WER,2))+" "+indent,1) );
00246   else
00247     if (stringp(silent) || (intp(silent) && silent > 0) )
00248      {  // Persoenliche Antwort ohne indent
00249        tell_object(this_player(),capitalize(name(WER,2))+" "+answer );
00250        if (stringp(silent))
00251         {
00252           silent=infoDefaultReplace(silent, this_player());
00253           say( capitalize(name(WER,2))+" "+silent, ({ this_player() }) );
00254         }
00255      }
00256     else // "normale Antwort" ohne Indent
00257       say( capitalize(name(WER,2))+" "+answer );
00258 
00259   return 1;
00260 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

public int frage ( string  str  ) 

Definiert in Zeile 117 der Datei info.c.

Benutzt _notify_fail(), do_frage(), EP_INFO, GiveEP(), name, QueryProp(), text(), WEN und WER.

00117                              {
00118   string myname, text;
00119 
00120   str=(extern_call()?this_player()->_unparsed_args():str);
00121   if( !str || sscanf( str, "%s nach %s", myname, text ) != 2 ) {
00122     _notify_fail( "WEN willst Du nach WAS fragen?\n" );
00123     return 0;
00124   }
00125 
00126   if( !id( lower_case(myname) )
00127     || QueryProp(P_INVIS) ) {
00128     _notify_fail( "So jemanden findest Du hier nicht.\n" );
00129     return 0;
00130   }
00131   say( capitalize(this_player()->name(WER))+" fragt " +
00132     name(WEN,2)+" nach "+capitalize(text)+".\n",
00133       this_player() );
00134 
00135   text = lower_case(text);
00136   GiveEP(EP_INFO, text);
00137 
00138   return do_frage( text );
00139 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

public varargs mixed GetInfo ( string  str  ) 

Definiert in Zeile 307 der Datei info.c.

Benutzt infos.

00308 {
00309   if (!str) return deep_copy(infos);
00310   return infos[str];
00311 }

static mixed* GetInfoArr ( string  str  )  [static]

Definiert in Zeile 170 der Datei info.c.

Benutzt infos.

Wird benutzt von do_frage().

00171 {  
00172    return ({ infos[str, 0], infos[str, 1], infos[str,2], infos[str, 3] });
00173 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static string infoDefaultReplace ( string  pstring,
object  pl 
) [static]

Definiert in Zeile 147 der Datei info.c.

Benutzt WEM, WEN, WER und WESSEN.

Wird benutzt von do_frage().

00148 {
00149   pstring=" "+pstring;
00150   if (strstr(pstring,"@WER",0) >-1 )
00151     pstring= regreplace(pstring,"@WER",pl->name(WER,1),1);
00152   if (strstr(pstring,"@WESSEN",0) >-1 )
00153     pstring= regreplace(pstring,"@WESSEN",pl->name(WESSEN,1),1);
00154   if (strstr(pstring,"@WEM",0) >-1 )
00155     pstring= regreplace(pstring,"@WEM",pl->name(WEM,1),1);
00156   if (strstr(pstring,"@WEN",0) >-1 )
00157     pstring= regreplace(pstring,"@WEN",pl->name(WEN,1),1);
00158   if (strstr(pstring,"@CAP_WER",0) >-1 )
00159     pstring= regreplace(pstring,"@CAP_WER",pl->Name(WER,1),1);
00160   if (strstr(pstring,"@CAP_WESSEN",0) >-1 )
00161     pstring= regreplace(pstring,"@CAP_WESSEN",pl->Name(WESSEN,1),1);
00162   if (strstr(pstring,"@CAP_WEM",0) >-1 )
00163     pstring= regreplace(pstring,"@CAP_WEM",pl->Name(WEM,1),1);
00164   if (strstr(pstring,"@CAP_WEN",0) >-1 )
00165     pstring= regreplace(pstring,"@CAP_WEN",pl->Name(WEN,1),1);
00166 
00167   return pstring[1..];
00168 }

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

void init (  ) 

Definiert in Zeile 85 der Datei info.c.

00085             {
00086   add_action( "frage", "frag", 1 );
00087 }

public void RemoveInfo ( string  key  ) 

Definiert in Zeile 294 der Datei info.c.

Benutzt infos und m_delete().

00295 {
00296   efun::m_delete(infos,key);
00297 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

static void smart_npc_log ( string  str  )  [static]

Definiert in Zeile 90 der Datei info.c.

Benutzt creat(), dtime(), log_file, MASTER, P_LOG_INFO, QueryProp() und ROOTID.

Wird benutzt von do_frage().

00091 {
00092   string creat, creat_det;
00093 
00094   if (!stringp(creat=QueryProp(P_LOG_INFO))) {
00095     creat = MASTER->creator_file(this_object());
00096     if (creat == ROOTID)
00097       creat = "ROOT";
00098     else if( !creat || creat[0]==' ' )
00099       creat="STD";
00100     creat_det="report/"+explode(creat, ".")[<1]+"_INFO.rep";
00101     creat="report/"+explode(creat, ".")[<1]+".rep";
00102   }
00103   log_file(creat,
00104            sprintf("INFO von %s [%s] (%s):\n%s\n",
00105                    getuid(this_interactive()),
00106                    explode(object_name(this_object()),"#")[0],
00107                    dtime(time())[5..<11],
00108                    str));
00109   log_file(creat_det,
00110            sprintf("INFO von %s [%s] (%s):\n%s\n",
00111                    getuid(this_interactive()),
00112                    explode(object_name(this_object()),"#")[0],
00113                    dtime(time())[5..<11],
00114                    str));
00115 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:


Variablen-Dokumentation

nosave mapping infos

Definiert in Zeile 66 der Datei info.c.

Wird benutzt von _query_npc_info(), _set_npc_info(), AddInfo(), create(), GetInfo(), GetInfoArr() und RemoveInfo().

Erzeugt am Thu Jun 3 14:42:42 2010 für MorgenGrauen Mudlib von  doxygen 1.6.3