mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
26 lines
614 B
C++
Executable File
26 lines
614 B
C++
Executable File
#include "console.h"
|
|
#include "addUnitCommand.h"
|
|
#include "addResourceCommand.h"
|
|
#include "addTechnologyCommand.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace battleship{
|
|
void Console::execute(string cmdStr) {
|
|
int space = cmdStr.find(" ");
|
|
string cmdName, argsStr;
|
|
|
|
if(space != -1){
|
|
cmdName = cmdStr.substr(0, space);
|
|
argsStr = cmdStr.substr(space + 1, string::npos);
|
|
}
|
|
|
|
if(cmdName == "add-unit")
|
|
AddUnitCommand(argsStr).execute();
|
|
else if(cmdName == "add-resource")
|
|
AddResourceCommand(argsStr).execute();
|
|
else if(cmdName == "add-technology")
|
|
AddTechnologyCommand(argsStr).execute();
|
|
}
|
|
}
|