Feature: Allow GameScripts to add additional text to Industry view window
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "script_map.hpp"
|
||||
#include "../../company_base.h"
|
||||
#include "../../industry.h"
|
||||
#include "../../string_func.h"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../station_base.h"
|
||||
#include "../../newgrf_industries.h"
|
||||
@@ -47,6 +48,20 @@
|
||||
return GetString(STR_INDUSTRY_NAME);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptIndustry::SetText(IndustryID industry_id, Text *text)
|
||||
{
|
||||
CCountedPtr<Text> counter(text);
|
||||
|
||||
const char *encoded_text = nullptr;
|
||||
if (text != nullptr) {
|
||||
encoded_text = text->GetEncodedText();
|
||||
EnforcePreconditionEncodedText(false, encoded_text);
|
||||
}
|
||||
EnforcePrecondition(false, IsValidIndustry(industry_id));
|
||||
|
||||
return ScriptObject::DoCommand(0, industry_id, static_cast<uint32>(IndustryAction::SetText), CMD_INDUSTRY_CTRL, encoded_text);
|
||||
}
|
||||
|
||||
/* static */ ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidIndustry(industry_id)) return CAS_NOT_ACCEPTED;
|
||||
|
Reference in New Issue
Block a user