race maps and maps without race convert spawns correctly, possible issue with maps with both
This commit is contained in:
@@ -37,7 +37,7 @@ TEST_CASE( "r2x: Unsupported entity types cause return of empty vector", "[Entit
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
entity.push_back(" type Worldspawn");
|
||||
entity.push_back(" type NotAType");
|
||||
|
||||
// Mock up entity queue
|
||||
std::queue<std::vector<std::string>> q;
|
||||
@@ -98,6 +98,16 @@ TEST_CASE( "r2x: a single PlayerSpawn (race) entity can be converted", "[EntityC
|
||||
// Instantiate object
|
||||
EntityConverter ec (PICKUP_FILENAME);
|
||||
|
||||
// Mock up WorldSpawn entity
|
||||
// (needed for mode info)
|
||||
std::vector<std::string> worldspawn;
|
||||
worldspawn.push_back(" type WorldSpawn");
|
||||
worldspawn.push_back(" Bool8 modeCTF 0");
|
||||
worldspawn.push_back(" Bool8 modeFFA 0");
|
||||
worldspawn.push_back(" Bool8 modeTDM 0");
|
||||
worldspawn.push_back(" Bool8 mode1v1 0");
|
||||
|
||||
|
||||
// Mock up entity
|
||||
std::vector<std::string> entity;
|
||||
entity.push_back(" type PlayerSpawn");
|
||||
@@ -110,16 +120,17 @@ 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( worldspawn );
|
||||
q.push( entity );
|
||||
|
||||
// Match related entities (none)
|
||||
ec.extractMapInfo( q );
|
||||
|
||||
// Convert a single entity
|
||||
// Convert a single entity (worldspawn conversion returns empty vector
|
||||
// BUT sets the supported game modes for entities in that worldspawn
|
||||
std::vector<std::string> unused = ec.convert(worldspawn);
|
||||
std::vector<std::string> converted = ec.convert(entity);
|
||||
|
||||
REQUIRE( converted[0] == "\"classname\" \"info_player_race\"\n" );
|
||||
|
||||
Reference in New Issue
Block a user