#include <thing/properties.h>#include <config.h>#include <rooms.h>#include <language.h>#include <wizlevels.h>#include <moving.h>#include <defines.h>#include <doorroom.h>#include <functionlist.h>
gehe zum Quellcode dieser Datei
Funktionen | |
| void | reset () |
| static int | _query_noget () |
| void | maybe_replace_program () |
| protected void | create () |
| protected void | create_super () |
| static private int | check_clean_count () |
| int | clean_up (int arg) |
| int | show_exits () |
| int | toggle_exits (string str) |
| void | init () |
| int | _query_para () |
| status | IsRoom () |
Variablen | |
| inherit std thing | properties |
| inherit std thing | language |
| inherit std room | moving |
| inherit std room | restrictions |
| inherit std room | description |
| inherit std room | exits |
| inherit std room | commands |
| inherit std room | items |
| inherit std room | doors |
| inherit std container | inventory |
| static int _query_noget | ( | ) | [static] |
| int _query_para | ( | ) |
Definiert in Zeile 223 der Datei room.c.
00223 { 00224 int re; 00225 if(re=Query(P_PARA))return re; 00226 if(sizeof(regexp(({object_name(this_object())}),".*\\^0$"))) 00227 return -1; 00228 return to_int( 00229 regreplace(object_name(this_object()),".*\\^\([1-9][0-9]*\)$","\\1",1)); 00230 }

| static private int check_clean_count | ( | ) | [static] |
Definiert in Zeile 107 der Datei room.c.
Wird benutzt von clean_up().
00108 { 00109 int cc; 00110 00111 cc=Query(" clean counter "); 00112 if (--cc<=0) 00113 return 1; 00114 Set(" clean counter ",cc); 00115 return 0; 00116 }


