1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

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).
This commit is contained in:
Misa 2020-07-19 12:43:29 -07:00 committed by Ethan Lee
parent b108e28c5a
commit 52f7a587fe
35 changed files with 124 additions and 159 deletions

View file

@ -1,11 +1,9 @@
#include "BinaryBlob.h" #include "BinaryBlob.h"
#include <physfs.h> /* FIXME: Abstract to FileSystemUtils! */
#include <SDL.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <SDL.h>
/* FIXME: Abstract to FileSystemUtils! */
#include <physfs.h>
binaryBlob::binaryBlob() binaryBlob::binaryBlob()
{ {

View file

@ -1,14 +1,14 @@
#ifndef ENTITY_H #ifndef ENTITY_H
#define ENTITY_H #define ENTITY_H
#include <string>
#include <vector>
#include "Maths.h" #include "Maths.h"
#include "Ent.h" #include "Ent.h"
#include "BlockV.h" #include "BlockV.h"
#include "Game.h" #include "Game.h"
#include <vector>
#include <string>
#define removeentity_iter(index) { if (obj.removeentity(index)) index--; } #define removeentity_iter(index) { if (obj.removeentity(index)) index--; }
#define removeblock_iter(index) { obj.removeblock(index); index--; } #define removeblock_iter(index) { obj.removeblock(index); index--; }

View file

@ -1,22 +1,17 @@
#include <vector> #include <algorithm>
#include <string> #include <iostream>
#include <iterator>
#include <physfs.h>
#include <SDL.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string>
#include <tinyxml2.h>
#include <vector>
#include "Graphics.h" #include "Graphics.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include <iterator>
#include <algorithm>
#include <iostream>
#include <SDL.h>
#include <physfs.h>
#include <tinyxml2.h>
/* These are needed for PLATFORM_* crap */ /* These are needed for PLATFORM_* crap */
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>

View file

@ -1,9 +1,8 @@
#include "Finalclass.h" #include "Finalclass.h"
#include "MakeAndPlay.h"
#include "Game.h" #include "Game.h"
#include "Entity.h" #include "Entity.h"
#include "MakeAndPlay.h"
#include "UtilityClass.h" #include "UtilityClass.h"
const short* finalclass::loadlevel(int rx, int ry) const short* finalclass::loadlevel(int rx, int ry)

View file

@ -1,27 +1,22 @@
#include "Enums.h"
#include "editor.h"
#include "Game.h" #include "Game.h"
#include "Graphics.h"
#include "Entity.h"
#include "Map.h"
#include "Music.h"
#include "Script.h"
#include "UtilityClass.h"
#include <sstream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sstream>
#include "FileSystemUtils.h"
#include <tinyxml2.h> #include <tinyxml2.h>
#include "Network.h" #include "editor.h"
#include "Entity.h"
#include "Enums.h"
#include "FileSystemUtils.h"
#include "Graphics.h"
#include "MakeAndPlay.h" #include "MakeAndPlay.h"
#include "Map.h"
#include "Music.h"
#include "Network.h"
#include "Script.h"
#include "UtilityClass.h"
// lol, Win32 -flibit // lol, Win32 -flibit
#ifdef _WIN32 #ifdef _WIN32

View file

@ -1,9 +1,9 @@
#ifndef GAME_H #ifndef GAME_H
#define GAME_H #define GAME_H
#include <vector>
#include <string>
#include <SDL.h> #include <SDL.h>
#include <string>
#include <vector>
struct MenuOption struct MenuOption
{ {

View file

@ -1,14 +1,16 @@
#include "Graphics.h" #include "Graphics.h"
#include <stdio.h>
#include <stdlib.h>
#include <utf8/unchecked.h>
#include "editor.h" #include "editor.h"
#include "Entity.h" #include "Entity.h"
#include "FileSystemUtils.h"
#include "Map.h" #include "Map.h"
#include "Music.h" #include "Music.h"
#include "Screen.h" #include "Screen.h"
#include "FileSystemUtils.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include <utf8/unchecked.h>
#include <stdio.h>
#include <stdlib.h>
void Graphics::init() void Graphics::init()
{ {

View file

@ -1,21 +1,16 @@
#ifndef GRAPHICS_H #ifndef GRAPHICS_H
#define GRAPHICS_H #define GRAPHICS_H
#include "GraphicsResources.h"
#include <vector>
#include <map>
#include "Maths.h"
#include "Textbox.h"
#include <string>
#include <algorithm> #include <algorithm>
#include <map>
#include <string>
#include <vector>
#include "GraphicsResources.h"
#include "GraphicsUtil.h" #include "GraphicsUtil.h"
#include "Maths.h"
#include "Screen.h" #include "Screen.h"
#include "Textbox.h"
class Graphics class Graphics
{ {

View file

@ -1,8 +1,10 @@
#include "GraphicsResources.h" #include "GraphicsResources.h"
#include "FileSystemUtils.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "FileSystemUtils.h"
// Used to load PNG data // Used to load PNG data
extern "C" extern "C"
{ {

View file

@ -1,21 +1,18 @@
#include "Logic.h"
#include "Script.h"
#include "Credits.h"
#include "MakeAndPlay.h"
#include <tinyxml2.h> #include <tinyxml2.h>
#include "FileSystemUtils.h" #include "Credits.h"
#include "editor.h" #include "editor.h"
#include "Entity.h" #include "Entity.h"
#include "Enums.h" #include "Enums.h"
#include "FileSystemUtils.h"
#include "Game.h" #include "Game.h"
#include "Graphics.h" #include "Graphics.h"
#include "KeyPoll.h" #include "KeyPoll.h"
#include "Logic.h"
#include "MakeAndPlay.h"
#include "Map.h" #include "Map.h"
#include "Music.h" #include "Music.h"
#include "Script.h"
void updatebuttonmappings(int bind) void updatebuttonmappings(int bind)
{ {

View file

@ -1,11 +1,13 @@
#include "KeyPoll.h" #include "KeyPoll.h"
#include "Game.h"
#include "Graphics.h"
#include "Music.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <utf8/unchecked.h> #include <utf8/unchecked.h>
#include "Game.h"
#include "Graphics.h"
#include "Music.h"
void KeyPoll::setSensitivity(int _value) void KeyPoll::setSensitivity(int _value)
{ {
switch (_value) switch (_value)

View file

@ -1,11 +1,10 @@
#ifndef KEYPOLL_H #ifndef KEYPOLL_H
#define KEYPOLL_H #define KEYPOLL_H
#include <map> // FIXME: I should feel very bad for using C++ -flibit
#include <SDL.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> // FIXME: I should feel very bad for using C++ -flibit
#include <SDL.h>
enum Kybrd enum Kybrd
{ {

View file

@ -1,9 +1,8 @@
#include "Labclass.h" #include "Labclass.h"
#include "MakeAndPlay.h"
#include "Game.h" #include "Game.h"
#include "Entity.h" #include "Entity.h"
#include "MakeAndPlay.h"
#include "UtilityClass.h" #include "UtilityClass.h"
const short* labclass::loadlevel(int rx, int ry) const short* labclass::loadlevel(int rx, int ry)

View file

@ -1,15 +1,14 @@
#include "Script.h"
#include "Network.h"
#include "FileSystemUtils.h"
#include "Credits.h" #include "Credits.h"
#include "editor.h" #include "editor.h"
#include "Entity.h" #include "Entity.h"
#include "Enums.h" #include "Enums.h"
#include "FileSystemUtils.h"
#include "Game.h" #include "Game.h"
#include "Graphics.h" #include "Graphics.h"
#include "Map.h" #include "Map.h"
#include "Music.h" #include "Music.h"
#include "Network.h"
#include "Script.h"
#include "UtilityClass.h" #include "UtilityClass.h"
void titleupdatetextcol() void titleupdatetextcol()

View file

@ -1,13 +1,12 @@
#include "Map.h" #include "Map.h"
#include "Script.h"
#include "MakeAndPlay.h"
#include "editor.h" #include "editor.h"
#include "Entity.h" #include "Entity.h"
#include "Game.h" #include "Game.h"
#include "Graphics.h" #include "Graphics.h"
#include "MakeAndPlay.h"
#include "Music.h" #include "Music.h"
#include "Script.h"
#include "UtilityClass.h" #include "UtilityClass.h"
mapclass::mapclass() mapclass::mapclass()

View file

@ -1,15 +1,15 @@
#ifndef MAPGAME_H #ifndef MAPGAME_H
#define MAPGAME_H #define MAPGAME_H
#include "Tower.h"
#include "WarpClass.h"
#include "Finalclass.h"
#include "Labclass.h"
#include "Spacestation2.h"
#include "Otherlevel.h"
#include <vector> #include <vector>
#include "Finalclass.h"
#include "Labclass.h"
#include "Maths.h" #include "Maths.h"
#include "Otherlevel.h"
#include "Spacestation2.h"
#include "Tower.h"
#include "WarpClass.h"
struct Roomtext struct Roomtext
{ {

View file

@ -1,6 +1,8 @@
#include "Music.h"
#include <SDL.h> #include <SDL.h>
#include <stdio.h> #include <stdio.h>
#include "Music.h"
#include "BinaryBlob.h" #include "BinaryBlob.h"
#include "Map.h" #include "Map.h"
#include "UtilityClass.h" #include "UtilityClass.h"

View file

@ -1,11 +1,11 @@
#ifndef MUSIC_H #ifndef MUSIC_H
#define MUSIC_H #define MUSIC_H
#include "SoundSystem.h"
#include "BinaryBlob.h"
#include <vector> #include <vector>
#include "BinaryBlob.h"
#include "SoundSystem.h"
#define musicroom(rx, ry) ((rx) + ((ry) * 20)) #define musicroom(rx, ry) ((rx) + ((ry) * 20))
class musicclass class musicclass

View file

@ -1,9 +1,8 @@
#include "Otherlevel.h" #include "Otherlevel.h"
#include "MakeAndPlay.h"
#include "Game.h" #include "Game.h"
#include "Entity.h" #include "Entity.h"
#include "MakeAndPlay.h"
const short* otherlevelclass::loadlevel(int rx, int ry) const short* otherlevelclass::loadlevel(int rx, int ry)
{ {

View file

@ -1,15 +1,14 @@
#include "Credits.h"
#include "editor.h" #include "editor.h"
#include "Graphics.h"
#include "UtilityClass.h"
#include "Maths.h"
#include "Entity.h" #include "Entity.h"
#include "FileSystemUtils.h"
#include "Graphics.h"
#include "MakeAndPlay.h"
#include "Map.h" #include "Map.h"
#include "Maths.h"
#include "Music.h" #include "Music.h"
#include "Script.h" #include "Script.h"
#include "FileSystemUtils.h" #include "UtilityClass.h"
#include "Credits.h"
#include "MakeAndPlay.h"
int tr; int tr;
int tg; int tg;

View file

@ -1,10 +1,10 @@
#include "Screen.h" #include "Screen.h"
#include <stdlib.h>
#include "FileSystemUtils.h" #include "FileSystemUtils.h"
#include "GraphicsUtil.h" #include "GraphicsUtil.h"
#include <stdlib.h>
// Used to create the window icon // Used to create the window icon
extern "C" extern "C"
{ {

View file

@ -1,12 +1,12 @@
#include "Script.h" #include "Script.h"
#include "Graphics.h"
#include "editor.h" #include "editor.h"
#include "Entity.h" #include "Entity.h"
#include "Enums.h" #include "Enums.h"
#include "Music.h" #include "Graphics.h"
#include "KeyPoll.h" #include "KeyPoll.h"
#include "Map.h" #include "Map.h"
#include "Music.h"
#include "UtilityClass.h" #include "UtilityClass.h"
scriptclass::scriptclass() scriptclass::scriptclass()

View file

@ -1,4 +1,5 @@
#include "Script.h" #include "Script.h"
#include <SDL.h> #include <SDL.h>
void scriptclass::load(const std::string& name) void scriptclass::load(const std::string& name)

View file

@ -1,5 +1,7 @@
#include <SDL.h>
#include "SoundSystem.h" #include "SoundSystem.h"
#include <SDL.h>
#include "FileSystemUtils.h" #include "FileSystemUtils.h"
MusicTrack::MusicTrack(const char* fileName) MusicTrack::MusicTrack(const char* fileName)

View file

@ -1,9 +1,8 @@
#include "Spacestation2.h" #include "Spacestation2.h"
#include "MakeAndPlay.h"
#include "Game.h" #include "Game.h"
#include "Entity.h" #include "Entity.h"
#include "MakeAndPlay.h"
#include "UtilityClass.h" #include "UtilityClass.h"
const short* spacestation2class::loadlevel(int rx, int ry) const short* spacestation2class::loadlevel(int rx, int ry)

View file

@ -1,4 +1,5 @@
#include "Script.h" #include "Script.h"
#include <SDL.h> #include <SDL.h>
void scriptclass::loadother(const char* t) void scriptclass::loadother(const char* t)

View file

@ -1,4 +1,5 @@
#include "Textbox.h" #include "Textbox.h"
#include <utf8/unchecked.h> #include <utf8/unchecked.h>
textboxclass::textboxclass() textboxclass::textboxclass()

View file

@ -1,7 +1,6 @@
#include "Tower.h" #include "Tower.h"
#include "MakeAndPlay.h" #include "MakeAndPlay.h"
#include "UtilityClass.h" #include "UtilityClass.h"
towerclass::towerclass() towerclass::towerclass()

View file

@ -1,8 +1,7 @@
#include "UtilityClass.h" #include "UtilityClass.h"
#include <SDL.h>
#include <cctype> #include <cctype>
#include <SDL.h>
#include <sstream> #include <sstream>
/* Used by UtilityClass::GCString to generate a button list */ /* Used by UtilityClass::GCString to generate a button list */

View file

@ -2,8 +2,8 @@
#define UTILITYCLASS_H #define UTILITYCLASS_H
#include <SDL.h> #include <SDL.h>
#include <vector>
#include <string> #include <string>
#include <vector>
int ss_toi(std::string _s); int ss_toi(std::string _s);

View file

@ -1,9 +1,8 @@
#include "WarpClass.h" #include "WarpClass.h"
#include "MakeAndPlay.h"
#include "Game.h" #include "Game.h"
#include "Entity.h" #include "Entity.h"
#include "MakeAndPlay.h"
#include "UtilityClass.h" #include "UtilityClass.h"
const short* warpclass::loadlevel(int rx, int ry) const short* warpclass::loadlevel(int rx, int ry)

View file

@ -2,24 +2,22 @@
#include "editor.h" #include "editor.h"
#include "Graphics.h" #include <physfs.h>
#include <stdio.h>
#include <string>
#include <tinyxml2.h>
#include <utf8/unchecked.h>
#include "Entity.h" #include "Entity.h"
#include "Music.h" #include "Enums.h"
#include "FileSystemUtils.h"
#include "Graphics.h"
#include "KeyPoll.h" #include "KeyPoll.h"
#include "Map.h" #include "Map.h"
#include "Music.h"
#include "Script.h" #include "Script.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include <tinyxml2.h>
#include "Enums.h"
#include "FileSystemUtils.h"
#include <string>
#include <utf8/unchecked.h>
#include <physfs.h>
#ifndef __STDC_FORMAT_MACROS #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif #endif
@ -27,7 +25,6 @@
#define _POSIX_SOURCE #define _POSIX_SOURCE
#endif #endif
#include <inttypes.h> #include <inttypes.h>
#include <cstdio>
edlevelclass::edlevelclass() edlevelclass::edlevelclass()
{ {

View file

@ -3,10 +3,9 @@
#ifndef EDITOR_H #ifndef EDITOR_H
#define EDITOR_H #define EDITOR_H
#include <vector>
#include <string>
#include <SDL.h> #include <SDL.h>
#include <string>
#include <vector>
// Text entry field type // Text entry field type
enum textmode { enum textmode {

View file

@ -1,37 +1,26 @@
#include <SDL.h> #include <SDL.h>
#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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#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; scriptclass script;
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)

View file

@ -1,5 +1,3 @@
#include "preloader.h"
#include "Enums.h" #include "Enums.h"
#include "Game.h" #include "Game.h"
#include "Graphics.h" #include "Graphics.h"