#include "/sys/player/filesys.h"#include <config.h>#include <player.h>#include <properties.h>#include <language.h>#include <moving.h>#include <wizlevels.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
Funktionen | |
| static int | update_object (string str) |
| static int | soft_update_object (string str) |
| int | clone (string str) |
| static int | soft_destruct_object (string str) |
| static int | destruct_object (string str) |
| static int | load (string str) |
| static int | exec_playerob (string name) |
| static string * | _query_localcmds () |
| static string* _query_localcmds | ( | ) | [static] |
Definiert in Zeile 232 der Datei objects.c.
Benutzt LEARNER_LVL und WIZARD_LVL.
00233 { 00234 return ({ 00235 ({"clone","clone",0,WIZARD_LVL}), 00236 ({"destruct","soft_destruct_object",0,LEARNER_LVL}), 00237 ({"Destruct","destruct_object",0,LEARNER_LVL}), 00238 ({"load","load",0,WIZARD_LVL}), 00239 ({"update","soft_update_object",0,LEARNER_LVL}), 00240 ({"Update","update_object",0,LEARNER_LVL}), 00241 ({"exec","exec_playerob",0,LEARNER_LVL}) 00242 }); 00243 }
| int clone | ( | string | str | ) |
Definiert in Zeile 72 der Datei objects.c.
Benutzt _unparsed_args(), destruct(), find_file(), M_GET, M_NOCHECK, name, notify_fail(), ob(), P_CLONE_MSG, QueryProp() und WER.
00073 { 00074 object ob; 00075 string clone_file; 00076 00077 if (!(str=_unparsed_args())){ 00078 notify_fail("Usage: clone <object_path>\n"); return 0; 00079 } 00080 clone_file = find_file(str,".c"); 00081 if (!clone_file) clone_file=find_file(str); 00082 if (!clone_file) { 00083 notify_fail(str+": No such file.\n"); return 0; 00084 } 00085 if (!(ob = clone_object(clone_file))) 00086 return notify_fail(str+": Failed to load.\n"), 0; 00087 00088 /* Some objects destruct themselves rather fast */ 00089 if (!objectp(ob)) 00090 return notify_fail(str+": Destructed whilst created.\n"), 0; 00091 00092 /* try to move the object to my environment */ 00093 if ((ob->move(this_object(),M_GET)>0) || 00094 (ob->move(environment(),M_NOCHECK)>0)) 00095 { 00096 if (!objectp(ob)) 00097 return notify_fail(str+": Destructed whilst created.\n"), 0; 00098 write("Cloned "+object_name(ob)+".\n"); 00099 say(this_player()->name(WER,1) + " " 00100 + this_player()->QueryProp(P_CLONE_MSG)+".\n"); 00101 return 1; 00102 } 00103 say(this_player()->name(WER,1)+" malt wilde Zeichen in die Luft und " 00104 +"murmelt vor sich hin, aber nichts passiert...\n"); 00105 destruct(ob); 00106 write(clone_file+": failed to move\n"); 00107 return 1; 00108 }

| static int destruct_object | ( | string | str | ) | [static] |
Definiert in Zeile 150 der Datei objects.c.
Benutzt _unparsed_args(), destruct(), notify_fail(), ob(), obs, P_DESTRUCT_MSG, PUT_GET_NONE, QueryProp(), WEN und WER.
00151 { 00152 object ob; 00153 object *obs; 00154 string strWER,strWEN; 00155 00156 if (!(str=_unparsed_args())) { 00157 notify_fail("Usage: Destruct <objectname>\n"); return 0; 00158 } 00159 strWER = lower_case(str); 00160 obs = this_player()->find_obs(strWER,PUT_GET_NONE); 00161 if (!obs || !sizeof(obs)) { 00162 notify_fail("Kein \"" + str + "\" gefunden.\n"); return 0; 00163 } 00164 ob=obs[0]; 00165 strWER=ob->name(WER); 00166 strWEN=ob->name(WEN); 00167 00168 say(capitalize(strWER)+" "+this_player()->QueryProp(P_DESTRUCT_MSG)+".\n"); 00169 destruct( ob ); 00170 write(capitalize(strWER)+" wird von dir zerstaeubt.\n"); 00171 return 1; 00172 }

| static int exec_playerob | ( | string | name | ) | [static] |
Definiert in Zeile 194 der Datei objects.c.
Benutzt _unparsed_args(), destruct(), dtime(), i, inv(), IS_LORD, log_file und ob().
00195 { 00196 object ob, *inv; 00197 int i; 00198 00199 if (!IS_LORD(this_object())) return 0; 00200 if (this_player() != this_interactive()) return 0; 00201 if (this_player() != this_object()) return 0; 00202 if (!(name=_unparsed_args())) return 0; 00203 name="secure/master"->_get_path(name,getuid(this_object())); 00204 if (catch(load_object(name);publish) ) 00205 { 00206 write("BUG in "+name+"\n"); 00207 return 1; 00208 } 00209 ob=clone_object(name); 00210 if (!ob) return 0; 00211 if (getuid(ob) != getuid(this_object())) 00212 { 00213 write("UID conflict.\n"); 00214 destruct(ob); 00215 return 1; 00216 } 00217 log_file("EXEC", getuid(this_object())+" "+name+" "+dtime(time())); 00218 disable_commands(); 00219 exec(ob,this_object()); 00220 if (interactive(this_object()) || !interactive(ob)) 00221 { 00222 enable_commands(); 00223 write("Fehler in exec\n"); 00224 return 1; 00225 } 00226 inv=all_inventory(this_object()); 00227 ob->start_player(capitalize(getuid(this_object()))); 00228 remove(); 00229 return 1; 00230 }

