Merge branch 'master' into jgrpp
# Conflicts: # src/debug.cpp # src/saveload/afterload.cpp # src/saveload/saveload.cpp # src/settings_type.h # src/town_cmd.cpp # src/window.cpp
This commit is contained in:
15
src/town.h
15
src/town.h
@@ -38,8 +38,8 @@ static const uint INVALID_TOWN = 0xFFFF;
|
||||
|
||||
static const uint TOWN_GROWTH_WINTER = 0xFFFFFFFE; ///< The town only needs this cargo in the winter (any amount)
|
||||
static const uint TOWN_GROWTH_DESERT = 0xFFFFFFFF; ///< The town needs the cargo for growth when on desert (any amount)
|
||||
static const uint16 TOWN_GROW_RATE_CUSTOM = 0x8000; ///< If this mask is applied to Town::growth_rate, the grow_counter will not be calculated by the system (but assumed to be set by scripts)
|
||||
static const uint16 TOWN_GROW_RATE_CUSTOM_NONE = 0xFFFF; ///< Special value for Town::growth_rate to disable town growth.
|
||||
static const uint16 TOWN_GROWTH_RATE_NONE = 0xFFFF; ///< Special value for Town::growth_rate to disable town growth.
|
||||
static const uint16 MAX_TOWN_GROWTH_TICKS = 930; ///< Max amount of original town ticks that still fit into uint16, about equal to UINT16_MAX / TOWN_GROWTH_TICKS but sligtly less to simplify calculations
|
||||
|
||||
typedef Pool<Town, TownID, 64, 64000> TownPool;
|
||||
extern TownPool _town_pool;
|
||||
@@ -193,6 +193,7 @@ enum TownFlags {
|
||||
TOWN_IS_GROWING = 0, ///< Conditions for town growth are met. Grow according to Town::growth_rate.
|
||||
TOWN_HAS_CHURCH = 1, ///< There can be only one church by town.
|
||||
TOWN_HAS_STADIUM = 2, ///< There can be only one stadium by town.
|
||||
TOWN_CUSTOM_GROWTH = 3, ///< Growth rate is controlled by GS.
|
||||
};
|
||||
|
||||
CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType type);
|
||||
@@ -223,7 +224,6 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t);
|
||||
bool GenerateTowns(TownLayout layout);
|
||||
const CargoSpec *FindFirstCargoWithTownEffect(TownEffect effect);
|
||||
|
||||
|
||||
/** Town actions of a company. */
|
||||
enum TownActions {
|
||||
TACT_NONE = 0x00, ///< Empty action set.
|
||||
@@ -313,6 +313,15 @@ void MakeDefaultName(T *obj)
|
||||
obj->town_cn = (uint16)next; // set index...
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts original town ticks counters to plain game ticks. Note that
|
||||
* tick 0 is a valid tick so actual amount is one more than the counter value.
|
||||
*/
|
||||
static inline uint16 TownTicksToGameTicks(uint16 ticks) {
|
||||
return (min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1;
|
||||
}
|
||||
|
||||
|
||||
extern uint32 _town_cargoes_accepted;
|
||||
|
||||
#endif /* TOWN_H */
|
||||
|
Reference in New Issue
Block a user