Merge pull request #1 from JGRennison/jgrpp
Synchronize with forked repository
This commit is contained in:
@@ -71,7 +71,7 @@ Company::Company(uint16 name_1, bool is_ai)
|
||||
this->purchase_land_limit = (uint32)_settings_game.construction.purchase_land_frame_burst << 16;
|
||||
this->build_object_limit = (uint32)_settings_game.construction.build_object_frame_burst << 16;
|
||||
|
||||
for (uint j = 0; j < 4; j++) this->share_owners[j] = COMPANY_SPECTATOR;
|
||||
for (uint j = 0; j < 4; j++) this->share_owners[j] = INVALID_OWNER;
|
||||
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY);
|
||||
}
|
||||
|
||||
|
@@ -495,7 +495,7 @@ struct CompanyFinancesWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
|
||||
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_CF_INCREASE_LOAN: {
|
||||
|
@@ -60,8 +60,8 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index)
|
||||
this->data = ReallocT(this->data, new_size);
|
||||
MemSetT(this->data + this->size, 0, new_size - this->size);
|
||||
|
||||
this->free_bitmap = ReallocT(this->free_bitmap, CeilDiv(new_size, 64));
|
||||
MemSetT(this->free_bitmap + CeilDiv(this->size, 64), 0, CeilDiv(new_size, 64) - CeilDiv(this->size, 64));
|
||||
this->free_bitmap = ReallocT(this->free_bitmap, CeilDivT<size_t>(new_size, 64));
|
||||
MemSetT(this->free_bitmap + CeilDivT<size_t>(this->size, 64), 0, CeilDivT<size_t>(new_size, 64) - CeilDivT<size_t>(this->size, 64));
|
||||
if (new_size % 64 != 0) {
|
||||
this->free_bitmap[new_size / 64] |= (~((uint64) 0)) << (new_size % 64);
|
||||
}
|
||||
@@ -75,8 +75,8 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index)
|
||||
*/
|
||||
DEFINE_POOL_METHOD(inline size_t)::FindFirstFree()
|
||||
{
|
||||
uint bitmap_index = this->first_free / 64;
|
||||
uint bitmap_end = CeilDiv(this->first_unused, 64);
|
||||
size_t bitmap_index = this->first_free / 64;
|
||||
size_t bitmap_end = CeilDivT<size_t>(this->first_unused, 64);
|
||||
|
||||
for (; bitmap_index < bitmap_end; bitmap_index++) {
|
||||
uint64 available = ~this->free_bitmap[bitmap_index];
|
||||
|
@@ -333,10 +333,12 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
|
||||
Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
|
||||
const Company *c = Company::Get(old_owner);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (c->share_owners[i] == INVALID_OWNER) continue;
|
||||
|
||||
if (c->bankrupt_value == 0 && c->share_owners[i] == new_owner) {
|
||||
/* You are the one buying the company; so don't sell the shares back to you. */
|
||||
Company::Get(new_owner)->share_owners[i] = COMPANY_SPECTATOR;
|
||||
} else if (c->share_owners[i] != INVALID_OWNER) {
|
||||
Company::Get(new_owner)->share_owners[i] = INVALID_OWNER;
|
||||
} else {
|
||||
cur_company2.Change(c->share_owners[i]);
|
||||
/* Sell the shares */
|
||||
CommandCost res = DoCommand(0, old_owner, 0, DC_EXEC | DC_BANKRUPT, CMD_SELL_SHARE_IN_COMPANY);
|
||||
|
@@ -70,17 +70,17 @@ private:
|
||||
public:
|
||||
SpriteFontCache(FontSize fs);
|
||||
~SpriteFontCache();
|
||||
virtual SpriteID GetUnicodeGlyph(WChar key);
|
||||
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite);
|
||||
virtual SpriteID GetUnicodeGlyph(WChar key) override;
|
||||
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite) override;
|
||||
virtual void InitializeUnicodeGlyphMap() override;
|
||||
virtual void ClearFontCache();
|
||||
virtual const Sprite *GetGlyph(GlyphID key);
|
||||
virtual uint GetGlyphWidth(GlyphID key);
|
||||
virtual bool GetDrawGlyphShadow();
|
||||
virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
|
||||
virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; }
|
||||
virtual void ClearFontCache() override;
|
||||
virtual const Sprite *GetGlyph(GlyphID key) override;
|
||||
virtual uint GetGlyphWidth(GlyphID key) override;
|
||||
virtual bool GetDrawGlyphShadow() override;
|
||||
virtual GlyphID MapCharToGlyph(WChar key) override { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
|
||||
virtual const void *GetFontTable(uint32 tag, size_t &length) override { length = 0; return nullptr; }
|
||||
virtual const char *GetFontName() { return "sprite"; }
|
||||
virtual bool IsBuiltInFont() { return true; }
|
||||
virtual bool IsBuiltInFont() override { return true; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -2185,6 +2185,8 @@ void UpdateGUIZoom()
|
||||
_gui_zoom = static_cast<ZoomLevel>(_gui_zoom_cfg);
|
||||
}
|
||||
|
||||
ZoomLevel old_font_zoom = _font_zoom;
|
||||
|
||||
/* Determine real font zoom to use. */
|
||||
if (_font_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_font_zoom = static_cast<ZoomLevel>(VideoDriver::GetInstance()->GetSuggestedUIZoom());
|
||||
@@ -2192,6 +2194,10 @@ void UpdateGUIZoom()
|
||||
_font_zoom = static_cast<ZoomLevel>(_font_zoom_cfg);
|
||||
}
|
||||
|
||||
if (old_font_zoom != _font_zoom) {
|
||||
ClearFontCache();
|
||||
}
|
||||
|
||||
UpdateFontHeightCache();
|
||||
}
|
||||
|
||||
|
@@ -397,6 +397,7 @@ static void UpdateRouteStepSpriteSize()
|
||||
_vp_route_step_subsprite.top = 0;
|
||||
}
|
||||
|
||||
#if !defined(DEDICATED)
|
||||
/* multi can be density, field type, ... */
|
||||
static SpriteID GetSpriteIDForClearGround(const ClearGround cg, const Slope slope, const uint multi)
|
||||
{
|
||||
@@ -415,6 +416,7 @@ static SpriteID GetSpriteIDForClearGround(const ClearGround cg, const Slope slop
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
#endif /* !DEDICATED */
|
||||
|
||||
/** Once the sprites are loaded, we can determine main colours of ground/water/... */
|
||||
void GfxDetermineMainColours()
|
||||
|
@@ -586,7 +586,7 @@ public:
|
||||
void SendCommand(Packet *p, const CommandPacket *cp);
|
||||
|
||||
virtual std::string GetDebugInfo() const;
|
||||
virtual void LogSentPacket(const Packet &pkt);
|
||||
virtual void LogSentPacket(const Packet &pkt) override;
|
||||
};
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_GAME_H */
|
||||
|
@@ -200,7 +200,7 @@ struct DeterministicSpriteGroup : SpriteGroup {
|
||||
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override;
|
||||
|
||||
protected:
|
||||
const SpriteGroup *Resolve(ResolverObject &object) const;
|
||||
const SpriteGroup *Resolve(ResolverObject &object) const override;
|
||||
};
|
||||
|
||||
enum RandomizedSpriteGroupCompareMode {
|
||||
@@ -224,7 +224,7 @@ struct RandomizedSpriteGroup : SpriteGroup {
|
||||
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override;
|
||||
|
||||
protected:
|
||||
const SpriteGroup *Resolve(ResolverObject &object) const;
|
||||
const SpriteGroup *Resolve(ResolverObject &object) const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ struct CallbackResultSpriteGroup : SpriteGroup {
|
||||
}
|
||||
|
||||
uint16 result;
|
||||
uint16 GetCallbackResult() const { return this->result; }
|
||||
uint16 GetCallbackResult() const override { return this->result; }
|
||||
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override;
|
||||
};
|
||||
|
||||
|
@@ -1820,7 +1820,6 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
case OCV_COUNTER_VALUE:
|
||||
case OCV_TIME_DATE:
|
||||
case OCV_TIMETABLE:
|
||||
if (data >= (1 << 16)) return CMD_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -72,6 +72,7 @@
|
||||
#include "scope_info.h"
|
||||
#include "viewport_func.h"
|
||||
#include "gui.h"
|
||||
#include "statusbar_gui.h"
|
||||
|
||||
#include "void_map.h"
|
||||
#include "station_base.h"
|
||||
@@ -1306,6 +1307,7 @@ static bool UpdateTimeSettings(int32 p1)
|
||||
{
|
||||
SetupTimeSettings();
|
||||
InvalidateVehTimetableWindow(p1);
|
||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_REINIT);
|
||||
MarkWholeScreenDirty();
|
||||
return true;
|
||||
}
|
||||
|
@@ -580,7 +580,6 @@ struct GameOptionsWindow : Window {
|
||||
GfxClearSpriteCache();
|
||||
_font_zoom_cfg = new_zoom;
|
||||
UpdateGUIZoom();
|
||||
ClearFontCache();
|
||||
LoadStringWidthTable();
|
||||
UpdateAllVirtCoords();
|
||||
ReInitAllWindows(true);
|
||||
@@ -1904,7 +1903,6 @@ static SettingsContainer &GetSettingsTree()
|
||||
{
|
||||
accounting->Add(new SettingEntry("economy.inflation"));
|
||||
accounting->Add(new SettingEntry("economy.inflation_fixed_dates"));
|
||||
accounting->Add(new SettingEntry("economy.day_length_factor"));
|
||||
accounting->Add(new SettingEntry("difficulty.initial_interest"));
|
||||
accounting->Add(new SettingEntry("difficulty.max_loan"));
|
||||
accounting->Add(new SettingEntry("difficulty.subsidy_multiplier"));
|
||||
@@ -2122,6 +2120,7 @@ static SettingsContainer &GetSettingsTree()
|
||||
treedist->Add(new SettingEntry("construction.tree_growth_rate"));
|
||||
}
|
||||
|
||||
environment->Add(new SettingEntry("economy.day_length_factor"));
|
||||
environment->Add(new SettingEntry("station.modified_catchment"));
|
||||
environment->Add(new SettingEntry("station.catchment_increase"));
|
||||
environment->Add(new SettingEntry("station.cargo_class_rating_wait_time"));
|
||||
|
@@ -115,8 +115,8 @@ struct StatusBarWindow : Window {
|
||||
Dimension d;
|
||||
switch (widget) {
|
||||
case WID_S_LEFT:
|
||||
SetDParamMaxValue(0, MAX_YEAR * DAYS_IN_YEAR);
|
||||
d = GetStringBoundingBox(STR_WHITE_DATE_LONG);
|
||||
SetDParam(0, (uint64)MAX_YEAR * (uint64)DAYS_IN_YEAR * (uint64)DAY_TICKS * (uint64)_settings_game.economy.day_length_factor);
|
||||
d = GetStringBoundingBox(STR_WHITE_DATE_WALLCLOCK_LONG);
|
||||
break;
|
||||
|
||||
case WID_S_RIGHT: {
|
||||
@@ -210,6 +210,9 @@ struct StatusBarWindow : Window {
|
||||
this->ticker_scroll = TICKER_STOP; // reset ticker ...
|
||||
this->reminder_timeout.SetInterval(REMINDER_STOP); // ... and reminder
|
||||
break;
|
||||
case SBI_REINIT:
|
||||
this->ReInit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ enum StatusBarInvalidate {
|
||||
SBI_SHOW_TICKER, ///< start scrolling news
|
||||
SBI_SHOW_REMINDER, ///< show a reminder (dot on the right side of the statusbar)
|
||||
SBI_NEWS_DELETED, ///< abort current news display (active news were deleted)
|
||||
SBI_REINIT, ///< reinit status bar
|
||||
SBI_END
|
||||
};
|
||||
|
||||
|
@@ -38,9 +38,9 @@ int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FO
|
||||
int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) WARN_FORMAT(3, 0);
|
||||
|
||||
char *CDECL str_fmt(const char *str, ...) WARN_FORMAT(1, 2);
|
||||
char *str_vfmt(const char *str, va_list ap);
|
||||
char *str_vfmt(const char *str, va_list ap) WARN_FORMAT(1, 0);
|
||||
std::string CDECL stdstr_fmt(const char *str, ...) WARN_FORMAT(1, 2);
|
||||
std::string stdstr_vfmt(const char *str, va_list va);
|
||||
std::string stdstr_vfmt(const char *str, va_list va) WARN_FORMAT(1, 0);
|
||||
|
||||
char *str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);
|
||||
std::string str_validate(const std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);
|
||||
|
@@ -4794,7 +4794,7 @@ max = 3
|
||||
str = STR_CONFIG_SETTING_DATE_WITH_TIME
|
||||
strval = STR_CONFIG_SETTING_DATE_WITH_TIME_NONE
|
||||
strhelp = STR_CONFIG_SETTING_DATE_WITH_TIME_HELPTEXT
|
||||
proc = RedrawScreen
|
||||
proc = UpdateTimeSettings
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.timetable_start_text_entry
|
||||
|
@@ -874,8 +874,8 @@ static uint ConvertIntegerValue(TraceRestrictValueType type, uint in, bool to_di
|
||||
|
||||
case TRVT_SPEED:
|
||||
return to_display
|
||||
? ConvertSpeedToDisplaySpeed(in) * 10 / 16
|
||||
: ConvertDisplaySpeedToSpeed(in) * 16 / 10;
|
||||
? ConvertKmhishSpeedToDisplaySpeed(in)
|
||||
: ConvertDisplaySpeedToKmhishSpeed(in);
|
||||
|
||||
case TRVT_WEIGHT:
|
||||
return to_display
|
||||
|
Reference in New Issue
Block a user