| int clean_up | ( | int | arg | ) |
Definiert in Zeile 119 der Datei room.c.
Benutzt check_clean_count(), i, P_ITEMS, Query(), QueryProp(), REFRESH_DESTRUCT, REFRESH_NONE, RITEM_FILE, RITEM_OBJECT, RITEM_REFRESH und Set().
00120 { 00121 mixed itema; 00122 00123 if(arg>1) return 1; // better not ;) 00124 00125 if (Query(" never clean ")) return 0; 00126 00127 // if there are any item we have produced ourselfes check them 00128 if(pointerp(itema = QueryProp(P_ITEMS))) 00129 { 00130 mixed names; 00131 int i; 00132 i = sizeof(names = all_inventory(this_object())); 00133 while(i--) 00134 { 00135 if (query_once_interactive(names[i])) 00136 { 00137 Set(" clean counter ",2); 00138 return 1; 00139 } 00140 if(objectp(names[i])) names[i] = explode(object_name(names[i]),"#")[0]; 00141 } 00142 00143 for(i = sizeof(itema)-1; i >= 0; i--) 00144 { 00145 // Semantik: 00146 // 1. Wenn RITEM_OBJECT ein array ist, kann evtl ge'clean'ed werden. 00147 // 2. Wenn es ein REFRESH_NONE Item ist und es entweder nicht mehr 00148 // existiert oder nicht in diesem Raum ist, kein clean_up (es wuerde 00149 // beim neuladen des Raumes ja wieder erzeugt; 00150 // falls es aber hier ist, wird es mitvernichtet, dann ists ok) 00151 // 3. Wenn es ein REFRESH_DESTRUCT ist und noch existiert, aber nicht 00152 // hier ist, KEIN clean_up. 00153 if (!pointerp(itema[i][RITEM_OBJECT]) 00154 && ((itema[i][RITEM_REFRESH] == REFRESH_NONE 00155 && (!itema[i][RITEM_OBJECT] 00156 || environment(itema[i][RITEM_OBJECT])!=this_object())) 00157 || (itema[i][RITEM_REFRESH] == REFRESH_DESTRUCT 00158 && itema[i][RITEM_OBJECT] 00159 && environment(itema[i][RITEM_OBJECT]) != this_object()))) 00160 return 1; 00161 names -= (pointerp(itema[i][RITEM_FILE]) ? 00162 itema[i][RITEM_FILE] : ({ itema[i][RITEM_FILE] })); 00163 } 00164 // if there are objects left in the room do not clean up but try again later 00165 if(sizeof(names) && !check_clean_count()) return 1; 00166 } 00167 else 00168 // is there any object lying around? 00169 if(first_inventory(this_object()) && !check_clean_count()) return 2; 00170 00171 // do clean_up 00172 //log_file("clean_up_log",sprintf( 00173 // "%s:%s: %O\n",ctime(time())[11..18],__HOST_NAME__,this_object())); 00174 00175 remove(); 00176 // wenn der Raum sich im remove() nicht zerstoert, hat er dafuer vermutlich 00177 // nen Grund. Evtl. klappts ja naechstes Mal. 00178 00179 return(1); 00180 }

| protected void create | ( | ) |
Definiert in Zeile 76 der Datei room.c.
Benutzt create(), F_MODE, maybe_replace_program(), P_ADJECTIVES, P_IDS, P_LONG, P_NAME, P_NAME_ADJ, P_SHORT, P_TOTAL_WEIGHT, P_TRANSPARENT, P_WEIGHT, PROTECTED, Set() und SetProp().
00077 { 00078 maybe_replace_program(); 00079 /* Set effective userid to userid */ 00080 /* so that we may clone other things */ 00081 seteuid(getuid(this_object())); 00082 properties::create(); 00083 restrictions::create(); 00084 commands::create(); 00085 description::create(); 00086 exits::create(); 00087 items::create(); 00088 doors::create(); 00089 00090 SetProp(P_NAME,0); 00091 SetProp(P_NAME_ADJ,({})); 00092 Set(P_SHORT,0); 00093 Set(P_LONG,0); 00094 Set(P_TRANSPARENT,0); 00095 Set(P_ADJECTIVES,({})); 00096 Set(P_IDS,({})); 00097 Set(P_WEIGHT,PROTECTED,F_MODE); 00098 Set(P_TOTAL_WEIGHT,PROTECTED,F_MODE); 00099 Set(" clean counter ",2); 00100 }

| protected void create_super | ( | ) |
Definiert in Zeile 102 der Datei room.c.
Benutzt set_next_reset().
00102 { 00103 set_next_reset(-1); 00104 }

| void init | ( | ) |
Definiert in Zeile 208 der Datei room.c.
00209 { 00210 Set(" clean counter ",2); 00211 00212 exits::init(); 00213 commands::init(); 00214 description::init(); 00215 doors::init(); 00216 00217 add_action("toggle_exits", "exits"); 00218 add_action("toggle_exits", "ausgang"); 00219 add_action("toggle_exits", "ausgaenge"); 00220 add_action("toggle_exits", "aus"); 00221 }

| void maybe_replace_program | ( | ) |
Definiert in Zeile 53 der Datei room.c.
Benutzt list, NAME_INHERITED und RETURN_FUNCTION_NAME.
Wird benutzt von create().
00054 { 00055 string *list, first; 00056 object first_ob; 00057 00058 // Debugkram auskommentiert, Zesstra, 04.11.06 00059 // DB("MAYBE_REPLACE_PROGRAM\n"); 00060 // DB(sprintf("FILENAME: %O\n",object_name(this_object()))); 00061 // DB(sprintf("FIRST_OB: %O\n",inherit_list(this_object()))); 00062 // first_ob=find_object(first=(list=inherit_list(this_object()))[1]); 00063 // DB(sprintf("%O ?= %O\n",sizeof(list),1+sizeof(inherit_list(first_ob)))); 00064 // DB(sprintf("%O ?= sizeof(%O)\n",1,list=functionlist(this_object(),RETURN_FUNCTION_NAME|NAME_INHERITED))); 00065 if (object_name(this_object())=="/std/room" || 00066 !(first_ob=find_object(first=(list=inherit_list(this_object()))[1])) || 00067 (sizeof(list)!=1+sizeof(inherit_list(first_ob))) || 00068 (1!=sizeof(list=functionlist(this_object(), 00069 RETURN_FUNCTION_NAME|NAME_INHERITED))) || 00070 list[0]!="create") 00071 return; 00072 // DB("REPLACING\n"); 00073 replace_program(first); 00074 }

| void reset | ( | void | ) |
Definiert in Zeile 37 der Datei room.c.
Benutzt reset().
00038 { 00039 items::reset(); 00040 exits::reset(); 00041 doors::reset(); 00042 }

| int show_exits | ( | ) |
Definiert in Zeile 185 der Datei room.c.
Benutzt CannotSee(), ex, GetExits(), P_HIDE_EXITS und QueryProp().
00185 { 00186 mixed ex; 00187 if( this_player()->CannotSee() ) return 1; 00188 if ((ex=QueryProp(P_HIDE_EXITS)) && intp(ex)) return 1; 00189 if (ex = GetExits(this_player())) write(ex); 00190 return 1; 00191 }

| int toggle_exits | ( | string | str | ) |
Definiert in Zeile 194 der Datei room.c.
Benutzt ex, P_SHOW_EXITS und show_exits().
00195 { 00196 int ex; 00197 00198 if (!str) return show_exits(); 00199 if (str!="auto") return 0; 00200 ex = this_player()->QueryProp(P_SHOW_EXITS); 00201 this_player()->SetProp(P_SHOW_EXITS, !ex); 00202 if (ex) write("Ausgaenge werden nicht mehr automatisch angezeigt.\n"); 00203 else write("Ausgaenge werden automatisch angezeigt.\n"); 00204 return 1; 00205 }

| inherit std room description |
| inherit std thing properties |
| inherit std room restrictions |
1.6.3