From 52f7a587fe09f58cd413af3c18b34c4b6f23885e Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 19 Jul 2020 12:43:29 -0700 Subject: [PATCH] Separate includes into sections and alphabetize them Okay, so basically here's the include layout that this game now consistently uses: [The "main" header file, if any (e.g. Graphics.h for Graphics.cpp)] [blank line] [All system includes, such as tinyxml2/physfs/utfcpp/SDL] [blank line] [All project includes, such as Game.h/Entity.h/etc.] And if applicable, another blank line, and then some special-case include screwy stuff (take a look at editor.cpp or FileSystemUtils.cpp, for example, they have ifdefs and defines with their includes). --- desktop_version/src/BinaryBlob.cpp | 6 +-- desktop_version/src/Entity.h | 6 +-- desktop_version/src/FileSystemUtils.cpp | 21 ++++------ desktop_version/src/Finalclass.cpp | 3 +- desktop_version/src/Game.cpp | 27 +++++-------- desktop_version/src/Game.h | 4 +- desktop_version/src/Graphics.cpp | 10 +++-- desktop_version/src/Graphics.h | 17 +++----- desktop_version/src/GraphicsResources.cpp | 4 +- desktop_version/src/Input.cpp | 13 +++--- desktop_version/src/KeyPoll.cpp | 8 ++-- desktop_version/src/KeyPoll.h | 5 +-- desktop_version/src/Labclass.cpp | 3 +- desktop_version/src/Logic.cpp | 7 ++-- desktop_version/src/Map.cpp | 5 +-- desktop_version/src/Map.h | 12 +++--- desktop_version/src/Music.cpp | 4 +- desktop_version/src/Music.h | 6 +-- desktop_version/src/Otherlevel.cpp | 3 +- desktop_version/src/Render.cpp | 13 +++--- desktop_version/src/Screen.cpp | 4 +- desktop_version/src/Script.cpp | 4 +- desktop_version/src/Scripts.cpp | 1 + desktop_version/src/SoundSystem.cpp | 4 +- desktop_version/src/Spacestation2.cpp | 3 +- desktop_version/src/TerminalScripts.cpp | 1 + desktop_version/src/Textbox.cpp | 1 + desktop_version/src/Tower.cpp | 1 - desktop_version/src/UtilityClass.cpp | 3 +- desktop_version/src/UtilityClass.h | 2 +- desktop_version/src/WarpClass.cpp | 3 +- desktop_version/src/editor.cpp | 23 +++++------ desktop_version/src/editor.h | 5 +-- desktop_version/src/main.cpp | 49 +++++++++-------------- desktop_version/src/preloader.cpp | 2 - 35 files changed, 124 insertions(+), 159 deletions(-) diff --git a/desktop_version/src/BinaryBlob.cpp b/desktop_version/src/BinaryBlob.cpp index 94fff1ea..1f52304d 100644 --- a/desktop_version/src/BinaryBlob.cpp +++ b/desktop_version/src/BinaryBlob.cpp @@ -1,11 +1,9 @@ #include "BinaryBlob.h" +#include /* FIXME: Abstract to FileSystemUtils! */ +#include #include #include -#include - -/* FIXME: Abstract to FileSystemUtils! */ -#include binaryBlob::binaryBlob() { diff --git a/desktop_version/src/Entity.h b/desktop_version/src/Entity.h index 005a3276..50bbaa59 100644 --- a/desktop_version/src/Entity.h +++ b/desktop_version/src/Entity.h @@ -1,14 +1,14 @@ #ifndef ENTITY_H #define ENTITY_H +#include +#include + #include "Maths.h" #include "Ent.h" #include "BlockV.h" #include "Game.h" -#include -#include - #define removeentity_iter(index) { if (obj.removeentity(index)) index--; } #define removeblock_iter(index) { obj.removeblock(index); index--; } diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 252e87bc..3709a7bb 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -1,22 +1,17 @@ -#include -#include - +#include +#include +#include +#include +#include #include #include -#include +#include +#include +#include #include "Graphics.h" #include "UtilityClass.h" -#include -#include -#include - -#include -#include - -#include - /* These are needed for PLATFORM_* crap */ #if defined(_WIN32) #include diff --git a/desktop_version/src/Finalclass.cpp b/desktop_version/src/Finalclass.cpp index a1d552b3..a22ce1fc 100644 --- a/desktop_version/src/Finalclass.cpp +++ b/desktop_version/src/Finalclass.cpp @@ -1,9 +1,8 @@ #include "Finalclass.h" -#include "MakeAndPlay.h" - #include "Game.h" #include "Entity.h" +#include "MakeAndPlay.h" #include "UtilityClass.h" const short* finalclass::loadlevel(int rx, int ry) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 8e98eb27..20aaaeb3 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -1,27 +1,22 @@ -#include "Enums.h" - -#include "editor.h" #include "Game.h" -#include "Graphics.h" -#include "Entity.h" -#include "Map.h" -#include "Music.h" -#include "Script.h" -#include "UtilityClass.h" +#include #include #include #include - -#include - -#include "FileSystemUtils.h" - #include -#include "Network.h" - +#include "editor.h" +#include "Entity.h" +#include "Enums.h" +#include "FileSystemUtils.h" +#include "Graphics.h" #include "MakeAndPlay.h" +#include "Map.h" +#include "Music.h" +#include "Network.h" +#include "Script.h" +#include "UtilityClass.h" // lol, Win32 -flibit #ifdef _WIN32 diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index f1e696aa..bdc13951 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -1,9 +1,9 @@ #ifndef GAME_H #define GAME_H -#include -#include #include +#include +#include struct MenuOption { diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 209b4123..32ecd9da 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1,14 +1,16 @@ #include "Graphics.h" + +#include +#include +#include + #include "editor.h" #include "Entity.h" +#include "FileSystemUtils.h" #include "Map.h" #include "Music.h" #include "Screen.h" -#include "FileSystemUtils.h" #include "UtilityClass.h" -#include -#include -#include void Graphics::init() { diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index df76e1fa..9f77d927 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -1,21 +1,16 @@ #ifndef GRAPHICS_H #define GRAPHICS_H -#include "GraphicsResources.h" -#include -#include - - - -#include "Maths.h" -#include "Textbox.h" - - -#include #include +#include +#include +#include +#include "GraphicsResources.h" #include "GraphicsUtil.h" +#include "Maths.h" #include "Screen.h" +#include "Textbox.h" class Graphics { diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index 12c3eaaf..a006d791 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -1,8 +1,10 @@ #include "GraphicsResources.h" -#include "FileSystemUtils.h" + #include #include +#include "FileSystemUtils.h" + // Used to load PNG data extern "C" { diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index c9a921df..b23d5bbb 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1,21 +1,18 @@ -#include "Logic.h" -#include "Script.h" -#include "Credits.h" - -#include "MakeAndPlay.h" - #include -#include "FileSystemUtils.h" - +#include "Credits.h" #include "editor.h" #include "Entity.h" #include "Enums.h" +#include "FileSystemUtils.h" #include "Game.h" #include "Graphics.h" #include "KeyPoll.h" +#include "Logic.h" +#include "MakeAndPlay.h" #include "Map.h" #include "Music.h" +#include "Script.h" void updatebuttonmappings(int bind) { diff --git a/desktop_version/src/KeyPoll.cpp b/desktop_version/src/KeyPoll.cpp index a283b613..1fd3b09d 100644 --- a/desktop_version/src/KeyPoll.cpp +++ b/desktop_version/src/KeyPoll.cpp @@ -1,11 +1,13 @@ #include "KeyPoll.h" -#include "Game.h" -#include "Graphics.h" -#include "Music.h" + #include #include #include +#include "Game.h" +#include "Graphics.h" +#include "Music.h" + void KeyPoll::setSensitivity(int _value) { switch (_value) diff --git a/desktop_version/src/KeyPoll.h b/desktop_version/src/KeyPoll.h index e7d40f83..6d8d21ef 100644 --- a/desktop_version/src/KeyPoll.h +++ b/desktop_version/src/KeyPoll.h @@ -1,11 +1,10 @@ #ifndef KEYPOLL_H #define KEYPOLL_H +#include // FIXME: I should feel very bad for using C++ -flibit +#include #include #include -#include // FIXME: I should feel very bad for using C++ -flibit - -#include enum Kybrd { diff --git a/desktop_version/src/Labclass.cpp b/desktop_version/src/Labclass.cpp index 9804855e..1ed2dbc2 100644 --- a/desktop_version/src/Labclass.cpp +++ b/desktop_version/src/Labclass.cpp @@ -1,9 +1,8 @@ #include "Labclass.h" -#include "MakeAndPlay.h" - #include "Game.h" #include "Entity.h" +#include "MakeAndPlay.h" #include "UtilityClass.h" const short* labclass::loadlevel(int rx, int ry) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index e0ee9149..70dd470c 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -1,15 +1,14 @@ -#include "Script.h" -#include "Network.h" -#include "FileSystemUtils.h" #include "Credits.h" - #include "editor.h" #include "Entity.h" #include "Enums.h" +#include "FileSystemUtils.h" #include "Game.h" #include "Graphics.h" #include "Map.h" #include "Music.h" +#include "Network.h" +#include "Script.h" #include "UtilityClass.h" void titleupdatetextcol() diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index f95cafff..9d91e19e 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1,13 +1,12 @@ #include "Map.h" -#include "Script.h" - -#include "MakeAndPlay.h" #include "editor.h" #include "Entity.h" #include "Game.h" #include "Graphics.h" +#include "MakeAndPlay.h" #include "Music.h" +#include "Script.h" #include "UtilityClass.h" mapclass::mapclass() diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index 1c91586f..b777b311 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -1,15 +1,15 @@ #ifndef MAPGAME_H #define MAPGAME_H -#include "Tower.h" -#include "WarpClass.h" -#include "Finalclass.h" -#include "Labclass.h" -#include "Spacestation2.h" -#include "Otherlevel.h" #include +#include "Finalclass.h" +#include "Labclass.h" #include "Maths.h" +#include "Otherlevel.h" +#include "Spacestation2.h" +#include "Tower.h" +#include "WarpClass.h" struct Roomtext { diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index d9f34f11..ef60f5b0 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -1,6 +1,8 @@ +#include "Music.h" + #include #include -#include "Music.h" + #include "BinaryBlob.h" #include "Map.h" #include "UtilityClass.h" diff --git a/desktop_version/src/Music.h b/desktop_version/src/Music.h index f7bee414..764a6dfe 100644 --- a/desktop_version/src/Music.h +++ b/desktop_version/src/Music.h @@ -1,11 +1,11 @@ #ifndef MUSIC_H #define MUSIC_H -#include "SoundSystem.h" -#include "BinaryBlob.h" - #include +#include "BinaryBlob.h" +#include "SoundSystem.h" + #define musicroom(rx, ry) ((rx) + ((ry) * 20)) class musicclass diff --git a/desktop_version/src/Otherlevel.cpp b/desktop_version/src/Otherlevel.cpp index 363588e5..02f63e64 100644 --- a/desktop_version/src/Otherlevel.cpp +++ b/desktop_version/src/Otherlevel.cpp @@ -1,9 +1,8 @@ #include "Otherlevel.h" -#include "MakeAndPlay.h" - #include "Game.h" #include "Entity.h" +#include "MakeAndPlay.h" const short* otherlevelclass::loadlevel(int rx, int ry) { diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index d045d11a..f6d94baa 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1,15 +1,14 @@ +#include "Credits.h" #include "editor.h" -#include "Graphics.h" -#include "UtilityClass.h" -#include "Maths.h" #include "Entity.h" +#include "FileSystemUtils.h" +#include "Graphics.h" +#include "MakeAndPlay.h" #include "Map.h" +#include "Maths.h" #include "Music.h" #include "Script.h" -#include "FileSystemUtils.h" -#include "Credits.h" - -#include "MakeAndPlay.h" +#include "UtilityClass.h" int tr; int tg; diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index a62e60ef..e7330016 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -1,10 +1,10 @@ #include "Screen.h" +#include + #include "FileSystemUtils.h" #include "GraphicsUtil.h" -#include - // Used to create the window icon extern "C" { diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index e33e1fe5..f02e5813 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1,12 +1,12 @@ #include "Script.h" -#include "Graphics.h" #include "editor.h" #include "Entity.h" #include "Enums.h" -#include "Music.h" +#include "Graphics.h" #include "KeyPoll.h" #include "Map.h" +#include "Music.h" #include "UtilityClass.h" scriptclass::scriptclass() diff --git a/desktop_version/src/Scripts.cpp b/desktop_version/src/Scripts.cpp index 0d33c415..ddbe0e39 100644 --- a/desktop_version/src/Scripts.cpp +++ b/desktop_version/src/Scripts.cpp @@ -1,4 +1,5 @@ #include "Script.h" + #include void scriptclass::load(const std::string& name) diff --git a/desktop_version/src/SoundSystem.cpp b/desktop_version/src/SoundSystem.cpp index 8f825e43..6e760a2d 100644 --- a/desktop_version/src/SoundSystem.cpp +++ b/desktop_version/src/SoundSystem.cpp @@ -1,5 +1,7 @@ -#include #include "SoundSystem.h" + +#include + #include "FileSystemUtils.h" MusicTrack::MusicTrack(const char* fileName) diff --git a/desktop_version/src/Spacestation2.cpp b/desktop_version/src/Spacestation2.cpp index c8126982..c0192f7e 100644 --- a/desktop_version/src/Spacestation2.cpp +++ b/desktop_version/src/Spacestation2.cpp @@ -1,9 +1,8 @@ #include "Spacestation2.h" -#include "MakeAndPlay.h" - #include "Game.h" #include "Entity.h" +#include "MakeAndPlay.h" #include "UtilityClass.h" const short* spacestation2class::loadlevel(int rx, int ry) diff --git a/desktop_version/src/TerminalScripts.cpp b/desktop_version/src/TerminalScripts.cpp index fabb8cbc..eb12d541 100644 --- a/desktop_version/src/TerminalScripts.cpp +++ b/desktop_version/src/TerminalScripts.cpp @@ -1,4 +1,5 @@ #include "Script.h" + #include void scriptclass::loadother(const char* t) diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 34f01ee2..8b6347de 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -1,4 +1,5 @@ #include "Textbox.h" + #include textboxclass::textboxclass() diff --git a/desktop_version/src/Tower.cpp b/desktop_version/src/Tower.cpp index f561fb5f..ee6003a0 100644 --- a/desktop_version/src/Tower.cpp +++ b/desktop_version/src/Tower.cpp @@ -1,7 +1,6 @@ #include "Tower.h" #include "MakeAndPlay.h" - #include "UtilityClass.h" towerclass::towerclass() diff --git a/desktop_version/src/UtilityClass.cpp b/desktop_version/src/UtilityClass.cpp index b7e076d7..f784dfc1 100644 --- a/desktop_version/src/UtilityClass.cpp +++ b/desktop_version/src/UtilityClass.cpp @@ -1,8 +1,7 @@ #include "UtilityClass.h" -#include - #include +#include #include /* Used by UtilityClass::GCString to generate a button list */ diff --git a/desktop_version/src/UtilityClass.h b/desktop_version/src/UtilityClass.h index 412df265..42558fe1 100644 --- a/desktop_version/src/UtilityClass.h +++ b/desktop_version/src/UtilityClass.h @@ -2,8 +2,8 @@ #define UTILITYCLASS_H #include -#include #include +#include int ss_toi(std::string _s); diff --git a/desktop_version/src/WarpClass.cpp b/desktop_version/src/WarpClass.cpp index 3f14cc81..269199f0 100644 --- a/desktop_version/src/WarpClass.cpp +++ b/desktop_version/src/WarpClass.cpp @@ -1,9 +1,8 @@ #include "WarpClass.h" -#include "MakeAndPlay.h" - #include "Game.h" #include "Entity.h" +#include "MakeAndPlay.h" #include "UtilityClass.h" const short* warpclass::loadlevel(int rx, int ry) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 5ca107e6..e08d2bd7 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -2,24 +2,22 @@ #include "editor.h" -#include "Graphics.h" +#include +#include +#include +#include +#include + #include "Entity.h" -#include "Music.h" +#include "Enums.h" +#include "FileSystemUtils.h" +#include "Graphics.h" #include "KeyPoll.h" #include "Map.h" +#include "Music.h" #include "Script.h" #include "UtilityClass.h" -#include - -#include "Enums.h" - -#include "FileSystemUtils.h" - -#include -#include -#include - #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif @@ -27,7 +25,6 @@ #define _POSIX_SOURCE #endif #include -#include edlevelclass::edlevelclass() { diff --git a/desktop_version/src/editor.h b/desktop_version/src/editor.h index 10a1db80..c6bd8219 100644 --- a/desktop_version/src/editor.h +++ b/desktop_version/src/editor.h @@ -3,10 +3,9 @@ #ifndef EDITOR_H #define EDITOR_H -#include -#include - #include +#include +#include // Text entry field type enum textmode { diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 414981c1..9910a595 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -1,37 +1,26 @@ #include -#include "SoundSystem.h" - -#include "UtilityClass.h" -#include "Enums.h" -#include "Entity.h" -#include "Game.h" -#include "Graphics.h" -#include "KeyPoll.h" -#include "Render.h" - -#include "Tower.h" -#include "WarpClass.h" -#include "Labclass.h" -#include "Finalclass.h" -#include "Map.h" -#include "Music.h" - -#include "Screen.h" - -#include "Script.h" - -#include "Logic.h" - -#include "Input.h" -#include "editor.h" -#include "preloader.h" - -#include "FileSystemUtils.h" -#include "Network.h" - #include #include +#include "editor.h" +#include "Enums.h" +#include "Entity.h" +#include "FileSystemUtils.h" +#include "Game.h" +#include "Graphics.h" +#include "Input.h" +#include "KeyPoll.h" +#include "Logic.h" +#include "Map.h" +#include "Music.h" +#include "Network.h" +#include "preloader.h" +#include "Render.h" +#include "Screen.h" +#include "Script.h" +#include "SoundSystem.h" +#include "UtilityClass.h" + scriptclass script; #if !defined(NO_CUSTOM_LEVELS) diff --git a/desktop_version/src/preloader.cpp b/desktop_version/src/preloader.cpp index 5cca49f8..f656aadc 100644 --- a/desktop_version/src/preloader.cpp +++ b/desktop_version/src/preloader.cpp @@ -1,5 +1,3 @@ -#include "preloader.h" - #include "Enums.h" #include "Game.h" #include "Graphics.h"