From 7bc37c4c3eacc3e643dfe19aa28cad3fb100b504 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 13 Dec 2025 22:18:03 -0800
Subject: [PATCH] override is an actual keyword as of C++11
---
game/MacDialog.h | 32 ++++++++++++++++----------------
game/MaelstromUI.h | 6 +++---
game/lobby.h | 8 ++++----
screenlib/UIBaseElement.h | 7 -------
screenlib/UIContainer.h | 10 +++++-----
screenlib/UIDialog.h | 6 +++---
screenlib/UIDialogButton.h | 4 ++--
screenlib/UIElement.h | 16 ++++++++--------
screenlib/UIElementButton.h | 12 ++++++------
screenlib/UIElementCheckbox.h | 10 +++++-----
screenlib/UIElementDropdown.h | 10 +++++-----
screenlib/UIElementEditbox.h | 8 ++++----
screenlib/UIElementRadio.h | 12 ++++++------
screenlib/UIElementThumbstick.h | 4 ++--
screenlib/UIPanel.h | 14 +++++++-------
15 files changed, 76 insertions(+), 83 deletions(-)
diff --git a/game/MacDialog.h b/game/MacDialog.h
index b2492b86..56a89688 100644
--- a/game/MacDialog.h
+++ b/game/MacDialog.h
@@ -32,10 +32,10 @@ DECLARE_TYPESAFE_CLASS(UIDialog)
public:
MacDialog(UIManager *ui, const char *name);
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override void Show();
- override void Draw(DRAWLEVEL drawLevel);
+ virtual void Show() override;
+ virtual void Draw(DRAWLEVEL drawLevel) override;
protected:
enum {
@@ -56,7 +56,7 @@ DECLARE_TYPESAFE_CLASS(UIDialog)
class MacDialogDrawEngine : public UIDrawEngine
{
public:
- override void Init(UIElement *element);
+ virtual void Init(UIElement *element) override;
};
//////////////////////////////////////////////////////////////////////////////
@@ -66,11 +66,11 @@ class MacDialogButton : public MacDialogDrawEngine
public:
MacDialogButton() : MacDialogDrawEngine() { }
- override void Init(UIElement *element);
- override void OnLoad();
- override void OnDraw();
- override void OnMouseDown();
- override void OnMouseUp();
+ virtual void Init(UIElement *element) override;
+ virtual void OnLoad() override;
+ virtual void OnDraw() override;
+ virtual void OnMouseDown() override;
+ virtual void OnMouseUp() override;
protected:
Uint32 m_colors[2];
@@ -83,8 +83,8 @@ class MacDialogCheckbox : public MacDialogDrawEngine
public:
MacDialogCheckbox() : MacDialogDrawEngine() { }
- override void Init(UIElement *element);
- override void OnDraw();
+ virtual void Init(UIElement *element) override;
+ virtual void OnDraw() override;
};
//////////////////////////////////////////////////////////////////////////////
@@ -94,8 +94,8 @@ class MacDialogRadioButton : public MacDialogDrawEngine
public:
MacDialogRadioButton() : MacDialogDrawEngine() { }
- override void Init(UIElement *element);
- override void OnDraw();
+ virtual void Init(UIElement *element) override;
+ virtual void OnDraw() override;
};
//////////////////////////////////////////////////////////////////////////////
@@ -105,9 +105,9 @@ class MacDialogEditbox : public MacDialogDrawEngine
public:
MacDialogEditbox() : MacDialogDrawEngine() { }
- override void Init(UIElement *element);
- override void OnLoad();
- override void OnDraw();
+ virtual void Init(UIElement *element) override;
+ virtual void OnLoad() override;
+ virtual void OnDraw() override;
protected:
Uint32 m_colors[2];
diff --git a/game/MaelstromUI.h b/game/MaelstromUI.h
index d3d00ea0..92598572 100644
--- a/game/MaelstromUI.h
+++ b/game/MaelstromUI.h
@@ -74,7 +74,7 @@ class UIDrawEngineIcon : public UIDrawEngine
public:
UIDrawEngineIcon() : UIDrawEngine() { }
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
};
//////////////////////////////////////////////////////////////////////////////
@@ -83,7 +83,7 @@ class UIDrawEngineSprite : public UIDrawEngine
public:
UIDrawEngineSprite() : UIDrawEngine() { }
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
};
//////////////////////////////////////////////////////////////////////////////
@@ -92,7 +92,7 @@ class UIDrawEngineTitle : public UIDrawEngine
public:
UIDrawEngineTitle() : UIDrawEngine() { }
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
};
// Generic dialog function
diff --git a/game/lobby.h b/game/lobby.h
index dd0863d8..1239d498 100644
--- a/game/lobby.h
+++ b/game/lobby.h
@@ -43,10 +43,10 @@ class LobbyDialogDelegate : public UIDialogDelegate
public:
LobbyDialogDelegate(UIPanel *panel);
- override bool OnLoad();
- override void OnShow();
- override void OnHide();
- override void OnPoll();
+ virtual bool OnLoad() override;
+ virtual void OnShow() override;
+ virtual void OnHide() override;
+ virtual void OnPoll() override;
void SendKick(int index);
diff --git a/screenlib/UIBaseElement.h b/screenlib/UIBaseElement.h
index f857271f..35d2d97d 100644
--- a/screenlib/UIBaseElement.h
+++ b/screenlib/UIBaseElement.h
@@ -266,11 +266,4 @@ public: \
}
/////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////
-// So we can be explicit about what methods are being newly exposed and
-// which methods are overriding a base class method, I'm going to introduce
-// the "override" keyword in this inheritance hierarchy.
-#define override virtual
-/////////////////////////////////////////////////////////////////////////
-
#endif // _UIBaseElement_h
diff --git a/screenlib/UIContainer.h b/screenlib/UIContainer.h
index 7e5c2f24..e4c6ecdd 100644
--- a/screenlib/UIContainer.h
+++ b/screenlib/UIContainer.h
@@ -36,19 +36,19 @@ DECLARE_TYPESAFE_CLASS(UIElement)
public:
UIContainer(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
- override bool FinishLoading() {
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
+ virtual bool FinishLoading() override {
LayoutChildren();
return true;
}
- override void OnChildShown(UIBaseElement *child) {
+ virtual void OnChildShown(UIBaseElement *child) override {
LayoutChildren();
}
- override void OnChildHidden(UIBaseElement *child) {
+ virtual void OnChildHidden(UIBaseElement *child) override {
LayoutChildren();
}
- override void OnChildRectChanged(UIBaseElement *child) {
+ virtual void OnChildRectChanged(UIBaseElement *child) override {
LayoutChildren();
}
diff --git a/screenlib/UIDialog.h b/screenlib/UIDialog.h
index a1bc5b8d..223299a3 100644
--- a/screenlib/UIDialog.h
+++ b/screenlib/UIDialog.h
@@ -66,9 +66,9 @@ DECLARE_TYPESAFE_CLASS(UIPanel)
return m_status;
}
- override void Show();
- override void Hide();
- override bool HandleEvent(const SDL_Event &event);
+ virtual void Show() override;
+ virtual void Hide() override;
+ virtual bool HandleEvent(const SDL_Event &event) override;
protected:
int m_status;
diff --git a/screenlib/UIDialogButton.h b/screenlib/UIDialogButton.h
index bfe95c7c..9ae24d1c 100644
--- a/screenlib/UIDialogButton.h
+++ b/screenlib/UIDialogButton.h
@@ -30,7 +30,7 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
public:
UIDialogButton(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
void SetCloseDialog(bool close) { m_closeDialog = close; }
@@ -38,7 +38,7 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
return m_default;
}
- override void OnClick();
+ virtual void OnClick() override;
protected:
int m_statusID;
diff --git a/screenlib/UIElement.h b/screenlib/UIElement.h
index c8597340..94cbad83 100644
--- a/screenlib/UIElement.h
+++ b/screenlib/UIElement.h
@@ -130,14 +130,14 @@ DECLARE_TYPESAFE_CLASS(UIBaseElement)
UIElement(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElement();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
- override bool FinishLoading();
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
+ virtual bool FinishLoading() override;
// Bind any preferences variables to the preferences manager
- override void LoadData(Prefs *prefs);
- override void SaveData(Prefs *prefs);
+ virtual void LoadData(Prefs *prefs) override;
+ virtual void SaveData(Prefs *prefs) override;
- override void OnRectChanged() {
+ virtual void OnRectChanged() override {
UIBaseElement::OnRectChanged();
m_imageArea.AutoSize(Width(), Height(), true);
@@ -230,10 +230,10 @@ DECLARE_TYPESAFE_CLASS(UIBaseElement)
}
// Draw!
- override void Draw(DRAWLEVEL drawLevel);
+ virtual void Draw(DRAWLEVEL drawLevel) override;
// Events
- override bool HandleEvent(const SDL_Event &event);
+ virtual bool HandleEvent(const SDL_Event &event) override;
// Once set, the element owns the click callback and will free it.
template <class C>
@@ -296,7 +296,7 @@ DECLARE_TYPESAFE_CLASS(UIBaseElement)
bool LoadColor(rapidxml::xml_node<> *node, const char *name, Uint32 &value);
bool ParseFont(char *text);
- override void UpdateDisabledState();
+ virtual void UpdateDisabledState() override;
};
#endif // _UIElement_h
diff --git a/screenlib/UIElementButton.h b/screenlib/UIElementButton.h
index 678432e8..fa4bbbd9 100644
--- a/screenlib/UIElementButton.h
+++ b/screenlib/UIElementButton.h
@@ -40,11 +40,11 @@ DECLARE_TYPESAFE_CLASS(UIElement)
UIElementButton(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElementButton();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override bool HandleEvent(const SDL_Event &event);
- override void OnMouseDown();
- override void OnMouseUp();
+ virtual bool HandleEvent(const SDL_Event &event) override;
+ virtual void OnMouseDown() override;
+ virtual void OnMouseUp() override;
UITexture *GetButtonStateImage(BUTTON_STATE state) {
return m_stateImages[state];
@@ -53,8 +53,8 @@ DECLARE_TYPESAFE_CLASS(UIElement)
protected:
void SetButtonState(BUTTON_STATE state);
- override void UpdateDisabledState();
- override void OnClick();
+ virtual void UpdateDisabledState() override;
+ virtual void OnClick() override;
bool ShouldHandleKey(SDL_Keycode key);
diff --git a/screenlib/UIElementCheckbox.h b/screenlib/UIElementCheckbox.h
index 69b7caa4..fcb4d9bd 100644
--- a/screenlib/UIElementCheckbox.h
+++ b/screenlib/UIElementCheckbox.h
@@ -32,12 +32,12 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
UIElementCheckbox(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElementCheckbox();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
- override bool FinishLoading();
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
+ virtual bool FinishLoading() override;
// Bind any preferences variables to the preferences manager
- override void LoadData(Prefs *prefs);
- override void SaveData(Prefs *prefs);
+ virtual void LoadData(Prefs *prefs) override;
+ virtual void SaveData(Prefs *prefs) override;
void SetChecked(bool checked) {
if (checked != m_checked) {
@@ -52,7 +52,7 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
return m_checked;
}
- override void OnClick();
+ virtual void OnClick() override;
protected:
// This can be overridden by inheriting classes
diff --git a/screenlib/UIElementDropdown.h b/screenlib/UIElementDropdown.h
index cb083777..d17b1d8b 100644
--- a/screenlib/UIElementDropdown.h
+++ b/screenlib/UIElementDropdown.h
@@ -32,12 +32,12 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
UIElementDropdown(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElementDropdown();
- override bool FinishLoading();
+ virtual bool FinishLoading() override;
- override bool HandleEvent(const SDL_Event &event);
- override void Action(UIBaseElement *sender, const char *action);
- override void UpdateDisabledState();
- override void OnClick();
+ virtual bool HandleEvent(const SDL_Event &event) override;
+ virtual void Action(UIBaseElement *sender, const char *action) override;
+ virtual void UpdateDisabledState() override;
+ virtual void OnClick() override;
void ShowElements();
void HideElements();
diff --git a/screenlib/UIElementEditbox.h b/screenlib/UIElementEditbox.h
index ae77ad05..96fe527a 100644
--- a/screenlib/UIElementEditbox.h
+++ b/screenlib/UIElementEditbox.h
@@ -36,11 +36,11 @@ DECLARE_TYPESAFE_CLASS(UIElement)
UIElementEditbox(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElementEditbox();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override bool HandleEvent(const SDL_Event &event);
+ virtual bool HandleEvent(const SDL_Event &event) override;
- override void OnClick() {
+ virtual void OnClick() override {
SetFocus(!HasFocus());
}
@@ -56,7 +56,7 @@ DECLARE_TYPESAFE_CLASS(UIElement)
void SetTextMax(int maxLen);
- override void SetText(const char *text);
+ virtual void SetText(const char *text) override;
const char *GetText() const {
return m_text;
}
diff --git a/screenlib/UIElementRadio.h b/screenlib/UIElementRadio.h
index 4357e04e..54f6ed07 100644
--- a/screenlib/UIElementRadio.h
+++ b/screenlib/UIElementRadio.h
@@ -87,10 +87,10 @@ DECLARE_TYPESAFE_CLASS(UIElement)
UIElementRadioGroup(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
~UIElementRadioGroup();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override void LoadData(Prefs *prefs);
- override void SaveData(Prefs *prefs);
+ virtual void LoadData(Prefs *prefs) override;
+ virtual void SaveData(Prefs *prefs) override;
UIElementRadioButton *GetRadioButton(int id);
@@ -126,10 +126,10 @@ DECLARE_TYPESAFE_CLASS(UIElementCheckbox)
return m_id;
}
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override void OnClick();
- override void OnChecked(bool checked);
+ virtual void OnClick() override;
+ virtual void OnChecked(bool checked) override;
protected:
int m_id;
diff --git a/screenlib/UIElementThumbstick.h b/screenlib/UIElementThumbstick.h
index 0f4aaeec..f3f2c447 100644
--- a/screenlib/UIElementThumbstick.h
+++ b/screenlib/UIElementThumbstick.h
@@ -32,9 +32,9 @@ DECLARE_TYPESAFE_CLASS(UIElement)
UIElementThumbstick(UIBaseElement *parent, const char *name, UIDrawEngine *drawEngine);
virtual ~UIElementThumbstick();
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
- override bool HandleEvent(const SDL_Event &event);
+ virtual bool HandleEvent(const SDL_Event &event) override;
protected:
void MoveCenter(int x, int y);
diff --git a/screenlib/UIPanel.h b/screenlib/UIPanel.h
index 297d2b45..4129d8a4 100644
--- a/screenlib/UIPanel.h
+++ b/screenlib/UIPanel.h
@@ -95,22 +95,22 @@ DECLARE_TYPESAFE_CLASS(UIBaseElement)
return 3;
}
- override bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
- override bool FinishLoading();
+ virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates) override;
+ virtual bool FinishLoading() override;
void SetPanelDelegate(UIPanelDelegate *delegate, bool autodelete = true);
- override void Show();
- override void Hide();
+ virtual void Show() override;
+ virtual void Hide() override;
virtual bool ShouldSaveData() { return true; }
void HideAll();
virtual void Poll();
virtual void Tick();
- override void Draw(DRAWLEVEL drawLevel);
- override bool HandleEvent(const SDL_Event &event);
- override void Action(UIBaseElement *sender, const char *action);
+ virtual void Draw(DRAWLEVEL drawLevel) override;
+ virtual bool HandleEvent(const SDL_Event &event) override;
+ virtual void Action(UIBaseElement *sender, const char *action) override;
protected:
bool m_fullscreen;