Fix various compiler warnings

See: #267
This commit is contained in:
Jonathan G Rennison 2021-06-10 23:43:41 +01:00
parent 24783c3d26
commit 97d5982cb5
8 changed files with 22 additions and 21 deletions

View File

@ -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: {

View File

@ -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];

View File

@ -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; }
};
/**

View File

@ -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()

View File

@ -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 */

View File

@ -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;
};

View File

@ -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:

View File

@ -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);