| static int load | ( | string | str | ) | [static] |
Definiert in Zeile 174 der Datei objects.c.
Benutzt _unparsed_args(), env(), err, file(), find_file() und notify_fail().
00175 { 00176 object env; 00177 string file; 00178 string err; 00179 00180 if (!(str=_unparsed_args())) { 00181 notify_fail("Usage: load <object_path>\n"); return 0; 00182 } 00183 file = find_file(str,".c"); 00184 if (!file) file=find_file(str); 00185 if (!file) { 00186 notify_fail(str+": No such file.\n"); return 0; 00187 } 00188 if ( err = catch(load_object(file);publish) ) 00189 printf("Cannot load %O, err = %O\n",file,err); 00190 else write(file+"\n"); 00191 return 1; 00192 }

| static int soft_destruct_object | ( | string | str | ) | [static] |
Definiert in Zeile 116 der Datei objects.c.
Benutzt _unparsed_args(), name, notify_fail(), ob(), obs, P_DESTRUCT_MSG, PUT_GET_NONE, QueryProp(), WEN und WER.
00117 { 00118 object ob; 00119 object *obs; 00120 string strWER,strWEN; 00121 00122 if (!(str=_unparsed_args())){ 00123 notify_fail("Usage: destruct <objectname>\n"); return 0; 00124 } 00125 strWER = lower_case(str); 00126 obs = this_player()->find_obs(strWER,PUT_GET_NONE); 00127 if (!obs || !sizeof(obs)) { 00128 notify_fail("Kein \"" + str + "\" gefunden.\n"); 00129 return 0; 00130 } 00131 ob=obs[0]; 00132 strWER=ob->name(WER); 00133 strWEN=ob->name(WEN); 00134 if (!strWER) 00135 strWER="jemand"; 00136 if (!strWEN) 00137 strWEN="jemanden"; 00138 00139 if (ob->remove() == 0) { 00140 notify_fail(strWER+" will nicht 'destructed' werden!\n"); 00141 say(this_player()->name(WER,1)+" versucht vergeblich, "+strWEN+ 00142 " zu atomisieren.\n"); 00143 return 0; 00144 } 00145 say(capitalize(strWER)+" "+this_player()->QueryProp(P_DESTRUCT_MSG)+".\n"); 00146 write(capitalize(strWER)+" wird von dir zerstaeubt.\n"); 00147 return 1; 00148 }

| static int soft_update_object | ( | string | str | ) | [static] |
Definiert in Zeile 49 der Datei objects.c.
Benutzt _unparsed_args(), find_file(), notify_fail() und ob().
00050 { 00051 object ob; 00052 string upd_file; 00053 if (!(str=_unparsed_args())) { 00054 notify_fail("Usage: update <object_path>\n"); return 0; 00055 } 00056 upd_file = find_file(str,".c"); 00057 if (!upd_file) upd_file=find_file(str); 00058 if (!upd_file) { 00059 notify_fail(str+": No such file.\n"); return 0; 00060 } 00061 ob = find_object(upd_file); 00062 if (!ob) { 00063 notify_fail(upd_file+": No such object.\n"); return 0; 00064 } 00065 if (ob->remove() == 0) { 00066 notify_fail(upd_file+": doesn't want to be destructed!\n"); return 0; 00067 } 00068 write(upd_file + ": will be reloaded at next reference.\n"); 00069 return 1; 00070 }

| static int update_object | ( | string | str | ) | [static] |
Definiert in Zeile 23 der Datei objects.c.
Benutzt _unparsed_args(), destruct(), find_file(), notify_fail() und ob().
00023 { 00024 object ob; 00025 string upd_file; 00026 if (!(str=_unparsed_args())) { 00027 notify_fail("Usage: Update <object_path>\n"); return 0; 00028 } 00029 upd_file = find_file(str,".c"); 00030 if (!upd_file) upd_file=find_file(str); 00031 if (!upd_file) { 00032 notify_fail(str+": No such file.\n"); return 0; 00033 } 00034 ob = find_object(upd_file); 00035 if (!ob) { 00036 notify_fail(upd_file+": No such object.\n"); return 0; 00037 } 00038 destruct(ob); 00039 write(upd_file + ": will be reloaded at next reference.\n"); 00040 return 1; 00041 }

1.6.3