change folder name
This commit is contained in:
37
src/commands/Command.cpp
Normal file
37
src/commands/Command.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "Command.h"
|
||||
#include "../Shared.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Command *Command::create(int clientIndex, yojimbo::Message *message)
|
||||
{
|
||||
switch (message->GetType())
|
||||
{
|
||||
case (int)GameMessageType::TEST:
|
||||
return new TestCommand(clientIndex, message);
|
||||
case (int)GameMessageType::SETNAME:
|
||||
return new SetNameCommand(clientIndex, message);
|
||||
default:
|
||||
std::cout << "Unknown message type received!" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Command *Command::create(std::string command)
|
||||
{
|
||||
std::stringstream ss(command);
|
||||
std::string token;
|
||||
ss >>
|
||||
token;
|
||||
if (token == "stop")
|
||||
{
|
||||
return new StopCommandInternal();
|
||||
}
|
||||
else if (token == "test")
|
||||
{
|
||||
return new TestCommandInternal();
|
||||
}
|
||||
std::cout << "Internal commando don't exists: " << command << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user