MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetSlotText

Method GetSlotText

src/ai/ai_gui.cpp:169–174  ·  view source on GitHub ↗

* Get text to display for a given company slot. * @param cid Company to display. * @returns Text to display for company. */

Source from the content-addressed store, hash-verified

167 * @returns Text to display for company.
168 */
169 std::string GetSlotText(CompanyID cid) const
170 {
171 if ((_game_mode != GM_NORMAL && cid == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(cid))) return GetString(STR_AI_CONFIG_HUMAN_PLAYER);
172 if (const AIInfo *info = AIConfig::GetConfig(cid)->GetInfo(); info != nullptr) return info->GetName();
173 return GetString(STR_AI_CONFIG_RANDOM_AI);
174 }
175
176 /**
177 * Get colour to display text in for a given company slot.

Callers 1

DrawWidgetMethod · 0.95

Calls 4

GetConfigFunction · 0.85
GetStringFunction · 0.50
GetInfoMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected