minor bug fix & general test cases made for EC

This commit is contained in:
suhrke
2017-07-04 00:06:13 -07:00
parent cf2eb575fc
commit e4412bcdaa
3 changed files with 180 additions and 18 deletions

View File

@@ -341,13 +341,13 @@ EntityConverter::convertPlayerSpawn(std::vector<std::string> &lines)
if ( ! isModeRace ) {
switch (team) {
case 0:
convertedLines.push_back ( "\"classname\" \"info_player_deathmatch\"" );
convertedLines.push_back ( "\"classname\" \"info_player_deathmatch\"\n" );
break;
case 1:
convertedLines.push_back ( "\"classname\" \"info_player_team1\"" );
convertedLines.push_back ( "\"classname\" \"info_player_team1\"\n" );
break;
case 2:
convertedLines.push_back ( "\"classname\" \"info_player_team2\"" );
convertedLines.push_back ( "\"classname\" \"info_player_team2\"\n" );
break;
}
@@ -476,26 +476,25 @@ EntityConverter::convertTarget(std::vector<std::string> &lines)
}
if ( havePosition && haveName) {
//**! no way to tell if teleporter or jump pad dest from targetName alone
if ( targetMap_[targetName] == "Teleporter") {
convertedLines.push_back ( "\"classname\" \"misc_teleporter_dest\"\n" );
}
else if ( targetMap_[targetName] == "JumpPad") {
convertedLines.push_back ( "\"classname\" \"target_push\"\n" );
convertedLines.push_back ( "\"classname\" \"target_position\"\n" );
}
std::stringstream oss;
oss << "\"targetname\" \"" << targetName << "\"\n";
convertedLines.push_back ( oss.str() );
// coordinates reordered to x, z, y
std::stringstream oss2;
oss2 << "\"origin\" \"" << coords[0] << " " << coords[2] << " " <<
coords[1] << "\"" << std::endl;
convertedLines.push_back ( oss2.str() );
std::stringstream oss;
oss << "\"targetname\" \"" << targetName << "\"" << std::endl;
convertedLines.push_back ( oss.str() );
// Write angle only if position and name exist
if ( haveAngle ) {
std::stringstream oss3;
oss3 << "\"angle\" \"" << angle << "\"\n";
oss3 << "\"angle\" \"" << angle << "\"" << std::endl;
convertedLines.push_back (oss3.str() );
}
return convertedLines;
@@ -512,9 +511,9 @@ std::vector<std::string>
EntityConverter::convertRaceStart(std::vector<std::string> &lines)
{
std::vector<std::string> convertedLines;
convertedLines.push_back ("\"classname\" \"trigger_race_checkpoint\"");
convertedLines.push_back ("\"targetname\" \"cp1\"");
convertedLines.push_back ("\"cnt\" \"1\"");
convertedLines.push_back ("\"classname\" \"trigger_race_checkpoint\"\n");
convertedLines.push_back ("\"targetname\" \"cp1\"\n");
convertedLines.push_back ("\"cnt\" \"1\"\n");
return convertedLines;
}
@@ -524,9 +523,9 @@ std::vector<std::string>
EntityConverter::convertRaceFinish(std::vector<std::string> &lines)
{
std::vector<std::string> convertedLines;
convertedLines.push_back ("\"classname\" \"trigger_race_checkpoint\"");
convertedLines.push_back ("\"targetname\" \"finish\"");
convertedLines.push_back ("\"cnt\" \"0\"");
convertedLines.push_back ("\"classname\" \"trigger_race_checkpoint\"\n");
convertedLines.push_back ("\"targetname\" \"finish\"\n");
convertedLines.push_back ("\"cnt\" \"0\"\n");
return convertedLines;
}