musicmud-2.1.6/data/
musicmud-2.1.6/data/help/
musicmud-2.1.6/data/policy/
musicmud-2.1.6/data/wild/
musicmud-2.1.6/data/world/
musicmud-2.1.6/doc/
musicmud-2.1.6/src/ident/
musicmud-2.1.6/src/lua/
musicmud-2.1.6/src/lua/include/
musicmud-2.1.6/src/lua/src/lib/
musicmud-2.1.6/src/lua/src/lua/
musicmud-2.1.6/src/lua/src/luac/
#ifndef STATE_H
#define STATE_H

#include "Player.h"

typedef void (*state_t)(Player *, const char *);

extern MudObject *qui;

//! A state that a player can be in
class State : public Object {
  const char *prompt;
  state_t fn;
  bool need_lf;
 public:
  State(const char *id, const char *prompt, state_t fn, bool needcr=false) 
    : Object(id), prompt(prompt), fn(fn), need_lf(needcr) {
  }
  void invoke(Player *who, const char *what) const {
    MudObject *wh = qui;
    qui = who;
    if (need_lf) 
      who->printf("\n");
    fn(who, what);
    qui = wh;
  }
  const char *get_prompt() const {
    return prompt;
  }
  bool needs_noecho() const {
    return need_lf;
  }
};

// #define ADD_STATE(a, b, c) states->add(*(new State(a, b, c)))

extern World<State> *states;

//! an item on the stack of states for each player
class PersonState : public base {
 public:
	PersonState *previous;
	PersonState(const char *state) {
		previous = 0;
		set("state", state);
	}
};

#endif