Changeset - r26991:340cf837308d
[Not reviewed]
master
0 2 0
glx22 - 18 months ago 2023-03-04 18:32:41
glx@openttd.org
Codechange: Use SQInteger for generic numbers in script_town
2 files changed with 50 insertions and 44 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_town.cpp
Show inline comments
 
@@ -19,15 +19,15 @@
 
#include "../../landscape.h"
 
#include "../../town_cmd.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ int32 ScriptTown::GetTownCount()
 
/* static */ SQInteger ScriptTown::GetTownCount()
 
{
 
	return (int32)::Town::GetNumItems();
 
	return ::Town::GetNumItems();
 
}
 

	
 
/* static */ bool ScriptTown::IsValidTown(TownID town_id)
 
{
 
	return ::Town::IsValidID(town_id);
 
}
 
@@ -60,20 +60,20 @@
 

	
 
	EnforcePrecondition(false, IsValidTown(town_id));
 

	
 
	return ScriptObject::Command<CMD_TOWN_SET_TEXT>::Do(town_id, text != nullptr ? text->GetEncodedText() : std::string{});
 
}
 

	
 
/* static */ int32 ScriptTown::GetPopulation(TownID town_id)
 
/* static */ SQInteger 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)
 
/* static */ SQInteger ScriptTown::GetHouseCount(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 
	const Town *t = ::Town::Get(town_id);
 
	return t->cache.num_houses;
 
}
 

	
 
@@ -81,63 +81,65 @@
 
{
 
	if (!IsValidTown(town_id)) return INVALID_TILE;
 
	const Town *t = ::Town::Get(town_id);
 
	return t->xy;
 
}
 

	
 
/* static */ int32 ScriptTown::GetLastMonthProduction(TownID town_id, CargoID cargo_id)
 
/* static */ SQInteger ScriptTown::GetLastMonthProduction(TownID town_id, CargoID cargo_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 
	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 

	
 
	return t->supplied[cargo_id].old_max;
 
}
 

	
 
/* static */ int32 ScriptTown::GetLastMonthSupplied(TownID town_id, CargoID cargo_id)
 
/* static */ SQInteger ScriptTown::GetLastMonthSupplied(TownID town_id, CargoID cargo_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 
	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 

	
 
	return t->supplied[cargo_id].old_act;
 
}
 

	
 
/* static */ int32 ScriptTown::GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id)
 
/* static */ SQInteger ScriptTown::GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 
	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 
	return ::ToPercent8(t->GetPercentTransported(cargo_id));
 
}
 

	
 
/* static */ int32 ScriptTown::GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 
/* static */ SQInteger ScriptTown::GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 
	if (!ScriptCargo::IsValidTownEffect(towneffect_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 

	
 
	return t->received[towneffect_id].old_act;
 
}
 

	
 
/* static */ bool ScriptTown::SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, uint32 goal)
 
/* static */ bool ScriptTown::SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, SQInteger goal)
 
{
 
	EnforcePrecondition(false, IsValidTown(town_id));
 
	EnforcePrecondition(false, ScriptCargo::IsValidTownEffect(towneffect_id));
 

	
 
	goal = Clamp<SQInteger>(goal, 0, UINT32_MAX);
 

	
 
	return ScriptObject::Command<CMD_TOWN_CARGO_GOAL>::Do(town_id, (::TownEffect)towneffect_id, goal);
 
}
 

	
 
