Added TeamName
parent
12be88c8c9
commit
a6ccd7f270
|
@ -3523,7 +3523,7 @@ bool COldObject::GetTooltipName(std::string& name)
|
|||
{
|
||||
GetResource(RES_OBJECT, m_type, name);
|
||||
if(GetTeam() != 0) {
|
||||
name += " [team "+boost::lexical_cast<std::string>(GetTeam())+"]"; //TODO: better way to display this
|
||||
name += " ["+CRobotMain::GetInstancePointer()->GetTeamName(GetTeam())+" ("+boost::lexical_cast<std::string>(GetTeam())+")]";
|
||||
}
|
||||
return !name.empty();
|
||||
}
|
||||
|
|
|
@ -193,6 +193,8 @@ CRobotMain::CRobotMain(CController* controller)
|
|||
m_codeBattleInit = false;
|
||||
m_codeBattleStarted = false;
|
||||
|
||||
m_teamNames.clear();
|
||||
|
||||
#if DEV_BUILD
|
||||
m_showAll = true; // for development
|
||||
#else
|
||||
|
@ -2954,6 +2956,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_codeBattleInit = false;
|
||||
m_codeBattleStarted = false;
|
||||
|
||||
m_teamNames.clear();
|
||||
|
||||
m_missionResult = ERR_MISSION_NOTERM;
|
||||
}
|
||||
|
||||
|
@ -3059,6 +3063,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "TeamName")
|
||||
{
|
||||
int team = line->GetParam("team")->AsInt();
|
||||
std::string name = line->GetParam("name")->AsString();
|
||||
m_teamNames[team] = name;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "CacheAudio" && !resetObject)
|
||||
{
|
||||
m_sound->CacheMusic(std::string("../")+line->GetParam("filename")->AsPath("music"));
|
||||
|
@ -6155,4 +6167,11 @@ bool CRobotMain::CanPlayerInteract()
|
|||
return !m_codeBattleStarted;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::string NO_TEAM_NAME = "Team";
|
||||
const std::string& CRobotMain::GetTeamName(int id)
|
||||
{
|
||||
if(m_teamNames.count(id) == 0) return NO_TEAM_NAME;
|
||||
return m_teamNames[id];
|
||||
}
|
|
@ -329,6 +329,9 @@ public:
|
|||
//! Returns true if player can interact with things manually
|
||||
bool CanPlayerInteract();
|
||||
|
||||
//! Returns team name for the given team id
|
||||
const std::string& GetTeamName(int id);
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
bool EventObject(const Event &event);
|
||||
|
@ -463,6 +466,8 @@ protected:
|
|||
bool m_codeBattleInit;
|
||||
bool m_codeBattleStarted;
|
||||
|
||||
std::map<int, std::string> m_teamNames;
|
||||
|
||||
float m_fontSize;
|
||||
Math::Point m_windowPos;
|
||||
Math::Point m_windowDim;
|
||||
|
|
Loading…
Reference in New Issue