Correct case for all CUnit methods
This commit is contained in:
		
							parent
							
								
									c38fb3dd41
								
							
						
					
					
						commit
						f55bc5413a
					
				
					 5 changed files with 96 additions and 96 deletions
				
			
		|  | @ -80,7 +80,7 @@ int CTTRTSGame::IssueOrder( Team team, const SOrder & order ) | |||
|     // Get the right unit for the order
 | ||||
|     for ( SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         if ( pair.unit.getID() == order.unit ) | ||||
|         if (pair.unit.GetID() == order.unit ) | ||||
|         { | ||||
|             pair.order = order; | ||||
|             return 0; | ||||
|  | @ -113,10 +113,10 @@ uvector2 CTTRTSGame::GetNewPosition( const SOrderUnitPair & pair ) const | |||
|     { | ||||
|     // For forward orders, grab in front
 | ||||
|     case command_c::F: | ||||
|         return pair.unit.getInFront(); | ||||
|         return pair.unit.GetInFront(); | ||||
|     // For all other orders, just grab the old position
 | ||||
|     default: | ||||
|         return pair.unit.getPos(); | ||||
|         return pair.unit.GetPos(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -145,7 +145,7 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|                     for ( const SOrderUnitPair & pair2 : m_OrderUnitPairs ) | ||||
|                     { | ||||
|                         // Skip myself
 | ||||
|                         if( pair.unit.getID() == pair2.unit.getID() ) continue; | ||||
|                         if(pair.unit.GetID() == pair2.unit.GetID() ) continue; | ||||
| 
 | ||||
|                         if( GetNewPosition(pair2) == newpos ) | ||||
|                         { | ||||
|  | @ -158,7 +158,7 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|                 // If the movement is still possible
 | ||||
|                 if ( possible ) | ||||
|                 { | ||||
|                     pair.unit.setPos(newpos); | ||||
|                     pair.unit.SetPos(newpos); | ||||
|                 } | ||||
|             } | ||||
|             break; | ||||
|  | @ -175,13 +175,13 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|             case command_c::L: | ||||
|             { | ||||
|                 // Simply turn left
 | ||||
|                 pair.unit.turnLeft(); | ||||
|                 pair.unit.TurnLeft(); | ||||
|             } | ||||
|                 break; | ||||
|             case command_c::R: | ||||
|             { | ||||
|                 // Simply turn right
 | ||||
|                 pair.unit.turnRight(); | ||||
|                 pair.unit.TurnRight(); | ||||
|             } | ||||
|                 break; | ||||
|             default: | ||||
|  | @ -200,11 +200,11 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|         { | ||||
|             if ( pair.order.command == command_c::A ) | ||||
|             { | ||||
|                 uvector2 newpos = pair.unit.getInFront(); | ||||
|                 uvector2 newpos = pair.unit.GetInFront(); | ||||
|                 // If move would be within the arena
 | ||||
|                 if ( ( newpos.x <= dimensions.x-1 ) && ( newpos.y <= dimensions.y-1 ) ) | ||||
|                 { | ||||
|                     pair.unit.setPos(newpos); | ||||
|                     pair.unit.SetPos(newpos); | ||||
| 
 | ||||
|                     // Unit moved, so more charging needs to be done
 | ||||
|                     charging = true; | ||||
|  | @ -218,13 +218,13 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|         for ( SOrderUnitPair & pair1 : m_OrderUnitPairs ) | ||||
|         if ( pair1.order.command == command_c::A ) | ||||
|         for ( SOrderUnitPair & pair2 : m_OrderUnitPairs ) | ||||
|         if ( pair1.unit.getID() != pair2.unit.getID() // Don't check the same units
 | ||||
|         if (pair1.unit.GetID() != pair2.unit.GetID() // Don't check the same units
 | ||||
|                 && pair2.order.command == command_c::A ) | ||||
|         { | ||||
|             if( CheckForPassThrough(pair1.unit,pair2.unit) ) | ||||
|             { | ||||
|                 toKill.push_back(pair1.unit.getID()); | ||||
|                 toKill.push_back(pair2.unit.getID()); | ||||
|                 toKill.push_back(pair1.unit.GetID()); | ||||
|                 toKill.push_back(pair2.unit.GetID()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -236,18 +236,18 @@ int CTTRTSGame::SimulateToNextTurn() | |||
|         for ( SOrderUnitPair & pair1 : m_OrderUnitPairs ) | ||||
|         for ( SOrderUnitPair & pair2 : m_OrderUnitPairs ) | ||||
|         { | ||||
|             if( pair1.unit.getID() == pair2.unit.getID() ) continue; // Don't check the same units
 | ||||
|             if(pair1.unit.GetID() == pair2.unit.GetID() ) continue; // Don't check the same units
 | ||||
| 
 | ||||
|             if( pair1.unit.getPos() ==  pair2.unit.getPos() ) | ||||
|             if(pair1.unit.GetPos() == pair2.unit.GetPos() ) | ||||
|             { | ||||
|                 if( pair1.order.command == command_c::A ) | ||||
|                 { | ||||
|                     toKill.push_back(pair2.unit.getID()); | ||||
|                     toKill.push_back(pair2.unit.GetID()); | ||||
|                 } | ||||
| 
 | ||||
|                 if( pair2.order.command == command_c::A ) | ||||
|                 { | ||||
|                     toKill.push_back(pair1.unit.getID()); | ||||
|                     toKill.push_back(pair1.unit.GetID()); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -280,7 +280,7 @@ void CTTRTSGame::KillAll( std::vector< unit_id_t >& vec ) | |||
|               it != m_OrderUnitPairs.end(); | ||||
|               it++ ) | ||||
|         { | ||||
|             if( (*it).unit.getID() == id ) | ||||
|             if((*it).unit.GetID() == id ) | ||||
|             { | ||||
|                 // Remove the unit from our alive unit pairs
 | ||||
|                 m_OrderUnitPairs.erase(it); | ||||
|  | @ -294,10 +294,10 @@ void CTTRTSGame::KillAll( std::vector< unit_id_t >& vec ) | |||
| // Check if two units passed through each other
 | ||||
| bool CTTRTSGame::CheckForPassThrough( const CUnit& one, const CUnit& two ) | ||||
| { | ||||
|     uvector2 pos1 = one.getPos(); | ||||
|     uvector2 pos2 = two.getPos(); | ||||
|     dir_t dir1 = one.getDir(); | ||||
|     dir_t dir2 = two.getDir(); | ||||
|     uvector2 pos1 = one.GetPos(); | ||||
|     uvector2 pos2 = two.GetPos(); | ||||
|     dir_t dir1 = one.GetDir(); | ||||
|     dir_t dir2 = two.GetDir(); | ||||
| 
 | ||||
|     if( pos1.x == pos2.x ) { // Same col
 | ||||
|         if (pos1.y == (pos2.y + 1)) { | ||||
|  | @ -327,18 +327,18 @@ bool CTTRTSGame::CheckForPassThrough( const CUnit& one, const CUnit& two ) | |||
| int CTTRTSGame::AddUnit( CUnit&& unit ) | ||||
| {	 | ||||
| 	// Verify the unit
 | ||||
| 	if( !unit.valid() ) | ||||
| 	if( !unit.Valid() ) | ||||
| 		return 1; | ||||
| 
 | ||||
| 	// Verify if the unit can be placed on the current board
 | ||||
| 	const uvector2 pos = unit.getPos(); | ||||
| 	const uvector2 pos = unit.GetPos(); | ||||
|     if( (pos.x >= dimensions.x) || (pos.y >= dimensions.y) ) | ||||
| 		return 2; | ||||
| 
 | ||||
|     // If any unit's position matches, reject this
 | ||||
|     for ( const SOrderUnitPair & pair: m_OrderUnitPairs ) | ||||
|     { | ||||
|         if( pair.unit.getPos() == unit.getPos() ) | ||||
|         if(pair.unit.GetPos() == unit.GetPos() ) | ||||
|             return 3; | ||||
|     } | ||||
| 
 | ||||
|  | @ -377,8 +377,8 @@ int CTTRTSGame::VerifyOrder( Team team, const SOrder & order ) const | |||
|     for ( const SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
| 	{ | ||||
|         // Accept if we have the unit
 | ||||
|         if ( pair.unit.getID() == unitID | ||||
|                 && pair.unit.getTeam() == team ) | ||||
|         if (pair.unit.GetID() == unitID | ||||
|                 && pair.unit.GetTeam() == team ) | ||||
| 		{ | ||||
|             ret = 0; | ||||
| 			break; | ||||
|  | @ -395,7 +395,7 @@ const CUnit& CTTRTSGame::GetUnitByIDConst( unit_id_t id ) const | |||
|     for ( const SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         // Attempt the unit add
 | ||||
|         if ( pair.unit.getID() == id  ) | ||||
|         if (pair.unit.GetID() == id  ) | ||||
|             return pair.unit; | ||||
|     } | ||||
| 
 | ||||
|  | @ -410,7 +410,7 @@ const SOrder & CTTRTSGame::GetOrderByIDConst( unit_id_t id ) const | |||
|     for ( const SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         // Attempt the unit add
 | ||||
|         if ( pair.unit.getID() == id  ) | ||||
|         if (pair.unit.GetID() == id  ) | ||||
|             return pair.order; | ||||
|     } | ||||
| 
 | ||||
|  | @ -425,7 +425,7 @@ CUnit& CTTRTSGame::GetUnitByID( unit_id_t id ) | |||
|     for ( SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         // Attempt the unit add
 | ||||
|         if ( pair.unit.getID() == id ) | ||||
|         if (pair.unit.GetID() == id ) | ||||
|             return pair.unit; | ||||
|     } | ||||
| 
 | ||||
|  | @ -443,7 +443,7 @@ std::vector<Team> CTTRTSGame::GetTeams() const | |||
|     // Grab all teams
 | ||||
|     for ( const SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         teams.push_back(pair.unit.getTeam()); | ||||
|         teams.push_back(pair.unit.GetTeam()); | ||||
|     } | ||||
| 
 | ||||
|     // Remove dupes
 | ||||
|  | @ -463,7 +463,7 @@ Team CTTRTSGame::CheckForWin() const | |||
|     // Count up all the units for each Team
 | ||||
|     for ( const SOrderUnitPair & pair : m_OrderUnitPairs ) | ||||
|     { | ||||
|         const int team = (int)pair.unit.getTeam(); | ||||
|         const int team = (int) pair.unit.GetTeam(); | ||||
|         units[team] += 1; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ namespace | |||
| } | ||||
| 
 | ||||
| // force a reset of the unit ID value
 | ||||
| void forceResetUnitId() | ||||
| void __forceResetCUnitID() | ||||
| { | ||||
|     unit_id_t i = 0; | ||||
|     get_unique_unit_id(&i); | ||||
|  | @ -46,7 +46,7 @@ void forceResetUnitId() | |||
| CUnit CUnit::GetUnitFromVis( unitVis_c vis ) | ||||
| { | ||||
|     CUnit unit; | ||||
|     unit.setFromVisual(vis); | ||||
|     unit.SetFromVisual(vis); | ||||
|     return unit; | ||||
| } | ||||
| 
 | ||||
|  | @ -106,7 +106,7 @@ CUnit::CUnit() | |||
| , dir 		( dir_t::S ) | ||||
| , pos 		( { ucoord_invalid, ucoord_invalid } ) | ||||
| { | ||||
| 	updateMyVisual(); | ||||
|     UpdateMyVisual(); | ||||
| } | ||||
| 
 | ||||
| // Move constructor
 | ||||
|  | @ -117,7 +117,7 @@ CUnit::CUnit(CUnit&& unit) | |||
| , dir 		( std::move(unit.dir) ) | ||||
| , pos 		( std::move(unit.pos) ) | ||||
| { | ||||
| 	updateMyVisual(); | ||||
|     UpdateMyVisual(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -143,22 +143,22 @@ bool CUnit::operator==(const CUnit& rhs) | |||
| } | ||||
| 
 | ||||
| // Update the visual representation of the unit
 | ||||
| unitVis_c CUnit::updateMyVisual() | ||||
| unitVis_c CUnit::UpdateMyVisual() | ||||
| { | ||||
| 	// Start at invalid
 | ||||
| 	setVisual(unitVis_invalid); | ||||
|     SetVisual(unitVis_invalid); | ||||
| 
 | ||||
| 	dir_to_vis_map::const_iterator it = get_vis_map_V().find(dir); | ||||
| 
 | ||||
| 	// If found set to new vis
 | ||||
| 	if( it != get_vis_map_V().end() ) | ||||
| 		setVisual(it->second); | ||||
|         SetVisual(it->second); | ||||
| 
 | ||||
| 	return getVisual(); | ||||
| 	return GetVisual(); | ||||
| } | ||||
| 
 | ||||
| // Set the unit from visual
 | ||||
| bool CUnit::setFromVisual( const unitVis_c& vis ) | ||||
| bool CUnit::SetFromVisual(const unitVis_c &vis) | ||||
| { | ||||
| 	dir_to_vis_map::const_iterator it; | ||||
| 
 | ||||
|  | @ -167,7 +167,7 @@ bool CUnit::setFromVisual( const unitVis_c& vis ) | |||
| 		if( it->second == vis ) | ||||
| 		{ | ||||
|             dir = it->first; | ||||
| 			updateMyVisual(); | ||||
|             UpdateMyVisual(); | ||||
| 			return true; | ||||
| 		} | ||||
| 	} | ||||
|  | @ -177,7 +177,7 @@ bool CUnit::setFromVisual( const unitVis_c& vis ) | |||
| } | ||||
| 
 | ||||
| // Turn unit left
 | ||||
| dir_t CUnit::turnLeft() | ||||
| dir_t CUnit::TurnLeft() | ||||
| { | ||||
|     switch( dir ) | ||||
|     { | ||||
|  | @ -198,13 +198,13 @@ dir_t CUnit::turnLeft() | |||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     updateMyVisual(); | ||||
|     UpdateMyVisual(); | ||||
| 
 | ||||
|     return getDir(); | ||||
|     return GetDir(); | ||||
| } | ||||
| 
 | ||||
| // Turn unit right
 | ||||
| dir_t CUnit::turnRight() | ||||
| dir_t CUnit::TurnRight() | ||||
| { | ||||
|     switch( dir ) | ||||
|     { | ||||
|  | @ -225,13 +225,13 @@ dir_t CUnit::turnRight() | |||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     updateMyVisual(); | ||||
|     UpdateMyVisual(); | ||||
| 
 | ||||
|     return getDir(); | ||||
|     return GetDir(); | ||||
| } | ||||
| 
 | ||||
| // Turn unit around
 | ||||
| dir_t CUnit::turnAround() | ||||
| dir_t CUnit::TurnAround() | ||||
| { | ||||
|     switch( dir ) | ||||
|     { | ||||
|  | @ -252,13 +252,13 @@ dir_t CUnit::turnAround() | |||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     updateMyVisual(); | ||||
|     UpdateMyVisual(); | ||||
| 
 | ||||
|     return getDir(); | ||||
|     return GetDir(); | ||||
| } | ||||
| 
 | ||||
| // Get the co-ordinate infront of the unit
 | ||||
| uvector2 CUnit::getInFront() const | ||||
| uvector2 CUnit::GetInFront() const | ||||
| { | ||||
|     vector2 delta = vecFromDir(dir); | ||||
|     return pos + delta; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #define UNIT_FORMATTER "UNIT:%u tm:%u vs:%c dr:%c ps:[%u,%u]" | ||||
| 
 | ||||
| // force a reset of the unit ID value
 | ||||
| void forceResetUnitId(); | ||||
| void __forceResetCUnitID(); | ||||
| 
 | ||||
| // Base unit type
 | ||||
| class CUnit | ||||
|  | @ -35,36 +35,36 @@ public: | |||
| 	bool 				operator!=(const CUnit& rhs) { return !(*this == rhs); } | ||||
| 
 | ||||
|     // Getters for all the members
 | ||||
| 	inline const unit_id_t& 	getID() const 		{ return unit_id; } | ||||
| 	inline const Team & 		getTeam() const 	{ return team_id; } | ||||
| 	inline const unitVis_c&		getVisual() const 	{ return unit_vis; } | ||||
|     inline const dir_t&         getDir() const      { return dir; } | ||||
| 	inline const uvector2& 		getPos() const 						{ return pos; } | ||||
| 	inline const unit_id_t&		GetID() const 		{ return unit_id; } | ||||
| 	inline const Team &			GetTeam() const 	{ return team_id; } | ||||
| 	inline const unitVis_c&		GetVisual() const 	{ return unit_vis; } | ||||
|     inline const dir_t&			GetDir() const      { return dir; } | ||||
| 	inline const uvector2&		GetPos() const 						{ return pos; } | ||||
| 
 | ||||
| 	// Set
 | ||||
|     inline Team 				setTeam(const Team & v)  		{ return (team_id = v); } | ||||
|     inline unitVis_c	 		setVisual(const unitVis_c& v)  	{ return ( unit_vis = v ); } | ||||
|     inline dir_t 				setDir(const dir_t& v)          { return (dir = v); } | ||||
| 	inline void 				setPos(const uvector2& v)  		{ pos = v; } | ||||
|     inline Team 				SetTeam(const Team &v)  		{ return (team_id = v); } | ||||
|     inline unitVis_c	 		SetVisual(const unitVis_c &v)  	{ return ( unit_vis = v ); } | ||||
|     inline dir_t 				SetDir(const dir_t &v)          { return (dir = v); } | ||||
| 	inline void 				SetPos(const uvector2 &v)  		{ pos = v; } | ||||
| 
 | ||||
|     // Get the co-ordinate in front of the unit
 | ||||
|     uvector2 					getInFront() const; | ||||
|     uvector2 					GetInFront() const; | ||||
| 
 | ||||
| 	// Check unit is valid
 | ||||
| 	inline bool 				valid() const; | ||||
| 	inline bool 				Valid() const; | ||||
| 
 | ||||
| 	// Set a unit based solely on it's visual
 | ||||
| 	bool 						setFromVisual( const unitVis_c& vis); | ||||
| 	bool 						SetFromVisual(const unitVis_c &vis); | ||||
| 
 | ||||
|     // Orientation methods
 | ||||
|     dir_t 						turnLeft(); | ||||
|     dir_t 						turnRight(); | ||||
|     dir_t 						turnAround(); | ||||
|     dir_t 						TurnLeft(); | ||||
|     dir_t 						TurnRight(); | ||||
|     dir_t 						TurnAround(); | ||||
| 
 | ||||
| private: | ||||
| 
 | ||||
|     // Update my visual must be called when setting direction
 | ||||
|     unitVis_c 					updateMyVisual(); | ||||
|     unitVis_c 					UpdateMyVisual(); | ||||
| 
 | ||||
| 	// Unit ID
 | ||||
|     unit_id_t 					unit_id; | ||||
|  | @ -83,11 +83,11 @@ private: | |||
| }; | ||||
| 
 | ||||
| // Typedef for a vector of units
 | ||||
| typedef std::vector< CUnit > CUnitVector; | ||||
| typedef std::vector< unit_id_t > CUnitIDVector; | ||||
| typedef std::vector< CUnit > 		CUnitVector; | ||||
| typedef std::vector< unit_id_t > 	CUnitIDVector; | ||||
| 
 | ||||
| // Simple validation
 | ||||
| inline bool CUnit::valid() const | ||||
| inline bool CUnit::Valid() const | ||||
| { | ||||
| 	return (unit_id 	!= unit_id_invalid ) | ||||
| 		&& (team_id 	!= Team::NUM_INVALID ) | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| void AddUnitToGame( Team team, char vis, uvector2 vec, CTTRTSGame& game ) | ||||
| { | ||||
|     CUnit unit = CUnit::GetUnitFromVis(vis); | ||||
|     unit.setPos( vec ); | ||||
|     unit.setTeam(team); | ||||
|     unit.SetPos(vec); | ||||
|     unit.SetTeam(team); | ||||
|     game.AddUnit(std::move(unit)); | ||||
| } | ||||
| 
 | ||||
|  | @ -18,7 +18,7 @@ void OutputGame( CTTRTSGame&& game ) | |||
|     output << game.GetStateAsString(); | ||||
|     output.close(); | ||||
| 
 | ||||
|     forceResetUnitId(); | ||||
|     __forceResetCUnitID(); | ||||
| } | ||||
| 
 | ||||
| int main() | ||||
|  |  | |||
|  | @ -8,8 +8,8 @@ const char* tests() | |||
|     // Test if we can properly set a unit's visual
 | ||||
| 	{ | ||||
| 		CUnit unit; | ||||
| 		unit.setFromVisual('v'); | ||||
|         if( unit.getVisual() != 'v' ) | ||||
|         unit.SetFromVisual('v'); | ||||
|         if(unit.GetVisual() != 'v' ) | ||||
| 			 return "failed to properly create V unit"; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -17,7 +17,7 @@ const char* tests() | |||
| 	{ | ||||
| 		CUnit unit; | ||||
| 		CUnit unit2; | ||||
| 		if( unit.getID() == unit2.getID() ) | ||||
| 		if(unit.GetID() == unit2.GetID() ) | ||||
| 			 return "Unit IDs the same"; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -35,9 +35,9 @@ const char* tests() | |||
|     // Test custom unit conversion
 | ||||
|     { | ||||
|         CUnit unit1; | ||||
|         unit1.setFromVisual('v'); | ||||
|         unit1.setTeam(Team::Green); | ||||
|         unit1.setPos( uvector2(5,10) ); | ||||
|         unit1.SetFromVisual('v'); | ||||
|         unit1.SetTeam(Team::Green); | ||||
|         unit1.SetPos(uvector2(5, 10)); | ||||
| 
 | ||||
|         std::string unit1Desc = CUnit::GetStringFromUnit(unit1); | ||||
|         CUnit unit2 = CUnit::GetUnitFromString(unit1Desc); | ||||
|  | @ -49,7 +49,7 @@ const char* tests() | |||
|     // Test if we can successfully create a unit from a visual
 | ||||
| 	{ | ||||
| 		CUnit unit = CUnit::GetUnitFromVis('v'); | ||||
| 		if( unit.getVisual() != 'v' ) | ||||
| 		if(unit.GetVisual() != 'v' ) | ||||
| 			return "failed to properly create V unit with factory"; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -81,16 +81,16 @@ const char* tests() | |||
| 
 | ||||
|         { | ||||
|             CUnit unit = CUnit::GetUnitFromVis('^'); | ||||
|             unit.setPos( {2,2} ); | ||||
|             unit.setTeam(Team::Red); | ||||
|             unit.SetPos({2, 2}); | ||||
|             unit.SetTeam(Team::Red); | ||||
| 
 | ||||
|             game.AddUnit(std::move(unit)); | ||||
|         } | ||||
| 
 | ||||
|         { | ||||
|             CUnit unit = CUnit::GetUnitFromVis('^'); | ||||
|             unit.setPos( {2,2} ); | ||||
|             unit.setTeam(Team::Red); | ||||
|             unit.SetPos({2, 2}); | ||||
|             unit.SetTeam(Team::Red); | ||||
| 
 | ||||
|             if( !game.AddUnit(std::move(unit)) ) | ||||
|                 return "Game should have rejected unit placed on the same spot"; | ||||
|  | @ -105,11 +105,11 @@ const char* tests() | |||
|         CTTRTSGame game( 5, 5 ); | ||||
| 
 | ||||
|         CUnit unit = CUnit::GetUnitFromVis('>'); | ||||
|         const unit_id_t id = unit.getID(); | ||||
|         const unit_id_t id = unit.GetID(); | ||||
|         SOrder order; | ||||
| 
 | ||||
|         unit.setPos( {2,2} ); | ||||
|         unit.setTeam(Team::Red); | ||||
|         unit.SetPos({2, 2}); | ||||
|         unit.SetTeam(Team::Red); | ||||
| 
 | ||||
|         if ( game.AddUnit(std::move(unit)) ) | ||||
|             return "Game failed to add valid unit"; | ||||
|  | @ -123,7 +123,7 @@ const char* tests() | |||
|         if (game.SimulateToNextTurn() ) | ||||
|             return "Game failed to simulate valid turn"; | ||||
| 
 | ||||
|         if( game.GetUnitByIDConst(id).getPos() != uvector2{3,2} ) | ||||
|         if(game.GetUnitByIDConst(id).GetPos() != uvector2{3,2} ) | ||||
|             return "Simple movement order failed"; | ||||
| 
 | ||||
|     } | ||||
|  | @ -136,11 +136,11 @@ const char* tests() | |||
|         unit_id_t id; | ||||
|         { | ||||
|             CUnit unit = CUnit::GetUnitFromVis('>'); | ||||
|             id = unit.getID(); | ||||
|             id = unit.GetID(); | ||||
|             SOrder order; | ||||
| 
 | ||||
|             unit.setPos( {0,0} ); | ||||
|             unit.setTeam(Team::Blue); | ||||
|             unit.SetPos({0, 0}); | ||||
|             unit.SetTeam(Team::Blue); | ||||
| 
 | ||||
|             if ( game.AddUnit(std::move(unit)) ) | ||||
|                 return "Game failed to add valid unit"; | ||||
|  | @ -154,8 +154,8 @@ const char* tests() | |||
|         { | ||||
|             CUnit unit = CUnit::GetUnitFromVis('<'); | ||||
| 
 | ||||
|             unit.setPos( {1,0} ); | ||||
|             unit.setTeam(Team::Red); | ||||
|             unit.SetPos({1, 0}); | ||||
|             unit.SetTeam(Team::Red); | ||||
| 
 | ||||
|             if ( game.AddUnit(std::move(unit)) ) | ||||
|                 return "Game failed to add valid unit"; | ||||
|  | @ -166,10 +166,10 @@ const char* tests() | |||
|         if ( game.GetNumUnits() != 1 ) | ||||
|             return "Game failed to kill a unit when it logically should have"; | ||||
| 
 | ||||
|         if ( game.GetUnitByIndex(0).getDir() != dir_t::E ) | ||||
|         if (game.GetUnitByIndex(0).GetDir() != dir_t::E ) | ||||
|             return "Game killed the wrong unit"; | ||||
| 
 | ||||
|         if ( game.GetUnitByIndex(0).getID() != id ) | ||||
|         if (game.GetUnitByIndex(0).GetID() != id ) | ||||
|             return "Game killed the wrong unit"; | ||||
| 
 | ||||
|         if ( game.CheckForWin() != Team::Blue ) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue