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

Method GetWidgetString

src/script/script_gui.cpp:806–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804 }
805
806 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
807 {
808 if (widget != WID_SCRD_NAME_TEXT) return this->Window::GetWidgetString(widget, stringid);
809
810 if (this->filter.script_debug_company == OWNER_DEITY) {
811 const GameInfo *info = Game::GetInfo();
812 assert(info != nullptr);
813 return GetString(STR_AI_DEBUG_NAME_AND_VERSION, info->GetName(), info->GetVersion());
814 }
815 if (this->filter.script_debug_company == CompanyID::Invalid() || !Company::IsValidAiID(this->filter.script_debug_company)) {
816 return {};
817 }
818
819 const AIInfo *info = Company::Get(this->filter.script_debug_company)->ai_info;
820 return GetString(STR_AI_DEBUG_NAME_AND_VERSION, info->GetName(), info->GetVersion());
821 }
822
823 void DrawWidget(const Rect &r, WidgetID widget) const override
824 {

Callers

nothing calls this directly

Calls 4

InvalidFunction · 0.85
GetStringFunction · 0.50
GetNameMethod · 0.45
GetVersionMethod · 0.45

Tested by

no test coverage detected