EC extracts mode info where it can, race spawns still an issue
This commit is contained in:
@@ -44,7 +44,7 @@ TEST_CASE( "r2x: Unsupported entity types cause return of empty vector", "[Entit
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -71,7 +71,7 @@ TEST_CASE( "r2x: a single Pickup entity can be converted", "[EntityConverter]" )
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -110,12 +110,14 @@ TEST_CASE( "r2x: a single PlayerSpawn (race) entity can be converted", "[EntityC
|
||||
entity.push_back(" Bool8 modeTDM 0");
|
||||
entity.push_back(" Bool8 mode1v1 0");
|
||||
|
||||
// With how map info works, at least one other spawn must be
|
||||
|
||||
// Mock up entity queue
|
||||
std::queue<std::vector<std::string>> q;
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -159,7 +161,7 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -182,6 +184,46 @@ TEST_CASE( "r2x: a single PlayerSpawn (teamA) entity can be converted", "[Entity
|
||||
|
||||
|
||||
|
||||
TEST_CASE( "r2x: a single PlayerSpawn (non-team) entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
entity.push_back(" type PlayerSpawn");
|
||||
entity.push_back(" Vector3 position -216.00000 -132.00000 -1488.000488");
|
||||
entity.push_back(" Vector3 angles 180.00000 0.00000 0.00000");
|
||||
|
||||
// Mock up entity queue
|
||||
std::queue<std::vector<std::string>> q;
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
||||
REQUIRE( converted[0] == "\"classname\" \"info_player_deathmatch\"\n" );
|
||||
REQUIRE( converted[2] == "\"angle\" \"180.00000\"\n" );
|
||||
|
||||
// The z (vertical) is offset by +32
|
||||
std::istringstream iss(converted[1]);
|
||||
std::string attribute;
|
||||
std::string coords[2];
|
||||
float offsetCoord;
|
||||
iss >> attribute >> coords[0] >> coords[1] >> offsetCoord;
|
||||
|
||||
REQUIRE( attribute == "\"origin\"" );
|
||||
REQUIRE( coords[0] == "\"-216.00000" );
|
||||
REQUIRE( coords[1] == "-1488.000488" );
|
||||
REQUIRE( fabs(-100.00000 - offsetCoord) <= DELTA );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter]" ) {
|
||||
|
||||
// Instantiate object
|
||||
@@ -196,7 +238,7 @@ TEST_CASE( "r2x: a single RaceStart entity can be converted", "[EntityConverter]
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -222,7 +264,7 @@ TEST_CASE( "r2x: a single RaceFinish entity can be converted", "[EntityConverter
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -256,7 +298,7 @@ TEST_CASE( "r2x: a single Teleporter and related Target can be converted", "[Ent
|
||||
q.push( entity2 );
|
||||
|
||||
// Match related entities (one pair)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert two entities
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
@@ -308,7 +350,7 @@ TEST_CASE( "r2x: a single JumpPad and related Target can be converted", "[Entity
|
||||
q.push( entity2 );
|
||||
|
||||
// Match related entities (one pair)
|
||||
ec.matchRelated( q );
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert two entities
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
Reference in New Issue
Block a user