Fix various compiler warnings

See: #267
pull/275/head
Jonathan G Rennison 3 years ago
parent 24783c3d26
commit 97d5982cb5

@ -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) { switch (widget) {
case WID_CF_INCREASE_LOAN: { 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); this->data = ReallocT(this->data, new_size);
MemSetT(this->data + this->size, 0, new_size - this->size); MemSetT(this->data + this->size, 0, new_size - this->size);
this->free_bitmap = ReallocT(this->free_bitmap, CeilDiv(new_size, 64)); this->free_bitmap = ReallocT(this->free_bitmap, CeilDivT<size_t>(new_size, 64));
MemSetT(this->free_bitmap + CeilDiv(this->size, 64), 0, CeilDiv(new_size, 64) - CeilDiv(this->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) { if (new_size % 64 != 0) {
this->free_bitmap[new_size / 64] |= (~((uint64) 0)) << (new_size % 64); 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() DEFINE_POOL_METHOD(inline size_t)::FindFirstFree()
{ {
uint bitmap_index = this->first_free / 64; size_t bitmap_index = this->first_free / 64;
uint bitmap_end = CeilDiv(this->first_unused, 64); size_t bitmap_end = CeilDivT<size_t>(this->first_unused, 64);
for (; bitmap_index < bitmap_end; bitmap_index++) { for (; bitmap_index < bitmap_end; bitmap_index++) {
uint64 available = ~this->free_bitmap[bitmap_index]; uint64 available = ~this->free_bitmap[bitmap_index];

@ -70,17 +70,17 @@ private:
public: public:
SpriteFontCache(FontSize fs); SpriteFontCache(FontSize fs);
~SpriteFontCache(); ~SpriteFontCache();
virtual SpriteID GetUnicodeGlyph(WChar key); virtual SpriteID GetUnicodeGlyph(WChar key) override;
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite); virtual void SetUnicodeGlyph(WChar key, SpriteID sprite) override;
virtual void InitializeUnicodeGlyphMap() override; virtual void InitializeUnicodeGlyphMap() override;
virtual void ClearFontCache(); virtual void ClearFontCache() override;
virtual const Sprite *GetGlyph(GlyphID key); virtual const Sprite *GetGlyph(GlyphID key) override;
virtual uint GetGlyphWidth(GlyphID key); virtual uint GetGlyphWidth(GlyphID key) override;
virtual bool GetDrawGlyphShadow(); virtual bool GetDrawGlyphShadow() override;
virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } virtual GlyphID MapCharToGlyph(WChar key) override { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; } virtual const void *GetFontTable(uint32 tag, size_t &length) override { length = 0; return nullptr; }
virtual const char *GetFontName() { return "sprite"; } virtual const char *GetFontName() { return "sprite"; }
virtual bool IsBuiltInFont() { return true; } virtual bool IsBuiltInFont() override { return true; }
}; };
/** /**

@ -397,6 +397,7 @@ static void UpdateRouteStepSpriteSize()
_vp_route_step_subsprite.top = 0; _vp_route_step_subsprite.top = 0;
} }
#if !defined(DEDICATED)
/* multi can be density, field type, ... */ /* multi can be density, field type, ... */
static SpriteID GetSpriteIDForClearGround(const ClearGround cg, const Slope slope, const uint multi) 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(); default: NOT_REACHED();
} }
} }
#endif /* !DEDICATED */
/** Once the sprites are loaded, we can determine main colours of ground/water/... */ /** Once the sprites are loaded, we can determine main colours of ground/water/... */
void GfxDetermineMainColours() void GfxDetermineMainColours()

@ -586,7 +586,7 @@ public:
void SendCommand(Packet *p, const CommandPacket *cp); void SendCommand(Packet *p, const CommandPacket *cp);
virtual std::string GetDebugInfo() const; virtual std::string GetDebugInfo() const;
virtual void LogSentPacket(const Packet &pkt); virtual void LogSentPacket(const Packet &pkt) override;
}; };
#endif /* NETWORK_CORE_TCP_GAME_H */ #endif /* NETWORK_CORE_TCP_GAME_H */

@ -200,7 +200,7 @@ struct DeterministicSpriteGroup : SpriteGroup {
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override; void AnalyseCallbacks(AnalyseCallbackOperation &op) const override;
protected: protected:
const SpriteGroup *Resolve(ResolverObject &object) const; const SpriteGroup *Resolve(ResolverObject &object) const override;
}; };
enum RandomizedSpriteGroupCompareMode { enum RandomizedSpriteGroupCompareMode {
@ -224,7 +224,7 @@ struct RandomizedSpriteGroup : SpriteGroup {
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override; void AnalyseCallbacks(AnalyseCallbackOperation &op) const override;
protected: protected:
const SpriteGroup *Resolve(ResolverObject &object) const; const SpriteGroup *Resolve(ResolverObject &object) const override;
}; };
@ -250,7 +250,7 @@ struct CallbackResultSpriteGroup : SpriteGroup {
} }
uint16 result; uint16 result;
uint16 GetCallbackResult() const { return this->result; } uint16 GetCallbackResult() const override { return this->result; }
void AnalyseCallbacks(AnalyseCallbackOperation &op) const override; 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_COUNTER_VALUE:
case OCV_TIME_DATE: case OCV_TIME_DATE:
case OCV_TIMETABLE: case OCV_TIMETABLE:
if (data >= (1 << 16)) return CMD_ERROR;
break; break;
default: default:

@ -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); 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 *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 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); 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); std::string str_validate(const std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);

Loading…
Cancel
Save