| 385 | |
| 386 | |
| 387 | static 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 | //============================================================================// |
no test coverage detected