Changeset - r23497:a0ab44ebd2fa
[Not reviewed]
master
! ! !
Henry Wilson - 5 years ago 2019-03-03 22:25:13
m3henry@googlemail.com
Codechange: Use override specifer for overriding member declarations

This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
85 files changed with 565 insertions and 565 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_config.hpp
Show inline comments
 
@@ -27,27 +27,27 @@ public:
 
	{}
 

	
 
	AIConfig(const AIConfig *config);
 

	
 
	class AIInfo *GetInfo() const;
 

	
 
	/* virtual */ int GetSetting(const char *name) const;
 
	/* virtual */ void SetSetting(const char *name, int value);
 
	/* virtual */ void AddRandomDeviation();
 
	int GetSetting(const char *name) const override;
 
	void SetSetting(const char *name, int value) override;
 
	void AddRandomDeviation() override;
 

	
 
	/**
 
	 * When ever the AI Scanner is reloaded, all infos become invalid. This
 
	 *  function tells AIConfig about this.
 
	 * @param force_exact_match If true try to find the exact same version
 
	 *   as specified. If false any version is ok.
 
	 * @return \c true if the reset was successful, \c false if the AI was no longer
 
	 *  found.
 
	 */
 
	bool ResetInfo(bool force_exact_match);
 

	
 
protected:
 
	/* virtual */ void PushExtraConfigList();
 
	/* virtual */ void ClearConfigList();
 
	/* virtual */ ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match);
 
	void PushExtraConfigList() override;
 
	void ClearConfigList() override;
 
	ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match) override;
 
};
 

	
 
#endif /* AI_CONFIG_HPP */
src/ai/ai_gui.cpp
Show inline comments
 
@@ -643,13 +643,13 @@ struct ScriptTextfileWindow : public Tex
 
	ScriptTextfileWindow(TextfileType file_type, CompanyID slot) : TextfileWindow(file_type), slot(slot)
 
	{
 
		const char *textfile = GetConfig(slot)->GetTextfile(file_type, slot);
 
		this->LoadTextfile(textfile, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		if (widget == WID_TF_CAPTION) {
 
			SetDParam(0, (slot == OWNER_DEITY) ? STR_CONTENT_TYPE_GAME_SCRIPT : STR_CONTENT_TYPE_AI);
 
			SetDParamStr(1, GetConfig(slot)->GetName());
 
		}
 
	}
src/ai/ai_instance.hpp
Show inline comments
 
@@ -22,17 +22,17 @@ public:
 
	/**
 
	 * Initialize the AI and prepare it for its first run.
 
	 * @param info The AI to create the instance of.
 
	 */
 
	void Initialize(class AIInfo *info);
 

	
 
	/* virtual */ int GetSetting(const char *name);
 
	/* virtual */ ScriptInfo *FindLibrary(const char *library, int version);
 
	int GetSetting(const char *name) override;
 
	ScriptInfo *FindLibrary(const char *library, int version) override;
 

	
 
private:
 
	/* virtual */ void RegisterAPI();
 
	/* virtual */ void Died();
 
	/* virtual */ CommandCallback *GetDoCommandCallback();
 
	/* virtual */ void LoadDummyScript();
 
	void RegisterAPI() override;
 
	void Died() override;
 
	CommandCallback *GetDoCommandCallback() override;
 
	void LoadDummyScript() override;
 
};
 

	
 
#endif /* AI_INSTANCE_HPP */
src/ai/ai_scanner.hpp
Show inline comments
 
@@ -16,13 +16,13 @@
 

	
 
class AIScannerInfo : public ScriptScanner {
 
public:
 
	AIScannerInfo();
 
	~AIScannerInfo();
 

	
 
	/* virtual */ void Initialize();
 
	void Initialize() override;
 

	
 
	/**
 
	 * Select a random AI.
 
	 * @return A random AI from the pool.
 
	 */
 
	class AIInfo *SelectRandomAI() const;
 
@@ -39,37 +39,37 @@ public:
 
	/**
 
	 * Set the Dummy AI.
 
	 */
 
	void SetDummyAI(class AIInfo *info);
 

	
 
protected:
 
	/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
 
	/* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
 
	/* virtual */ Subdirectory GetDirectory() const { return AI_DIR; }
 
	/* virtual */ const char *GetScannerName() const { return "AIs"; }
 
	/* virtual */ void RegisterAPI(class Squirrel *engine);
 
	void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
 
	const char *GetFileName() const override { return PATHSEP "info.nut"; }
 
	Subdirectory GetDirectory() const override { return AI_DIR; }
 
	const char *GetScannerName() const override { return "AIs"; }
 
	void RegisterAPI(class Squirrel *engine) override;
 

	
 
private:
 
	AIInfo *info_dummy; ///< The dummy AI.
 
};
 

	
 
class AIScannerLibrary : public ScriptScanner {
 
public:
 
	/* virtual */ void Initialize();
 
	void Initialize() override;
 

	
 
	/**
 
	 * Find a library in the pool.
 
	 * @param library The library name to find.
 
	 * @param version The version the library should have.
 
	 * @return The library if found, NULL otherwise.
 
	 */
 
	class AILibrary *FindLibrary(const char *library, int version);
 

	
 
protected:
 
	/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
 
	/* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
 
	/* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; }
 
	/* virtual */ const char *GetScannerName() const { return "AI Libraries"; }
 
	/* virtual */ void RegisterAPI(class Squirrel *engine);
 
	void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
 
	const char *GetFileName() const override { return PATHSEP "library.nut"; }
 
	Subdirectory GetDirectory() const override { return AI_LIBRARY_DIR; }
 
	const char *GetScannerName() const override { return "AI Libraries"; }
 
	void RegisterAPI(class Squirrel *engine) override;
 
};
 

	
 
#endif /* AI_SCANNER_HPP */
src/base_media_base.h
Show inline comments
 
@@ -173,13 +173,13 @@ template <class Tbase_set>
 
class BaseMedia : FileScanner {
 
protected:
 
	static Tbase_set *available_sets; ///< All available sets
 
	static Tbase_set *duplicate_sets; ///< All sets that aren't available, but needed for not downloading base sets when a newer version than the one on BaNaNaS is loaded.
 
	static const Tbase_set *used_set; ///< The currently used set
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override;
 

	
 
	/**
 
	 * Get the extension that is used to identify this set.
 
	 * @return the extension
 
	 */
 
	static const char *GetExtension();
src/blitter/32bpp_anim.hpp
Show inline comments
 
@@ -34,27 +34,27 @@ public:
 
	{
 
		this->palette = _cur_palette;
 
	}
 

	
 
	~Blitter_32bppAnim();
 

	
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(const Palette &palette);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
 
	void SetPixel(void *video, int x, int y, uint8 colour) override;
 
	void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
 
	void DrawRect(void *video, int width, int height, uint8 colour) override;
 
	void CopyFromBuffer(void *video, const void *src, int width, int height) override;
 
	void CopyToBuffer(const void *video, void *dst, int width, int height) override;
 
	void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
 
	int BufferSize(int width, int height) override;
 
	void PaletteAnimate(const Palette &palette) override;
 
	Blitter::PaletteAnimation UsePaletteAnimation() override;
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-anim"; }
 
	/* virtual */ int GetBytesPerPixel() { return 6; }
 
	/* virtual */ void PostResize();
 
	const char *GetName() override { return "32bpp-anim"; }
 
	int GetBytesPerPixel() override { return 6; }
 
	void PostResize() override;
 

	
 
	/**
 
	 * Look up the colour in the current palette.
 
	 */
 
	inline Colour LookupColourInPalette(uint index)
 
	{
 
@@ -74,10 +74,10 @@ public:
 
};
 

	
 
/** Factory for the 32bpp blitter with animation. */
 
class FBlitter_32bppAnim : public BlitterFactory {
 
public:
 
	FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppAnim(); }
 
};
 

	
 
#endif /* BLITTER_32BPP_ANIM_HPP */
src/blitter/32bpp_anim_sse2.hpp
Show inline comments
 
@@ -25,19 +25,19 @@
 
#include "32bpp_anim.hpp"
 
#include "32bpp_sse2.hpp"
 

	
 
/** A partially 32 bpp blitter with palette animation. */
 
class Blitter_32bppSSE2_Anim : public Blitter_32bppAnim {
 
public:
 
	/* virtual */ void PaletteAnimate(const Palette &palette);
 
	/* virtual */ const char *GetName() { return "32bpp-sse2-anim"; }
 
	void PaletteAnimate(const Palette &palette) override;
 
	const char *GetName() override { return "32bpp-sse2-anim"; }
 
};
 

	
 
/** Factory for the partially 32bpp blitter with animation. */
 
class FBlitter_32bppSSE2_Anim : public BlitterFactory {
 
public:
 
	FBlitter_32bppSSE2_Anim() : BlitterFactory("32bpp-sse2-anim", "32bpp partially SSE2 Animation Blitter (palette animation)", HasCPUIDFlag(1, 3, 26)) {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2_Anim(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSSE2_Anim(); }
 
};
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_ANIM_HPP */
src/blitter/32bpp_anim_sse4.hpp
Show inline comments
 
@@ -32,23 +32,23 @@
 
/** The SSE4 32 bpp blitter with palette animation. */
 
class Blitter_32bppSSE4_Anim FINAL : public Blitter_32bppSSE2_Anim, public Blitter_32bppSSE_Base {
 
private:
 

	
 
public:
 
	template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent, bool animated>
 
	/* virtual */ void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
 
	void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override {
 
		return Blitter_32bppSSE_Base::Encode(sprite, allocator);
 
	}
 
	/* virtual */ const char *GetName() { return "32bpp-sse4-anim"; }
 
	const char *GetName() override { return "32bpp-sse4-anim"; }
 
};
 

	
 
/** Factory for the SSE4 32 bpp blitter (with palette animation). */
 
class FBlitter_32bppSSE4_Anim: public BlitterFactory {
 
public:
 
	FBlitter_32bppSSE4_Anim() : BlitterFactory("32bpp-sse4-anim", "SSE4 Blitter (palette animation)", HasCPUIDFlag(1, 2, 19)) {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4_Anim(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSSE4_Anim(); }
 
};
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_SSE4_ANIM_HPP */
src/blitter/32bpp_base.hpp
Show inline comments
 
@@ -17,25 +17,25 @@
 
#include "../core/math_func.hpp"
 
#include "../gfx_func.h"
 

	
 
/** Base for all 32bpp blitters. */
 
class Blitter_32bppBase : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 32; }
 
	/* virtual */ void *MoveTo(void *video, int x, int y);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(const Palette &palette);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 
	/* virtual */ int GetBytesPerPixel() { return 4; }
 
	uint8 GetScreenDepth() override { return 32; }
 
	void *MoveTo(void *video, int x, int y) override;
 
	void SetPixel(void *video, int x, int y, uint8 colour) override;
 
	void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
 
	void DrawRect(void *video, int width, int height, uint8 colour) override;
 
	void CopyFromBuffer(void *video, const void *src, int width, int height) override;
 
	void CopyToBuffer(const void *video, void *dst, int width, int height) override;
 
	void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
 
	void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
 
	int BufferSize(int width, int height) override;
 
	void PaletteAnimate(const Palette &palette) override;
 
	Blitter::PaletteAnimation UsePaletteAnimation() override;
 
	int GetBytesPerPixel() override { return 4; }
 

	
 
	/**
 
	 * Look up the colour in the current palette.
 
	 */
 
	static inline Colour LookupColourInPalette(uint index)
 
	{
src/blitter/32bpp_optimized.hpp
Show inline comments
 
@@ -20,22 +20,22 @@ public:
 
	/** Data stored about a (single) sprite. */
 
	struct SpriteData {
 
		uint32 offset[ZOOM_LVL_COUNT][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information.
 
		byte data[];                      ///< Data, all zoomlevels.
 
	};
 

	
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-optimized"; }
 
	const char *GetName() override { return "32bpp-optimized"; }
 

	
 
	template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
};
 

	
 
/** Factory for the optimised 32 bpp blitter (without palette animation). */
 
class FBlitter_32bppOptimized : public BlitterFactory {
 
public:
 
	FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppOptimized(); }
 
};
 

	
 
#endif /* BLITTER_32BPP_OPTIMIZED_HPP */
src/blitter/32bpp_simple.hpp
Show inline comments
 
@@ -23,21 +23,21 @@ class Blitter_32bppSimple : public Blitt
 
		uint8 b;  ///< Blue-channel
 
		uint8 a;  ///< Alpha-channel
 
		uint8 m;  ///< Remap-channel
 
		uint8 v;  ///< Brightness-channel
 
	};
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-simple"; }
 
	const char *GetName() override { return "32bpp-simple"; }
 
};
 

	
 
/** Factory for the simple 32 bpp blitter. */
 
class FBlitter_32bppSimple : public BlitterFactory {
 
public:
 
	FBlitter_32bppSimple() : BlitterFactory("32bpp-simple", "32bpp Simple Blitter (no palette animation)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSimple(); }
 
};
 

	
 
#endif /* BLITTER_32BPP_SIMPLE_HPP */
src/blitter/32bpp_sse2.hpp
Show inline comments
 
@@ -79,26 +79,26 @@ public:
 

	
 
DECLARE_ENUM_AS_BIT_SET(Blitter_32bppSSE_Base::SpriteFlags);
 

	
 
/** The SSE2 32 bpp blitter (without palette animation). */
 
class Blitter_32bppSSE2 : public Blitter_32bppSimple, public Blitter_32bppSSE_Base {
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
 
	void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 

	
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override {
 
		return Blitter_32bppSSE_Base::Encode(sprite, allocator);
 
	}
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-sse2"; }
 
	const char *GetName() override { return "32bpp-sse2"; }
 
};
 

	
 
/** Factory for the SSE2 32 bpp blitter (without palette animation). */
 
class FBlitter_32bppSSE2 : public BlitterFactory {
 
public:
 
	FBlitter_32bppSSE2() : BlitterFactory("32bpp-sse2", "32bpp SSE2 Blitter (no palette animation)", HasCPUIDFlag(1, 3, 26)) {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSSE2(); }
 
};
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_SSE2_HPP */
src/blitter/32bpp_sse4.hpp
Show inline comments
 
@@ -24,21 +24,21 @@
 

	
 
#include "32bpp_ssse3.hpp"
 

	
 
/** The SSE4 32 bpp blitter (without palette animation). */
 
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
 
	void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
	/* virtual */ const char *GetName() { return "32bpp-sse4"; }
 
	const char *GetName() override { return "32bpp-sse4"; }
 
};
 

	
 
/** Factory for the SSE4 32 bpp blitter (without palette animation). */
 
class FBlitter_32bppSSE4: public BlitterFactory {
 
public:
 
	FBlitter_32bppSSE4() : BlitterFactory("32bpp-sse4", "32bpp SSE4 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 19)) {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSSE4(); }
 
};
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_SSE4_HPP */
src/blitter/32bpp_ssse3.hpp
Show inline comments
 
@@ -24,21 +24,21 @@
 

	
 
#include "32bpp_sse2.hpp"
 

	
 
/** The SSSE3 32 bpp blitter (without palette animation). */
 
class Blitter_32bppSSSE3 : public Blitter_32bppSSE2 {
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
 
