We've got a small bug^H^H^H old optimization here. It conflicts with OBJECT_MATCHING.
> goto /domains/campus/room/basement
The basement
You are in the basement of the LPC University administrative building. It is very dark here, and rather damp. The fluorescent
lighting seems to be on the verge of total failure, with only one or two flickering on and off enough to see anything. The air
here is damp, thick and musty. There is a small crawlspace you can enter under the stairs here, and the basement continues east
into darkness.
Obvious exits: east, up, enter crawlspace
A rat is standing here.
>
Now, to load the room and allow rat to wander:
> enter crawlspace
/domains/campus/room/crawlspace
A tiny crawlspace
You are in a cramped little space beneath the stairs in the basement. It is dark, tight, and dirty in here.
Obvious exit: out
A small, plastic flashlight and thirty-one dollars are here.
> out
/domains/campus/room/basement
The basement
You are in the basement of the LPC University administrative building. It is very dark here, and rather damp. The fluorescent
lighting seems to be on the verge of total failure, with only one or two flickering on and off enough to see anything. The air
here is damp, thick and musty. There is a small crawlspace you can enter under the stairs here, and the basement continues east
into darkness.
Obvious exits: east, up, enter crawlspace
>
(wait a moment...)
A mangy little rat scurries in.
A mangy little rat enters into the cr.
A mangy little rat scurries in.
A mangy little rat enters into the crawl.
A mangy little rat scurries in.
A mangy little rat enters into the crawlsp.
A mangy little rat scurries in.
A mangy little rat enters into the craw.
A mangy little rat scurries in.
A mangy little rat enters into the crawlspac.
A mangy little rat scurries in.
A mangy little rat enters into the crawlspace.
A mangy little rat scurries in.
A mangy little rat enters into the crawlspa.
A mangy little rat scurries in.
A mangy little rat enters into the crawlspace.
After half a minute (thanks again for findfun command), I've found this:
/lib/sentient.c:
293: foreach(tmp in (string *)environment()->GetEnters()) {
And, of course:
> call here->GetEnters()
OBJ(/domains/campus/room/basement) -> GetEnters() = ({ "crawlspace", "crawlspac", "crawlspa", "crawlsp", "crawls", "crawl",
"craw", "cra", "cr", "/lib/std/dummy#27", "crawlspace", "crawlspace", "crawlspac", "crawlspa", "crawlsp", "crawls", "crawl",
"craw", "cra", "cr" })
>
Why?
/lib/exits.c:
177: varargs string array GetEnters(int i) {
(snip...)
190: foreach(object ob in obs) {
191: if( ob->GetEnter() ) {
192: if(i) ids += ({ ob->GetId()[0] });
193: else ids += ob->GetId();
193: }
195: }
/lib/props/id.c:
57: string array GetId() {
58: string tmp;
59: //if(!inherits(LIB_GERM,this_object())) tmp = GetKeyName();
60: tmp = GetKeyName();
61:
62: if( tmp ) {
63: if(!OBJECT_MATCHING || !Matching) return distinct_array(({ CanonicalId..., tmp }));
64: else return Id + ({ file_name(this_object()) }) + atomize_string(tmp) - ExcludedIds;
65: }
66: else return Id;
67: }
Ok, so if I change line 293 in /lib/sentient.c from GetEnters() to GetEnters(1) wandering monsters will not
use truncated names. (This is good because the wandering code picks an entrance randomly, and now it is
imbalanced - crawlspace with truncations has 20 entries in array, while for example 'hut' will have... er...
(@#%$ duplicates)... 3? 6? Not the same amount, that is. With GetEnters(1) every entrance has one array entry.)
But what if player types 'enter crawlsp' instead of 'enter crawlspace'?
Raudhrskal enters into the crawlsp.
Oops.
Let's see... verb just call eventEnter...
/lib/enter.c:
95: varargs mixed eventEnter(object who, string what, string verb) {
(snip)//string what is the word as typed by player^^^ - it worked in the old days where the full name was required
114: if(verb == "crawl") who->eventMoveLiving(Enter["room"],"into the " + what );
115: else who->eventMoveLiving(Enter["room"], "$N enters into the " + what + ".");
Aha!
My current fix (in addition to the sentient.c:293) is:
--- lib/enter.c~ 2007-10-27 21:45:03.000000000 +0200
+++ lib/enter.c 2007-11-11 18:42:51.769447000 +0100
@@ -111,8 +111,8 @@
if( Enter["pre"] && !evaluate(Enter["pre"], what) ) {
return 1;
}
- if(verb == "crawl") who->eventMoveLiving(Enter["room"],"into the " + what );
- else who->eventMoveLiving(Enter["room"], "$N enters into the " + what + ".");
+ if(verb == "crawl") who->eventMoveLiving(Enter["room"],"into the " + this_object()->GetKeyName() );
+ else who->eventMoveLiving(Enter["room"], "$N enters into the " + this_object()->GetKeyName() + ".");
+ //this_object() refers to the dummy entrance item ^^^
if( Enter["post"] ) {
evaluate(Enter["post"], what);
}
This is a Kludge(tm). /lib/enter is inherited by the dummy entrance, but it may be inherited by somthing else.
'grep -R LIB_ENTER /*' reveals /lib/vehicle.c - this is OK, it has GetKeyName(). But there must be a better way to fix this.
Any ideas?
'Skal
PS. Exits are unaffected by the matching system - they are not dummy objects.
OBJ(/domains/campus/room/basement) -> GetExits() = ({ "east", "up" })
PPS. I use the basement as an example - tested also with the dry well.
PPPS. This is DS 2.5a21 - if it has been fixed last week, sorry.