aboutsummaryrefslogtreecommitdiff
path: root/world.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-01 17:55:58 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-01 17:55:58 +0100
commit029f4e66a157a01f094c20d11569f4876379bcfb (patch)
treea9aca9a3175db5d29070ee4c9bc5bea32d40d27a /world.h
parent0e7a419f55dfed12fd60a0cd41be324a398673f9 (diff)
It seems to do something useful now
Diffstat (limited to 'world.h')
-rw-r--r--world.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/world.h b/world.h
index 162110d..2e392c2 100644
--- a/world.h
+++ b/world.h
@@ -45,6 +45,12 @@ using Script = vector<Instruction>;
class Team;
class World;
+enum class WorldAction{
+ none,
+ die,
+ move,
+};
+
class Robot{
Location ip={0,0};
int waited=0;
@@ -53,7 +59,7 @@ class Robot{
uint16_t* resolveVar(const Argument &arg,World &world);
Instruction resolve(World &world);
int calcDuration(Instruction &ins);
- void execute(Instruction &ins,World &world);
+ WorldAction execute(Instruction &ins,World &world);
void advanceIP();
bool ipInRange() const;
@@ -69,7 +75,7 @@ public:
void load(int idx,const Script &scr);
- void tick(World &world);
+ WorldAction tick(World &world);
};
class Team{
@@ -79,6 +85,8 @@ public:
};
class World{
+ Robot** targetbotptr(const Robot *r);
+
public:
Robot *board[SIZE][SIZE];
@@ -86,6 +94,7 @@ public:
~World();
Robot& create(const Team *team,int iset,int nbanks,bool mobile);
+ Robot& createInFront(const Robot *caller,const Team *team,int iset,int nbanks,bool mobile);
void tick();
Robot* targetbot(const Robot *r);