1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Remove unnecessary includes from header files

Including a header file inside another header file means a bunch of
files are going to be unnecessarily recompiled whenever that inner
header file is changed. So I minimized the amount of header files
included in a header file, and only included the ones that were
necessary (system includes don't count, I'm only talking about includes
from within this project). Then the includes are only in the .cpp files
themselves.

This also minimizes problems such as a NO_CUSTOM_LEVELS build failing
because some file depended on an include that got included in editor.h,
which is another benefit of removing unnecessary includes from header
files.
This commit is contained in:
Misa 2020-07-19 12:05:41 -07:00 committed by Ethan Lee
parent d455e38715
commit b5ff65c84e
38 changed files with 81 additions and 65 deletions

View File

@ -1,5 +1,8 @@
#include "Ent.h"
#include "Game.h"
#include "Graphics.h"
entclass::entclass()
{
invis = false;

View File

@ -1,7 +1,7 @@
#ifndef ENT_H
#define ENT_H
#include "Graphics.h"
#include <SDL.h>
#define rn( rx, ry) ((rx) + ((ry) * 100))

View File

@ -1,6 +1,10 @@
#include "Entity.h"
#include "editor.h"
#include "Game.h"
#include "Graphics.h"
#include "Map.h"
#include "Music.h"
#include "UtilityClass.h"
bool entityclass::checktowerspikes(int t)

View File

@ -4,6 +4,7 @@
#include "Maths.h"
#include "Ent.h"
#include "BlockV.h"
#include "Game.h"
#include <vector>
#include <string>

View File

@ -1,5 +1,3 @@
#include "FileSystemUtils.h"
#include <vector>
#include <string>
@ -8,6 +6,7 @@
#include <string.h>
#include "Graphics.h"
#include "UtilityClass.h"
#include <iterator>
#include <algorithm>
@ -231,6 +230,8 @@ void FILESYSTEM_unmountassets()
FILESYSTEM_assetsmounted = false;
}
void FILESYSTEM_freeMemory(unsigned char **mem);
void FILESYSTEM_loadFileToMemory(
const char *name,
unsigned char **mem,

View File

@ -2,6 +2,10 @@
#include "MakeAndPlay.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
const short* finalclass::loadlevel(int rx, int ry)
{
int t;

View File

@ -1,9 +1,6 @@
#ifndef FINALCLASS_H
#define FINALCLASS_H
#include "Game.h"
#include "Entity.h"
#include <string>
class finalclass

View File

@ -1,10 +1,13 @@
#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 <stdio.h>
#include <stdlib.h>

View File

@ -4,9 +4,6 @@
#include <vector>
#include <string>
#include <SDL.h>
#include "Maths.h"
#include "UtilityClass.h"
#include "GraphicsUtil.h"
struct MenuOption
{

View File

@ -1,9 +1,11 @@
#include "Graphics.h"
#include "Maths.h"
#include "editor.h"
#include "Entity.h"
#include "Map.h"
#include "Music.h"
#include "Screen.h"
#include "FileSystemUtils.h"
#include "UtilityClass.h"
#include <utf8/unchecked.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -9,8 +9,6 @@
#include "Maths.h"
#include "Textbox.h"
#include "UtilityClass.h"
#include "Game.h"
#include <string>

View File

@ -1,4 +1,3 @@
#include "Input.h"
#include "Logic.h"
#include "Script.h"
#include "Credits.h"
@ -9,6 +8,15 @@
#include "FileSystemUtils.h"
#include "editor.h"
#include "Entity.h"
#include "Enums.h"
#include "Game.h"
#include "Graphics.h"
#include "KeyPoll.h"
#include "Map.h"
#include "Music.h"
void updatebuttonmappings(int bind)
{
for (

View File

@ -1,14 +1,6 @@
#ifndef INPUT_H
#define INPUT_H
#include "KeyPoll.h"
#include "Graphics.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
#include "Music.h"
#include "Map.h"
void titleinput();
void gameinput();

View File

@ -1,4 +1,5 @@
#include "KeyPoll.h"
#include "Game.h"
#include "Graphics.h"
#include "Music.h"
#include <stdio.h>

View File

@ -7,8 +7,6 @@
#include <SDL.h>
#include "Screen.h"
enum Kybrd
{
KEYBOARD_UP = SDLK_UP,

View File

@ -2,6 +2,10 @@
#include "MakeAndPlay.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
const short* labclass::loadlevel(int rx, int ry)
{
int t;

View File

@ -1,9 +1,6 @@
#ifndef LABCLASS_H
#define LABCLASS_H
#include "Game.h"
#include "Entity.h"
#include <string>
class labclass

View File

@ -1,9 +1,17 @@
#include "Logic.h"
#include "Script.h"
#include "Network.h"
#include "FileSystemUtils.h"
#include "Credits.h"
#include "editor.h"
#include "Entity.h"
#include "Enums.h"
#include "Game.h"
#include "Graphics.h"
#include "Map.h"
#include "Music.h"
#include "UtilityClass.h"
void titleupdatetextcol()
{
graphics.col_tr = map.r - (help.glow / 4) - int(fRandom() * 4);

View File

@ -1,13 +1,6 @@
#ifndef LOGIC_H
#define LOGIC_H
#include "Graphics.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
#include "Music.h"
#include "Map.h"
void titleupdatetextcol();
void titlelogic();

View File

@ -3,6 +3,13 @@
#include "MakeAndPlay.h"
#include "editor.h"
#include "Entity.h"
#include "Game.h"
#include "Graphics.h"
#include "Music.h"
#include "UtilityClass.h"
mapclass::mapclass()
{
//Start here!

View File

@ -7,11 +7,9 @@
#include "Labclass.h"
#include "Spacestation2.h"
#include "Otherlevel.h"
#include "Entity.h"
#include "Graphics.h"
#include <vector>
#include "Music.h"
#include "editor.h"
#include "Maths.h"
struct Roomtext
{

View File

@ -3,6 +3,7 @@
#include "Music.h"
#include "BinaryBlob.h"
#include "Map.h"
#include "UtilityClass.h"
void songend();

View File

@ -1,4 +1,4 @@
#include "Network.h"
#include <stdint.h>
#define UNUSED(expr) (void)(expr)

View File

@ -2,6 +2,9 @@
#include "MakeAndPlay.h"
#include "Game.h"
#include "Entity.h"
const short* otherlevelclass::loadlevel(int rx, int ry)
{
int t;

View File

@ -1,9 +1,6 @@
#ifndef OTHERLEVEL_H
#define OTHERLEVEL_H
#include "Game.h"
#include "Entity.h"
#include <string>
class otherlevelclass

View File

@ -1,10 +1,10 @@
#include "Render.h"
#include "editor.h"
#include "Graphics.h"
#include "UtilityClass.h"
#include "Maths.h"
#include "Entity.h"
#include "Map.h"
#include "Music.h"
#include "Script.h"
#include "FileSystemUtils.h"
#include "Credits.h"

View File

@ -1,13 +1,6 @@
#ifndef RENDER_H
#define RENDER_H
#include "Graphics.h"
#include "UtilityClass.h"
#include "Maths.h"
#include "Entity.h"
#include "Map.h"
#include "Script.h"
void titlerender();
void gamerender();

View File

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

View File

@ -4,8 +4,6 @@
#include <string>
#include <vector>
#include "Enums.h"
#define filllines(lines) commands.insert(commands.end(), lines, lines + sizeof(lines)/sizeof(lines[0]))

View File

@ -2,6 +2,10 @@
#include "MakeAndPlay.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
const short* spacestation2class::loadlevel(int rx, int ry)
{
int t;

View File

@ -1,9 +1,6 @@
#ifndef SPACESTATION2_H
#define SPACESTATION2_H
#include "Game.h"
#include "Entity.h"
#include <string>
class spacestation2class

View File

@ -2,6 +2,10 @@
#include "MakeAndPlay.h"
#include "Game.h"
#include "Entity.h"
#include "UtilityClass.h"
const short* warpclass::loadlevel(int rx, int ry)
{
int t;

View File

@ -1,9 +1,6 @@
#ifndef WARPCLASS_H
#define WARPCLASS_H
#include "Game.h"
#include "Entity.h"
#include <string>
class warpclass

View File

@ -8,6 +8,7 @@
#include "KeyPoll.h"
#include "Map.h"
#include "Script.h"
#include "UtilityClass.h"
#include "time.h"
#include <tinyxml2.h>

View File

@ -5,8 +5,8 @@
#include <vector>
#include <string>
#include "Script.h"
#include "Graphics.h"
#include <SDL.h>
// Text entry field type
enum textmode {

View File

@ -2,6 +2,8 @@
#include "SoundSystem.h"
#include "UtilityClass.h"
#include "Enums.h"
#include "Entity.h"
#include "Game.h"
#include "Graphics.h"
#include "KeyPoll.h"
@ -12,6 +14,7 @@
#include "Labclass.h"
#include "Finalclass.h"
#include "Map.h"
#include "Music.h"
#include "Screen.h"

View File

@ -1,6 +1,9 @@
#include "preloader.h"
#include "Enums.h"
#include "Game.h"
#include "Graphics.h"
#include "UtilityClass.h"
int pre_fakepercent=0, pre_transition=30;
bool pre_startgame=false;

View File

@ -1,10 +1,6 @@
#ifndef PRELOADER_H
#define PRELOADER_H
#include "Graphics.h"
#include "Game.h"
#include "UtilityClass.h"
void preloaderrender();
void preloaderlogic();