/* * This will enable an object to use commands normally only * accessible by interactive users. * Also check if the user is a wizard. Wizards must not affect the * value of the wizlist ranking. */ static void enable_commands (int num) { #ifndef NO_ENVIRONMENT object_t *pp; #endif if (current_object->flags & O_DESTRUCTED) return; debug(d_flag, ("Enable commands /%s (ref %d)", current_object->obname, current_object->ref)); if (num) { current_object->flags |= O_ENABLE_COMMANDS; set_command_giver(current_object); } else { #ifndef NO_ENVIRONMENT /* Remove all sentences defined for the object */ if (current_object->flags & O_ENABLE_COMMANDS) { if (current_object->super) { remove_sent(current_object->super, current_object); for (pp = current_object->super->contains; pp; pp = pp->next_inv) remove_sent(pp, current_object); } for (pp = current_object->contains; pp; pp = pp->next_inv) remove_sent(pp, current_object); } #endif current_object->flags &= ~O_ENABLE_COMMANDS; if (current_object == command_giver) set_command_giver(0); } }
/* * There are global variables that must be zeroed before any execution. * In case of errors, there will be a LONGJMP(), and the variables will * have to be cleared explicitely. They are normally maintained by the * code that use them. * * This routine must only be called from top level, not from inside * stack machine execution (as stack will be cleared). */ void clear_state() { current_object = 0; set_command_giver(0); current_interactive = 0; previous_ob = 0; current_prog = 0; caller_type = 0; reset_machine(0); /* Pop down the stack. */ } /* clear_state() */