From aa5413bd42d77db001c4ab42657f72016af23fa7 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sat, 12 Apr 2008 21:53:37 +0200 Subject: [PATCH] Updated the Editors to match the new behavior. --- src/Core/Editors/EditorNewCharacter.cpp | 2 +- src/Core/Editors/EditorPlaying.cpp | 55 +++++++++------------------------ src/Core/Editors/EditorPlaying.h | 6 +--- 3 files changed, 17 insertions(+), 46 deletions(-) diff --git a/src/Core/Editors/EditorNewCharacter.cpp b/src/Core/Editors/EditorNewCharacter.cpp index 0c8456c..2c366af 100644 --- a/src/Core/Editors/EditorNewCharacter.cpp +++ b/src/Core/Editors/EditorNewCharacter.cpp @@ -184,7 +184,7 @@ void EditorNewCharacter::OnLine(const std::string &line) character->setName(m_name); character->setRace(m_raceid); - character->setRoom(1); + character->setChunk(1); character->Save(); character.reset(); diff --git a/src/Core/Editors/EditorPlaying.cpp b/src/Core/Editors/EditorPlaying.cpp index a7315c8..7617b90 100644 --- a/src/Core/Editors/EditorPlaying.cpp +++ b/src/Core/Editors/EditorPlaying.cpp @@ -28,8 +28,8 @@ #include "Character.h" #include "PCharacter.h" #include "PCharacterManager.h" -#include "Room.h" -#include "RoomManager.h" +#include "Chunk.h" +#include "ChunkManager.h" #include "Managers.h" using mud::PCharacter; @@ -38,11 +38,7 @@ typedef EditorPlaying E; typedef CommandObject O; typedef CommandBinding B; -static O listAreas( "Areas", &E::listAreas); -static O listColours("Colours", &E::listColours); static O listCommands("Commands",&E::listCommands); -static O listRaces( "Races", &E::listRaces); -static O listRooms( "Rooms", &E::listRooms); static O showScore( "Score", &E::showScore); static O look( "Look", &E::look); static O say( "Say", &E::say); @@ -51,13 +47,9 @@ static O quitEditor("Quit", &E::quitEditor); static const B commands[] = { B("?", listCommands), - B("areas", listAreas), - B("colours", listColours), B("delete", deleteCharacter), B("look", look), B("quit", quitEditor), - B("races", listRaces), - B("rooms", listRooms), B("say", say), B("score", showScore), }; @@ -69,11 +61,14 @@ m_char(character) { try { - long id = m_char->getRoom(); - mud::RoomPtr inroom = mud::Managers::Get()->Room->GetByKey(id); - inroom->addCharacter(m_char->getID()); + long chunkid = m_char->getChunk(); + mud::ChunkPtr inchunk = mud::Managers::Get()->Chunk->GetByKey(chunkid); + inchunk->addCharacter(m_char->getID()); + + std::string msg = m_char->getName(); + msg.append(" enters the realm.\n"); - inroom->Sendf("%s enters the realm.\n", m_char->getName().c_str()); + inchunk->Send(msg); } catch(RowNotFoundException& e) { @@ -106,17 +101,6 @@ void EditorPlaying::dispatch(const std::string& action, const std::string& argum act->Run(this, argument); } -void EditorPlaying::listAreas(const std::string& argument) -{ - m_char->OnAreaList(argument); - return; -} - -void EditorPlaying::listColours(const std::string& argument) -{ - m_char->OnColourList(argument); -} - void EditorPlaying::listCommands(const std::string& argument) { m_char->OnSend(String::Get()->box(m_commands.getCommandsVector(), "Playing")); @@ -150,10 +134,13 @@ void EditorPlaying::quitEditor(const std::string& argument) try { - value_type id = m_char->getRoom(); - mud::RoomPtr room = mud::Managers::Get()->Room->GetByKey(id); + value_type chunkid = m_char->getChunk(); + mud::ChunkPtr chunk = mud::Managers::Get()->Chunk->GetByKey(chunkid); + + std::string msg = m_char->getName(); + msg.append(" fades from the realm.\n"); - room->Sendf("%s fades from the realm.\n", m_char->getName().c_str()); + chunk->Send(msg); } catch(RowNotFoundException& e) { @@ -172,18 +159,6 @@ void EditorPlaying::quitEditor(const std::string& argument) } } -void EditorPlaying::listRaces(const std::string& argument) -{ - m_char->OnRaceList(argument); - return; -} - -void EditorPlaying::listRooms(const std::string& argument) -{ - m_char->OnRoomList(argument); - return; -} - void EditorPlaying::showScore(const std::string& argument) { m_char->OnScore(argument); diff --git a/src/Core/Editors/EditorPlaying.h b/src/Core/Editors/EditorPlaying.h index 9372a1d..3a23236 100644 --- a/src/Core/Editors/EditorPlaying.h +++ b/src/Core/Editors/EditorPlaying.h @@ -39,12 +39,8 @@ public: std::string lookup(const std::string& action); void dispatch(const std::string& action, const std::string& argument); - - void listAreas(const std::string& argument); - void listColours(const std::string& argument); + void listCommands(const std::string& argument); - void listRooms(const std::string& argument); - void listRaces(const std::string& argument); void showScore(const std::string& argument); void look(const std::string& argument); void say(const std::string& argument); -- 2.11.4.GIT