/* static */ uint32 ScriptTown::GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 
/* static */ SQInteger ScriptTown::GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 
{
 
	if (!IsValidTown(town_id)) return UINT32_MAX;
 
	if (!ScriptCargo::IsValidTownEffect(towneffect_id)) return UINT32_MAX;
 
	if (!IsValidTown(town_id)) return -1;
 
	if (!ScriptCargo::IsValidTownEffect(towneffect_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 

	
 
	switch (t->goal[towneffect_id]) {
 
		case TOWN_GROWTH_WINTER:
 
			if (TileHeight(t->xy) >= GetSnowLine() && t->cache.population > 90) return 1;
 
@@ -148,13 +150,13 @@
 
			return 0;
 

	
 
		default: return t->goal[towneffect_id];
 
	}
 
}
 

	
 
/* static */ bool ScriptTown::SetGrowthRate(TownID town_id, uint32 days_between_town_growth)
 
/* static */ bool ScriptTown::SetGrowthRate(TownID town_id, SQInteger days_between_town_growth)
 
{
 
	EnforcePrecondition(false, IsValidTown(town_id));
 
	uint16 growth_rate;
 
	switch (days_between_town_growth) {
 
		case TOWN_GROWTH_NORMAL:
 
			growth_rate = 0;
 
@@ -164,36 +166,36 @@
 
			growth_rate = TOWN_GROWTH_RATE_NONE;
 
			break;
 

	
 
		default:
 
			EnforcePrecondition(false, (days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS) <= MAX_TOWN_GROWTH_TICKS);
 
			/* Don't use growth_rate 0 as it means GROWTH_NORMAL */
 
			growth_rate = std::max(days_between_town_growth * DAY_TICKS, 2u) - 1;
 
			growth_rate = std::max<SQInteger>(days_between_town_growth * DAY_TICKS, 2u) - 1;
 
			break;
 
	}
 

	
 
	return ScriptObject::Command<CMD_TOWN_GROWTH_RATE>::Do(town_id, growth_rate);
 
}
 

	
 
/* static */ int32 ScriptTown::GetGrowthRate(TownID town_id)
 
/* static */ SQInteger ScriptTown::GetGrowthRate(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 

	
 
	if (t->growth_rate == TOWN_GROWTH_RATE_NONE) return TOWN_GROWTH_NONE;
 

	
 
	return RoundDivSU(t->growth_rate + 1, DAY_TICKS);
 
}
 

	
 
/* static */ int32 ScriptTown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile)
 
/* static */ SQInteger ScriptTown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile)
 
{
 
	return ScriptMap::DistanceManhattan(tile, GetLocation(town_id));
 
}
 

	
 
/* static */ int32 ScriptTown::GetDistanceSquareToTile(TownID town_id, TileIndex tile)
 
/* static */ SQInteger ScriptTown::GetDistanceSquareToTile(TownID town_id, TileIndex tile)
 
{
 
	return ScriptMap::DistanceSquare(tile, GetLocation(town_id));
 
}
 

	
 
/* static */ bool ScriptTown::IsWithinTownInfluence(TownID town_id, TileIndex tile)
 
{
 
@@ -215,20 +217,20 @@
 
{
 
	if (!IsValidTown(town_id)) return false;
 

	
 
	return ::Town::Get(town_id)->larger_town;
 
}
 

	
 
/* static */ int ScriptTown::GetRoadReworkDuration(TownID town_id)
 
/* static */ SQInteger ScriptTown::GetRoadReworkDuration(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 

	
 
	return ::Town::Get(town_id)->road_build_months;
 
}
 

	
 
/* static */ int ScriptTown::GetFundBuildingsDuration(TownID town_id)
 
/* static */ SQInteger ScriptTown::GetFundBuildingsDuration(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 

	
 
	return ::Town::Get(town_id)->fund_buildings_months;
 
}
 

	
 
@@ -237,13 +239,13 @@
 
	if (ScriptObject::GetCompany() == OWNER_DEITY) return ScriptCompany::COMPANY_INVALID;
 
	if (!IsValidTown(town_id)) return ScriptCompany::COMPANY_INVALID;
 

	
 
	return (ScriptCompany::CompanyID)(int8)::Town::Get(town_id)->exclusivity;
 
}
 

	
 
/* static */ int32 ScriptTown::GetExclusiveRightsDuration(TownID town_id)
 
/* static */ SQInteger ScriptTown::GetExclusiveRightsDuration(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 

	
 
	return ::Town::Get(town_id)->exclusive_counter;
 
}
 

	
 
@@ -261,18 +263,20 @@
 
	EnforcePrecondition(false, IsValidTown(town_id));
 
	EnforcePrecondition(false, IsActionAvailable(town_id, town_action));
 

	
 
	return ScriptObject::Command<CMD_DO_TOWN_ACTION>::Do(town_id, town_action);
 
}
 

	
 
/* static */ bool ScriptTown::ExpandTown(TownID town_id, int houses)
 
