|
@@ -34,28 +34,27 @@
|
|
|
{
|
|
|
if (!IsValidTown(town_id)) return NULL;
|
|
|
|
|
|
::SetDParam(0, town_id);
|
|
|
return GetString(STR_TOWN_NAME);
|
|
|
}
|
|
|
|
|
|
/* static */ bool ScriptTown::SetText(TownID town_id, Text *text)
|
|
|
{
|
|
|
CCountedPtr<Text> counter(text);
|
|
|
|
|
|
EnforcePrecondition(false, text != NULL);
|
|
|
const char *encoded_text = text->GetDecodedText();
|
|
|
const char *encoded_text = text->GetEncodedText();
|
|
|
EnforcePreconditionEncodedText(false, encoded_text);
|
|
|
EnforcePrecondition(false, IsValidTown(town_id));
|
|
|
EnforcePreconditionCustomError(false, ::Utf8StringLength(encoded_text) < MAX_LENGTH_TOWN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
|
|
|
|
|
|
return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, 0, CMD_TOWN_SET_TEXT, encoded_text);
|
|
|
}
|
|
|
|
|
|
/* static */ int32 ScriptTown::GetPopulation(TownID town_id)
|
|
|
{
|
|
|
if (!IsValidTown(town_id)) return -1;
|
|
|
const Town *t = ::Town::Get(town_id);
|
|
|
return t->cache.population;
|
|
|
}
|
|
|
|
|
|
/* static */ int32 ScriptTown::GetHouseCount(TownID town_id)
|