	void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
	/* virtual */ const char *GetName() { return "32bpp-ssse3"; }
 
	const char *GetName() override { return "32bpp-ssse3"; }
 
};
 

	
 
/** Factory for the SSSE3 32 bpp blitter (without palette animation). */
 
class FBlitter_32bppSSSE3: public BlitterFactory {
 
public:
 
	FBlitter_32bppSSSE3() : BlitterFactory("32bpp-ssse3", "32bpp SSSE3 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 9)) {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSSE3(); }
 
	Blitter *CreateInstance() override { return new Blitter_32bppSSSE3(); }
 
};
 

	
 
#endif /* WITH_SSE */
 
#endif /* BLITTER_32BPP_SSSE3_HPP */
src/blitter/8bpp_base.hpp
Show inline comments
 
@@ -14,23 +14,23 @@
 

	
 
#include "base.hpp"
 

	
 
/** Base for all 8bpp blitters. */
 
class Blitter_8bppBase : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 8; }
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
 
	/* virtual */ void *MoveTo(void *video, int x, int y);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(const Palette &palette);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 
	/* virtual */ int GetBytesPerPixel() { return 1; }
 
	uint8 GetScreenDepth() override { return 8; }
 
	void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
 
	void *MoveTo(void *video, int x, int y) override;
 
	void SetPixel(void *video, int x, int y, uint8 colour) override;
 
	void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
 
	void DrawRect(void *video, int width, int height, uint8 colour) override;
 
	void CopyFromBuffer(void *video, const void *src, int width, int height) override;
 
	void CopyToBuffer(const void *video, void *dst, int width, int height) override;
 
	void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
 
	void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
 
	int BufferSize(int width, int height) override;
 
	void PaletteAnimate(const Palette &palette) override;
 
	Blitter::PaletteAnimation UsePaletteAnimation() override;
 
	int GetBytesPerPixel() override { return 1; }
 
};
 

	
 
#endif /* BLITTER_8BPP_BASE_HPP */
src/blitter/8bpp_optimized.hpp
Show inline comments
 
@@ -21,20 +21,20 @@ public:
 
	/** Data stored about a (single) sprite. */
 
	struct SpriteData {
 
		uint32 offset[ZOOM_LVL_COUNT]; ///< Offsets (from .data) to streams for different zoom levels.
 
		byte data[];                   ///< Data, all zoomlevels.
 
	};
 

	
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
 

	
 
	/* virtual */ const char *GetName() { return "8bpp-optimized"; }
 
	const char *GetName() override { return "8bpp-optimized"; }
 
};
 

	
 
/** Factory for the 8bpp blitter optimised for speed. */
 
class FBlitter_8bppOptimized : public BlitterFactory {
 
public:
 
	FBlitter_8bppOptimized() : BlitterFactory("8bpp-optimized", "8bpp Optimized Blitter (compression + all-ZoomLevel cache)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
 
	Blitter *CreateInstance() override { return new Blitter_8bppOptimized(); }
 
};
 

	
 
#endif /* BLITTER_8BPP_OPTIMIZED_HPP */
src/blitter/8bpp_simple.hpp
Show inline comments
 
@@ -15,20 +15,20 @@
 
#include "8bpp_base.hpp"
 
#include "factory.hpp"
 

	
 
/** Most trivial 8bpp blitter. */
 
class Blitter_8bppSimple FINAL : public Blitter_8bppBase {
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
 

	
 
	/* virtual */ const char *GetName() { return "8bpp-simple"; }
 
	const char *GetName() override { return "8bpp-simple"; }
 
};
 

	
 
/** Factory for the most trivial 8bpp blitter. */
 
class FBlitter_8bppSimple : public BlitterFactory {
 
public:
 
	FBlitter_8bppSimple() : BlitterFactory("8bpp-simple", "8bpp Simple Blitter (relative slow, but never wrong)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppSimple(); }
 
	Blitter *CreateInstance() override { return new Blitter_8bppSimple(); }
 
};
 

	
 
#endif /* BLITTER_8BPP_SIMPLE_HPP */
src/blitter/null.hpp
Show inline comments
 
@@ -14,34 +14,34 @@
 

	
 
#include "factory.hpp"
 

	
 
/** Blitter that does nothing. */
 
class Blitter_Null : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 0; }
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
 
	/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
 
	/* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) {};
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height) {};
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height) {};
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {};
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) {};
 
	/* virtual */ int BufferSize(int width, int height) { return 0; };
 
	/* virtual */ void PaletteAnimate(const Palette &palette) { };
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation() { return Blitter::PALETTE_ANIMATION_NONE; };
 
	uint8 GetScreenDepth() override { return 0; }
 
	void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {};
 
	void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {};
 
	Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
 
	void *MoveTo(void *video, int x, int y) override { return NULL; };
 
	void SetPixel(void *video, int x, int y, uint8 colour) override {};
 
	void DrawRect(void *video, int width, int height, uint8 colour) override {};
 
	void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override {};
 
	void CopyFromBuffer(void *video, const void *src, int width, int height) override {};
 
	void CopyToBuffer(const void *video, void *dst, int width, int height) override {};
 
	void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {};
 
	void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override {};
 
	int BufferSize(int width, int height) override { return 0; };
 
	void PaletteAnimate(const Palette &palette) override { };
 
	Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };
 

	
 
	/* virtual */ const char *GetName() { return "null"; }
 
	/* virtual */ int GetBytesPerPixel() { return 0; }
 
	const char *GetName() override { return "null"; }
 
	int GetBytesPerPixel() override { return 0; }
 
};
 

	
 
/** Factory for the blitter that does nothing. */
 
class FBlitter_Null : public BlitterFactory {
 
public:
 
	FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
 
	Blitter *CreateInstance() override { return new Blitter_Null(); }
 
};
 

	
 
#endif /* BLITTER_NULL_HPP */
src/fileio_func.h
Show inline comments
 
@@ -104,13 +104,13 @@ public:
 
		AI       = 1 << 2, ///< Scan for AIs and its libraries.
 
		SCENARIO = 1 << 3, ///< Scan for scenarios and heightmaps.
 
		GAME     = 1 << 4, ///< Scan for game scripts.
 
		ALL      = BASESET | NEWGRF | AI | SCENARIO | GAME, ///< Scan for everything.
 
	};
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename = NULL);
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename = NULL) override;
 

	
 
	bool AddFile(Subdirectory sd, const char *filename);
 

	
 
	/** Do the scan for Tars. */
 
	static uint DoScan(TarScanner::Mode mode);
 
};
src/fios.cpp
Show inline comments
 
@@ -273,13 +273,13 @@ public:
 
	 * @param file_list Destination of the found files.
 
	 */
 
	FiosFileScanner(SaveLoadOperation fop, fios_getlist_callback_proc *callback_proc, FileList &file_list) :
 
			fop(fop), callback_proc(callback_proc), file_list(file_list)
 
	{}
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override;
 
};
 

	
 
/**
 
 * Try to add a fios item set with the given filename.
 
 * @param filename        the full path to the file to read
 
 * @param basepath_length amount of characters to chop of before to get a relative filename
 
@@ -670,13 +670,13 @@ public:
 
		if (this->scanned && !rescan) return;
 

	
 
		this->FileScanner::Scan(".id", SCENARIO_DIR, true, true);
 
		this->scanned = true;
 
	}
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename)
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override
 
	{
 
		FILE *f = FioFOpenFile(filename, "r", SCENARIO_DIR);
 
		if (f == NULL) return false;
 

	
 
		ScenarioIdentifier id;
 
		int fret = fscanf(f, "%i", &id.scenid);
src/game/game_config.hpp
Show inline comments
 
@@ -39,10 +39,10 @@ public:
 
	 * @return \c true if the reset was successful, \c false if the Game was no longer
 
	 *  found.
 
	 */
 
	bool ResetInfo(bool force_exact_match);
 

	
 
protected:
 
	/* virtual */ ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match);
 
	ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match) override;
 
};
 

	
 
#endif /* GAME_CONFIG_HPP */
src/game/game_info.hpp
Show inline comments
 
@@ -37,13 +37,13 @@ public:
 

	
 
	/**
 
	 * Get the API version this Game is written for.
 
	 */
 
	const char *GetAPIVersion() const { return this->api_version; }
 

	
 
	/* virtual */ bool IsDeveloperOnly() const { return this->is_developer_only; }
 
	bool IsDeveloperOnly() const override { return this->is_developer_only; }
 

	
 
private:
 
	int min_loadable_version; ///< The Game can load savegame data if the version is equal or greater than this.
 
	bool is_developer_only;   ///< Is the script selectable by non-developers?
 
	const char *api_version;  ///< API version used by this Game.
 
};
src/game/game_instance.hpp
Show inline comments
 
@@ -22,17 +22,17 @@ public:
 
	/**
 
	 * Initialize the script and prepare it for its first run.
 
	 * @param info The GameInfo to start.
 
	 */
 
	void Initialize(class GameInfo *info);
 

	
 
	/* virtual */ int GetSetting(const char *name);
 
	/* virtual */ ScriptInfo *FindLibrary(const char *library, int version);
 
	int GetSetting(const char *name) override;
 
	ScriptInfo *FindLibrary(const char *library, int version) override;
 

	
 
private:
 
	/* virtual */ void RegisterAPI();
 
	/* virtual */ void Died();
 
	/* virtual */ CommandCallback *GetDoCommandCallback();
 
	/* virtual */ void LoadDummyScript() {}
 
	void RegisterAPI() override;
 
	void Died() override;
 
	CommandCallback *GetDoCommandCallback() override;
 
	void LoadDummyScript() override {}
 
};
 

	
 
#endif /* GAME_INSTANCE_HPP */
src/game/game_scanner.hpp
Show inline comments
 
@@ -13,47 +13,47 @@
 
#define GAME_SCANNER_HPP
 

	
 
#include "../script/script_scanner.hpp"
 

	
 
class GameScannerInfo : public ScriptScanner {
 
public:
 
	/* virtual */ void Initialize();
 
	void Initialize() override;
 

	
 
	/**
 
	 * Check if we have a game by name and version available in our list.
 
	 * @param nameParam The name of the game script.
 
	 * @param versionParam The version of the game script, or -1 if you want the latest.
 
	 * @param force_exact_match Only match name+version, never latest.
 
	 * @return NULL if no match found, otherwise the game script that matched.
 
	 */
 
	class GameInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
 

	
 
protected:
 
	/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
 
	/* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
 
	/* virtual */ Subdirectory GetDirectory() const { return GAME_DIR; }
 
	/* virtual */ const char *GetScannerName() const { return "Game Scripts"; }
 
	/* virtual */ void RegisterAPI(class Squirrel *engine);
 
	void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
 
	const char *GetFileName() const override { return PATHSEP "info.nut"; }
 
	Subdirectory GetDirectory() const override { return GAME_DIR; }
 
	const char *GetScannerName() const override { return "Game Scripts"; }
 
	void RegisterAPI(class Squirrel *engine) override;
 
};
 

	
 

	
 
class GameScannerLibrary : public ScriptScanner {
 
public:
 
	/* virtual */ void Initialize();
 
	void Initialize() override;
 

	
 
	/**
 
	 * Find a library in the pool.
 
	 * @param library The library name to find.
 
	 * @param version The version the library should have.
 
	 * @return The library if found, NULL otherwise.
 
	 */
 
	class GameLibrary *FindLibrary(const char *library, int version);
 

	
 
protected:
 
	/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
 
	/* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
 
	/* virtual */ Subdirectory GetDirectory() const { return GAME_LIBRARY_DIR; }
 
	/* virtual */ const char *GetScannerName() const { return "GS Libraries"; }
 
	/* virtual */ void RegisterAPI(class Squirrel *engine);
 
	void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
 
	const char *GetFileName() const override { return PATHSEP "library.nut"; }
 
	Subdirectory GetDirectory() const override { return GAME_LIBRARY_DIR; }
 
	const char *GetScannerName() const override { return "GS Libraries"; }
 
	void RegisterAPI(class Squirrel *engine) override;
 
};
 

	
 
#endif /* GAME_SCANNER_HPP */
src/game/game_text.cpp
Show inline comments
 
@@ -148,13 +148,13 @@ struct StringListReader : StringReader {
 
	 */
 
	StringListReader(StringData &data, const LanguageStrings *strings, bool master, bool translation) :
 
			StringReader(data, strings->language, master, translation), p(strings->lines.Begin()), end(strings->lines.End())
 
	{
 
	}
 

	
 
	/* virtual */ char *ReadLine(char *buffer, const char *last)
 
	char *ReadLine(char *buffer, const char *last) override
 
	{
 
		if (this->p == this->end) return NULL;
 

	
 
		strecpy(buffer, *this->p, last);
 
		this->p++;
 

	
 
@@ -239,13 +239,13 @@ public:
 
	 */
 
	void Scan(const char *directory)
 
	{
 
		this->FileScanner::Scan(".txt", directory, false);
 
	}
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename)
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override
 
	{
 
		if (strcmp(filename, exclude) == 0) return true;
 

	
 
		*gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
 
		return true;
 
	}
src/goal_gui.cpp
Show inline comments
 
@@ -47,25 +47,25 @@ struct GoalListWindow : public Window {
 
		this->vscroll = this->GetScrollbar(WID_GOAL_SCROLLBAR);
 
		this->FinishInitNested(window_number);
 
		this->owner = (Owner)this->window_number;
 
		this->OnInvalidateData(0);
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		if (widget != WID_GOAL_CAPTION) return;
 

	
 
		if (this->window_number == INVALID_COMPANY) {
 
			SetDParam(0, STR_GOALS_SPECTATOR_CAPTION);
 
		} else {
 
			SetDParam(0, STR_GOALS_CAPTION);
 
			SetDParam(1, this->window_number);
 
		}
 
	}
 

	
 
	/* virtual */ void OnClick(Point pt, int widget, int click_count)
 
	void OnClick(Point pt, int widget, int click_count) override
 
	{
 
		if (widget != WID_GOAL_LIST) return;
 

	
 
		int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_GOAL_LIST, WD_FRAMERECT_TOP);
 
		int num = 0;
 
		const Goal *s;
 
@@ -174,13 +174,13 @@ struct GoalListWindow : public Window {
 
		if (num_company == 0) num_company = 1;
 

	
 
		/* Global, company and an empty line before the accepted ones. */
 
		return 3 + num_global + num_company;
 
	}
 

	
 
	/* virtual */ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		if (widget != WID_GOAL_LIST) return;
 
		Dimension d = maxdim(GetStringBoundingBox(STR_GOALS_GLOBAL_TITLE), GetStringBoundingBox(STR_GOALS_COMPANY_TITLE));
 

	
 
		resize->height = d.height;
 

	
 
@@ -269,13 +269,13 @@ struct GoalListWindow : public Window {
 

	
 
		/* Draw partial list with company goals. */
 
		pos++;
 
		DrawPartialGoalList(pos, cap, x, y, right, progress_col_width, false, column);
 
	}
 

	
 
	/* virtual */ void OnPaint()
 
	void OnPaint() override
 
	{
 
		this->DrawWidgets();
 

	
 
		if (this->IsShaded()) return; // Don't draw anything when the window is shaded.
 

	
 
		/* Calculate progress column width. */
 
@@ -296,23 +296,23 @@ struct GoalListWindow : public Window {
 
		/* Draw goal list. */
 
		this->DrawListColumn(GC_PROGRESS, wid, progress_col_width);
 
		this->DrawListColumn(GC_GOAL, wid, progress_col_width);
 

	
 
	}
 

	
 
	/* virtual */ void OnResize()
 
	void OnResize() override
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, WID_GOAL_LIST);
 
	}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	/* virtual */ void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	void OnInvalidateData(int data = 0, bool gui_scope = true) override
 
	{
 
		if (!gui_scope) return;
 
		this->vscroll->SetCount(this->CountLines());
 
		this->SetWidgetDirty(WID_GOAL_LIST);
 
	}
 
};
 
@@ -385,13 +385,13 @@ struct GoalQuestionWindow : public Windo
 

	
 
	~GoalQuestionWindow()
 
	{
 
		free(this->question);
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		switch (widget) {
 
			case WID_GQ_CAPTION:
 
				SetDParam(0, STR_GOAL_QUESTION_CAPTION_QUESTION + this->type);
 
				break;
 

	
 
@@ -406,13 +406,13 @@ struct GoalQuestionWindow : public Windo
 
			case WID_GQ_BUTTON_3:
 
				SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[2]);
 
				break;
 
		}
 
	}
 

	
 
	/* virtual */ void OnClick(Point pt, int widget, int click_count)
 
	void OnClick(Point pt, int widget, int click_count) override
 
	{
 
		switch (widget) {
 
			case WID_GQ_BUTTON_1:
 
				DoCommandP(0, this->window_number, this->button[0], CMD_GOAL_QUESTION_ANSWER);
 
				delete this;
 
				break;
 
@@ -426,21 +426,21 @@ struct GoalQuestionWindow : public Windo
 
				DoCommandP(0, this->window_number, this->button[2], CMD_GOAL_QUESTION_ANSWER);
 
				delete this;
 
				break;
 
		}
 
	}
 

	
 
	/* virtual */ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		if (widget != WID_GQ_QUESTION) return;
 

	
 
		SetDParamStr(0, this->question);
 
		size->height = GetStringHeight(STR_JUST_RAW_STRING, size->width) + WD_PAR_VSEP_WIDE;
 
	}
 

	
 
	/* virtual */ void DrawWidget(const Rect &r, int widget) const
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		if (widget != WID_GQ_QUESTION) return;
 

	
 
		SetDParamStr(0, this->question);
 
		DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK, SA_TOP | SA_HOR_CENTER);
 
	}
src/ground_vehicle.hpp
Show inline comments
 
@@ -89,20 +89,20 @@ struct GroundVehicle : public Specialize
 
	 */
 
	GroundVehicle() : SpecializedVehicle<T, Type>() {}
 

	
 
	void PowerChanged();
 
	void CargoChanged();
 
	int GetAcceleration() const;
 
	bool IsChainInDepot() const;
 
	bool IsChainInDepot() const override;
 

	
 
	/**
 
	 * Common code executed for crashed ground vehicles
 
	 * @param flooded was this vehicle flooded?
 
	 * @return number of victims
 
	 */
 
	/* virtual */ uint Crash(bool flooded)
 
	uint Crash(bool flooded) override
 
	{
 
		/* Crashed vehicles aren't going up or down */
 
		for (T *v = T::From(this); v != NULL; v = v->Next()) {
 
			ClrBit(v->gv_flags, GVF_GOINGUP_BIT);
 
			ClrBit(v->gv_flags, GVF_GOINGDOWN_BIT);
 
		}
src/music/allegro_m.h
Show inline comments
 
@@ -14,24 +14,24 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** Allegro's music player. */
 
class MusicDriver_Allegro : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "allegro"; }
 
};
 

	
 
/** Factory for allegro's music player. */
 
class FMusicDriver_Allegro : public DriverFactoryBase {
 
public:
 
#if !defined(WITH_SDL) && defined(WITH_ALLEGRO)
 
@@ -40,10 +40,10 @@ public:
 
	 * over extmidi because with extmidi we get crashes. */
 
	static const int PRIORITY = 9;
 
#else
 
	static const int PRIORITY = 2;
 
#endif
 
	FMusicDriver_Allegro() : DriverFactoryBase(Driver::DT_MUSIC, PRIORITY, "allegro", "Allegro MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_Allegro(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_Allegro(); }
 
};
 

	
 
#endif /* MUSIC_ALLEGRO_H */
src/music/bemidi.h
Show inline comments
 
@@ -14,28 +14,28 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** The midi player for BeOS. */
 
class MusicDriver_BeMidi : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "bemidi"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "bemidi"; }
 
};
 

	
 
/** Factory for the BeOS midi player. */
 
class FMusicDriver_BeMidi : public DriverFactoryBase {
 
public:
 
	FMusicDriver_BeMidi() : DriverFactoryBase(Driver::DT_MUSIC, 10, "bemidi", "BeOS MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_BeMidi(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_BeMidi(); }
 
};
 

	
 
#endif /* MUSIC_BEMIDI_H */
src/music/cocoa_m.h
Show inline comments
 
@@ -13,27 +13,27 @@
 
#define MUSIC_MACOSX_COCOA_H
 

	
 
#include "music_driver.hpp"
 

	
 
class MusicDriver_Cocoa : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "cocoa"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "cocoa"; }
 
};
 

	
 
class FMusicDriver_Cocoa : public DriverFactoryBase {
 
public:
 
	FMusicDriver_Cocoa() : DriverFactoryBase(Driver::DT_MUSIC, 10, "cocoa", "Cocoa MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_Cocoa(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_Cocoa(); }
 
};
 

	
 
#endif /* MUSIC_MACOSX_COCOA_H */
src/music/dmusic.h
Show inline comments
 
@@ -16,28 +16,28 @@
 

	
 
/** Music player making use of DirectX. */
 
class MusicDriver_DMusic : public MusicDriver {
 
public:
 
	virtual ~MusicDriver_DMusic();
 

	
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "dmusic"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "dmusic"; }
 
};
 

	
 
/** Factory for the DirectX music player. */
 
class FMusicDriver_DMusic : public DriverFactoryBase {
 
public:
 
	FMusicDriver_DMusic() : DriverFactoryBase(Driver::DT_MUSIC, 10, "dmusic", "DirectMusic MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_DMusic(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_DMusic(); }
 
};
 

	
 
#endif /* MUSIC_DMUSIC_H */
src/music/extmidi.h
Show inline comments
 
@@ -21,27 +21,27 @@ private:
 
	pid_t pid;
 

	
 
	void DoPlay();
 
	void DoStop();
 

	
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "extmidi"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "extmidi"; }
 
};
 

	
 
class FMusicDriver_ExtMidi : public DriverFactoryBase {
 
public:
 
	FMusicDriver_ExtMidi() : DriverFactoryBase(Driver::DT_MUSIC, 3, "extmidi", "External MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_ExtMidi(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_ExtMidi(); }
 
};
 

	
 
#endif /* MUSIC_EXTERNAL_H */
src/music/fluidsynth.h
Show inline comments
 
@@ -14,28 +14,28 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** Music driver making use of FluidSynth. */
 
class MusicDriver_FluidSynth : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "fluidsynth"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "fluidsynth"; }
 
};
 

	
 
/** Factory for the fluidsynth driver. */
 
class FMusicDriver_FluidSynth : public DriverFactoryBase {
 
public:
 
	FMusicDriver_FluidSynth() : DriverFactoryBase(Driver::DT_MUSIC, 5, "fluidsynth", "FluidSynth MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_FluidSynth(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_FluidSynth(); }
 
};
 

	
 
#endif /* MUSIC_FLUIDSYNTH_H */
src/music/null_m.h
Show inline comments
 
@@ -14,28 +14,28 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** The music player that does nothing. */
 
class MusicDriver_Null : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param) { return NULL; }
 
	const char *Start(const char * const *param) override { return NULL; }
 

	
 
	/* virtual */ void Stop() { }
 
	void Stop() override { }
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song) { }
 
	void PlaySong(const MusicSongInfo &song) override { }
 

	
 
	/* virtual */ void StopSong() { }
 
	void StopSong() override { }
 

	
 
	/* virtual */ bool IsSongPlaying() { return true; }
 
	bool IsSongPlaying() override { return true; }
 

	
 
	/* virtual */ void SetVolume(byte vol) { }
 
	/* virtual */ const char *GetName() const { return "null"; }
 
	void SetVolume(byte vol) override { }
 
	const char *GetName() const override { return "null"; }
 
};
 

	
 
/** Factory for the null music player. */
 
class FMusicDriver_Null : public DriverFactoryBase {
 
public:
 
	FMusicDriver_Null() : DriverFactoryBase(Driver::DT_MUSIC, 1, "null", "Null Music Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_Null(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_Null(); }
 
};
 

	
 
#endif /* MUSIC_NULL_H */
src/music/os2_m.h
Show inline comments
 
@@ -14,28 +14,28 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** OS/2's music player. */
 
class MusicDriver_OS2 : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "os2"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "os2"; }
 
};
 

	
 
/** Factory for OS/2's music player. */
 
class FMusicDriver_OS2 : public DriverFactoryBase {
 
public:
 
	FMusicDriver_OS2() : DriverFactoryBase(Driver::DT_MUSIC, 10, "os2", "OS/2 Music Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_OS2(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_OS2(); }
 
};
 

	
 
#endif /* MUSIC_OS2_H */
src/music/qtmidi.h
Show inline comments
 
@@ -13,27 +13,27 @@
 
#define MUSIC_MACOSX_QUICKTIME_H
 

	
 
#include "music_driver.hpp"
 

	
 
class MusicDriver_QtMidi : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "qt"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "qt"; }
 
};
 

	
 
class FMusicDriver_QtMidi : public DriverFactoryBase {
 
public:
 
	FMusicDriver_QtMidi() : DriverFactoryBase(Driver::DT_MUSIC, 5, "qt", "QuickTime MIDI Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_QtMidi(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_QtMidi(); }
 
};
 

	
 
#endif /* MUSIC_MACOSX_QUICKTIME_H */
src/music/win32_m.h
Show inline comments
 
@@ -14,28 +14,28 @@
 

	
 
#include "music_driver.hpp"
 

	
 
/** The Windows music player. */
 
class MusicDriver_Win32 : public MusicDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void PlaySong(const MusicSongInfo &song);
 
	void PlaySong(const MusicSongInfo &song) override;
 

	
 
	/* virtual */ void StopSong();
 
	void StopSong() override;
 

	
 
	/* virtual */ bool IsSongPlaying();
 
	bool IsSongPlaying() override;
 

	
 
	/* virtual */ void SetVolume(byte vol);
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
	void SetVolume(byte vol) override;
 
	const char *GetName() const override { return "win32"; }
 
};
 

	
 
/** Factory for Windows' music player. */
 
class FMusicDriver_Win32 : public DriverFactoryBase {
 
public:
 
	FMusicDriver_Win32() : DriverFactoryBase(Driver::DT_MUSIC, 5, "win32", "Win32 Music Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new MusicDriver_Win32(); }
 
	Driver *CreateInstance() const override { return new MusicDriver_Win32(); }
 
};
 

	
 
#endif /* MUSIC_WIN32_H */
src/network/network_client.cpp
Show inline comments
 
@@ -81,13 +81,13 @@ struct PacketReader : LoadFilter {
 
		this->bufe = this->buf + CHUNK;
 

	
 
		memcpy(this->buf, pbuf, to_write);
 
		this->buf += to_write;
 
	}
 

	
 
	/* virtual */ size_t Read(byte *rbuf, size_t size)
 
	size_t Read(byte *rbuf, size_t size) override
 
	{
 
		/* Limit the amount to read to whatever we still have. */
 
		size_t ret_size = size = min(this->written_bytes - this->read_bytes, size);
 
		this->read_bytes += ret_size;
 
		const byte *rbufe = rbuf + ret_size;
 

	
 
@@ -103,13 +103,13 @@ struct PacketReader : LoadFilter {
 
			this->buf += to_write;
 
		}
 

	
 
		return ret_size;
 
	}
 

	
 
	/* virtual */ void Reset()
 
	void Reset() override
 
	{
 
		this->read_bytes = 0;
 

	
 
		this->block = this->blocks.Begin();
 
		this->buf   = *this->block++;
 
		this->bufe  = this->buf + CHUNK;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -61,13 +61,13 @@ struct ContentTextfileWindow : public Te
 
			case CONTENT_TYPE_SCENARIO:      return STR_CONTENT_TYPE_SCENARIO;
 
			case CONTENT_TYPE_HEIGHTMAP:     return STR_CONTENT_TYPE_HEIGHTMAP;
 
			default: NOT_REACHED();
 
		}
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		if (widget == WID_TF_CAPTION) {
 
			SetDParam(0, this->GetTypeString());
 
			SetDParamStr(1, this->ci->name);
 
		}
 
	}
src/network/network_gui.cpp
Show inline comments
 
@@ -114,13 +114,13 @@ public:
 

	
 
		/* First and last are always visible, the rest is implicitly zeroed */
 
		this->visible[0] = true;
 
		*lastof(this->visible) = true;
 
	}
 

	
 
	void SetupSmallestSize(Window *w, bool init_array)
 
	void SetupSmallestSize(Window *w, bool init_array) override
 
	{
 
		/* Oh yeah, we ought to be findable! */
 
		w->nested_array[WID_NG_HEADER] = this;
 

	
 
		this->smallest_y = 0; // Biggest child.
 
		this->fill_x = 1;
 
@@ -140,13 +140,13 @@ public:
 
			child_wid->current_y = this->smallest_y;
 
		}
 

	
 
		this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not
 
	}
 

	
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
 
	{
 
		assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
 

	
 
		this->pos_x = x;
 
		this->pos_y = y;
 
		this->current_x = given_width;
 
@@ -180,23 +180,23 @@ public:
 

	
 
			child_wid = rtl ? child_wid->prev : child_wid->next;
 
			i += rtl ? -1 : 1;
 
		}
 
	}
 

	
 
	/* virtual */ void Draw(const Window *w)
 
	void Draw(const Window *w) override
 
	{
 
		int i = 0;
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
			if (!this->visible[i++]) continue;
 

	
 
			child_wid->Draw(w);
 
		}
 
	}
 

	
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y)
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override
 
	{
 
		if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
 

	
 
		int i = 0;
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
			if (!this->visible[i++]) continue;
src/network/network_server.cpp
Show inline comments
 
@@ -160,13 +160,13 @@ struct PacketWriter : SaveFilter {
 
		}
 
		*p = this->current;
 

	
 
		this->current = NULL;
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		/* We want to abort the saving when the socket is closed. */
 
		if (this->cs == NULL) SlError(STR_NETWORK_ERROR_LOSTCONNECTION);
 

	
 
		if (this->current == NULL) this->current = new Packet(PACKET_SERVER_MAP_DATA);
 

	
 
@@ -187,13 +187,13 @@ struct PacketWriter : SaveFilter {
 

	
 
		if (this->mutex != NULL) this->mutex->EndCritical();
 

	
 
		this->total_size += size;
 
	}
 

	
 
	/* virtual */ void Finish()
 
	void Finish() override
 
	{
 
		/* We want to abort the saving when the socket is closed. */
 
		if (this->cs == NULL) SlError(STR_NETWORK_ERROR_LOSTCONNECTION);
 

	
 
		if (this->mutex != NULL) this->mutex->BeginCritical();
 

	
src/newgrf_airport.cpp
Show inline comments
 
@@ -36,33 +36,33 @@ struct AirportScopeResolver : public Sco
 
	 */
 
	AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout)
 
			: ScopeResolver(ro), st(st), airport_id(airport_id), layout(layout), tile(tile)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	/* virtual */ void StorePSA(uint pos, int32 value);
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
	void StorePSA(uint pos, int32 value) override;
 
};
 

	
 
/** Resolver object for airports. */
 
struct AirportResolverObject : public ResolverObject {
 
	AirportScopeResolver airport_scope;
 

	
 
	AirportResolverObject(TileIndex tile, Station *st, byte airport_id, byte layout,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &this->airport_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
/**
 
 * Reset airport classes to their default state.
 
 * This includes initialising the defaults classes with an empty
 
 * entry, for standard airports.
src/newgrf_airporttiles.h
Show inline comments
 
@@ -35,24 +35,24 @@ struct AirportTileScopeResolver : public
 
		: ScopeResolver(ro), st(st), tile(tile)
 
	{
 
		assert(st != NULL);
 
		this->airport_id = st->airport.type;
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
};
 

	
 
/** Resolver for tiles of an airport. */
 
struct AirportTileResolverObject : public ResolverObject {
 
	AirportTileScopeResolver tiles_scope; ///< Scope resolver for the tiles.
 

	
 
	AirportTileResolverObject(const AirportTileSpec *ats, TileIndex tile, Station *st,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &tiles_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
src/newgrf_canal.cpp
Show inline comments
 
@@ -27,32 +27,32 @@ struct CanalScopeResolver : public Scope
 

	
 
	CanalScopeResolver(ResolverObject &ro, TileIndex tile)
 
		: ScopeResolver(ro), tile(tile)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
};
 

	
 
/** Resolver object for canals. */
 
struct CanalResolverObject : public ResolverObject {
 
	CanalScopeResolver canal_scope;
 

	
 
	CanalResolverObject(CanalFeature feature, TileIndex tile,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &this->canal_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
/* virtual */ uint32 CanalScopeResolver::GetRandomBits() const
 
{
 
	/* Return random bits only for water tiles, not station tiles */
 
	return IsTileType(this->tile, MP_WATER) ? GetWaterTileRandomBits(this->tile) : 0;
src/newgrf_cargo.cpp
Show inline comments
 
@@ -16,13 +16,13 @@
 
#include "safeguards.h"
 

	
 
/** Resolver of cargo. */
 
struct CargoResolverObject : public ResolverObject {
 
	CargoResolverObject(const CargoSpec *cs, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
/* virtual */ const SpriteGroup *CargoResolverObject::ResolveReal(const RealSpriteGroup *group) const
 
{
 
	/* Cargo action 2s should always have only 1 "loaded" state, but some
 
	 * times things don't follow the spec... */
src/newgrf_config.cpp
Show inline comments
 
@@ -630,13 +630,13 @@ class GRFFileScanner : FileScanner {
 

	
 
public:
 
	GRFFileScanner() : next_update(_realtime_tick), num_scanned(0)
 
	{
 
	}
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override;
 

	
 
	/** Do the scan for GRFs. */
 
	static uint DoScan()
 
	{
 
		GRFFileScanner fs;
 
		int ret = fs.Scan(".grf", NEWGRF_DIR);
src/newgrf_engine.h
Show inline comments
 
@@ -37,15 +37,15 @@ struct VehicleScopeResolver : public Sco
 
		: ScopeResolver(ro), v(v), self_type(engine_type), info_view(info_view)
 
	{
 
	}
 

	
 
	void SetVehicle(const Vehicle *v) { this->v = v; }
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	/* virtual */ uint32 GetTriggers() const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
	uint32 GetTriggers() const override;
 
};
 

	
 
/** Resolver for a vehicle (chain) */
 
struct VehicleResolverObject : public ResolverObject {
 
	/** Application of 'wagon overrides'. */
 
	enum WagonOverride {
 
@@ -61,15 +61,15 @@ struct VehicleResolverObject : public Re
 
	VehicleScopeResolver relative_scope; ///< Scope resolver for an other vehicle in the chain.
 
	byte cached_relative_count;          ///< Relative position of the other vehicle.
 

	
 
	VehicleResolverObject(EngineID engine_type, const Vehicle *v, WagonOverride wagon_override, bool info_view = false,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0);
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override;
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
static const uint TRAININFO_DEFAULT_VEHICLE_WIDTH   = 29;
 
static const uint ROADVEHINFO_DEFAULT_VEHICLE_WIDTH = 32;
 
static const uint VEHICLEINFO_FULL_VEHICLE_WIDTH    = 32;
 

	
src/newgrf_generic.cpp
Show inline comments
 
@@ -39,34 +39,34 @@ struct GenericScopeResolver : public Sco
 
	GenericScopeResolver(ResolverObject &ro, bool ai_callback)
 
		: ScopeResolver(ro), cargo_type(0), default_selection(0), src_industry(0), dst_industry(0), distance(0),
 
		event(), count(0), station_size(0), ai_callback(ai_callback)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 

	
 
private:
 
	bool ai_callback; ///< Callback comes from the AI.
 
};
 

	
 

	
 
/** Resolver object for generic objects/properties. */
 
struct GenericResolverObject : public ResolverObject {
 
	GenericScopeResolver generic_scope;
 

	
 
	GenericResolverObject(bool ai_callback, CallbackID callback = CBID_NO_CALLBACK);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &this->generic_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
struct GenericCallback {
 
	const GRFFile *file;
 
	const SpriteGroup *group;
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -547,13 +547,13 @@ struct NewGRFTextfileWindow : public Tex
 
	NewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c) : TextfileWindow(file_type), grf_config(c)
 
	{
 
		const char *textfile = this->grf_config->GetTextfile(file_type);
 
		this->LoadTextfile(textfile, NEWGRF_DIR);
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		if (widget == WID_TF_CAPTION) {
 
			SetDParam(0, STR_CONTENT_TYPE_NEWGRF);
 
			SetDParamStr(1, this->grf_config->GetName());
 
		}
 
	}
src/newgrf_house.h
Show inline comments
 
@@ -41,27 +41,27 @@ struct HouseScopeResolver : public Scope
 
			bool not_yet_constructed, uint8 initial_random_bits, CargoTypes watched_cargo_triggers)
 
		: ScopeResolver(ro), house_id(house_id), tile(tile), town(town), not_yet_constructed(not_yet_constructed),
 
		initial_random_bits(initial_random_bits), watched_cargo_triggers(watched_cargo_triggers)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	/* virtual */ uint32 GetTriggers() const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
	uint32 GetTriggers() const override;
 
};
 

	
 
/** Resolver object to be used for houses (feature 07 spritegroups). */
 
struct HouseResolverObject : public ResolverObject {
 
	HouseScopeResolver house_scope;
 
	TownScopeResolver  town_scope;
 

	
 
	HouseResolverObject(HouseID house_id, TileIndex tile, Town *town,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 param1 = 0, uint32 param2 = 0,
 
			bool not_yet_constructed = false, uint8 initial_random_bits = 0, CargoTypes watched_cargo_triggers = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF:   return &this->house_scope;
 
			case VSG_SCOPE_PARENT: return &this->town_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
src/newgrf_industries.h
Show inline comments
 
@@ -31,16 +31,16 @@ struct IndustriesScopeResolver : public 
 
	 */
 
	IndustriesScopeResolver(ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32 random_bits = 0)
 
		: ScopeResolver(ro), tile(tile), industry(industry), type(type), random_bits(random_bits)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	/* virtual */ uint32 GetTriggers() const;
 
	/* virtual */ void StorePSA(uint pos, int32 value);
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
	uint32 GetTriggers() const override;
 
	void StorePSA(uint pos, int32 value) override;
 
};
 

	
 
/** Resolver for industries. */
 
struct IndustriesResolverObject : public ResolverObject {
 
	IndustriesScopeResolver industries_scope; ///< Scope resolver for the industry.
 
	TownScopeResolver *town_scope;            ///< Scope resolver for the associated town (if needed and available, else \c NULL).
 
@@ -48,13 +48,13 @@ struct IndustriesResolverObject : public
 
	IndustriesResolverObject(TileIndex tile, Industry *indus, IndustryType type, uint32 random_bits = 0,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 
	~IndustriesResolverObject();
 

	
 
	TownScopeResolver *GetTown();
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &industries_scope;
 
			case VSG_SCOPE_PARENT: {
 
				TownScopeResolver *tsr = this->GetTown();
 
				if (tsr != NULL) return tsr;
src/newgrf_industrytiles.h
Show inline comments
 
@@ -29,26 +29,26 @@ struct IndustryTileScopeResolver : publi
 
	 */
 
	IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile)
 
		: ScopeResolver(ro), industry(industry), tile(tile)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	/* virtual */ uint32 GetTriggers() const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
	uint32 GetTriggers() const override;
 
};
 

	
 
/** Resolver for industry tiles. */
 
struct IndustryTileResolverObject : public ResolverObject {
 
	IndustryTileScopeResolver indtile_scope; ///< Scope resolver for the industry tile.
 
	IndustriesScopeResolver ind_scope;       ///< Scope resolver for the industry owning the tile.
 

	
 
	IndustryTileResolverObject(IndustryGfx gfx, TileIndex tile, Industry *indus,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &indtile_scope;
 
			case VSG_SCOPE_PARENT: return &ind_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
src/newgrf_object.h
Show inline comments
 
@@ -113,26 +113,26 @@ struct ObjectScopeResolver : public Scop
 
	 */
 
	ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view = 0)
 
		: ScopeResolver(ro), obj(obj), tile(tile), view(view)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
};
 

	
 
/** A resolver object to be used with feature 0F spritegroups. */
 
struct ObjectResolverObject : public ResolverObject {
 
	ObjectScopeResolver object_scope; ///< The object scope resolver.
 
	TownScopeResolver *town_scope;    ///< The town scope resolver (created on the first call).
 

	
 
	ObjectResolverObject(const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view = 0,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 param1 = 0, uint32 param2 = 0);
 
	~ObjectResolverObject();
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF:
 
				return &this->object_scope;
 

	
 
			case VSG_SCOPE_PARENT: {
src/newgrf_railtype.h
Show inline comments
 
@@ -29,31 +29,31 @@ struct RailTypeScopeResolver : public Sc
 
	 */
 
	RailTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context)
 
		: ScopeResolver(ro), tile(tile), context(context)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
};
 

	
 
/** Resolver object for rail types. */
 
struct RailTypeResolverObject : public ResolverObject {
 
	RailTypeScopeResolver railtype_scope; ///< Resolver for the railtype scope.
 

	
 
	RailTypeResolverObject(const RailtypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32 param1 = 0, uint32 param2 = 0);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &this->railtype_scope;
 
			default:             return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = NULL);
 
SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false);
 

	
 
uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
src/newgrf_station.h
Show inline comments
 
@@ -39,16 +39,16 @@ struct StationScopeResolver : public Sco
 
	 */
 
	StationScopeResolver(ResolverObject &ro, const StationSpec *statspec, BaseStation *st, TileIndex tile)
 
		: ScopeResolver(ro), tile(tile), st(st), statspec(statspec), cargo_type(CT_INVALID), axis(INVALID_AXIS)
 
	{
 
	}
 

	
 
	/* virtual */ uint32 GetRandomBits() const;
 
	/* virtual */ uint32 GetTriggers() const;
 
	uint32 GetRandomBits() const override;
 
	uint32 GetTriggers() const override;
 

	
 
	/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
 
	uint32 GetVariable(byte variable, uint32 parameter, bool *available) const override;
 
};
 

	
 
/** Station resolver. */
 
struct StationResolverObject : public ResolverObject {
 
	StationScopeResolver station_scope; ///< The station scope resolver.
 
	TownScopeResolver *town_scope;      ///< The town scope resolver (created on the first call).
 
@@ -56,13 +56,13 @@ struct StationResolverObject : public Re
 
	StationResolverObject(const StationSpec *statspec, BaseStation *st, TileIndex tile,
 
			CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
 
	~StationResolverObject();
 

	
 
	TownScopeResolver *GetTown();
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF:
 
				return &this->station_scope;
 

	
 
			case VSG_SCOPE_PARENT: {
 
@@ -73,13 +73,13 @@ struct StationResolverObject : public Re
 

	
 
			default:
 
				return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
 

	
 
	/* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
 
	const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const override;
 
};
 

	
 
enum StationClassID {
 
	STAT_CLASS_BEGIN = 0,    ///< the lowest valid value
 
	STAT_CLASS_DFLT = 0,     ///< Default station class.
 
	STAT_CLASS_WAYP,         ///< Waypoint class.
src/newgrf_town.h
Show inline comments
 
@@ -43,13 +43,13 @@ struct TownScopeResolver : public ScopeR
 
/** Resolver of town properties. */
 
struct TownResolverObject : public ResolverObject {
 
	TownScopeResolver town_scope; ///< Scope resolver specific for towns.
 

	
 
	TownResolverObject(const struct GRFFile *grffile, Town *t, bool readonly);
 

	
 
	/* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &town_scope;
 
			default: return ResolverObject::GetScope(scope, relative);
 
		}
 
	}
src/os/macosx/crashlog_osx.cpp
Show inline comments
 
@@ -49,13 +49,13 @@ class CrashLogOSX : public CrashLog {
 
	int signum;
 

	
 
	char filename_log[MAX_PATH];        ///< Path of crash.log
 
	char filename_save[MAX_PATH];       ///< Path of crash.sav
 
	char filename_screenshot[MAX_PATH]; ///< Path of crash.(png|bmp|pcx)
 

	
 
	/* virtual */ char *LogOSVersion(char *buffer, const char *last) const
 
	char *LogOSVersion(char *buffer, const char *last) const override
 
	{
 
		int ver_maj, ver_min, ver_bug;
 
		GetMacOSVersion(&ver_maj, &ver_min, &ver_bug);
 

	
 
		const NXArchInfo *arch = NXGetLocalArchInfo();
 

	
 
@@ -68,25 +68,25 @@ class CrashLogOSX : public CrashLog {
 
				ver_maj, ver_min, ver_bug,
 
				arch != NULL ? arch->description : "unknown",
 
				MAC_OS_X_VERSION_MIN_REQUIRED
 
		);
 
	}
 

	
 
	/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const
 
	char *LogError(char *buffer, const char *last, const char *message) const override
 
	{
 
		return buffer + seprintf(buffer, last,
 
				"Crash reason:\n"
 
				" Signal:  %s (%d)\n"
 
				" Message: %s\n\n",
 
				strsignal(this->signum),
 
				this->signum,
 
				message == NULL ? "<none>" : message
 
		);
 
	}
 

	
 
	/* virtual */ char *LogStacktrace(char *buffer, const char *last) const
 
	char *LogStacktrace(char *buffer, const char *last) const override
 
	{
 
		/* As backtrace() is only implemented in 10.5 or later,
 
		 * we're rolling our own here. Mostly based on
 
		 * http://stackoverflow.com/questions/289820/getting-the-current-stack-trace-on-mac-os-x
 
		 * and some details looked up in the Darwin sources. */
 
		buffer += seprintf(buffer, last, "\nStacktrace:\n");
src/os/unix/crashlog_unix.cpp
Show inline comments
 
@@ -37,13 +37,13 @@
 
 * Unix implementation for the crash logger.
 
 */
 
class CrashLogUnix : public CrashLog {
 
	/** Signal that has been thrown. */
 
	int signum;
 

	
 
	/* virtual */ char *LogOSVersion(char *buffer, const char *last) const
 
	char *LogOSVersion(char *buffer, const char *last) const override
 
	{
 
		struct utsname name;
 
		if (uname(&name) < 0) {
 
			return buffer + seprintf(buffer, last, "Could not get OS version: %s\n", strerror(errno));
 
		}
 

	
 
@@ -57,13 +57,13 @@ class CrashLogUnix : public CrashLog {
 
				name.release,
 
				name.version,
 
				name.machine
 
		);
 
	}
 

	
 
	/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const
 
	char *LogError(char *buffer, const char *last, const char *message) const override
 
	{
 
		return buffer + seprintf(buffer, last,
 
				"Crash reason:\n"
 
				" Signal:  %s (%d)\n"
 
				" Message: %s\n\n",
 
				strsignal(this->signum),
 
@@ -102,13 +102,13 @@ class CrashLogUnix : public CrashLog {
 
		wp->counter++;
 

	
 
		return 0;
 
	}
 
#endif
 

	
 
	/* virtual */ char *LogStacktrace(char *buffer, const char *last) const
 
	char *LogStacktrace(char *buffer, const char *last) const override
 
	{
 
		buffer += seprintf(buffer, last, "Stacktrace:\n");
 
#if defined(__GLIBC__)
 
		void *trace[64];
 
		int trace_size = backtrace(trace, lengthof(trace));
 

	
src/os/windows/crashlog_win.cpp
Show inline comments
 
@@ -40,20 +40,20 @@ static const uint MAX_FRAMES     = 64;
 
 * Windows implementation for the crash logger.
 
 */
 
class CrashLogWindows : public CrashLog {
 
	/** Information about the encountered exception */
 
	EXCEPTION_POINTERS *ep;
 

	
 
	/* virtual */ char *LogOSVersion(char *buffer, const char *last) const;
 
	/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const;
 
	/* virtual */ char *LogStacktrace(char *buffer, const char *last) const;
 
	/* virtual */ char *LogRegisters(char *buffer, const char *last) const;
 
	/* virtual */ char *LogModules(char *buffer, const char *last) const;
 
	char *LogOSVersion(char *buffer, const char *last) const override;
 
	char *LogError(char *buffer, const char *last, const char *message) const override;
 
	char *LogStacktrace(char *buffer, const char *last) const override;
 
	char *LogRegisters(char *buffer, const char *last) const override;
 
	char *LogModules(char *buffer, const char *last) const override;
 
public:
 
#if defined(_MSC_VER)
 
	/* virtual */ int WriteCrashDump(char *filename, const char *filename_last) const;
 
	int WriteCrashDump(char *filename, const char *filename_last) const override;
 
	char *AppendDecodedStacktrace(char *buffer, const char *last) const;
 
#else
 
	char *AppendDecodedStacktrace(char *buffer, const char *last) const { return buffer; }
 
#endif /* _MSC_VER */
 

	
 
	/** Buffer for the generated crash log */
src/saveload/saveload.cpp
Show inline comments
 
@@ -1841,21 +1841,21 @@ struct FileReader : LoadFilter {
 
		this->file = NULL;
 

	
 
		/* Make sure we don't double free. */
 
		_sl.sf = NULL;
 
	}
 

	
 
	/* virtual */ size_t Read(byte *buf, size_t size)
 
	size_t Read(byte *buf, size_t size) override
 
	{
 
		/* We're in the process of shutting down, i.e. in "failure" mode. */
 
		if (this->file == NULL) return 0;
 

	
 
		return fread(buf, 1, size, this->file);
 
	}
 

	
 
	/* virtual */ void Reset()
 
	void Reset() override
 
	{
 
		clearerr(this->file);
 
		if (fseek(this->file, this->begin, SEEK_SET)) {
 
			DEBUG(sl, 1, "Could not reset the file reading");
 
		}
 
	}
 
@@ -1879,21 +1879,21 @@ struct FileWriter : SaveFilter {
 
		this->Finish();
 

	
 
		/* Make sure we don't double free. */
 
		_sl.sf = NULL;
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		/* We're in the process of shutting down, i.e. in "failure" mode. */
 
		if (this->file == NULL) return;
 

	
 
		if (fwrite(buf, 1, size, this->file) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
 
	}
 

	
 
	/* virtual */ void Finish()
 
	void Finish() override
 
	{
 
		if (this->file != NULL) fclose(this->file);
 
		this->file = NULL;
 
	}
 
};
 

	
 
@@ -1915,13 +1915,13 @@ struct LZOLoadFilter : LoadFilter {
 
	 */
 
	LZOLoadFilter(LoadFilter *chain) : LoadFilter(chain)
 
	{
 
		if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor");
 
	}
 

	
 
	/* virtual */ size_t Read(byte *buf, size_t ssize)
 
	size_t Read(byte *buf, size_t ssize) override
 
	{
 
		assert(ssize >= LZO_BUFFER_SIZE);
 

	
 
		/* Buffer size is from the LZO docs plus the chunk header size. */
 
		byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32) * 2];
 
		uint32 tmp[2];
 
@@ -1963,13 +1963,13 @@ struct LZOSaveFilter : SaveFilter {
 
	 */
 
	LZOSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain)
 
	{
 
		if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor");
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		const lzo_bytep in = buf;
 
		/* Buffer size is from the LZO docs plus the chunk header size. */
 
		byte out[LZO_BUFFER_SIZE + LZO_BUFFER_SIZE / 16 + 64 + 3 + sizeof(uint32) * 2];
 
		byte wrkmem[LZO1X_1_MEM_COMPRESS];
 
		lzo_uint outlen;
 
@@ -2002,13 +2002,13 @@ struct NoCompLoadFilter : LoadFilter {
 
	 * @param chain The next filter in this chain.
 
	 */
 
	NoCompLoadFilter(LoadFilter *chain) : LoadFilter(chain)
 
	{
 
	}
 

	
 
	/* virtual */ size_t Read(byte *buf, size_t size)
 
	size_t Read(byte *buf, size_t size) override
 
	{
 
		return this->chain->Read(buf, size);
 
	}
 
};
 

	
 
/** Filter without any compression. */
 
@@ -2019,13 +2019,13 @@ struct NoCompSaveFilter : SaveFilter {
 
	 * @param compression_level The requested level of compression.
 
	 */
 
	NoCompSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain)
 
	{
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		this->chain->Write(buf, size);
 
	}
 
};
 

	
 
/********************************************
 
@@ -2053,13 +2053,13 @@ struct ZlibLoadFilter : LoadFilter {
 
	/** Clean everything up. */
 
	~ZlibLoadFilter()
 
	{
 
		inflateEnd(&this->z);
 
	}
 

	
 
	/* virtual */ size_t Read(byte *buf, size_t size)
 
	size_t Read(byte *buf, size_t size) override
 
	{
 
		this->z.next_out  = buf;
 
		this->z.avail_out = (uint)size;
 

	
 
		do {
 
			/* read more bytes from the file? */
 
@@ -2132,18 +2132,18 @@ struct ZlibSaveFilter : SaveFilter {
 
			if (r == Z_STREAM_END) break;
 

	
 
			if (r != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "zlib returned error code");
 
		} while (this->z.avail_in || !this->z.avail_out);
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		this->WriteLoop(buf, size, 0);
 
	}
 

	
 
	/* virtual */ void Finish()
 
	void Finish() override
 
	{
 
		this->WriteLoop(NULL, 0, Z_FINISH);
 
		this->chain->Finish();
 
	}
 
};
 

	
 
@@ -2182,13 +2182,13 @@ struct LZMALoadFilter : LoadFilter {
 
	/** Clean everything up. */
 
	~LZMALoadFilter()
 
	{
 
		lzma_end(&this->lzma);
 
	}
 

	
 
	/* virtual */ size_t Read(byte *buf, size_t size)
 
	size_t Read(byte *buf, size_t size) override
 
	{
 
		this->lzma.next_out  = buf;
 
		this->lzma.avail_out = size;
 

	
 
		do {
 
			/* read more bytes from the file? */
 
@@ -2251,18 +2251,18 @@ struct LZMASaveFilter : SaveFilter {
 
			}
 
			if (r == LZMA_STREAM_END) break;
 
			if (r != LZMA_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "liblzma returned error code");
 
		} while (this->lzma.avail_in || !this->lzma.avail_out);
 
	}
 

	
 
	/* virtual */ void Write(byte *buf, size_t size)
 
	void Write(byte *buf, size_t size) override
 
	{
 
		this->WriteLoop(buf, size, LZMA_RUN);
 
	}
 

	
 
	/* virtual */ void Finish()
 
	void Finish() override
 
	{
 
		this->WriteLoop(NULL, 0, LZMA_FINISH);
 
		this->chain->Finish();
 
	}
 
};
 

	
src/script/api/script_text.hpp
Show inline comments
 
@@ -42,13 +42,13 @@ public:
 
 */
 
class RawText : public Text {
 
public:
 
	RawText(const char *text);
 
	~RawText();
 

	
 
	/* virtual */ const char *GetEncodedText() { return this->text; }
 
	const char *GetEncodedText() override { return this->text; }
 
private:
 
	const char *text;
 
};
 

	
 
/**
 
 * Class that handles all text related functions. You can define a language
src/script/script_scanner.hpp
Show inline comments
 
@@ -74,13 +74,13 @@ public:
 
	 * @param ci The information to compare to.
 
	 * @param md5sum Whether to check the MD5 checksum.
 
	 * @return A filename of a file of the content, else \c NULL.
 
	 */
 
	const char *FindMainScript(const ContentInfo *ci, bool md5sum);
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
 
	bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override;
 

	
 
	/**
 
	 * Rescan the script dir.
 
	 */
 
	void RescanDir();
 

	
src/settings_gui.cpp
Show inline comments
 
@@ -149,13 +149,13 @@ struct BaseSetTextfileWindow : public Te
 
	BaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) : TextfileWindow(file_type), baseset(baseset), content_type(content_type)
 
	{
 
		const char *textfile = this->baseset->GetTextfile(file_type);
 
		this->LoadTextfile(textfile, BASESET_DIR);
 
	}
 

	
 
	/* virtual */ void SetStringParameters(int widget) const
 
	void SetStringParameters(int widget) const override
 
	{
 
		if (widget == WID_TF_CAPTION) {
 
			SetDParam(0, content_type);
 
			SetDParamStr(1, this->baseset->name);
 
		}
 
	}
src/sound/allegro_s.h
Show inline comments
 
@@ -14,18 +14,18 @@
 

	
 
#include "sound_driver.hpp"
 

	
 
/** Implementation of the allegro sound driver. */
 
class SoundDriver_Allegro : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param);
 

	
 
	/* virtual */ void Stop();
 
	void Stop();
 

	
 
	/* virtual */ void MainLoop();
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
	void MainLoop();
 
	const char *GetName() const { return "allegro"; }
 
};
 

	
 
/** Factory for the allegro sound driver. */
 
class FSoundDriver_Allegro : public DriverFactoryBase {
 
public:
 
	FSoundDriver_Allegro() : DriverFactoryBase(Driver::DT_SOUND, 4, "allegro", "Allegro Sound Driver") {}
src/sound/cocoa_s.h
Show inline comments
 
@@ -13,19 +13,19 @@
 
#define SOUND_COCOA_H
 

	
 
#include "sound_driver.hpp"
 

	
 
class SoundDriver_Cocoa : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "cocoa"; }
 
	void Stop() override;
 
	const char *GetName() const override { return "cocoa"; }
 
};
 

	
 
class FSoundDriver_Cocoa : public DriverFactoryBase {
 
public:
 
	FSoundDriver_Cocoa() : DriverFactoryBase(Driver::DT_SOUND, 10, "cocoa", "Cocoa Sound Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new SoundDriver_Cocoa(); }
 
	Driver *CreateInstance() const override { return new SoundDriver_Cocoa(); }
 
};
 

	
 
#endif /* SOUND_COCOA_H */
src/sound/null_s.h
Show inline comments
 
@@ -14,20 +14,20 @@
 

	
 
#include "sound_driver.hpp"
 

	
 
/** Implementation of the null sound driver. */
 
class SoundDriver_Null : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param) { return NULL; }
 
	const char *Start(const char * const *param) override { return NULL; }
 

	
 
	/* virtual */ void Stop() { }
 
	/* virtual */ const char *GetName() const { return "null"; }
 
	void Stop() override { }
 
	const char *GetName() const override { return "null"; }
 
};
 

	
 
/** Factory for the null sound driver. */
 
class FSoundDriver_Null : public DriverFactoryBase {
 
public:
 
	FSoundDriver_Null() : DriverFactoryBase(Driver::DT_SOUND, 1, "null", "Null Sound Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new SoundDriver_Null(); }
 
	Driver *CreateInstance() const override { return new SoundDriver_Null(); }
 
};
 

	
 
#endif /* SOUND_NULL_H */
src/sound/sdl_s.h
Show inline comments
 
@@ -14,20 +14,20 @@
 

	
 
#include "sound_driver.hpp"
 

	
 
/** Implementation of the SDL sound driver. */
 
class SoundDriver_SDL : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "sdl"; }
 
	void Stop() override;
 
	const char *GetName() const override { return "sdl"; }
 
};
 

	
 
/** Factory for the SDL sound driver. */
 
class FSoundDriver_SDL : public DriverFactoryBase {
 
public:
 
	FSoundDriver_SDL() : DriverFactoryBase(Driver::DT_SOUND, 5, "sdl", "SDL Sound Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new SoundDriver_SDL(); }
 
	Driver *CreateInstance() const override { return new SoundDriver_SDL(); }
 
};
 

	
 
#endif /* SOUND_SDL_H */
src/sound/win32_s.h
Show inline comments
 
@@ -14,20 +14,20 @@
 

	
 
#include "sound_driver.hpp"
 

	
 
/** Implementation of the sound driver for Windows. */
 
class SoundDriver_Win32 : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
	void Stop() override;
 
	const char *GetName() const override { return "win32"; }
 
};
 

	
 
/** Factory for the sound driver for Windows. */
 
class FSoundDriver_Win32 : public DriverFactoryBase {
 
public:
 
	FSoundDriver_Win32() : DriverFactoryBase(Driver::DT_SOUND, 9, "win32", "Win32 WaveOut Sound Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new SoundDriver_Win32(); }
 
	Driver *CreateInstance() const override { return new SoundDriver_Win32(); }
 
};
 

	
 
#endif /* SOUND_WIN32_H */
src/sound/xaudio2_s.h
Show inline comments
 
@@ -14,20 +14,20 @@
 

	
 
#include "sound_driver.hpp"
 

	
 
/** Implementation of the XAudio2 sound driver. */
 
class SoundDriver_XAudio2 : public SoundDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	/* virtual */ const char *GetName() const { return "xaudio2"; }
 
	void Stop() override;
 
	const char *GetName() const override { return "xaudio2"; }
 
};
 

	
 
/** Factory for the XAudio2 sound driver. */
 
class FSoundDriver_XAudio2 : public DriverFactoryBase {
 
public:
 
	FSoundDriver_XAudio2() : DriverFactoryBase(Driver::DT_SOUND, 10, "xaudio2", "XAudio2 Sound Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new SoundDriver_XAudio2(); }
 
	Driver *CreateInstance() const override { return new SoundDriver_XAudio2(); }
 
};
 

	
 
#endif /* SOUND_XAUDIO2_H */
src/station_base.h
Show inline comments
 
@@ -487,18 +487,18 @@ public:
 
	~Station();
 

	
 
	void AddFacility(StationFacility new_facility_bit, TileIndex facil_xy);
 

	
 
	void MarkTilesDirty(bool cargo_change) const;
 

	
 
	void UpdateVirtCoord();
 
	void UpdateVirtCoord() override;
 

	
 
	void AfterStationTileSetChange(bool adding, StationType type);
 

	
 
	/* virtual */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) const;
 
	/* virtual */ uint GetPlatformLength(TileIndex tile) const;
 
	uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override;
 
	uint GetPlatformLength(TileIndex tile) const override;
 
	void RecomputeCatchment();
 
	static void RecomputeCatchmentForAll();
 

	
 
	uint GetCatchmentRadius() const;
 
	Rect GetCatchmentRect() const;
 
	bool CatchmentCoversTown(TownID t) const;
 
@@ -506,25 +506,25 @@ public:
 

	
 
	inline bool TileIsInCatchment(TileIndex tile) const
 
	{
 
		return this->catchment_tiles.HasTile(tile);
 
	}
 

	
 
	/* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const
 
	inline bool TileBelongsToRailStation(TileIndex tile) const override
 
	{
 
		return IsRailStationTile(tile) && GetStationIndex(tile) == this->index;
 
	}
 

	
 
	inline bool TileBelongsToAirport(TileIndex tile) const
 
	{
 
		return IsAirportTile(tile) && GetStationIndex(tile) == this->index;
 
	}
 

	
 
	/* virtual */ uint32 GetNewGRFVariable(const ResolverObject &object, byte variable, byte parameter, bool *available) const;
 
	uint32 GetNewGRFVariable(const ResolverObject &object, byte variable, byte parameter, bool *available) const override;
 

	
 
	/* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
 
	void GetTileArea(TileArea *ta, StationType type) const override;
 
};
 

	
 
#define FOR_ALL_STATIONS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Station, var)
 

	
 
/** Iterator to iterate over all tiles belonging to an airport. */
 
class AirportTileIterator : public OrthogonalTileIterator {
src/strgen/strgen.cpp
Show inline comments
 
@@ -112,20 +112,20 @@ struct FileStringReader : StringReader {
 
	/** Free/close the file. */
 
	virtual ~FileStringReader()
 
	{
 
		fclose(this->fh);
 
	}
 

	
 
	/* virtual */ char *ReadLine(char *buffer, const char *last)
 
	char *ReadLine(char *buffer, const char *last) override
 
	{
 
		return fgets(buffer, ClampToU16(last - buffer + 1), this->fh);
 
	}
 

	
 
	/* virtual */ void HandlePragma(char *str);
 
	void HandlePragma(char *str) override;
 

	
 
	/* virtual */ void ParseFile()
 
	void ParseFile() override
 
	{
 
		this->StringReader::ParseFile();
 

	
 
		if (StrEmpty(_lang.name) || StrEmpty(_lang.own_name) || StrEmpty(_lang.isocode)) {
 
			error("Language must include ##name, ##ownname and ##isocode");
 
		}
src/strings.cpp
Show inline comments
 
@@ -2029,24 +2029,24 @@ bool MissingGlyphSearcher::FindMissingGl
 

	
 
/** Helper for searching through the language pack. */
 
class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
 
	uint i; ///< Iterator for the primary language tables.
 
	uint j; ///< Iterator for the secondary language tables.
 

	
 
	/* virtual */ void Reset()
 
	void Reset() override
 
	{
 
		this->i = 0;
 
		this->j = 0;
 
	}
 

	
 
	/* virtual */ FontSize DefaultSize()
 
	FontSize DefaultSize() override
 
	{
 
		return FS_NORMAL;
 
	}
 

	
 
	/* virtual */ const char *NextString()
 
	const char *NextString() override
 
	{
 
		if (this->i >= TEXT_TAB_END) return NULL;
 

	
 
		const char *ret = _langpack_offs[_langtab_start[this->i] + this->j];
 

	
 
		this->j++;
 
@@ -2055,18 +2055,18 @@ class LanguagePackGlyphSearcher : public
 
			this->j = 0;
 
		}
 

	
 
		return ret;
 
	}
 

	
 
	/* virtual */ bool Monospace()
 
	bool Monospace() override
 
	{
 
		return false;
 
	}
 

	
 
	/* virtual */ void SetFontNames(FreeTypeSettings *settings, const char *font_name)
 
	void SetFontNames(FreeTypeSettings *settings, const char *font_name) override
 
	{
 
#ifdef WITH_FREETYPE
 
		strecpy(settings->small.font,  font_name, lastof(settings->small.font));
 
		strecpy(settings->medium.font, font_name, lastof(settings->medium.font));
 
		strecpy(settings->large.font,  font_name, lastof(settings->large.font));
 
#endif /* WITH_FREETYPE */
src/table/newgrf_debug_data.h
Show inline comments
 
@@ -66,20 +66,20 @@ static const NIVariable _niv_vehicles[] 
 
	// 0x61 not useful, since it requires register 0x10F
 
	NIV(0x62, "Curvature/position difference to other vehicle"),
 
	NIV_END()
 
};
 

	
 
class NIHVehicle : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return Vehicle::Get(index)->GetGRF() != NULL; }
 
	uint GetParent(uint index) const                     { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); }
 
	const void *GetInstance(uint index)const             { return Vehicle::Get(index); }
 
	const void *GetSpec(uint index) const                { return Vehicle::Get(index)->GetEngine(); }
 
	void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_VEHICLE_NAME, index); }
 
	uint32 GetGRFID(uint index) const                    { return Vehicle::Get(index)->GetGRFID(); }
 
	bool IsInspectable(uint index) const override        { return Vehicle::Get(index)->GetGRF() != NULL; }
 
	uint GetParent(uint index) const override            { const Vehicle *first = Vehicle::Get(index)->First(); return GetInspectWindowNumber(GetGrfSpecFeature(first->type), first->index); }
 
	const void *GetInstance(uint index)const override    { return Vehicle::Get(index); }
 
	const void *GetSpec(uint index) const override       { return Vehicle::Get(index)->GetEngine(); }
 
	void SetStringParameters(uint index) const override  { this->SetSimpleStringParameters(STR_VEHICLE_NAME, index); }
 
	uint32 GetGRFID(uint index) const override                   { return Vehicle::Get(index)->GetGRFID(); }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		Vehicle *v = Vehicle::Get(index);
 
		VehicleResolverObject ro(v->engine_type, v, VehicleResolverObject::WO_CACHED);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 
@@ -129,20 +129,20 @@ static const NIVariable _niv_stations[] 
 
	NIV(0x68, "station info of nearby tiles"),
 
	NIV(0x69, "information about cargo accepted in the past"),
 
	NIV_END()
 
};
 

	
 
class NIHStation : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return GetStationSpec(index) != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return GetStationSpec(index); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? GetStationSpec(index)->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return GetStationSpec(index) != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const override    { return NULL; }
 
	const void *GetSpec(uint index) const override       { return GetStationSpec(index); }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? GetStationSpec(index)->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		StationResolverObject ro(GetStationSpec(index), Station::GetByTile(index), index);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 

	
 
@@ -194,20 +194,20 @@ static const NIVariable _niv_house[] = {
 
	NIV(0x66, "class and ID of nearby house tile"),
 
	NIV(0x67, "GRFID of nearby house tile"),
 
	NIV_END()
 
};
 

	
 
class NIHHouse : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return HouseSpec::Get(GetHouseType(index)); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_TOWN_NAME, GetTownIndex(index), index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); }
 
	const void *GetInstance(uint index)const override    { return NULL; }
 
	const void *GetSpec(uint index) const override       { return HouseSpec::Get(GetHouseType(index)); }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_TOWN_NAME, GetTownIndex(index), index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		HouseResolverObject ro(GetHouseType(index), index, Town::GetByTile(index));
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 

	
 
@@ -244,20 +244,20 @@ static const NIVariable _niv_industrytil
 
	NIV(0x61, "animation stage of nearby tiles"),
 
	NIV(0x62, "get industry or airport tile ID at offset"),
 
	NIV_END()
 
};
 

	
 
class NIHIndustryTile : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return GetIndustryTileSpec(GetIndustryGfx(index)); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); }
 
	const void *GetInstance(uint index)const override    { return NULL; }
 
	const void *GetSpec(uint index) const override       { return GetIndustryTileSpec(GetIndustryGfx(index)); }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		IndustryTileResolverObject ro(GetIndustryGfx(index), index, Industry::GetByTile(index));
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 

	
 
@@ -343,29 +343,29 @@ static const NIVariable _niv_industries[
 
	NIV(0x67, "count of industry and distance of closest instance"),
 
	NIV(0x68, "count of industry and distance of closest instance with layout filter"),
 
	NIV_END()
 
};
 

	
 
class NIHIndustry : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
 
	const void *GetInstance(uint index)const             { return Industry::Get(index); }
 
	const void *GetSpec(uint index) const                { return GetIndustrySpec(Industry::Get(index)->type); }
 
	void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_INDUSTRY_NAME, index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Industry::Get(index)->town->index); }
 
	const void *GetInstance(uint index)const override    { return Industry::Get(index); }
 
	const void *GetSpec(uint index) const override       { return GetIndustrySpec(Industry::Get(index)->type); }
 
	void SetStringParameters(uint index) const override  { this->SetSimpleStringParameters(STR_INDUSTRY_NAME, index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? GetIndustrySpec(Industry::Get(index)->type)->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		Industry *i = Industry::Get(index);
 
		IndustriesResolverObject ro(i->location.tile, i, i->type);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 

	
 
	uint GetPSASize(uint index, uint32 grfid) const      { return cpp_lengthof(PersistentStorage, storage); }
 
	uint GetPSASize(uint index, uint32 grfid) const override { return cpp_lengthof(PersistentStorage, storage); }
 

	
 
	const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
 
	const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const override
 
	{
 
		const Industry *i = (const Industry *)this->GetInstance(index);
 
		if (i->psa == NULL) return NULL;
 
		return (int32 *)(&i->psa->storage);
 
	}
 
};
 
@@ -408,20 +408,20 @@ static const NIVariable _niv_objects[] =
 
	NIV(0x63, "animation stage of nearby tiles"),
 
	NIV(0x64, "distance on nearest object with given type"),
 
	NIV_END()
 
};
 

	
 
class NIHObject : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return ObjectSpec::GetByTile(index)->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const             { return Object::GetByTile(index); }
 
	const void *GetSpec(uint index) const                { return ObjectSpec::GetByTile(index); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT, INVALID_STRING_ID, index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? ObjectSpec::GetByTile(index)->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return ObjectSpec::GetByTile(index)->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Object::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const override    { return Object::GetByTile(index); }
 
	const void *GetSpec(uint index) const override       { return ObjectSpec::GetByTile(index); }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT, INVALID_STRING_ID, index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? ObjectSpec::GetByTile(index)->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		ObjectResolverObject ro(ObjectSpec::GetByTile(index), Object::GetByTile(index), index);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 

	
 
@@ -442,20 +442,20 @@ static const NIVariable _niv_railtypes[]
 
	NIV(0x43, "construction date"),
 
	NIV(0x44, "town zone"),
 
	NIV_END()
 
};
 

	
 
class NIHRailType : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return true; }
 
	uint GetParent(uint index) const                     { return UINT32_MAX; }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return NULL; }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
 
	uint32 GetGRFID(uint index) const                    { return 0; }
 
	bool IsInspectable(uint index) const override        { return true; }
 
	uint GetParent(uint index) const override            { return UINT32_MAX; }
 
	const void *GetInstance(uint index)const override    { return NULL; }
 
	const void *GetSpec(uint index) const override       { return NULL; }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
 
	uint32 GetGRFID(uint index) const override           { return 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		/* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
 
		 * However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
 
		RailTypeResolverObject ro(NULL, index, TCX_NORMAL, RTSG_END);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
@@ -478,20 +478,20 @@ static const NICallback _nic_airporttile
 
	NICAT(CBID_AIRPTILE_ANIM_NEXT_FRAME,  CBM_AIRT_ANIM_NEXT_FRAME),
 
	NICAT(CBID_AIRPTILE_ANIMATION_SPEED,  CBM_AIRT_ANIM_SPEED),
 
	NIC_END()
 
};
 

	
 
class NIHAirportTile : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const                     { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const             { return NULL; }
 
	const void *GetSpec(uint index) const                { return AirportTileSpec::Get(GetAirportGfx(index)); }
 
	void SetStringParameters(uint index) const           { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
 
	uint32 GetGRFID(uint index) const                    { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile->grfid : 0; }
 
	bool IsInspectable(uint index) const override        { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != NULL; }
 
	uint GetParent(uint index) const override            { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); }
 
	const void *GetInstance(uint index)const override    { return NULL; }
 
	const void *GetSpec(uint index) const override       { return AirportTileSpec::Get(GetAirportGfx(index)); }
 
	void SetStringParameters(uint index) const override  { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); }
 
	uint32 GetGRFID(uint index) const override           { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile->grfid : 0; }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		AirportTileResolverObject ro(AirportTileSpec::GetByTile(index), index, Station::GetByTile(index));
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 
};
 

	
 
@@ -516,28 +516,28 @@ static const NIVariable _niv_towns[] = {
 
	NIV(0x9C, "zone radius 4"),
 
	NIV(0xB6, "number of buildings"),
 
	NIV_END()
 
};
 

	
 
class NIHTown : public NIHelper {
 
	bool IsInspectable(uint index) const                 { return Town::IsValidID(index); }
 
	uint GetParent(uint index) const                     { return UINT32_MAX; }
 
	const void *GetInstance(uint index)const             { return Town::Get(index); }
 
	const void *GetSpec(uint index) const                { return NULL; }
 
	void SetStringParameters(uint index) const           { this->SetSimpleStringParameters(STR_TOWN_NAME, index); }
 
	uint32 GetGRFID(uint index) const                    { return 0; }
 
	bool PSAWithParameter() const                        { return true; }
 
	uint GetPSASize(uint index, uint32 grfid) const      { return cpp_lengthof(PersistentStorage, storage); }
 
	bool IsInspectable(uint index) const override        { return Town::IsValidID(index); }
 
	uint GetParent(uint index) const override            { return UINT32_MAX; }
 
	const void *GetInstance(uint index)const override    { return Town::Get(index); }
 
	const void *GetSpec(uint index) const override       { return NULL; }
 
	void SetStringParameters(uint index) const override  { this->SetSimpleStringParameters(STR_TOWN_NAME, index); }
 
	uint32 GetGRFID(uint index) const override           { return 0; }
 
	bool PSAWithParameter() const override               { return true; }
 
	uint GetPSASize(uint index, uint32 grfid) const override { return cpp_lengthof(PersistentStorage, storage); }
 

	
 
	/* virtual */ uint Resolve(uint index, uint var, uint param, bool *avail) const
 
	uint Resolve(uint index, uint var, uint param, bool *avail) const override
 
	{
 
		TownResolverObject ro(NULL, Town::Get(index), true);
 
		return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
 
	}
 

	
 
	const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
 
	const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const override
 
	{
 
		Town *t = Town::Get(index);
 

	
 
		std::list<PersistentStorage *>::iterator iter;
 
		for (iter = t->psa_list.begin(); iter != t->psa_list.end(); iter++) {
 
			if ((*iter)->grfid == grfid) return (int32 *)(&(*iter)->storage[0]);
src/thread/thread_os2.cpp
Show inline comments
 
@@ -38,19 +38,19 @@ public:
 
		param(param),
 
		self_destruct(self_destruct)
 
	{
 
		thread = _beginthread(stThreadProc, NULL, 1048576, this);
 
	}
 

	
 
	/* virtual */ bool Exit()
 
	bool Exit() override
 
	{
 
		_endthread();
 
		return true;
 
	}
 

	
 
	/* virtual */ void Join()
 
	void Join() override
 
	{
 
		DosWaitThread(&this->thread, DCWW_WAIT);
 
		this->thread = 0;
 
	}
 
private:
 
	/**
 
@@ -103,42 +103,42 @@ public:
 
	ThreadMutex_OS2() : recursive_count(0)
 
	{
 
		DosCreateMutexSem(NULL, &mutex, 0, FALSE);
 
		DosCreateEventSem(NULL, &event, 0, FALSE);
 
	}
 

	
 
	/* virtual */ ~ThreadMutex_OS2()
 
	~ThreadMutex_OS2() override
 
	{
 
		DosCloseMutexSem(mutex);
 
		DosCloseEventSem(event);
 
	}
 

	
 
	/* virtual */ void BeginCritical(bool allow_recursive = false)
 
	void BeginCritical(bool allow_recursive = false) override
 
	{
 
		/* os2 mutex is recursive by itself */
 
		DosRequestMutexSem(mutex, (unsigned long) SEM_INDEFINITE_WAIT);
 
		this->recursive_count++;
 
		if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
 
	}
 

	
 
	/* virtual */ void EndCritical(bool allow_recursive = false)
 
	void EndCritical(bool allow_recursive = false) override
 
	{
 
		if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
 
		this->recursive_count--;
 
		DosReleaseMutexSem(mutex);
 
	}
 

	
 
	/* virtual */ void WaitForSignal()
 
	void WaitForSignal() override
 
	{
 
		assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise?
 
		this->EndCritical();
 
		DosWaitEventSem(event, SEM_INDEFINITE_WAIT);
 
		this->BeginCritical();
 
	}
 

	
 
	/* virtual */ void SendSignal()
 
	void SendSignal() override
 
	{
 
		DosPostEventSem(event);
 
	}
 
};
 

	
 
/* static */ ThreadMutex *ThreadMutex::New()
src/thread/thread_pthread.cpp
Show inline comments
 
@@ -42,20 +42,20 @@ public:
 
		self_destruct(self_destruct),
 
		name(name)
 
	{
 
		pthread_create(&this->thread, NULL, &stThreadProc, this);
 
	}
 

	
 
	/* virtual */ bool Exit()
 
	bool Exit() override
 
	{
 
		assert(pthread_self() == this->thread);
 
		/* For now we terminate by throwing an error, gives much cleaner cleanup */
 
		throw OTTDThreadExitSignal();
 
	}
 

	
 
	/* virtual */ void Join()
 
	void Join() override
 
	{
 
		/* You cannot join yourself */
 
		assert(pthread_self() != this->thread);
 
		pthread_join(this->thread, NULL);
 
		this->thread = 0;
 
	}
 
@@ -126,26 +126,26 @@ public:
 
		pthread_mutexattr_init(&this->attr);
 
		pthread_mutexattr_settype(&this->attr, PTHREAD_MUTEX_ERRORCHECK);
 
		pthread_mutex_init(&this->mutex, &this->attr);
 
		pthread_cond_init(&this->condition, NULL);
 
	}
 

	
 
	/* virtual */ ~ThreadMutex_pthread()
 
	~ThreadMutex_pthread() override
 
	{
 
		int err = pthread_cond_destroy(&this->condition);
 
		assert(err != EBUSY);
 
		err = pthread_mutex_destroy(&this->mutex);
 
		assert(err != EBUSY);
 
	}
 

	
 
	bool IsOwnedByCurrentThread() const
 
	{
 
		return this->owner == pthread_self();
 
	}
 

	
 
	/* virtual */ void BeginCritical(bool allow_recursive = false)
 
	void BeginCritical(bool allow_recursive = false) override
 
	{
 
		/* pthread mutex is not recursive by itself */
 
		if (this->IsOwnedByCurrentThread()) {
 
			if (!allow_recursive) NOT_REACHED();
 
		} else {
 
			int err = pthread_mutex_lock(&this->mutex);
 
@@ -153,35 +153,35 @@ public:
 
			assert(this->recursive_count == 0);
 
			this->owner = pthread_self();
 
		}
 
		this->recursive_count++;
 
	}
 

	
 
	/* virtual */ void EndCritical(bool allow_recursive = false)
 
	void EndCritical(bool allow_recursive = false) override
 
	{
 
		assert(this->IsOwnedByCurrentThread());
 
		if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
 
		this->recursive_count--;
 
		if (this->recursive_count != 0) return;
 
		this->owner = 0;
 
		int err = pthread_mutex_unlock(&this->mutex);
 
		assert(err == 0);
 
	}
 

	
 
	/* virtual */ void WaitForSignal()
 
	void WaitForSignal() override
 
	{
 
		uint old_recursive_count = this->recursive_count;
 
		this->recursive_count = 0;
 
		this->owner = 0;
 
		int err = pthread_cond_wait(&this->condition, &this->mutex);
 
		assert(err == 0);
 
		this->owner = pthread_self();
 
		this->recursive_count = old_recursive_count;
 
	}
 

	
 
	/* virtual */ void SendSignal()
 
	void SendSignal() override
 
	{
 
		int err = pthread_cond_signal(&this->condition);
 
		assert(err == 0);
 
	}
 
};
 

	
src/thread/thread_win32.cpp
Show inline comments
 
@@ -46,28 +46,28 @@ public:
 
	{
 
		this->thread = (HANDLE)_beginthreadex(NULL, 0, &stThreadProc, this, CREATE_SUSPENDED, &this->id);
 
		if (this->thread == NULL) return;
 
		ResumeThread(this->thread);
 
	}
 

	
 
	/* virtual */ ~ThreadObject_Win32()
 
	~ThreadObject_Win32() override
 
	{
 
		if (this->thread != NULL) {
 
			CloseHandle(this->thread);
 
			this->thread = NULL;
 
		}
 
	}
 

	
 
	/* virtual */ bool Exit()
 
	bool Exit() override
 
	{
 
		assert(GetCurrentThreadId() == this->id);
 
		/* For now we terminate by throwing an error, gives much cleaner cleanup */
 
		throw OTTDThreadExitSignal();
 
	}
 

	
 
	/* virtual */ void Join()
 
	void Join() override
 
	{
 
		/* You cannot join yourself */
 
		assert(GetCurrentThreadId() != this->id);
 
		WaitForSingleObject(this->thread, INFINITE);
 
	}
 

	
 
@@ -123,42 +123,42 @@ public:
 
	ThreadMutex_Win32() : recursive_count(0)
 
	{
 
		InitializeCriticalSection(&this->critical_section);
 
		this->event = CreateEvent(NULL, FALSE, FALSE, NULL);
 
	}
 

	
 
	/* virtual */ ~ThreadMutex_Win32()
 
	~ThreadMutex_Win32() override
 
	{
 
		DeleteCriticalSection(&this->critical_section);
 
		CloseHandle(this->event);
 
	}
 

	
 
	/* virtual */ void BeginCritical(bool allow_recursive = false)
 
	void BeginCritical(bool allow_recursive = false) override
 
	{
 
		/* windows mutex is recursive by itself */
 
		EnterCriticalSection(&this->critical_section);
 
		this->recursive_count++;
 
		if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
 
	}
 

	
 
	/* virtual */ void EndCritical(bool allow_recursive = false)
 
	void EndCritical(bool allow_recursive = false) override
 
	{
 
		if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
 
		this->recursive_count--;
 
		LeaveCriticalSection(&this->critical_section);
 
	}
 

	
 
	/* virtual */ void WaitForSignal()
 
	void WaitForSignal() override
 
	{
 
		assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise?
 
		this->EndCritical();
 
		WaitForSingleObject(this->event, INFINITE);
 
		this->BeginCritical();
 
	}
 

	
 
	/* virtual */ void SendSignal()
 
	void SendSignal() override
 
	{
 
		SetEvent(this->event);
 
	}
 
};
 

	
 
/* static */ ThreadMutex *ThreadMutex::New()
src/toolbar_gui.cpp
Show inline comments
 
@@ -1329,13 +1329,13 @@ public:
 