/* static */ bool ScriptTown::ExpandTown(TownID town_id, SQInteger houses)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
 
	EnforcePrecondition(false, IsValidTown(town_id));
 
	EnforcePrecondition(false, houses > 0);
 

	
 
	houses = std::min<SQInteger>(houses, UINT32_MAX);
 

	
 
	return ScriptObject::Command<CMD_EXPAND_TOWN>::Do(town_id, houses);
 
}
 

	
 
/* static */ bool ScriptTown::FoundTown(TileIndex tile, TownSize size, bool city, RoadLayout layout, Text *name)
 
{
 
	CCountedPtr<Text> counter(name);
 
@@ -327,23 +331,23 @@
 
		return TOWN_RATING_EXCELLENT;
 
	} else {
 
		return TOWN_RATING_OUTSTANDING;
 
	}
 
}
 

	
 
/* static */ int ScriptTown::GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id)
 
/* static */ SQInteger ScriptTown::GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id)
 
{
 
	if (!IsValidTown(town_id)) return TOWN_RATING_INVALID;
 
	ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
 
	if (company == ScriptCompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
 

	
 
	const Town *t = ::Town::Get(town_id);
 
	return t->ratings[company];
 
}
 

	
 
/* static */ bool ScriptTown::ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta)
 
/* static */ bool ScriptTown::ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, SQInteger delta)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
 
	EnforcePrecondition(false, IsValidTown(town_id));
 
	ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
 
	EnforcePrecondition(false, company != ScriptCompany::COMPANY_INVALID);
 

	
 
@@ -351,13 +355,13 @@
 
	int16 new_rating = Clamp(t->ratings[company] + delta, RATING_MINIMUM, RATING_MAXIMUM);
 
	if (new_rating == t->ratings[company]) return false;
 

	
 
	return ScriptObject::Command<CMD_TOWN_RATING>::Do(town_id, (::CompanyID)company_id, new_rating);
 
}
 

	
 
/* static */ int ScriptTown::GetAllowedNoise(TownID town_id)
 
/* static */ SQInteger ScriptTown::GetAllowedNoise(TownID town_id)
 
