SWORD2: Add override keywords

This commit is contained in:
Bastien Bouclet 2020-02-09 12:05:32 +01:00
parent 9d1447113d
commit c616550ebe
6 changed files with 68 additions and 68 deletions

View File

@ -80,8 +80,8 @@ public:
void drawDebugGraphics();
private:
virtual void preEnter();
virtual void postEnter();
void preEnter() override;
void postEnter() override;
private:
Sword2Engine *_vm;

View File

@ -552,15 +552,15 @@ public:
setHitRect(x, y, w, h);
}
virtual void onMouseExit() {
void onMouseExit() override {
setState(0);
}
virtual void onMouseDown(int x, int y) {
void onMouseDown(int x, int y) override {
setState(1);
}
virtual void onMouseUp(int x, int y) {
void onMouseUp(int x, int y) override {
if (getState() != 0) {
setState(0);
_parent->onAction(this);
@ -583,21 +583,21 @@ public:
setHitRect(x, y, w, h);
}
virtual void onMouseExit() {
void onMouseExit() override {
setState(0);
}
virtual void onMouseDown(int x, int y) {
void onMouseDown(int x, int y) override {
setState(1);
_parent->onAction(this);
_holdCounter = 0;
}
virtual void onMouseUp(int x, int y) {
void onMouseUp(int x, int y) override {
setState(0);
}
virtual void onTick() {
void onTick() override {
if (getState() != 0) {
_holdCounter++;
if (_holdCounter > 16 && (_holdCounter % 4) == 0)
@ -644,18 +644,18 @@ public:
return _value;
}
virtual void onMouseExit() {
void onMouseExit() override {
if (_holding && !_value)
setState(_upState);
_holding = false;
}
virtual void onMouseDown(int x, int y) {
void onMouseDown(int x, int y) override {
_holding = true;
setState(_downState);
}
virtual void onMouseUp(int x, int y) {
void onMouseUp(int x, int y) override {
if (_holding) {
_holding = false;
_value = !_value;
@ -706,7 +706,7 @@ public:
createSurfaceImages(3406, x, y);
}
virtual void paint(Common::Rect *clipRect = NULL) {
void paint(Common::Rect *clipRect = NULL) override {
// This will redraw a bit more than is strictly necessary,
// but I doubt that will make any noticeable difference.
@ -725,7 +725,7 @@ public:
return _value;
}
virtual void onMouseMove(int x, int y) {
void onMouseMove(int x, int y) override {
if (_dragging) {
int newX = x - _dragOffset;
int newValue;
@ -748,7 +748,7 @@ public:
}
}
virtual void onMouseDown(int x, int y) {
void onMouseDown(int x, int y) override {
if (x >= _sprites[0].x && x < _sprites[0].x + 38) {
_dragging = true;
_dragOffset = x - _sprites[0].x;
@ -765,12 +765,12 @@ public:
}
}
virtual void releaseMouse(int x, int y) {
void releaseMouse(int x, int y) override {
if (_dragging)
_dragging = false;
}
virtual void onTick() {
void onTick() override {
if (!_dragging) {
int target = posFromValue(_targetValue);
@ -1106,7 +1106,7 @@ public:
return &_text[0];
}
virtual void paint(Common::Rect *clipRect = NULL) {
void paint(Common::Rect *clipRect = NULL) override {
Widget::paint();
// HACK: The main dialog is responsible for drawing the text
@ -1116,7 +1116,7 @@ public:
_fr->drawText(_text, _sprites[0].x + 16, _sprites[0].y + 4 + 2 * getState());
}
virtual void onMouseDown(int x, int y) {
void onMouseDown(int x, int y) override {
if (_clickable) {
if (getState() == 0) {
setState(1);
@ -1130,15 +1130,15 @@ public:
}
}
virtual void onWheelUp(int x, int y) {
void onWheelUp(int x, int y) override {
_parent->onAction(this, kWheelUp);
}
virtual void onWheelDown(int x, int y) {
void onWheelDown(int x, int y) override {
_parent->onAction(this, kWheelDown);
}
virtual void onKey(KeyboardEvent *ke) {
void onKey(KeyboardEvent *ke) override {
if (_editable) {
if (ke->kbd.keycode == Common::KEYCODE_BACKSPACE)
_parent->onAction(this, Common::KEYCODE_BACKSPACE);
@ -1151,7 +1151,7 @@ public:
}
}
virtual void onTick() {
void onTick() override {
if (_editable)
_parent->onAction(this, kCursorTick);
}

View File

@ -95,10 +95,10 @@ private:
public:
OptionsDialog(Sword2Engine *vm);
~OptionsDialog();
~OptionsDialog() override;
virtual void paint();
virtual void onAction(Widget *widget, int result = 0);
void paint() override;
void onAction(Widget *widget, int result = 0) override;
};
class SaveRestoreDialog : public Dialog {
@ -121,15 +121,15 @@ private:
public:
SaveRestoreDialog(Sword2Engine *vm, int mode);
~SaveRestoreDialog();
~SaveRestoreDialog() override;
void updateSlots();
void drawEditBuffer(Slot *slot);
virtual void onAction(Widget *widget, int result = 0);
virtual void paint();
virtual void setResult(int result);
virtual int runModal();
void onAction(Widget *widget, int result = 0) override;
void paint() override;
void setResult(int result) override;
int runModal() override;
};
/**
@ -149,27 +149,27 @@ private:
public:
MiniDialog(Sword2Engine *vm, uint32 headerTextId, uint32 okTextId = TEXT_OK, uint32 cancelTextId = TEXT_CANCEL);
virtual ~MiniDialog();
virtual void paint();
virtual void onAction(Widget *widget, int result = 0);
~MiniDialog() override;
void paint() override;
void onAction(Widget *widget, int result = 0) override;
};
class StartDialog : public MiniDialog {
public:
StartDialog(Sword2Engine *vm);
virtual int runModal();
int runModal() override;
};
class RestartDialog : public MiniDialog {
public:
RestartDialog(Sword2Engine *vm);
virtual int runModal();
int runModal() override;
};
class QuitDialog : public MiniDialog {
public:
QuitDialog(Sword2Engine *vm);
virtual int runModal();
int runModal() override;
};
class SaveDialog : public SaveRestoreDialog {

View File

@ -109,13 +109,13 @@ private:
public:
CLUInputStream(Common::File *file, int size);
~CLUInputStream();
~CLUInputStream() override;
int readBuffer(int16 *buffer, const int numSamples);
int readBuffer(int16 *buffer, const int numSamples) override;
bool endOfData() const { return eosIntern(); }
bool isStereo() const { return false; }
int getRate() const { return 22050; }
bool endOfData() const override { return eosIntern(); }
bool isStereo() const override { return false; }
int getRate() const override { return 22050; }
};
struct SoundFileHandle {
@ -153,13 +153,13 @@ private:
public:
MusicInputStream(int cd, SoundFileHandle *fh, uint32 musicId, bool looping);
~MusicInputStream();
~MusicInputStream() override;
int readBuffer(int16 *buffer, const int numSamples);
int readBuffer(int16 *buffer, const int numSamples) override;
bool endOfData() const { return eosIntern(); }
bool isStereo() const { return _decoder->isStereo(); }
int getRate() const { return _decoder->getRate(); }
bool endOfData() const override { return eosIntern(); }
bool isStereo() const override { return _decoder->isStereo(); }
int getRate() const override { return _decoder->getRate(); }
int getCD() { return _cd; }
@ -221,14 +221,14 @@ private:
public:
Sound(Sword2Engine *vm);
~Sound();
~Sound() override;
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return false; }
bool endOfData() const;
int getRate() const { return Sword2Engine::isPsx() ? 11025 : 22050; }
int readBuffer(int16 *buffer, const int numSamples) override;
bool isStereo() const override { return false; }
bool endOfData() const override;
int getRate() const override { return Sword2Engine::isPsx() ? 11025 : 22050; }
// End of AudioStream API

View File

@ -84,27 +84,27 @@ static const ExtraGuiOption sword2ExtraGuiOption = {
class Sword2MetaEngine : public MetaEngine {
public:
virtual const char *getEngineId() const override {
const char *getEngineId() const override {
return "sword2";
}
virtual const char *getName() const override {
const char *getName() const override {
return "Broken Sword II: The Smoking Mirror";
}
virtual const char *getOriginalCopyright() const override {
const char *getOriginalCopyright() const override {
return "Broken Sword II: The Smoking Mirror (C) Revolution";
}
virtual bool hasFeature(MetaEngineFeature f) const override;
bool hasFeature(MetaEngineFeature f) const override;
PlainGameList getSupportedGames() const override;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
PlainGameDescriptor findGame(const char *gameid) const override;
virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
virtual SaveStateList listSaves(const char *target) const override;
virtual int getMaximumSaveSlot() const override;
virtual void removeSaveState(const char *target, int slot) const override;
DetectedGames detectGames(const Common::FSList &fslist) const override;
SaveStateList listSaves(const char *target) const override;
int getMaximumSaveSlot() const override;
void removeSaveState(const char *target, int slot) const override;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const override;
Common::Error createInstance(OSystem *syst, Engine **engine) const override;
};
bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const {

View File

@ -142,15 +142,15 @@ private:
protected:
// Engine APIs
virtual Common::Error run() override;
virtual GUI::Debugger *getDebugger() override;
virtual bool hasFeature(EngineFeature f) const override;
virtual void syncSoundSettings() override;
virtual void pauseEngineIntern(bool pause) override;
Common::Error run() override;
GUI::Debugger *getDebugger() override;
bool hasFeature(EngineFeature f) const override;
void syncSoundSettings() override;
void pauseEngineIntern(bool pause) override;
public:
Sword2Engine(OSystem *syst);
~Sword2Engine();
~Sword2Engine() override;
int getFramesPerSecond();