commit cfb8bc47
Add include guards to os.hpp and moved some initialization
Changed files
| M | source/code/MenuSystem.cpp before |
| M | source/code/os.hpp before |
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp
index 3ecfc61..cce280e 100644
--- a/source/code/MenuSystem.cpp
+++ b/source/code/MenuSystem.cpp
@@ -143,16 +143,14 @@ void Menu::addButton(Button* b) {
placeButtons();
}
-Menu::Menu(SDL_Renderer* screen) {
+Menu::Menu(SDL_Renderer* screen) : buttons{std::vector<Button*>(10)} {
this->screen = screen;
- buttons = std::vector<Button*>(10);
isSubmenu = true;
exit.setLabel( _("Back") );
}
-Menu::Menu(SDL_Renderer* screen,bool submenu) {
+Menu::Menu(SDL_Renderer* screen,bool submenu) : buttons{std::vector<Button*>(0)} {
this->screen = screen;
- buttons = std::vector<Button*>(0);
isSubmenu = submenu;
if (isSubmenu) {
exit.setLabel( _("Back") );
diff --git a/source/code/os.hpp b/source/code/os.hpp
index 5a07131..42627bf 100644
--- a/source/code/os.hpp
+++ b/source/code/os.hpp
@@ -21,7 +21,10 @@ https://blockattack.net
===========================================================================
*/
-#if defined(_WIN32)
+#ifndef OS_HPP
+#define OS_HPP
+
+#if defined(_WIN32)
#include "windows.h"
#include "shlobj.h"
#endif
@@ -41,3 +44,5 @@ void OsCreateSaveFolder();
bool OsPathIsRelative(const std::string& path);
void OsCreateFolder(const std::string& path);
+
+#endif /* OS_HPP */