Skip to content
Permalink
Browse files

use override in all possible places

  • Loading branch information...
jacob1 committed Mar 10, 2019
1 parent d3fe7e3 commit 55e607494294f68cc34d4e0511689d60c20ab78f
Showing with 459 additions and 428 deletions.
  1. +1 −1 generator.py
  2. +3 −3 src/Activity.h
  3. +1 −1 src/debug/DebugLines.h
  4. +1 −1 src/debug/DebugParts.h
  5. +1 −1 src/debug/ElementPopulation.h
  6. +1 −1 src/debug/ParticleDebug.h
  7. +2 −2 src/gui/colourpicker/ColourPickerActivity.cpp
  8. +6 −6 src/gui/colourpicker/ColourPickerActivity.h
  9. +1 −1 src/gui/console/ConsoleView.cpp
  10. +3 −3 src/gui/dialogues/ConfirmPrompt.cpp
  11. +1 −1 src/gui/dialogues/ConfirmPrompt.h
  12. +2 −2 src/gui/dialogues/ErrorMessage.cpp
  13. +1 −1 src/gui/dialogues/ErrorMessage.h
  14. +1 −1 src/gui/dialogues/InformationMessage.cpp
  15. +1 −1 src/gui/dialogues/InformationMessage.h
  16. +1 −1 src/gui/dialogues/SaveIDMessage.cpp
  17. +2 −2 src/gui/dialogues/SaveIDMessage.h
  18. +2 −2 src/gui/dialogues/TextPrompt.cpp
  19. +1 −1 src/gui/dialogues/TextPrompt.h
  20. +4 −4 src/gui/elementsearch/ElementSearchActivity.cpp
  21. +5 −5 src/gui/elementsearch/ElementSearchActivity.h
  22. +7 −7 src/gui/filebrowser/FileBrowserActivity.cpp
  23. +8 −8 src/gui/filebrowser/FileBrowserActivity.h
  24. +9 −9 src/gui/font/FontEditor.cpp
  25. +3 −3 src/gui/font/FontEditor.h
  26. +1 −1 src/gui/game/BitmapBrush.h
  27. +4 −4 src/gui/game/DecorationTool.h
  28. +1 −1 src/gui/game/EllipseBrush.h
  29. +15 −15 src/gui/game/GameController.cpp
  30. +3 −3 src/gui/game/GameController.h
  31. +2 −2 src/gui/game/GameModelException.h
  32. +31 −35 src/gui/game/GameView.cpp
  33. +20 −20 src/gui/game/GameView.h
  34. +5 −5 src/gui/game/PropertyTool.cpp
  35. +12 −12 src/gui/game/QuickOptions.h
  36. +29 −13 src/gui/game/SignTool.cpp
  37. +38 −38 src/gui/game/Tool.h
  38. +4 −4 src/gui/game/ToolButton.h
  39. +1 −1 src/gui/game/TriangleBrush.h
  40. +1 −1 src/gui/interface/ContextMenu.cpp
  41. +3 −3 src/gui/interface/DropDown.cpp
  42. +1 −1 src/gui/interface/Engine.cpp
  43. +16 −16 src/gui/interface/Panel.h
  44. +2 −2 src/gui/interface/Textbox.h
  45. +4 −4 src/gui/localbrowser/LocalBrowserController.cpp
  46. +6 −6 src/gui/localbrowser/LocalBrowserView.cpp
  47. +4 −4 src/gui/localbrowser/LocalBrowserView.h
  48. +2 −2 src/gui/login/LoginView.cpp
  49. +4 −4 src/gui/login/LoginView.h
  50. +36 −16 src/gui/options/OptionsView.cpp
  51. +2 −2 src/gui/options/OptionsView.h
  52. +1 −1 src/gui/preview/PreviewController.h
  53. +2 −2 src/gui/preview/PreviewModelException.h
  54. +9 −9 src/gui/preview/PreviewView.cpp
  55. +7 −7 src/gui/preview/PreviewView.h
  56. +4 −4 src/gui/profile/ProfileActivity.cpp
  57. +3 −3 src/gui/profile/ProfileActivity.h
  58. +4 −4 src/gui/render/RenderView.cpp
  59. +6 −6 src/gui/render/RenderView.h
  60. +3 −3 src/gui/save/LocalSaveActivity.cpp
  61. +3 −3 src/gui/save/LocalSaveActivity.h
  62. +9 −9 src/gui/save/ServerSaveActivity.cpp
  63. +8 −8 src/gui/save/ServerSaveActivity.h
  64. +7 −7 src/gui/search/SearchController.cpp
  65. +16 −16 src/gui/search/SearchView.cpp
  66. +7 −7 src/gui/search/SearchView.h
  67. +3 −3 src/gui/tags/TagsView.cpp
  68. +2 −2 src/gui/tags/TagsView.h
  69. +4 −4 src/gui/update/UpdateActivity.cpp
  70. +4 −4 src/json/json.h
  71. +4 −4 src/json/jsoncpp.cpp
  72. +1 −1 src/lua/LuaButton.cpp
  73. +1 −1 src/lua/LuaCheckbox.cpp
  74. +6 −6 src/lua/LuaScriptInterface.h
  75. +1 −1 src/lua/LuaSlider.cpp
  76. +1 −1 src/lua/LuaTextbox.cpp
  77. +14 −14 src/lua/LuaWindow.cpp
  78. +2 −3 src/lua/TPTScriptInterface.h
  79. +1 −1 src/simulation/CoordStack.h
  80. +2 −2 src/tasks/AbandonableTask.h
  81. +2 −2 src/tasks/Task.h
  82. +7 −7 src/tasks/TaskWindow.h
