#include <thing/properties.h>#include <thing.h>#include <inpc.h>#include <moving.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
| #define | ME this_object() |
| #define | ENV environment() |
Funktionen | |
| int | _set_inpc_walk_delay (int del) |
| mixed | _query_inpc_home () |
| int | area_check (string fn) |
| int | may_enter_room (mixed room) |
| int | walk_random () |
| int | walk_route () |
| int | walk_to () |
| int | walk_follow () |
| int | walk_flee () |
| mixed _query_inpc_home | ( | ) |
Definiert in Zeile 29 der Datei walking.c.
Benutzt P_INPC_HOME und Query().
00029 { 00030 mixed res; 00031 00032 res=Query(P_INPC_HOME); 00033 if (!res) return "/room/void"; 00034 return res; 00035 }

| int _set_inpc_walk_delay | ( | int | del | ) |
Definiert in Zeile 24 der Datei walking.c.
Benutzt P_INPC_WALK_DELAYS und Set().

| int area_check | ( | string | fn | ) |
Definiert in Zeile 37 der Datei walking.c.
Benutzt i, old_explode(), P_INPC_WALK_AREA und QueryProp().
Wird benutzt von may_enter_room().
00037 { 00038 mixed area; 00039 string *words; 00040 int i; 00041 00042 if (!(area=QueryProp(P_INPC_WALK_AREA))) 00043 return 1; // Keine Beschraenkung im Gebiet? 00044 if (mappingp(area)) { 00045 if (area[fn]) 00046 return 1; // Explizit erlaubter Raum 00047 words=old_explode(fn,"/"); 00048 for (i=sizeof(words)-2;i>=0;i--) 00049 if (area[implode(words[0..i],"/")]) 00050 return 1; // Erlaubtes Gebiet 00051 return 0; // Nicht erlaubtes Gebiet 00052 } 00053 if (pointerp(area)) { 00054 for (i=sizeof(area)-1;i>=0;i--) 00055 if (fn[0..(strlen(area[i])-1)]==area[i]) 00056 return 1; // Erlaubtes Gebiet 00057 return 0; // Nicht erlaubtes Gebiet 00058 } 00059 return 1; 00060 }


| int may_enter_room | ( | mixed | room | ) |
Definiert in Zeile 62 der Datei walking.c.
Benutzt area_check(), flags, ob(), P_INPC_LAST_ENVIRONMENT, P_INPC_WALK_FLAGS, QueryProp(), WF_MAY_LOAD und WF_MAY_WALK_BACK.
Wird benutzt von move().
00062 { 00063 int flags; 00064 string fn; 00065 object ob; 00066 00067 if (objectp(room)) { 00068 fn=object_name(room); 00069 ob=room; 00070 } else if (stringp(room)) { 00071 fn=room; 00072 ob=find_object(room); 00073 } else 00074 return 1; // Dann sollte move schon nen Fehler machen 00075 if (fn=="/room/void") // Void darf IMMER betreten werden 00076 return 1; 00077 flags=QueryProp(P_INPC_WALK_FLAGS); 00078 if (!(flags & WF_MAY_LOAD) 00079 && !objectp(ob)) 00080 return 0; // Darf nicht in nicht geladene Raeume folgen. 00081 if (!(flags & WF_MAY_WALK_BACK) 00082 && ob==QueryProp(P_INPC_LAST_ENVIRONMENT)) 00083 return 0; // Darf nicht in den vorherigen Raum 00084 return area_check(fn); 00085 }


| int walk_random | ( | ) |
Definiert in Zeile 87 der Datei walking.c.
Benutzt command, ENV, env(), ex, flags, i, M_TPORT, move(), P_CAN_FLAGS, P_EXITS, P_INPC_HOME, P_INPC_LAST_ENVIRONMENT, P_SPECIAL_EXITS, QueryProp(), SetProp(), WF_MAY_USE_SPECIAL und WF_MAY_WALK_BACK.
00087 { 00088 string *ex,*ex2; 00089 object env; 00090 int i,r,flags; 00091 00092 if (!objectp(env=ENV)) 00093 return 0; 00094 ex=m_indices(ENV->QueryProp(P_EXITS)); 00095 flags=QueryProp(P_CAN_FLAGS); 00096 if (flags & WF_MAY_USE_SPECIAL) 00097 ex+=m_indices(ENV->QueryProp(P_SPECIAL_EXITS)); 00098 ex2=ex[0..]; 00099 while (i=sizeof(ex)) { 00100 r=random(i); 00101 command(ex[r]); 00102 if (ENV!=env) 00103 return 1; 00104 ex-=({ex[r]}); 00105 } 00106 if (!(flags & WF_MAY_WALK_BACK)) { 00107 SetProp(P_INPC_LAST_ENVIRONMENT,0);//Dirty Hack, um Sackgassen zu verlassen 00108 ex=ex2; 00109 while (i=sizeof(ex)) { 00110 r=random(i); 00111 command(ex[r]); 00112 if (ENV!=env) 00113 return 1; 00114 ex-=({ex[r]}); 00115 } 00116 } 00117 return move(QueryProp(P_INPC_HOME),M_TPORT); 00118 }

1.6.3