|
Phazic Novice
Joined: 12 Oct 2000 Posts: 32 Location: USA
|
Posted: Sun Dec 29, 2002 6:51 pm
[1.15] Access violation for non-existent exits |
It seems that exits are unlike rooms in that they have no 'dummy' form to represent no exit and ultimately lead to a access violation if a non-existent exit is referenced.
Example:
Make a new map
#VAR room %map.curroom
#SH @room.linknum(0).id
Result: Access Violation at address 006D6C93 in module 'Zmud.exe' Read of address 00000000.
I'd recommend a way to determine non-existent exits as well, similar to rooms, perhaps a property or a function that returns true/false or having the dummy obj set 'bogus' values, ie id of a nonexistent room could be -1 similarly exit id's could also be -1.
-Phazic
zMapper 1.15/zMUD 6.40 on WinXP |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jan 07, 2003 1:03 am |
No, it's a harder problem than that:
The linknum COM method returns a Room object. When you reference @room.linknum(0), a null object is returned since the link does not exist. Then COM tried to access the ID property of a null object, which gives an error. To prevent this, the linknum method would have to return some kind of "dummy" object to represent a null link. But there is no easy way to do this. You'll find that this same kind of error happens in every other application that uses COM. For example, if talking to Microsoft Outlook and you refer to a non-existent mail message, and then try to access the Subject property of the null mail message, you also get an error. It's just the way COM works (or doesn't).
Anyway, to avoid this you should use the @room.numlinks to determine how many valid links a room has.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|