	 */
 
	bool IsButton(WidgetType type) const
 
	{
 
		return type == WWT_IMGBTN || type == WWT_IMGBTN_2 || type == WWT_PUSHIMGBTN;
 
	}
 

	
 
	void SetupSmallestSize(Window *w, bool init_array)
 
	void SetupSmallestSize(Window *w, bool init_array) override
 
	{
 
		this->smallest_x = 0; // Biggest child
 
		this->smallest_y = 0; // Biggest child
 
		this->fill_x = 1;
 
		this->fill_y = 0;
 
		this->resize_x = 1; // We only resize in this direction
 
@@ -1362,13 +1362,13 @@ public:
 
				child_wid->current_x = child_wid->smallest_x;
 
			}
 
		}
 
		_toolbar_width = nbuttons * this->smallest_x;
 
	}
 

	
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
 
	{
 
		assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
 

	
 
		this->pos_x = x;
 
		this->pos_y = y;
 
		this->current_x = given_width;
 
@@ -1425,13 +1425,13 @@ public:
 
			} else {
 
				cur_wid++;
 
			}
 
		}
 
	}
 

	
 
	/* virtual */ void Draw(const Window *w)
 
	void Draw(const Window *w) override
 
	{
 
		/* Draw brown-red toolbar bg. */
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_VERY_DARK_RED);
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_DARK_RED, FILLRECT_CHECKER);
 

	
 
		bool rtl = _current_text_dir == TD_RTL;
 
