summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-03-03 22:25:13 +0000
committerMichael Lutz <michi@icosahedron.de>2019-03-24 16:10:04 +0100
commitaf7d9020a15c1b1a14b3981ac73c70d2e58cc877 (patch)
tree1dcff3e01382ea3a0a4733a4637659dbbfd4bad5 /src/game
parent31260e66252fb4d0dda6f992520faeeb96929cfe (diff)
downloadopenttd-af7d9020a15c1b1a14b3981ac73c70d2e58cc877.tar.xz
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.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_config.hpp2
-rw-r--r--src/game/game_info.hpp2
-rw-r--r--src/game/game_instance.hpp12
-rw-r--r--src/game/game_scanner.hpp24
-rw-r--r--src/game/game_text.cpp4
5 files changed, 22 insertions, 22 deletions
diff --git a/src/game/game_config.hpp b/src/game/game_config.hpp
index e9ebdc38c..dfae62c3a 100644
--- a/src/game/game_config.hpp
+++ b/src/game/game_config.hpp
@@ -42,7 +42,7 @@ public:
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 */
diff --git a/src/game/game_info.hpp b/src/game/game_info.hpp
index f4fc5ed86..a799ed7d6 100644
--- a/src/game/game_info.hpp
+++ b/src/game/game_info.hpp
@@ -40,7 +40,7 @@ public:
*/
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.
diff --git a/src/game/game_instance.hpp b/src/game/game_instance.hpp
index 08ce34424..dd0e7950a 100644
--- a/src/game/game_instance.hpp
+++ b/src/game/game_instance.hpp
@@ -25,14 +25,14 @@ public:
*/
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 */
diff --git a/src/game/game_scanner.hpp b/src/game/game_scanner.hpp
index 071d19d38..492545c2b 100644
--- a/src/game/game_scanner.hpp
+++ b/src/game/game_scanner.hpp
@@ -16,7 +16,7 @@
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.
@@ -28,17 +28,17 @@ public:
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.
@@ -49,11 +49,11 @@ public:
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 */
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index a32e5b41d..4673e732c 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -151,7 +151,7 @@ struct StringListReader : StringReader {
{
}
- /* virtual */ char *ReadLine(char *buffer, const char *last)
+ char *ReadLine(char *buffer, const char *last) override
{
if (this->p == this->end) return NULL;
@@ -242,7 +242,7 @@ public:
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;