MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

[SERVER] rfc: huh handling



Richard Godard and I were at it again, here's the fruits of our labor.
Please post your comments on this, let us know what you think.

This moves huh handling into the database.  This fixes problems with feature
objects not working when objects are in $nothing, and the value of the
'verb' variable will be consistant (removing this dubious 'feature' and all
the confusion that comes along with it).

I've tested this patch on 1.8.0p2, under a semi-clean lambdacore.  No ill
effects as far as I can tell.

---- START OF PATCH
*** tasks.c.original.aab        Sun Mar 24 13:26:40 1996
--- tasks.c     Sun Mar 24 21:24:26 1996
***************
*** 499,505 ****
            
            args = parse_into_wordlist(command);
            if (run_server_task_setting_id(tq->player, tq->handler,
!                                          "do_command", args, command,
                                           &result, &(tq->last_input_task_id))
                != OUTCOME_DONE
                || is_true(result)) {
--- 499,505 ----
            
            args = parse_into_wordlist(command);
            if (run_server_task_setting_id(tq->player, tq->handler,
!                                          "do_command", var_dup(args), command,
                                           &result, &(tq->last_input_task_id))
                != OUTCOME_DONE
                || is_true(result)) {
***************
*** 507,517 ****
            } else if (find_verb_on(this = tq->player, pc, &vh)
                       || find_verb_on(this = location, pc, &vh)
                       || find_verb_on(this = pc->dobj, pc, &vh)
!                      || find_verb_on(this = pc->iobj, pc, &vh)
!                      || (valid(this = location)
!                          && (vh = db_find_callable_verb(location, "huh"),
!                              vh.ptr))) {
                do_input_task(tq->player, pc, this, vh);
            } else {
                notify(tq->player, "I couldn't understand that.");
                tq->last_input_task_id = 0;
--- 507,520 ----
            } else if (find_verb_on(this = tq->player, pc, &vh)
                       || find_verb_on(this = location, pc, &vh)
                       || find_verb_on(this = pc->dobj, pc, &vh)
!                      || find_verb_on(this = pc->iobj, pc, &vh)) {
                do_input_task(tq->player, pc, this, vh);
+             } else if (run_server_task_setting_id(tq->player, tq->handler,
+                                           "do_command_failed", args, command,
+                                           &result, &(tq->last_input_task_id))
+                        != OUTCOME_DONE
+                        || is_true(result)) {
+             /* do nothing more; we assume :do_command_failed handled it. */
            } else {
                notify(tq->player, "I couldn't understand that.");
                tq->last_input_task_id = 0;
---- END OF PATCH

In order to emulate the current workings of the server and the huh stack,
these changes will need to made to the database.

@verb $sys:do_command_failed this none this rxd
@program $sys:do_command_failed
set_task_perms(player);
if (valid(loc = player.location))
  loc:huh(@args);
  return 1;
else
  return 0;
endif
 .

@program $root_class:huh
valid(caller_perms()) ? set_task_perms(caller_perms()) | raise(E_PERM);
$command_utils:do_huh(args[1], listdelete(args, 1));
 .

Notes:
1) The server doesn't call any huh related verbs at all after this.  If
:do_command_failed isn't defined, nothing happens short of parsing the command. 

2) If 0 is returned from :do_command_failed, the server will print a "I
couldn't understand that" message.

3) :do_command_failed will only be called if a verb wasn't found anywhere
else via :do_command or server parsing.

4) The server will call :do_command_failed on the object which handled the
connection.  Example, listen($newsys, xxxx); and I connected on port xxxx,
then $newsys will have it's :do_command_failed called on it.

Andy.




Home | Subject Index | Thread Index