// Petrarch // Merentha Lib 1.0 // <update> #include <rooms.h> varargs int command(string file) { object ob, *inv; string err; int i; if(!file || file=="here") { if(!environment(this_player())) return notify_fail("No environment.\n"); else file=file_name(environment(this_player())); } if(file[0..0]!="/") file=this_player()->query_cwd()+file; if(file_size(file)<0 && file_size(file+".c")<0) return notify_fail("File does not exist or is a directory.\n"); if(ob=find_object(file)) { if(ob->is_room()) { i=sizeof(inv=all_inventory(ob)); while(i--) if(userp(inv[i])) inv[i]->move(VOID_ROOM); ob->remove(); if(ob) destruct(ob); if(err=catch(call_other(file, "???"))) { message("command", "Error in update:\n"+err, this_player()); return 1; } i=sizeof(inv); while(i--) if(inv[i]) inv[i]->move(file); } else { ob->remove(); if(ob) destruct(ob); if(err=catch(call_other(file, "???"))) { message("command", "Error in update:\n"+err, this_player()); return 1; } } } else { if(err=catch(call_other(file, "???"))) { message("command", "Error in update:\n"+err, this_player()); return 1; } } message("command", "Update Successful.", this_player()); return 1; } string help() { return "Syntax: update <file>\n\nUpdates a file by destroying it and reloading it."; }