@@ -194,7 +194,7 @@ class {0}: public SimTool
public:
{0}();
virtual ~{0}();
virtual int Perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength);
int Perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength) override;
}};
""".format(className, str.join("\n", classMembers))

@@ -19,16 +19,16 @@ class WindowActivity: public ui::Window, public Activity
{
Show();
}
virtual void Exit()
void Exit() override
{
Hide();
SelfDestruct();
}
virtual void Show()
void Show() override
{
MakeActiveWindow();
}
virtual void Hide()
void Hide() override
{
CloseActiveWindow();
}
@@ -10,6 +10,6 @@ class DebugLines : public DebugInfo
GameController * controller;
public:
DebugLines(unsigned int id, GameView * view, GameController * controller);
virtual void Draw();
void Draw() override;
virtual ~DebugLines();
};
@@ -8,6 +8,6 @@ class DebugParts : public DebugInfo
Simulation * sim;
public:
DebugParts(unsigned int id, Simulation * sim);
virtual void Draw();
void Draw() override;
virtual ~DebugParts();
};
@@ -9,6 +9,6 @@ class ElementPopulationDebug : public DebugInfo
float maxAverage;
public:
ElementPopulationDebug(unsigned int id, Simulation * sim);
virtual void Draw();
void Draw() override;
virtual ~ElementPopulationDebug();
};
@@ -12,7 +12,7 @@ class ParticleDebug : public DebugInfo
public:
ParticleDebug(unsigned int id, Simulation * sim, GameModel * model);
void Debug(int mode, int x, int y);
virtual bool KeyPress(int key, int scan, bool shift, bool ctrl, bool alt, ui::Point currentMouse);
bool KeyPress(int key, int scan, bool shift, bool ctrl, bool alt, ui::Point currentMouse) override;
virtual ~ParticleDebug();
};

@@ -25,7 +25,7 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke
public:
ColourChange(ColourPickerActivity * a) : a(a) {}

void TextChangedCallback(ui::Textbox * sender)
void TextChangedCallback(ui::Textbox * sender) override
{
int r, g, b, alpha;
r = a->rValue->GetText().ToNumber<int>(true);
@@ -79,7 +79,7 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke
ColourPickerActivity * a;
public:
OkayAction(ColourPickerActivity * a) : a(a) { }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
int Red, Green, Blue;
Red = a->rValue->GetText().ToNumber<int>(true);
@@ -33,12 +33,12 @@ class ColourPickerActivity: public WindowActivity {

void UpdateTextboxes(int r, int g, int b, int a);
public:
virtual void OnMouseMove(int x, int y, int dx, int dy);
virtual void OnMouseDown(int x, int y, unsigned button);
virtual void OnMouseUp(int x, int y, unsigned button);
virtual void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void OnTryExit(ExitMethod method);
void OnMouseMove(int x, int y, int dx, int dy) override;
void OnMouseDown(int x, int y, unsigned button) override;
void OnMouseUp(int x, int y, unsigned button) override;
void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void OnTryExit(ExitMethod method) override;
ColourPickerActivity(ui::Colour initialColour, ColourPickedCallback * callback = NULL);
virtual ~ColourPickerActivity();
virtual void OnDraw();
void OnDraw() override;
};
@@ -10,7 +10,7 @@ ConsoleView::ConsoleView():
ConsoleView * v;
public:
CommandHighlighter(ConsoleView * v_) { v = v_; }
virtual void TextChangedCallback(ui::Textbox * sender)
void TextChangedCallback(ui::Textbox * sender) override
{
sender->SetDisplayText(v->c->FormatCommand(sender->GetText()));
}
@@ -39,7 +39,7 @@ ConfirmPrompt::ConfirmPrompt(String title, String message, ConfirmDialogueCallba
ConfirmPrompt * prompt;
DialogueResult result;
CloseAction(ConfirmPrompt * prompt_, DialogueResult result_) { prompt = prompt_; result = result_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
prompt->CloseActiveWindow();
if(prompt->callback)
@@ -101,7 +101,7 @@ ConfirmPrompt::ConfirmPrompt(String title, String message, String buttonText, Co
ConfirmPrompt * prompt;
DialogueResult result;
CloseAction(ConfirmPrompt * prompt_, DialogueResult result_) { prompt = prompt_; result = result_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
prompt->CloseActiveWindow();
if(prompt->callback)
@@ -136,7 +136,7 @@ bool ConfirmPrompt::Blocking(String title, String message, String buttonText)
public:
bool & outputResult;
BlockingPromptCallback(bool & output): outputResult(output) {}
virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
void ConfirmCallback(ConfirmPrompt::DialogueResult result) override {
if (result == ConfirmPrompt::ResultOkay)
outputResult = true;
else
@@ -11,7 +11,7 @@ class ConfirmPrompt: public ui::Window {
ConfirmPrompt(String title, String message, ConfirmDialogueCallback * callback_ = NULL);
ConfirmPrompt(String title, String message, String buttonText, ConfirmDialogueCallback * callback_ = NULL);
static bool Blocking(String title, String message, String buttonText = String("Confirm"));
virtual void OnDraw();
void OnDraw() override;
virtual ~ConfirmPrompt();
ConfirmDialogueCallback * callback;
};
@@ -29,7 +29,7 @@ ErrorMessage::ErrorMessage(String title, String message, ErrorMessageCallback *
ErrorMessage * message;
public:
DismissAction(ErrorMessage * message_) { message = message_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
message->CloseActiveWindow();
if(message->callback)
@@ -55,7 +55,7 @@ void ErrorMessage::Blocking(String title, String message)
class BlockingDismissCallback: public ErrorMessageCallback {
public:
BlockingDismissCallback() {}
virtual void DismissCallback() {
void DismissCallback() override {
ui::Engine::Ref().Break();
}
virtual ~BlockingDismissCallback() { }
@@ -9,7 +9,7 @@ class ErrorMessage: public ui::Window {
public:
ErrorMessage(String title, String message, ErrorMessageCallback * callback_ = NULL);
static void Blocking(String title, String message);
virtual void OnDraw();
void OnDraw() override;
virtual ~ErrorMessage();
};

@@ -57,7 +57,7 @@ InformationMessage::InformationMessage(String title, String message, bool large)
InformationMessage * message;
public:
DismissAction(InformationMessage * message_) { message = message_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
message->CloseActiveWindow();
message->SelfDestruct(); //TODO: Fix component disposal
@@ -6,7 +6,7 @@
class InformationMessage: public ui::Window {
public:
InformationMessage(String title, String message, bool large);
virtual void OnDraw();
void OnDraw() override;
virtual ~InformationMessage();
};

@@ -37,7 +37,7 @@ SaveIDMessage::SaveIDMessage(int id):
SaveIDMessage * message;
public:
DismissAction(SaveIDMessage * message_) { message = message_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
message->CloseActiveWindow();
message->SelfDestruct();
@@ -6,8 +6,8 @@
class SaveIDMessage: public ui::Window {
public:
SaveIDMessage(int id);
virtual void OnDraw();
virtual void OnTryExit(ExitMethod method);
void OnDraw() override;
void OnTryExit(ExitMethod method) override;
virtual ~SaveIDMessage();
};

@@ -12,7 +12,7 @@ class CloseAction: public ui::ButtonAction
TextPrompt * prompt;
TextPrompt::DialogueResult result;
CloseAction(TextPrompt * prompt_, TextPrompt::DialogueResult result_) { prompt = prompt_; result = result_; }
void ActionCallback(ui::Button * sender)
void ActionCallback(ui::Button * sender) override
{
prompt->CloseActiveWindow();
if(prompt->callback)
@@ -85,7 +85,7 @@ String TextPrompt::Blocking(String title, String message, String text, String pl
String & outputString;
public:
BlockingTextCallback(String & output) : outputString(output) {}
virtual void TextCallback(TextPrompt::DialogueResult result, String resultText) {
void TextCallback(TextPrompt::DialogueResult result, String resultText) override {
if(result == ResultOkay)
outputString = resultText;
else
@@ -13,7 +13,7 @@ class TextPrompt: public ui::Window {
enum DialogueResult { ResultCancel, ResultOkay };
TextPrompt(String title, String message, String text, String placeholder, bool multiline, TextDialogueCallback * callback_);
static String Blocking(String title, String message, String text, String placeholder, bool multiline);
virtual void OnDraw();
void OnDraw() override;
virtual ~TextPrompt();
TextDialogueCallback * callback;
};
@@ -15,7 +15,7 @@ class ElementSearchActivity::ToolAction: public ui::ButtonAction
public:
Tool * tool;
ToolAction(ElementSearchActivity * a, Tool * tool) : a(a), tool(tool) { }
void ActionCallback(ui::Button * sender_)
void ActionCallback(ui::Button * sender_) override
{
ToolButton *sender = (ToolButton*)sender_;
if(sender->GetSelectionState() >= 0 && sender->GetSelectionState() <= 2)
@@ -47,7 +47,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
ElementSearchActivity * a;
public:
SearchAction(ElementSearchActivity * a) : a(a) {}
virtual void TextChangedCallback(ui::Textbox * sender) {
void TextChangedCallback(ui::Textbox * sender) override {
a->searchTools(sender->GetText());
}
};
@@ -63,7 +63,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
ElementSearchActivity * a;
public:
CloseAction(ElementSearchActivity * a) : a(a) { }
void ActionCallback(ui::Button * sender_)
void ActionCallback(ui::Button * sender_) override
{
a->exit = true;
}
@@ -74,7 +74,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
ElementSearchActivity * a;
public:
OKAction(ElementSearchActivity * a) : a(a) { }
void ActionCallback(ui::Button * sender_)
void ActionCallback(ui::Button * sender_) override
{
if(a->GetFirstResult())
a->SetActiveTool(0, a->GetFirstResult());
@@ -32,11 +32,11 @@ class ElementSearchActivity: public WindowActivity
ElementSearchActivity(GameController * gameController, std::vector<Tool*> tools);
void SetActiveTool(int selectionState, Tool * tool);
virtual ~ElementSearchActivity();
virtual void OnTick(float dt);
virtual void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void OnKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt);
virtual void OnDraw();
virtual void ToolTip(ui::Point senderPosition, String ToolTip);
void OnTick(float dt) override;
void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void OnKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void OnDraw() override;
void ToolTip(ui::Point senderPosition, String ToolTip) override;
};

#endif /* ELEMENTSEARCHACTIVITY_H_ */
@@ -21,15 +21,15 @@ class SaveSelectedAction: public ui::SaveButtonAction
FileBrowserActivity * a;
public:
SaveSelectedAction(FileBrowserActivity * _a) { a = _a; }
virtual void ActionCallback(ui::SaveButton * sender)
void ActionCallback(ui::SaveButton * sender) override
{
a->SelectSave(sender->GetSaveFile());
}
virtual void AltActionCallback(ui::SaveButton * sender)
void AltActionCallback(ui::SaveButton * sender) override
{
a->RenameSave(sender->GetSaveFile());
}
virtual void AltActionCallback2(ui::SaveButton * sender)
void AltActionCallback2(ui::SaveButton * sender) override
{
a->DeleteSave(sender->GetSaveFile());
}
@@ -42,17 +42,17 @@ class LoadFilesTask: public Task
ByteString search;
std::vector<SaveFile*> saveFiles;

virtual void before()
void before() override
{

}

virtual void after()
void after() override
{

}

virtual bool doWork()
bool doWork() override
{
std::vector<ByteString> files = Client::Ref().DirectorySearch(directory, search, ".cps");
std::sort(files.rbegin(), files.rend(), [](ByteString a, ByteString b) { return a.ToLower() < b.ToLower(); });
@@ -99,7 +99,7 @@ class FileBrowserActivity::SearchAction: public ui::TextboxAction
public:
FileBrowserActivity * a;
SearchAction(FileBrowserActivity * a) : a(a) {}
virtual void TextChangedCallback(ui::Textbox * sender) {
void TextChangedCallback(ui::Textbox * sender) override {
a->DoSearch(sender->GetText().ToUtf8());
}
};
@@ -47,19 +47,19 @@ class FileBrowserActivity: public TaskListener, public WindowActivity
void populateList();
public:
FileBrowserActivity(ByteString directory, FileSelectedCallback * callback);
virtual void OnDraw();
virtual void OnTick(float dt);
virtual void OnTryExit(ExitMethod method);
virtual void OnMouseDown(int x, int y, unsigned button);
void OnDraw() override;
void OnTick(float dt) override;
void OnTryExit(ExitMethod method) override;
void OnMouseDown(int x, int y, unsigned button) override;
void loadDirectory(ByteString directory, ByteString search);
void SelectSave(SaveFile * file);
void DeleteSave(SaveFile * file);
void RenameSave(SaveFile * file);
void DoSearch(ByteString search);
virtual ~FileBrowserActivity();

virtual void NotifyDone(Task * task);
virtual void NotifyError(Task * task);
virtual void NotifyProgress(Task * task);
virtual void NotifyStatus(Task * task);
void NotifyDone(Task * task) override;
void NotifyError(Task * task) override;
void NotifyProgress(Task * task) override;
void NotifyStatus(Task * task) override;
};
Oops, something went wrong.

0 comments on commit 55e6074

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.