From 3297b8fde8e4c93cbbecd06fa5937c2d3a0c46ee Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Mon, 14 Apr 2008 01:47:01 +0200 Subject: [PATCH] Add a 'go' command in EditorPlaying that will drop the players in the movement editor. --- src/Core/Editors/EditorPlaying.cpp | 20 ++++++++++++++++++-- src/Core/Editors/EditorPlaying.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Core/Editors/EditorPlaying.cpp b/src/Core/Editors/EditorPlaying.cpp index 7617b90..5ae264f 100644 --- a/src/Core/Editors/EditorPlaying.cpp +++ b/src/Core/Editors/EditorPlaying.cpp @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "EditorAccount.h" #include "EditorPlaying.h" +#include "EditorMovement.h" #include "UBSocket.h" #include "Array.h" #include "Assert.h" @@ -42,12 +42,14 @@ static O listCommands("Commands",&E::listCommands); static O showScore( "Score", &E::showScore); static O look( "Look", &E::look); static O say( "Say", &E::say); +static O startMovement("Movement", &E::startMovement); static O deleteCharacter("Delete",&E::deleteCharacter); static O quitEditor("Quit", &E::quitEditor); static const B commands[] = { B("?", listCommands), B("delete", deleteCharacter), + B("go", startMovement), B("look", look), B("quit", quitEditor), B("say", say), @@ -118,7 +120,7 @@ void EditorPlaying::deleteCharacter(const std::string& argument) printf("Deleting PCharacter %s.\n", m_char->getName().c_str()); m_char->OnSend("Goodbye.\n"); - m_sock->SetEditor(new EditorAccount(m_sock)); + m_sock->PopEditor(); m_char->Delete(); return; } @@ -168,3 +170,17 @@ void EditorPlaying::say(const std::string& argument) { m_char->OnSay(argument); } + +void EditorPlaying::startMovement(const std::string& argument) +{ + m_sock->Send("Let's get movin'!\n"); + + if(!argument.size()) + { + m_sock->SetEditor(new EditorMovement(m_sock, m_char)); + return; + } + + m_sock->SetEditor(new EditorMovement(m_sock, m_char, argument)); + return; +} diff --git a/src/Core/Editors/EditorPlaying.h b/src/Core/Editors/EditorPlaying.h index 3a23236..220fd02 100644 --- a/src/Core/Editors/EditorPlaying.h +++ b/src/Core/Editors/EditorPlaying.h @@ -44,6 +44,7 @@ public: void showScore(const std::string& argument); void look(const std::string& argument); void say(const std::string& argument); + void startMovement(const std::string& argument); void deleteCharacter(const std::string& argument); void quitEditor(const std::string& argument); -- 2.11.4.GIT