roh/conf/area/
roh/game/talk/
roh/help/
roh/monsters/ocean/
roh/objects/ocean/
roh/player/
roh/rooms/area/1/
roh/rooms/misc/
roh/rooms/ocean/
roh/src-2.44b/
/*
 * mudobject.h
 *   The parent MudObject class
 *   ____            _
 *  |  _ \ ___  __ _| |_ __ ___  ___
 *  | |_) / _ \/ _` | | '_ ` _ \/ __|
 *  |  _ <  __/ (_| | | | | | | \__ \
 *  |_| \_\___|\__,_|_|_| |_| |_|___/
 *
 * Permission to use, modify and distribute is granted via the
 *  Creative Commons - Attribution - Non Commercial - Share Alike 3.0 License
 *    http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * 	Copyright (C) 2007-2009 Jason Mitchell, Randi Mitchell
 * 	   Contributions by Tim Callahan, Jonathan Hseu
 *  Based on Mordor (C) Brooke Paul, Brett J. Vickers, John P. Freeman
 *
 */

#ifndef MUDOBJECTS_H
#define MUDOBJECTS_H

#include <ext/hash_map> // Gnu gcc specific, switch to <map>

// allow the gnu hash_map to work on std::string
namespace __gnu_cxx {
   template<> struct hash< bstring > {
      size_t operator()(const bstring& s) const {
         return hash< const char* >()( s.c_str() );
      }
   }; // gcc.gnu.org/ml/libstdc++/2002-04/msg00107.html
}

//// this is what we would love:
typedef __gnu_cxx::hash_multimap<bstring, bstring> MultiMap;  // change to std::map
class MudObject;
class Player;
class Monster;
class Room;
class Object;

class Hooks {
public:
    Hooks();
    void save(xmlNodePtr curNode, const char* name) const;
    void load(xmlNodePtr curNode);
    void addHook(const bstring& event, const bstring& code);
    bool execute(const bstring& event, MudObject* target=0) const;
    void setParent(MudObject* target);
private:
    MultiMap hooks;
    MudObject* parent;
};


class MudObject {
public:
	char name[80];
	Hooks hooks;
	void moCopy(const MudObject& mo);

public:
    virtual ~MudObject() {};
    void moReset();
    void moDestroy();


    Monster* getMonster();
    Player* getPlayer();
    Object* getObject();
    Room* getRoom();

    const Monster* getConstMonster() const;
    const Player* getConstPlayer() const;
    const Object* getObject() const;
    const Room* getRoom() const;

    const char* getName();



};


#endif