reordered source files

This commit is contained in:
devZoGok
2026-05-21 20:28:52 +03:00
parent 4e36bfd311
commit ea9d49fe9d
182 changed files with 14678 additions and 0 deletions
@@ -0,0 +1,30 @@
#include "addResourceCommand.h"
#include "game.h"
#include "player.h"
#include "trader.h"
namespace battleship{
void AddResourceCommand::validate(){
if(arguments.size() != 3)
return;
playerId = atoi(arguments[0].c_str());
if(playerId != 0 && playerId != 1)
return;
resourceId = atoi(arguments[1].c_str());
if(!(0 <= resourceId && resourceId <= 2))
return;
resourceAmmount = atoi(arguments[2].c_str());
}
void AddResourceCommand::execute(){
AbstractCommand::execute();
Player *player = Game::getSingleton()->getPlayer(playerId);
player->updateResource(ResourceType(resourceId), resourceAmmount, true);
}
}