{
 
	if (!IsValidTown(town_id)) return -1;
 

	
 
	const Town *t = ::Town::Get(town_id);
 
	if (_settings_game.economy.station_noise_level) {
 
		return t->MaxTownNoise() - t->noise_reached;
src/script/api/script_town.hpp
Show inline comments
 
@@ -124,13 +124,13 @@ public:
 
	};
 

	
 
	/**
 
	 * Gets the number of towns.
 
	 * @return The number of towns.
 
	 */
 
	static int32 GetTownCount();
 
	static SQInteger GetTownCount();
 

	
 
	/**
 
	 * Checks whether the given town index is valid.
 
	 * @param town_id The index to check.
 
	 * @return True if and only if the town is valid.
 
	 */
 
@@ -167,21 +167,21 @@ public:
 
	/**
 
	 * Gets the number of inhabitants in the town.
 
	 * @param town_id The town to get the population of.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The number of inhabitants.
 
	 */
 
	static int32 GetPopulation(TownID town_id);
 
	static SQInteger GetPopulation(TownID town_id);
 

	
 
	/**
 
	 * Gets the number of houses in the town.
 
	 * @param town_id The town to get the number of houses of.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The number of houses.
 
	 */
 
	static int32 GetHouseCount(TownID town_id);
 
	static SQInteger GetHouseCount(TownID town_id);
 

	
 
	/**
 
	 * Gets the location of the town.
 
	 * @param town_id The town to get the location of.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The location of the town.
 
@@ -193,68 +193,69 @@ public:
 
	 * @param town_id The index of the town.
 
	 * @param cargo_id The index of the cargo.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 
	 * @return The last month's production of the given cargo for this town.
 
	 */
 
	static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
 
	static SQInteger GetLastMonthProduction(TownID town_id, CargoID cargo_id);
 

	
 
	/**
 
	 * Get the total amount of cargo supplied from a town last month.
 
	 * @param town_id The index of the town.
 
	 * @param cargo_id The index of the cargo.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 
	 * @return The amount of cargo supplied for transport from this town last month.
 
	 */
 
	static int32 GetLastMonthSupplied(TownID town_id, CargoID cargo_id);
 
	static SQInteger GetLastMonthSupplied(TownID town_id, CargoID cargo_id);
 

	
 
	/**
 
	 * Get the percentage of transported production of the given cargo at a town.
 
	 * @param town_id The index of the town.
 
	 * @param cargo_id The index of the cargo.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 
	 * @return The percentage of given cargo transported from this town last month.
 
	 */
 
	static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
 
	static SQInteger GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
 

	
 
	/**
 
	 * Get the total amount of cargo effects received by a town last month.
 
	 * @param town_id The index of the town.
 
	 * @param towneffect_id The index of the cargo.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidTownEffect(cargo_id).
 
	 * @return The amount of cargo received by this town last month for this cargo effect.
 
	 */
 
	static int32 GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 
	static SQInteger GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 

	
 
	/**
 
	 * Set the goal of a cargo for this town.
 
	 * @param town_id The index of the town.
 
	 * @param towneffect_id The index of the towneffect.
 
	 * @param goal The new goal.
 
	 *             The value will be clamped to 0 .. MAX(uint32).
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidTownEffect(towneffect_id).
 
	 * @return True if the action succeeded.
 
	 * @api -ai
 
	 */
 
	static bool SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, uint32 goal);
 
	static bool SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, SQInteger goal);
 

	
 
	/**
 
	 * Get the amount of cargo that needs to be delivered (per TownEffect) for a
 
	 *  town to grow. All goals need to be reached before a town will grow.
 
	 * @param town_id The index of the town.
 
	 * @param towneffect_id The index of the towneffect.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCargo::IsValidTownEffect(towneffect_id).
 
	 * @return The goal of the cargo.
 
	 * @note Goals can change over time. For example with a changing snowline, or
 
	 *  with a growing town.
 
	 */
 
	static uint32 GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 
	static SQInteger GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 

	
 
	/**
 
	 * Set the amount of days between town growth.
 
	 * @param town_id The index of the town.
 
	 * @param days_between_town_growth The amount of days between town growth, TOWN_GROWTH_NONE or TOWN_GROWTH_NORMAL.
 
	 * @pre IsValidTown(town_id).
 
@@ -262,42 +263,42 @@ public:
 
	 * @return True if the action succeeded.
 
	 * @note Even when setting a growth rate, towns only grow when the conditions for growth (SetCargoCoal) are met,
 
	 *       and the game settings (economy.town_growth_rate) allow town growth at all.
 
	 * @note When changing the growth rate, the relative progress is preserved and scaled to the new rate.
 
	 * @api -ai
 
	 */
 
	static bool SetGrowthRate(TownID town_id, uint32 days_between_town_growth);
 
	static bool SetGrowthRate(TownID town_id, SQInteger days_between_town_growth);
 

	
 
	/**
 
	 * Get the amount of days between town growth.
 
	 * @param town_id The index of the town.
 
	 * @pre IsValidTown(town_id).
 
	 * @return Amount of days between town growth, or TOWN_GROWTH_NONE.
 
	 * @note This function does not indicate when it will grow next. It only tells you the time between growths.
 
	 */
 
	static int32 GetGrowthRate(TownID town_id);
 
	static SQInteger GetGrowthRate(TownID town_id);
 

	
 
	/**
 
	 * Get the manhattan distance from the tile to the ScriptTown::GetLocation()
 
	 *  of the town.
 
	 * @param town_id The town to get the distance to.
 
	 * @param tile The tile to get the distance to.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The distance between town and tile.
 
	 */
 
	static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
 
	static SQInteger GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
 

	
 
	/**
 
	 * Get the square distance from the tile to the ScriptTown::GetLocation()
 
	 *  of the town.
 
	 * @param town_id The town to get the distance to.
 
	 * @param tile The tile to get the distance to.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The distance between town and tile.
 
	 */
 
	static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
 
	static SQInteger GetDistanceSquareToTile(TownID town_id, TileIndex tile);
 

	
 
	/**
 
	 * Find out if this tile is within the rating influence of a town.
 
	 *  If a station sign would be on this tile, the servicing quality of the station would
 
	 *  influence the rating of the town.
 
	 * @param town_id The town to check.
 
@@ -328,22 +329,22 @@ public:
 
	 * Find out how long the town is undergoing road reconstructions.
 
	 * @param town_id The town to check.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The number of months the road reworks are still going to take.
 
	 *         The value 0 means that there are currently no road reworks.
 
	 */
 
	static int GetRoadReworkDuration(TownID town_id);
 
	static SQInteger GetRoadReworkDuration(TownID town_id);
 

	
 
	/**
 
	 * Find out how long new buildings are still being funded in a town.
 
	 * @param town_id The town to check.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The number of months building construction is still funded.
 
	 *         The value 0 means that there is currently no funding.
 
	 */
 
	static int GetFundBuildingsDuration(TownID town_id);
 
	static SQInteger GetFundBuildingsDuration(TownID town_id);
 

	
 
	/**
 
	 * Find out which company currently has the exclusive rights of this town.
 
	 * @param town_id The town to check.
 
	 * @pre IsValidTown(town_id).
 
	 * @game @pre Valid ScriptCompanyMode active in scope.
 
@@ -358,13 +359,13 @@ public:
 
	 * @param town_id The town to check.
 
	 * @pre IsValidTown(town_id).
 
	 * @return The number of months the exclusive rights hold.
 
	 *         The value 0 means that there are currently no exclusive rights
 
	 *         given out to anyone.
 
	 */
 
	static int32 GetExclusiveRightsDuration(TownID town_id);
 
	static SQInteger GetExclusiveRightsDuration(TownID town_id);
 

	
 
	/**
 
	 * Find out if an action can currently be performed on the town.
 
	 * @param town_id The town to perform the action on.
 
	 * @param town_action The action to perform on the town.
 
	 * @pre IsValidTown(town_id).
 
@@ -385,18 +386,19 @@ public:
 
	static bool PerformTownAction(TownID town_id, TownAction town_action);
 

	
 
	/**
 
	 * Expand the town.
 
	 * @param town_id The town to expand.
 
	 * @param houses The amount of houses to grow the town with.
 
	 *               The value will be clamped to 0 .. MAX(uint32).
 
	 * @pre IsValidTown(town_id).
 
	 * @pre houses > 0.
 
	 * @return True if the action succeeded.
 
	 * @api -ai
 
	 */
 
	static bool ExpandTown(TownID town_id, int houses);
 
	static bool ExpandTown(TownID town_id, SQInteger houses);
 

	
 
	/**
 
	 * Found a new town.
 
	 * @param tile The location of the new town.
 
	 * @param size The town size of the new town.
 
	 * @param city True if the new town should be a city.
 
@@ -430,34 +432,34 @@ public:
 
	 * @param company_id The company to get the rating for.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
 
	 * @return The rating as a number between -1000 (worst) and 1000 (best).
 
	 * @api -ai
 
	 */
 
	static int GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id);
 
	static SQInteger GetDetailedRating(TownID town_id, ScriptCompany::CompanyID company_id);
 

	
 
	/**
 
	 * Change the rating of a company within a town.
 
	 * @param town_id The town to change the rating in.
 
	 * @param company_id The company to change the rating for.
 
	 * @param delta How much to change rating by (range -1000 to +1000).
 
	 * @return True if the rating was changed.
 
	 * @pre IsValidTown(town_id).
 
	 * @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
 
	 * @pre no company mode in scope
 
	 * @api -ai
 
	 */
 
	static bool ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, int delta);
 
	static bool ChangeRating(TownID town_id, ScriptCompany::CompanyID company_id, SQInteger delta);
 

	
 
	/**
 
	 * Get the maximum level of noise that still can be added by airports
 
	 *  before the town start to refuse building a new airport.
 
	 * @param town_id The town to get the allowed noise from.
 
	 * @return The noise that still can be added.
 
	 */
 
	static int GetAllowedNoise(TownID town_id);
 
	static SQInteger GetAllowedNoise(TownID town_id);
 

	
 
	/**
 
	 * Get the road layout for a town.
 
	 * @param town_id The town to get the road layout from.
 
	 * @return The RoadLayout for the town.
 
	 */
0 comments (0 inline, 0 general)