mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
4 Commits
fc81c505e6
...
fb348257ff
Author | SHA1 | Date |
---|---|---|
|
fb348257ff | |
|
7546c1acab | |
|
a6143eea21 | |
|
7bbe233377 |
|
@ -737,7 +737,12 @@ void StartupOneEngine(Engine *e, const TimerGameCalendar::YearMonthDay &aging_ym
|
||||||
/* Don't randomise the start-date in the first two years after gamestart to ensure availability
|
/* Don't randomise the start-date in the first two years after gamestart to ensure availability
|
||||||
* of engines in early starting games.
|
* of engines in early starting games.
|
||||||
* Note: TTDP uses fixed 1922 */
|
* Note: TTDP uses fixed 1922 */
|
||||||
e->intro_date = ei->base_intro <= TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (TimerGameCalendar::Date)GB(r, 0, 9) + ei->base_intro;
|
TimerGameCalendar::Date begin_random_date = TimerGameCalendar::ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1);
|
||||||
|
if (_settings_game.vehicle.vehicle_intro_randomisation && ei->base_intro > begin_random_date) {
|
||||||
|
e->intro_date = ei->base_intro + GB(r, 0, 9);
|
||||||
|
} else {
|
||||||
|
e->intro_date = ei->base_intro;
|
||||||
|
}
|
||||||
if (e->intro_date <= TimerGameCalendar::date) {
|
if (e->intro_date <= TimerGameCalendar::date) {
|
||||||
TimerGameCalendar::YearMonthDay intro_ymd = TimerGameCalendar::ConvertDateToYMD(e->intro_date);
|
TimerGameCalendar::YearMonthDay intro_ymd = TimerGameCalendar::ConvertDateToYMD(e->intro_date);
|
||||||
int aging_months = aging_ymd.year.base() * 12 + aging_ymd.month;
|
int aging_months = aging_ymd.year.base() * 12 + aging_ymd.month;
|
||||||
|
|
|
@ -43,26 +43,26 @@ SpriteFontCache::SpriteFontCache(FontSize fs) : FontCache(fs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get SpriteID associated with a GlyphID.
|
* Get SpriteID associated with a character.
|
||||||
* @param key Glyph to find.
|
* @param key Character to find.
|
||||||
* @return SpriteID of glyph, or 0 if not present.
|
* @return SpriteID for character, or 0 if not present.
|
||||||
*/
|
*/
|
||||||
SpriteID SpriteFontCache::GetUnicodeGlyph(GlyphID key)
|
SpriteID SpriteFontCache::GetUnicodeGlyph(char32_t key)
|
||||||
{
|
{
|
||||||
const auto found = this->glyph_to_spriteid_map.find(key & ~SPRITE_GLYPH);
|
const auto found = this->char_map.find(key);
|
||||||
if (found == std::end(this->glyph_to_spriteid_map)) return 0;
|
if (found == std::end(this->char_map)) return 0;
|
||||||
return found->second;
|
return found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFontCache::SetUnicodeGlyph(char32_t key, SpriteID sprite)
|
void SpriteFontCache::SetUnicodeGlyph(char32_t key, SpriteID sprite)
|
||||||
{
|
{
|
||||||
this->glyph_to_spriteid_map[key] = sprite;
|
this->char_map[key] = sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFontCache::InitializeUnicodeGlyphMap()
|
void SpriteFontCache::InitializeUnicodeGlyphMap()
|
||||||
{
|
{
|
||||||
/* Clear out existing glyph map if it exists */
|
/* Clear out existing glyph map if it exists */
|
||||||
this->glyph_to_spriteid_map.clear();
|
this->char_map.clear();
|
||||||
|
|
||||||
SpriteID base;
|
SpriteID base;
|
||||||
switch (this->fs) {
|
switch (this->fs) {
|
||||||
|
|
|
@ -28,8 +28,8 @@ public:
|
||||||
bool IsBuiltInFont() override { return true; }
|
bool IsBuiltInFont() override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<GlyphID, SpriteID> glyph_to_spriteid_map{}; ///< Mapping of glyphs to sprite IDs.
|
std::unordered_map<char32_t, SpriteID> char_map{}; ///< Mapping of characters to sprite IDs.
|
||||||
SpriteID GetUnicodeGlyph(GlyphID key);
|
SpriteID GetUnicodeGlyph(char32_t key);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SPRITEFONTCACHE_H */
|
#endif /* SPRITEFONTCACHE_H */
|
||||||
|
|
|
@ -1521,6 +1521,9 @@ STR_CONFIG_SETTING_WARN_OLD_VEHICLE_HELPTEXT :When enabled, a
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :Vehicles never expire: {STRING2}
|
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :Vehicles never expire: {STRING2}
|
||||||
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :When enabled, all vehicle models remain available forever after their introduction
|
STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :When enabled, all vehicle models remain available forever after their introduction
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_VEHICLE_INTRO_RANDOMISATION :Randomise vehicle introduction dates: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_VEHICLE_INTRO_RANDOMISATION_HELPTEXT :When enabled, randomises vehicle introduction dates by up to one and a half years
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TIMEKEEPING_UNITS :Timekeeping: {STRING2}
|
STR_CONFIG_SETTING_TIMEKEEPING_UNITS :Timekeeping: {STRING2}
|
||||||
STR_CONFIG_SETTING_TIMEKEEPING_UNITS_HELPTEXT :Select the timekeeping units of the game. This cannot be changed later.{}{}Calendar-based is the classic OpenTTD experience, with a year consisting of 12 months, and each month having 28-31 days.{}{}In Wallclock-based time, cargo production and financials are instead based on one-minute increments, which is about as long as a 30 day month takes in Calendar-based mode. These are grouped into 12-minute periods, equivalent to a year in Calendar-based mode.{}{}In either mode there is always a classic calendar, which is used for introduction dates of vehicles, houses, and other infrastructure
|
STR_CONFIG_SETTING_TIMEKEEPING_UNITS_HELPTEXT :Select the timekeeping units of the game. This cannot be changed later.{}{}Calendar-based is the classic OpenTTD experience, with a year consisting of 12 months, and each month having 28-31 days.{}{}In Wallclock-based time, cargo production and financials are instead based on one-minute increments, which is about as long as a 30 day month takes in Calendar-based mode. These are grouped into 12-minute periods, equivalent to a year in Calendar-based mode.{}{}In either mode there is always a classic calendar, which is used for introduction dates of vehicles, houses, and other infrastructure
|
||||||
###length 2
|
###length 2
|
||||||
|
|
|
@ -24,10 +24,12 @@
|
||||||
#include "api/script_event.hpp"
|
#include "api/script_event.hpp"
|
||||||
#include "api/script_log.hpp"
|
#include "api/script_log.hpp"
|
||||||
|
|
||||||
#include "../company_base.h"
|
#include "../company_type.h"
|
||||||
#include "../company_func.h"
|
|
||||||
#include "../fileio_func.h"
|
#include "../fileio_func.h"
|
||||||
|
#include "../goal_type.h"
|
||||||
#include "../league_type.h"
|
#include "../league_type.h"
|
||||||
|
#include "../signs_type.h"
|
||||||
|
#include "../story_type.h"
|
||||||
#include "../misc/endian_buffer.hpp"
|
#include "../misc/endian_buffer.hpp"
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
|
@ -12,12 +12,10 @@
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "../signs_func.h"
|
#include "../command_type.h"
|
||||||
#include "../vehicle_func.h"
|
#include "../company_type.h"
|
||||||
|
#include "../rail_type.h"
|
||||||
#include "../road_type.h"
|
#include "../road_type.h"
|
||||||
#include "../group.h"
|
|
||||||
#include "../goal_type.h"
|
|
||||||
#include "../story_type.h"
|
|
||||||
|
|
||||||
#include "script_types.hpp"
|
#include "script_types.hpp"
|
||||||
#include "script_log_types.hpp"
|
#include "script_log_types.hpp"
|
||||||
|
|
|
@ -797,6 +797,8 @@ SettingsContainer &GetSettingsTree()
|
||||||
orders->Add(new SettingEntry("gui.quick_goto"));
|
orders->Add(new SettingEntry("gui.quick_goto"));
|
||||||
orders->Add(new SettingEntry("gui.stop_location"));
|
orders->Add(new SettingEntry("gui.stop_location"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vehicles->Add(new SettingEntry("vehicle.vehicle_intro_randomisation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
|
SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
|
||||||
|
|
|
@ -511,6 +511,7 @@ struct VehicleSettings {
|
||||||
uint8_t freight_trains; ///< value to multiply the weight of cargo by
|
uint8_t freight_trains; ///< value to multiply the weight of cargo by
|
||||||
bool dynamic_engines; ///< enable dynamic allocation of engine data
|
bool dynamic_engines; ///< enable dynamic allocation of engine data
|
||||||
bool never_expire_vehicles; ///< never expire vehicles
|
bool never_expire_vehicles; ///< never expire vehicles
|
||||||
|
bool vehicle_intro_randomisation; ///< randomise the introduction dates of vehicles
|
||||||
uint8_t extend_vehicle_life; ///< extend vehicle life by this many years
|
uint8_t extend_vehicle_life; ///< extend vehicle life by this many years
|
||||||
uint8_t road_side; ///< the side of the road vehicles drive on
|
uint8_t road_side; ///< the side of the road vehicles drive on
|
||||||
uint8_t plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
|
uint8_t plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
|
||||||
|
|
|
@ -241,6 +241,12 @@ def = false
|
||||||
str = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES
|
str = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES
|
||||||
strhelp = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT
|
||||||
|
|
||||||
|
[SDT_BOOL]
|
||||||
|
var = vehicle.vehicle_intro_randomisation
|
||||||
|
def = true
|
||||||
|
str = STR_CONFIG_SETTING_VEHICLE_INTRO_RANDOMISATION
|
||||||
|
strhelp = STR_CONFIG_SETTING_VEHICLE_INTRO_RANDOMISATION_HELPTEXT
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = vehicle.max_trains
|
var = vehicle.max_trains
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
|
|
Loading…
Reference in New Issue