race maps and maps without race convert spawns correctly, possible issue with maps with both
This commit is contained in:
@@ -137,7 +137,34 @@ EntityConverter::convert(std::vector<std::string> lines)
|
||||
}
|
||||
|
||||
|
||||
if ( type == "Pickup" ) {
|
||||
// RETURN EMPTY VECTOR if type is WorldSpawn
|
||||
if ( type == "WorldSpawn" ) {
|
||||
for ( int i = 1; i < lines.size(); ++i ) {
|
||||
// only works for maps that support race AND other modes
|
||||
if ( lines[i].find("modeRace 0") != std::string::npos) {
|
||||
std::cout << "disabled race because worldspawn" << std::endl;
|
||||
mapinfo_.cts = false;
|
||||
}
|
||||
else if ( lines[i].find("modeCTF 0") != std::string::npos) {
|
||||
std::cout << "disabled ctf because worldspawn" << std::endl;
|
||||
mapinfo_.ctf = false;
|
||||
}
|
||||
else if ( lines[i].find("modeFFA 0") != std::string::npos) {
|
||||
std::cout << "disabled ffa because worldspawn" << std::endl;
|
||||
mapinfo_.ffa = false;
|
||||
}
|
||||
else if ( lines[i].find("modeTDM 0") != std::string::npos) {
|
||||
std::cout << "disabled tdm because worldspawn" << std::endl;
|
||||
mapinfo_.tdm = false;
|
||||
}
|
||||
else if ( lines[i].find("mode1v1 0") != std::string::npos) {
|
||||
std::cout << "disabled duel because worldspawn" << std::endl;
|
||||
mapinfo_.duel = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if ( type == "Pickup" ) {
|
||||
return convertPickup(lines);
|
||||
}
|
||||
else if ( type == "PlayerSpawn" ) {
|
||||
@@ -286,14 +313,8 @@ EntityConverter::convertPlayerSpawn(std::vector<std::string> &lines)
|
||||
}
|
||||
|
||||
if ( havePosition ) {
|
||||
if ( mapinfo_.cts && isModeRace ) {
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_race\"\n" );
|
||||
// Reflex maps have only start and finish, point to start on spawn
|
||||
convertedLines.push_back ( "\"target\" \"cp1\"\n" );
|
||||
// Reflex maps are only cts, set spawn to cts-only type
|
||||
convertedLines.push_back ( "\"race_place\" \"-1\"\n" );
|
||||
}
|
||||
else {
|
||||
// Will convert all race points to dm/team spawns on maps that support race AND others
|
||||
if ( mapinfo_.ctf || mapinfo_.tdm || mapinfo_.ffa || mapinfo_.duel ) {
|
||||
switch (team) {
|
||||
case 0:
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_deathmatch\"\n" );
|
||||
@@ -306,6 +327,13 @@ EntityConverter::convertPlayerSpawn(std::vector<std::string> &lines)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( mapinfo_.cts && isModeRace ) {
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_race\"\n" );
|
||||
// Reflex maps have only start and finish, point to start on spawn
|
||||
convertedLines.push_back ( "\"target\" \"cp1\"\n" );
|
||||
// Reflex maps are only cts, set spawn to cts-only type
|
||||
convertedLines.push_back ( "\"race_place\" \"-1\"\n" );
|
||||
}
|
||||
|
||||
|
||||
std::stringstream oss;
|
||||
@@ -554,27 +582,6 @@ EntityConverter::extractFromEntity(std::string &line, std::istream &is)
|
||||
}
|
||||
targetMap_.insert ( std::pair<std::string, std::string>(targetName, "JumpPad") );
|
||||
}
|
||||
else if ( line.find("type WorldSpawn") != std::string::npos) {
|
||||
while ( std::getline(is, line)) {
|
||||
// only works for maps that support race AND other modes
|
||||
if ( line.find("modeRace 0") != std::string::npos) {
|
||||
mapinfo_.cts = false;
|
||||
}
|
||||
else if ( line.find("modeCTF 0") != std::string::npos) {
|
||||
mapinfo_.ctf = false;
|
||||
}
|
||||
else if ( line.find("modeFFA 0") != std::string::npos) {
|
||||
mapinfo_.ffa = false;
|
||||
}
|
||||
else if ( line.find("modeTDM 0") != std::string::npos) {
|
||||
mapinfo_.tdm = false;
|
||||
}
|
||||
else if ( line.find("mode1v1 0") != std::string::npos) {
|
||||
mapinfo_.duel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user