MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ParseTeam

Function ParseTeam

src/lua/LuaCallOuts.cpp:387–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385
386
387static inline TeamColor ParseTeam(lua_State* L, int index) {
388 if (lua_israwstring(L, index)) {
389 const std::string teamName = lua_tostring(L, index);
390 const std::map<std::string, TeamColor>& teamNames = GetTeamNameMap();
391 std::map<std::string, TeamColor>::const_iterator it = teamNames.find(teamName);
392 if (it == teamNames.end()) {
393 return NoTeam;
394 }
395 return it->second;
396 }
397
398 TeamColor teamNum = (TeamColor)luaL_checkint(L, index);
399 if ((teamNum < AutomaticTeam) || (teamNum >= NumTeams)) {
400 return NoTeam;
401 }
402
403 return teamNum;
404}
405
406
407//============================================================================//

Callers 7

GetTeamNameMethod · 0.70
GetTeamLongNameMethod · 0.70
GetTeamCountMethod · 0.70
GetTeamScoreMethod · 0.70
GetTeamColorMethod · 0.70
GetTeamRadarColorMethod · 0.70
GetTeamsAreEnemiesMethod · 0.70

Calls 3

lua_israwstringFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected