Support fuer Pfad-Platzhalter
Expansion von Platzhaltern in Pfaden mit
normalize_path().
Change-Id: I5574946a9bae130b07fe35f74b5cf275c311682d
diff --git a/obj/tools/explorer.c b/obj/tools/explorer.c
index 72da8ac..44aec2b 100644
--- a/obj/tools/explorer.c
+++ b/obj/tools/explorer.c
@@ -5,14 +5,18 @@
// $Id: explorer.c 8357 2013-02-09 11:16:14Z Zesstra $
inherit "/std/secure_thing";
+protected functions virtual inherit "/std/util/path";
#include <properties.h>
#include <exploration.h>
#include <wizlevels.h>
-create()
+protected void create()
{
- if (!clonep(this_object())) return;
+ if (!clonep(this_object())) {
+ set_next_reset(-1);
+ return;
+ }
::create();
SetProp(P_SHORT, "Der Erforscher");
SetProp(P_NAME, "Erforscher");
@@ -114,8 +118,9 @@
ob = present(str, this_player());
if (!ob) {
- str = "/secure/master"->_get_path(str, getuid(this_player()));
- catch(call_other(str, "???"));
+ // Pfadexpansion fuer die UID vom aktuellen Benutzer.
+ str = normalize_path(str, getuid(this_interactive()||this_player()), 1);
+ catch(load_object(str));
ob = find_object(str);
}
return ob;
diff --git a/obj/tools/lupe.c b/obj/tools/lupe.c
index b3734fb..94d539e 100644
--- a/obj/tools/lupe.c
+++ b/obj/tools/lupe.c
@@ -3,6 +3,7 @@
// Some changes/extensions by Jof@MorgenGrauen
inherit "/std/thing";
+protected functions virtual inherit "/std/util/path";
#include <language.h>
#include <properties.h>
@@ -11,6 +12,7 @@
#include <defines.h>
#include <questmaster.h>
#include <userinfo.h>
+#include <strings.h>
#define add(s) commands+=({s});functions+=({s});ncmds++
#define add2(s,f) commands+=({s});functions+=({f});ncmds++
@@ -33,12 +35,15 @@
void cleanof(string str,object ob);
-void create()
+protected void create()
{
object owner;
string str;
-
- if (!clonep(ME)) return;
+
+ if (!clonep(ME)) {
+ set_next_reset(-1);
+ return;
+ }
::create();
owner=environment()||this_player();
if (owner)
@@ -182,7 +187,8 @@
for (i=0;i<maxverb;i++)
if (commands[i]==verb[0..sizeof(commands[i])-1])
if (ret=evalcmd(str))
- return ret;
+ return ret;
+
return(0); // non-void function, Zesstra
}
@@ -236,10 +242,7 @@
string strip(string str)
{
- string temp;
- if(!str) return "";
- while (sscanf(str," %s",temp)==1) str=temp;
- return str;
+ return trim(str,TRIM_BOTH);
}
int arglen;
@@ -470,7 +473,8 @@
string make_path(string path)
{
- return "secure/master"->_get_path( path, geteuid( this_player() ) );
+ // Pfadexpansion fuer Nutzer des Tools
+ return normalize_path(path, getuid( RPL || PL ), 1);
}
string new(string arg)
diff --git a/obj/tools/teller/teller.c b/obj/tools/teller/teller.c
index 5f34f06..b51eafa 100644
--- a/obj/tools/teller/teller.c
+++ b/obj/tools/teller/teller.c
@@ -2,11 +2,15 @@
// Tellerstapel, ein Stackorientiertes magiertool.
// Rumata 15.09.93
// ----------------------------------------------------------------------
+
#include "teller.h"
-inherit "std/secure_thing";
+
+inherit "/std/secure_thing";
+protected functions virtual inherit "/std/util/path";
+
inherit T_CMDS;
inherit T_EFUN;
-inherit "std/more";
+inherit "/std/more";
#include "/secure/wizlevels.h"
@@ -515,7 +519,7 @@
push( i );
else
{
- filename = MASTER->_get_path(str,getuid());
+ filename = normalize_path(str, getuid(), 1);
if( filename[<1] == '.' )
filename = filename[0..<2];
if( file_size( filename+".c" ) != -1 )