作者amosdeus (幽素)
看板mud_sanc
標題□ [wizs]問題請教(十六)
時間Mon Jul 30 22:56:25 2007
請問以下程式有節省記憶體或是好一點的寫法嗎?
檔案位置:/u/p/plain/wide/virtue/room2/test.c
void init()
{
int r;
r=random(2);
switch(r)
{
case 1:
set("long",@PLAIN
...
PLAIN
);
set("exits",([
...
...
]));
set("pre_exit_func",(["....":"hi"]));
break;
default:
set("long",@PLAIN
...
PLAIN
);
set("exits",([
...
...
]));
set("pre_exit_func",(["....":"hi"]));
break;
}
}
int hi()
{
object ppl = this_player();
if(ppl->query_temp("xxxx"))
{
ppl->delete_temp("xxxxx");
ppl->set_temp("yyyy",1);
return 0;
}
if(ppl->query_temp("yyyy"))
{
ppl->delete_temp("yyyyy");
ppl->set_temp("zzzz",1);
return 0;
}
if(ppl->query_temp("zzzz"))
{
ppl->delete_temp("zzzz");
ppl->move_player(VR2"ccc","SNEAK");
return 0;
}
return 1;
}
以上
謝謝
Plain@Sanc
--
咽咽學楚吟 病骨傷幽素 秋姿白髮生 木葉啼風雨
燈青蘭膏歇 落照飛蛾舞 古壁生凝塵 羇魂夢中語
【 傷心行 李賀 】
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.127.97.187