Player spawns added to entity file, used by EntityConverter
This commit is contained in:
parent
3d6896e6ff
commit
f2b0341da3
25
r2cpma.ent
25
r2cpma.ent
@ -1,25 +0,0 @@
|
||||
40 item_health_small
|
||||
41 item_health
|
||||
42 item_health_large
|
||||
43 item_health_mega
|
||||
50 item_armor_shard
|
||||
51 item_armor_jacket
|
||||
52 item_armor_combat
|
||||
53 item_armor_body
|
||||
1 weapon_shotgun
|
||||
2 weapon_grenadelauncher
|
||||
3 weapon_plasmagun
|
||||
4 weapon_rocketlauncher
|
||||
5 weapon_lightning
|
||||
6 weapon_railgun
|
||||
20 ammo_bullets
|
||||
21 ammo_shells
|
||||
22 ammo_rockets
|
||||
23 ammo_lightning
|
||||
24 ammo_rockets
|
||||
25 ammo_bullets
|
||||
26 ammo_lightning
|
||||
60 item_quad
|
||||
62 item_enviro
|
||||
70 team_CTF_redflag
|
||||
71 team_CTF_blueflag
|
8
r2q3.ent
8
r2q3.ent
@ -20,6 +20,8 @@
|
||||
25 item_bullets
|
||||
26 item_lightning
|
||||
60 item_quad
|
||||
62 item_shield?
|
||||
70 item_flag_team1
|
||||
71 item_flag_team2
|
||||
62 item_enviro
|
||||
70 team_CTF_redflag
|
||||
71 team_CTF_blueflag
|
||||
team1 team_CTF_redspawn
|
||||
team2 team_CTF_bluespawn
|
||||
|
@ -23,3 +23,5 @@
|
||||
62 item_invincible
|
||||
70 item_flag_team1
|
||||
71 item_flag_team2
|
||||
team1 info_player_team1
|
||||
team2 info_player_team2
|
||||
|
@ -79,12 +79,11 @@ EntityConverter::EntityConverter(const std::string &entityMapFile,
|
||||
else {
|
||||
throw std::ios::failure( "Error: EntityConverter failed to open .map file " + reflexMapFile );
|
||||
}
|
||||
fin.close();
|
||||
haveMapInfo_ = true;
|
||||
|
||||
//DEBUG
|
||||
//printMapping();
|
||||
//printTargetSources();
|
||||
fin.close();
|
||||
|
||||
if (haveRequiredMappings())
|
||||
haveMapInfo_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +110,8 @@ EntityConverter::extractMapInfo(std::queue<std::vector<std::string>> entities)
|
||||
}
|
||||
}
|
||||
|
||||
haveMapInfo_ = true;
|
||||
if (haveRequiredMappings())
|
||||
haveMapInfo_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -371,15 +371,21 @@ EntityConverter::convertPlayerSpawn(const std::vector<std::string> &lines) const
|
||||
}
|
||||
|
||||
if ( isModeCtf || isModeTdm || isModeFfa || isModeDuel ) {
|
||||
std::stringstream ss;
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
switch (team) {
|
||||
case 0:
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_deathmatch\"\n" );
|
||||
convertedLines.push_back ("\"classname\" \"info_player_deathmatch\"\n" );
|
||||
break;
|
||||
case 1:
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_team1\"\n" );
|
||||
case 1:
|
||||
it = entityMap_.find("team1");
|
||||
ss << "\"classname\" \"" << it->second << "\"" << std::endl;
|
||||
convertedLines.push_back (ss.str());
|
||||
break;
|
||||
case 2:
|
||||
convertedLines.push_back ( "\"classname\" \"info_player_team2\"\n" );
|
||||
it = entityMap_.find("team2");
|
||||
ss << "\"classname\" \"" << it->second << "\"" << std::endl;
|
||||
convertedLines.push_back (ss.str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -698,6 +704,24 @@ EntityConverter::mapEntities(const std::string &mapFile)
|
||||
|
||||
|
||||
|
||||
bool
|
||||
EntityConverter::haveRequiredMappings()
|
||||
{
|
||||
std::vector<std::string> required = { "team1",
|
||||
"team2" };
|
||||
for (std::string id : required) {
|
||||
auto pickupIter = entityMap_.find(id);
|
||||
if ( pickupIter == entityMap_.end() ) {
|
||||
throw std::runtime_error ("error: Missing required entity mappings");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
EntityConverter::extractFromEntity(const std::string &line, std::istream &is)
|
||||
{
|
||||
|
@ -152,6 +152,14 @@ class EntityConverter
|
||||
*--------------------------------------------------------------------------------------
|
||||
*/
|
||||
void mapEntities(const std::string &mapFile);
|
||||
/*
|
||||
*--------------------------------------------------------------------------------------
|
||||
* Class: EntityConverter
|
||||
* Method: EntityConverter :: haveRequiredMappings
|
||||
* Description: Check that required mappings exist
|
||||
*--------------------------------------------------------------------------------------
|
||||
*/
|
||||
bool haveRequiredMappings();
|
||||
/*
|
||||
*--------------------------------------------------------------------------------------
|
||||
* Class: EntityConverter
|
||||
|
Loading…
Reference in New Issue
Block a user