diff --git a/source/game/game.h b/source/game/game.h index 7272ffd..e260d89 100644 --- a/source/game/game.h +++ b/source/game/game.h @@ -4,40 +4,11 @@ #include "unit.h" #include "gametypes.h" #include "order.h" +#include "orderunitpair.h" #define GAME_HEADER_FORMATTER "NAME:%s\nSIZE:[%u,%u]\nTURN:%u" #define GAME_HEADER_DELIMITER "~~~~\n" -// Type for order and unit pairs -struct SOrderUnitPair -{ - // Straight up move constructor - SOrderUnitPair( SOrderUnitPair && other ) - : unit ( std::move(other.unit) ) - , order ( other.order ) - {} - - // Multi parameter constructor - SOrderUnitPair( CUnit&& u, COrder o ) - : unit ( std::move(u) ) - , order ( o ) - {} - - // Move assignment operator - inline SOrderUnitPair & operator=( SOrderUnitPair && rhs ) - { - this->unit = std::move(rhs.unit); - this->order = std::move(rhs.order); - return *this; - } - - CUnit unit; // The unit - COrder order; // Order for this unit from this turn -}; - -// Typedef for a vector of these unit pairs -typedef std::vector OrderUnitPairVector; - // Full TTRTS Game class // Stores information about the game // Can convert from a string or to a string diff --git a/source/game/orderunitpair.h b/source/game/orderunitpair.h new file mode 100644 index 0000000..759f165 --- /dev/null +++ b/source/game/orderunitpair.h @@ -0,0 +1,39 @@ +#ifndef _TTRTS_ORDERUNITPAIR_H_ +#define _TTRTS_ORDERUNITPAIR_H_ + +#include "order.h" +#include "unit.h" + +#include + +// Type for order and unit pairs +struct SOrderUnitPair +{ + // Straight up move constructor + SOrderUnitPair( SOrderUnitPair && other ) + : unit ( std::move(other.unit) ) + , order ( other.order ) + {} + + // Multi parameter constructor + SOrderUnitPair( CUnit&& u, COrder o ) + : unit ( std::move(u) ) + , order ( o ) + {} + + // Move assignment operator + inline SOrderUnitPair & operator=( SOrderUnitPair && rhs ) + { + this->unit = std::move(rhs.unit); + this->order = std::move(rhs.order); + return *this; + } + + CUnit unit; // The unit + COrder order; // Order for this unit from this turn +}; + +// Typedef for a vector of these unit pairs +typedef std::vector OrderUnitPairVector; + +#endif // _TTRTS_ORDERUNITPAIR_H_ \ No newline at end of file