This places name sanity checking closer to the point of object creation, so it can be used in all caller contexts. Player passwords are also checked in this way.
Commands affected are @action, @clone, @create, @dig, @mcpprogram, @open, @pcreate, @program, and create on the login screen.
Primitives affected are COPYOBJ, COPYPLAYER, NEWEXIT, NEWOBJECT, NEWPLAYER, NEWPROGRAM, and NEWROOM.
Techniques
Passing error messages with a string pointer. Seems like an old-style idea, so let me know if there's a more preferred way. It could eventually be an error struct...
SMALL_BUFFER_LEN = ~100~ 128. I didn't want to use another huge chunk of space for this. ~100~ 128 may be flexible enough for now - I was able to use it in several other places where buffers are also used.
Consequences
create on the login screen can now be more detailed if the creation fails, and tp_create_fail has been removed.
Some error messages needed to be combined. do_action and do_open refer to "an exit or action", and do_clone (as it uses create_object) refers to "create" not "clone".
Bonuses
This corrects the arrow anti-pattern or minor pyramid of doom in do_open. This is far from the only place this correction can be made.
prim_newroom now uses the nearest ABODE room as a parent (or default), like do_dig does - if the parent argument is NOTHING.
Future Work/Discussion
Charging a number of pennies to create certain objects has historically been a command-only transaction, and it might make sense to keep it this way?
It's certainly possible to check types (can only parent a room to a room, can only clone things) in this manner, though a theoretical MUF preprocessor could also check types of all primitive arguments. I guess it wouldn't hurt to do both?
This places name sanity checking closer to the point of object creation, so it can be used in all caller contexts. Player passwords are also checked in this way.
Commands affected are
@action
,@clone
,@create
,@dig
,@mcpprogram
,@open
,@pcreate
,@program
, andcreate
on the login screen. Primitives affected areCOPYOBJ
,COPYPLAYER
,NEWEXIT
,NEWOBJECT
,NEWPLAYER
,NEWPROGRAM
, andNEWROOM
.Techniques
Consequences
create
on the login screen can now be more detailed if the creation fails, and tp_create_fail has been removed.Bonuses
Future Work/Discussion