@@ -1440,13 +1440,13 @@ public:
 
			if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
 

	
 
			child_wid->Draw(w);
 
		}
 
	}
 

	
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y)
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override
 
	{
 
		if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
 

	
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
			if (child_wid->type == NWID_SPACER) continue;
 
			if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
 
@@ -1467,13 +1467,13 @@ public:
 
	 */
 
	virtual const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const = 0;
 
};
 

	
 
/** Container for the 'normal' main toolbar */
 
class NWidgetMainToolbarContainer : public NWidgetToolbarContainer {
 
	/* virtual */ const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const
 
	const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const override
 
	{
 
		static const uint SMALLEST_ARRANGEMENT = 14;
 
		static const uint BIGGEST_ARRANGEMENT  = 20;
 

	
 
		/* The number of buttons of each row of the toolbar should match the number of items which we want to be visible.
 
		 * The total number of buttons should be equal to arrangable_count * 2.
 
@@ -1790,13 +1790,13 @@ class NWidgetMainToolbarContainer : publ
 
};
 

	
 
/** Container for the scenario editor's toolbar */
 
class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer {
 
	uint panel_widths[2]; ///< The width of the two panels (the text panel and date panel)
 

	
 
	void SetupSmallestSize(Window *w, bool init_array)
 
	void SetupSmallestSize(Window *w, bool init_array) override
 
	{
 
		this->NWidgetToolbarContainer::SetupSmallestSize(w, init_array);
 

	
 
		/* Find the size of panel_widths */
 
		uint i = 0;
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
@@ -1805,13 +1805,13 @@ class NWidgetScenarioToolbarContainer : 
 
			assert(i < lengthof(this->panel_widths));
 
			this->panel_widths[i++] = child_wid->current_x;
 
			_toolbar_width += child_wid->current_x;
 
		}
 
	}
 

	
 
	/* virtual */ const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const
 
	const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const override
 
	{
 
		static const byte arrange_all[] = {
 
			WID_TE_PAUSE,
 
			WID_TE_FAST_FORWARD,
 
			WID_TE_SETTINGS,
 
			WID_TE_SAVE,
src/video/allegro_v.h
Show inline comments
 
@@ -14,33 +14,33 @@
 

	
 
#include "video_driver.hpp"
 

	
 
/** The allegro video driver. */
 
class VideoDriver_Allegro : public VideoDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	bool ToggleFullscreen(bool fullscreen) override;
 

	
 
	/* virtual */ bool AfterBlitterChange();
 
	bool AfterBlitterChange() override;
 

	
 
	/* virtual */ bool ClaimMousePointer();
 
	bool ClaimMousePointer() override;
 

	
 
	/* virtual */ const char *GetName() const { return "allegro"; }
 
	const char *GetName() const override { return "allegro"; }
 
};
 

	
 
/** Factory for the allegro video driver. */
 
class FVideoDriver_Allegro : public DriverFactoryBase {
 
public:
 
	FVideoDriver_Allegro() : DriverFactoryBase(Driver::DT_VIDEO, 4, "allegro", "Allegro Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_Allegro(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_Allegro(); }
 
};
 

	
 
#endif /* VIDEO_ALLEGRO_H */
src/video/cocoa/cocoa_v.h
Show inline comments
 
@@ -13,61 +13,61 @@
 
#define VIDEO_COCOA_H
 

	
 
#include "../video_driver.hpp"
 

	
 
class VideoDriver_Cocoa : public VideoDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/** Stop the video driver */
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/** Mark dirty a screen region
 
	 * @param left x-coordinate of left border
 
	 * @param top  y-coordinate of top border
 
	 * @param width width or dirty rectangle
 
	 * @param height height of dirty rectangle
 
	 */
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/** Programme main loop */
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/** Change window resolution
 
	 * @param w New window width
 
	 * @param h New window height
 
	 * @return Whether change was successful
 
	 */
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/** Set a new window mode
 
	 * @param fullscreen Whether to set fullscreen mode or not
 
	 * @return Whether changing the screen mode was successful
 
	 */
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	bool ToggleFullscreen(bool fullscreen) override;
 

	
 
	/** Callback invoked after the blitter was changed.
 
	 * @return True if no error.
 
	 */
 
	/* virtual */ bool AfterBlitterChange();
 
	bool AfterBlitterChange() override;
 

	
 
	/**
 
	 * An edit box lost the input focus. Abort character compositing if necessary.
 
	 */
 
	/* virtual */ void EditBoxLostFocus();
 
	void EditBoxLostFocus() override;
 

	
 
	/** Return driver name
 
	 * @return driver name
 
	 */
 
	/* virtual */ const char *GetName() const { return "cocoa"; }
 
	const char *GetName() const override { return "cocoa"; }
 
};
 

	
 
class FVideoDriver_Cocoa : public DriverFactoryBase {
 
public:
 
	FVideoDriver_Cocoa() : DriverFactoryBase(Driver::DT_VIDEO, 10, "cocoa", "Cocoa Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_Cocoa(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_Cocoa(); }
 
};
 

	
 

	
 
/**
 
 * Generic display driver for cocoa
 
 * On grounds to not duplicate some code, it contains a few variables
src/video/dedicated_v.h
Show inline comments
 
@@ -14,25 +14,25 @@
 

	
 
#include "video_driver.hpp"
 

	
 
/** The dedicated server video driver. */
 
class VideoDriver_Dedicated : public VideoDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "dedicated"; }
 
	/* virtual */ bool HasGUI() const { return false; }
 
	bool ToggleFullscreen(bool fullscreen) override;
 
	const char *GetName() const override { return "dedicated"; }
 
	bool HasGUI() const override { return false; }
 
};
 

	
 
/** Factory for the dedicated server video driver. */
 
class FVideoDriver_Dedicated : public DriverFactoryBase {
 
public:
 
#ifdef DEDICATED
 
@@ -40,10 +40,10 @@ public:
 
	 * server build. */
 
	static const int PRIORITY = 10;
 
#else
 
	static const int PRIORITY = 0;
 
#endif
 
	FVideoDriver_Dedicated() : DriverFactoryBase(Driver::DT_VIDEO, PRIORITY, "dedicated", "Dedicated Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_Dedicated(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_Dedicated(); }
 
};
 

	
 
#endif /* VIDEO_DEDICATED_H */
src/video/null_v.h
Show inline comments
 
@@ -17,29 +17,29 @@
 
/** The null video driver. */
 
class VideoDriver_Null : public VideoDriver {
 
private:
 
	uint ticks; ///< Amount of ticks to run.
 

	
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	/* virtual */ const char *GetName() const { return "null"; }
 
	/* virtual */ bool HasGUI() const { return false; }
 
	bool ToggleFullscreen(bool fullscreen) override;
 
	const char *GetName() const override { return "null"; }
 
	bool HasGUI() const override { return false; }
 
};
 

	
 
/** Factory the null video driver. */
 
class FVideoDriver_Null : public DriverFactoryBase {
 
public:
 
	FVideoDriver_Null() : DriverFactoryBase(Driver::DT_VIDEO, 0, "null", "Null Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_Null(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_Null(); }
 
};
 

	
 
#endif /* VIDEO_NULL_H */
src/video/sdl_v.h
Show inline comments
 
@@ -14,41 +14,41 @@
 

	
 
#include "video_driver.hpp"
 

	
 
/** The SDL video driver. */
 
class VideoDriver_SDL : public VideoDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	bool ToggleFullscreen(bool fullscreen) override;
 

	
 
	/* virtual */ bool AfterBlitterChange();
 
	bool AfterBlitterChange() override;
 

	
 
	/* virtual */ void AcquireBlitterLock();
 
	void AcquireBlitterLock() override;
 

	
 
	/* virtual */ void ReleaseBlitterLock();
 
	void ReleaseBlitterLock() override;
 

	
 
	/* virtual */ bool ClaimMousePointer();
 
	bool ClaimMousePointer() override;
 

	
 
	/* virtual */ const char *GetName() const { return "sdl"; }
 
	const char *GetName() const override { return "sdl"; }
 
private:
 
	int PollEvent();
 
	bool CreateMainSurface(uint w, uint h);
 
	void SetupKeyboard();
 
};
 

	
 
/** Factory for the SDL video driver. */
 
class FVideoDriver_SDL : public DriverFactoryBase {
 
public:
 
	FVideoDriver_SDL() : DriverFactoryBase(Driver::DT_VIDEO, 5, "sdl", "SDL Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_SDL(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_SDL(); }
 
};
 

	
 
#endif /* VIDEO_SDL_H */
src/video/win32_v.h
Show inline comments
 
@@ -14,41 +14,41 @@
 

	
 
#include "video_driver.hpp"
 

	
 
/** The video driver for windows. */
 
class VideoDriver_Win32 : public VideoDriver {
 
public:
 
	/* virtual */ const char *Start(const char * const *param);
 
	const char *Start(const char * const *param) override;
 

	
 
	/* virtual */ void Stop();
 
	void Stop() override;
 

	
 
	/* virtual */ void MakeDirty(int left, int top, int width, int height);
 
	void MakeDirty(int left, int top, int width, int height) override;
 

	
 
	/* virtual */ void MainLoop();
 
	void MainLoop() override;
 

	
 
	/* virtual */ bool ChangeResolution(int w, int h);
 
	bool ChangeResolution(int w, int h) override;
 

	
 
	/* virtual */ bool ToggleFullscreen(bool fullscreen);
 
	bool ToggleFullscreen(bool fullscreen) override;
 

	
 
	/* virtual */ bool AfterBlitterChange();
 
	bool AfterBlitterChange() override;
 

	
 
	/* virtual */ void AcquireBlitterLock();
 
	void AcquireBlitterLock() override;
 

	
 
	/* virtual */ void ReleaseBlitterLock();
 
	void ReleaseBlitterLock() override;
 

	
 
	/* virtual */ bool ClaimMousePointer();
 
	bool ClaimMousePointer() override;
 

	
 
	/* virtual */ void EditBoxLostFocus();
 
	void EditBoxLostFocus() override;
 

	
 
	/* virtual */ const char *GetName() const { return "win32"; }
 
	const char *GetName() const override { return "win32"; }
 

	
 
	bool MakeWindow(bool full_screen);
 
};
 

	
 
/** The factory for Windows' video driver. */
 
class FVideoDriver_Win32 : public DriverFactoryBase {
 
public:
 
	FVideoDriver_Win32() : DriverFactoryBase(Driver::DT_VIDEO, 10, "win32", "Win32 GDI Video Driver") {}
 
	/* virtual */ Driver *CreateInstance() const { return new VideoDriver_Win32(); }
 
	Driver *CreateInstance() const override { return new VideoDriver_Win32(); }
 
};
 

	
 
#endif /* VIDEO_WIN32_H */
src/waypoint_base.h
Show inline comments
 
@@ -22,29 +22,29 @@ struct Waypoint FINAL : SpecializedStati
 
	 * Create a waypoint at the given tile.
 
	 * @param tile The location of the waypoint.
 
	 */
 
	Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation<Waypoint, true>(tile) { }
 
	~Waypoint();
 

	
 
	void UpdateVirtCoord();
 
	void UpdateVirtCoord() override;
 

	
 
	/* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const
 
	inline bool TileBelongsToRailStation(TileIndex tile) const override
 
	{
 
		return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
 
	}
 

	
 
	/* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const;
 
	uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const override;
 

	
 
	/* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
 
	void GetTileArea(TileArea *ta, StationType type) const override;
 

	
 
	/* virtual */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) const
 
	uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override
 
	{
 
		return 1;
 
	}
 

	
 
	/* virtual */ uint GetPlatformLength(TileIndex tile) const
 
	uint GetPlatformLength(TileIndex tile) const override
 
	{
 
		return 1;
 
	}
 

	
 
	/**
 
	 * Is this a single tile waypoint?
src/widget_type.h
Show inline comments
 
@@ -290,17 +290,17 @@ public:
 

	
 
	inline void SetLowered(bool lowered);
 
	inline bool IsLowered() const;
 
	inline void SetDisabled(bool disabled);
 
	inline bool IsDisabled() const;
 

	
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	/* virtual */ bool IsHighlighted() const;
 
	/* virtual */ TextColour GetHighlightColour() const;
 
	/* virtual */ void SetHighlighted(TextColour highlight_colour);
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 
	bool IsHighlighted() const override;
 
	TextColour GetHighlightColour() const override;
 
	void SetHighlighted(TextColour highlight_colour) override;
 

	
 
	NWidgetDisplay disp_flags; ///< Flags that affect display and interaction with the widget.
 
	Colours colour;            ///< Colour of this widget.
 
	int index;                 ///< Index of the nested widget in the widget array of the window (\c -1 means 'not used').
 
	uint32 widget_data;        ///< Data of the widget. @see Widget::data
 
	StringID tool_tip;         ///< Tooltip of the widget. @see Widget::tootips
 
@@ -368,18 +368,18 @@ inline bool NWidgetCore::IsDisabled() co
 
class NWidgetContainer : public NWidgetBase {
 
public:
 
	NWidgetContainer(WidgetType tp);
 
	~NWidgetContainer();
 

	
 
	void Add(NWidgetBase *wid);
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 

	
 
	/** Return whether the container is empty. */
 
	inline bool IsEmpty() { return head == NULL; }
 

	
 
	/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
 
	NWidgetBase *GetWidgetOfType(WidgetType tp) override;
 

	
 
protected:
 
	NWidgetBase *head; ///< Pointer to first widget in container.
 
	NWidgetBase *tail; ///< Pointer to last widget in container.
 
};
 

	
 
@@ -405,18 +405,18 @@ enum StackedZeroSizePlanes {
 
class NWidgetStacked : public NWidgetContainer {
 
public:
 
	NWidgetStacked();
 

	
 
	void SetIndex(int index);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	void Draw(const Window *w) override;
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 

	
 
	void SetDisplayedPlane(int plane);
 

	
 
	int shown_plane; ///< Plane being displayed (for #NWID_SELECTION only).
 
	int index;       ///< If non-negative, index in the #Window::nested_array.
 
};
 
@@ -434,14 +434,14 @@ DECLARE_ENUM_AS_BIT_SET(NWidContainerFla
 
class NWidgetPIPContainer : public NWidgetContainer {
 
public:
 
	NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags = NC_NONE);
 

	
 
	void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	void Draw(const Window *w) override;
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 

	
 
protected:
 
	NWidContainerFlags flags; ///< Flags of the container.
 
	uint8 pip_pre;            ///< Amount of space before first widget.
 
	uint8 pip_inter;          ///< Amount of space between widgets.
 
	uint8 pip_post;           ///< Amount of space after last widget.
 
@@ -497,18 +497,18 @@ public:
 
	void SetIndex(int index);
 
	void SetColour(Colours colour);
 
	void SetClicked(int clicked);
 
	void SetCount(int count);
 
	void SetScrollbar(Scrollbar *sb);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 

	
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	/* virtual */ void Draw(const Window *w);
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 
	void Draw(const Window *w) override;
 
protected:
 
	int index;      ///< If non-negative, index in the #Window::nested_array.
 
	Colours colour; ///< Colour of this widget.
 
	int clicked;    ///< The currently clicked widget.
 
	int count;      ///< Amount of valid widgets.
 
	Scrollbar *sb;  ///< The scrollbar we're associated with.
 
@@ -527,18 +527,18 @@ private:
 
 * @ingroup NestedWidgets
 
 */
 
class NWidgetSpacer : public NWidgetResizeBase {
 
public:
 
	NWidgetSpacer(int length, int height);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ void SetDirty(const Window *w) const;
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	void Draw(const Window *w) override;
 
	void SetDirty(const Window *w) const override;
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 
};
 

	
 
/**
 
 * Nested widget with a child.
 
 * @ingroup NestedWidgets
 
 */
 
@@ -547,20 +547,20 @@ public:
 
	NWidgetBackground(WidgetType tp, Colours colour, int index, NWidgetPIPContainer *child = NULL);
 
	~NWidgetBackground();
 

	
 
	void Add(NWidgetBase *nwid);
 
	void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
 

	
 
	/* virtual */ void FillNestedArray(NWidgetBase **array, uint length);
 
	void FillNestedArray(NWidgetBase **array, uint length) override;
 

	
 
	/* virtual */ void Draw(const Window *w);
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y);
 
	/* virtual */ NWidgetBase *GetWidgetOfType(WidgetType tp);
 
	void Draw(const Window *w) override;
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override;
 
	NWidgetBase *GetWidgetOfType(WidgetType tp) override;
 

	
 
private:
 
	NWidgetPIPContainer *child; ///< Child widget.
 
};
 

	
 
/**
 
@@ -573,14 +573,14 @@ private:
 
 * @ingroup NestedWidgets
 
 */
 
class NWidgetViewport : public NWidgetCore {
 
public:
 
	NWidgetViewport(int index);
 

	
 
	/* virtual */ void SetupSmallestSize(Window *w, bool init_array);
 
	/* virtual */ void Draw(const Window *w);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void Draw(const Window *w) override;
 

	
 
	void InitializeViewport(Window *w, uint32 follow_flags, ZoomLevel zoom);
 
	void UpdateViewportCoordinates(Window *w);
 
};
 

	
 
/**
 
@@ -748,14 +748,14 @@ public:
 
 * @ingroup NestedWidgets
 
 */
 
class NWidgetScrollbar : public NWidgetCore, public Scrollbar {
 
public:
 
	NWidgetScrollbar(WidgetType tp, Colours colour, int index);
 

	
 
	/* virtual */ void SetupSmallestSize(Window *w, bool init_array);
 
	/* virtual */ void Draw(const Window *w);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void Draw(const Window *w) override;
 

	
 
	static void InvalidateDimensionCache();
 
	static Dimension GetVerticalDimension();
 
	static Dimension GetHorizontalDimension();
 

	
 
private:
 
@@ -768,14 +768,14 @@ private:
 
 * @ingroup NestedWidgets
 
 */
 
class NWidgetLeaf : public NWidgetCore {
 
public:
 
	NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data, StringID tip);
 

	
 
	/* virtual */ void SetupSmallestSize(Window *w, bool init_array);
 
	/* virtual */ void Draw(const Window *w);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void Draw(const Window *w) override;
 

	
 
	bool ButtonHit(const Point &pt);
 

	
 
	static void InvalidateDimensionCache();
 

	
 
	static Dimension dropdown_dimension;  ///< Cached size of a dropdown widget.
0 comments (0 inline, 0 general)