1
0
Fork 0

Add: Show version selected in the AI/GS slots as well

pull/13565/head
SamuXarick 2025-02-15 15:21:30 +00:00
parent 6ee9712d49
commit ae7903e71f
2 changed files with 10 additions and 4 deletions

View File

@ -169,8 +169,11 @@ struct AIConfigWindow : public Window {
std::string GetSlotText(CompanyID cid) const std::string GetSlotText(CompanyID cid) const
{ {
if ((_game_mode != GM_NORMAL && cid == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(cid))) return GetString(STR_AI_CONFIG_HUMAN_PLAYER); if ((_game_mode != GM_NORMAL && cid == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(cid))) return GetString(STR_AI_CONFIG_HUMAN_PLAYER);
if (const AIInfo *info = AIConfig::GetConfig(cid)->GetInfo(); info != nullptr) return info->GetName(); const AIConfig *config = AIConfig::GetConfig(cid);
return GetString(STR_AI_CONFIG_RANDOM_AI); const AIInfo *info = config->GetInfo();
if (info == nullptr) return GetString(STR_AI_CONFIG_RANDOM_AI);
if (config->GetForceExactMatch()) return GetString(STR_AI_CONFIG_NAME_VERSION, info->GetName(), info->GetVersion());
return info->GetName();
} }
/** /**

View File

@ -167,8 +167,11 @@ struct GSConfigWindow : public Window {
*/ */
std::string GetText() const std::string GetText() const
{ {
if (const GameInfo *info = GameConfig::GetConfig()->GetInfo(); info != nullptr) return info->GetName(); const GameConfig *config = GameConfig::GetConfig();
return GetString(STR_AI_CONFIG_NONE); const GameInfo *info = config->GetInfo();
if (info == nullptr) return GetString(STR_AI_CONFIG_NONE);
if (config->GetForceExactMatch()) return GetString(STR_AI_CONFIG_NAME_VERSION, info->GetName(), info->GetVersion());
return info->GetName();
} }
void DrawWidget(const Rect &r, WidgetID widget) const override void DrawWidget(const Rect &r, WidgetID widget) const override