很久以前編寫過一個判斷自己的檔名而創造出口的小code,但是到了sanc卻不能使用
可以請小寶幫我看看問題出在哪裡嗎?
:::::::::::::: /u/d/dolla/area/3_7_1.c ::::::::::::::
#include <path.h>
inherit ROOM;
inherit __DIR__"auto_exits";
void create()
{
::create();
seteuid(getuid());
mapping exit;
exit = ([]);
int *coor;
string *other;
other = ({"",""});//""內分別輸入enter and out的檔案位置,若無,請保持空白
set("light",1);
set("short",WHT+"西大道"+NOR);
//------05--------10--------15--------20--------25----28--30 <--字數量
尺
set("long",@LONG
銀白雪花依然飄落,似乎終年不停。道旁頂了層白的銀杏,隨著
冷冽的風艱難的晃著頭。在南北兩方好似各有著一條青磚小道,因著
兩旁高大的建築顯得相當狹小。
LONG);
//------------------------------------------------------------------------------
coor = getcoordination();
exit = set_exit(coor[0],coor[1],coor[2]other[0],other[1]) + exit;
set("exits",exit["exits"]);
set("coordinate","("+coor[0]+","+coor[1]+","+coor[2]+")");
reset();
}
:::::::::::::: /u/d/dolla/area/auto_exits.c ::::::::::::::
int *getcoordination(){
string name;
int x,y,z;
name = file_name();
sscanf(name,"%d_%d_%d",x,y,z);
return ({x,y,z});
}
string *mean_sit(int x,int y,int z){
string n,s,e,w,u,d;
n = x+"_"+(y+1)+"_"+z;
s = x+"_"+(y-1)+"_"+z;
e = (x+1)+"_"+y+"_"+z;
w = (x-1)+"_"+y+"_"+z;
u = x+"_"+y+"_"+(z+1);
d = x+"_"+y+"_"+(z-1);
return ({n,s,e,w,u,d});
}
mapping set_exit(int x,int y,int x,string enter,string out){
mapping map = ([
"exits":([ ]),
]);
int i;
string *temp;
string *exit = ({"north","south","east","west","up","down"});
temp = mean_sit(x,y,z);
for(i=0;i<6;i++){
if(file_size(__DIR__+("%s",temp[i])+".c") >= 0){
map["exits"] = ([ exit[i] :
__DIR__+("%s",temp[i]), ]) + map["exits"];
}
}
if(enter != "") map["exits"] = (["enter" : ("%s",enter),]) +
map["exits"];
if(out != "") map["exits"] = (["out" : ("%s",out),]) + map["exits"];
return map;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.8.138.169