From 607738af5520f55a552c3d3df90c3a0c4276270c Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 6 Jun 2009 16:00:12 +0100 Subject: [PATCH] Remove lots of headers from Platform.hpp --- src/AnimatedImage.cpp | 4 ++++ src/Asteroid.cpp | 4 ++++ src/ConfigFile.cpp | 4 ++++ src/ConfigFile.hpp | 3 +++ src/ElectricGate.cpp | 2 ++ src/ElectricGate.hpp | 2 ++ src/Emitter.cpp | 3 +++ src/Fade.cpp | 2 ++ src/Font.cpp | 3 +++ src/Font.hpp | 2 ++ src/Game.cpp | 3 +++ src/HighScores.cpp | 2 ++ src/Input.cpp | 4 ++++ src/InterfaceSounds.cpp | 2 ++ src/Key.cpp | 3 +++ src/LandingPad.cpp | 2 ++ src/LandingPad.hpp | 6 +++--- src/Main.cpp | 2 ++ src/Menu.cpp | 2 ++ src/Mine.cpp | 2 ++ src/Missile.cpp | 1 + src/ObjectGrid.cpp | 2 ++ src/OpenGL.cpp | 5 ++++- src/Options.cpp | 2 ++ src/Platform.hpp | 15 +++------------ src/ScreenManager.cpp | 3 +++ src/ScreenManager.hpp | 2 ++ src/Ship.cpp | 3 +++ src/SoundEffect.cpp | 5 ++++- src/Surface.cpp | 2 ++ src/Texture.cpp | 4 ++++ 31 files changed, 84 insertions(+), 17 deletions(-) diff --git a/src/AnimatedImage.cpp b/src/AnimatedImage.cpp index d2dfb10..6457b1a 100644 --- a/src/AnimatedImage.cpp +++ b/src/AnimatedImage.cpp @@ -17,6 +17,10 @@ #include "AnimatedImage.hpp" +#include +#include +#include + AnimatedImage::AnimatedImage(const string& fileName, int frameWidth, int frameHeight, int frameCount) : Image(fileName), frameWidth(frameWidth), frameHeight(frameHeight), diff --git a/src/Asteroid.cpp b/src/Asteroid.cpp index 59e123e..63e10ba 100644 --- a/src/Asteroid.cpp +++ b/src/Asteroid.cpp @@ -20,6 +20,10 @@ #include "OpenGL.hpp" #include "Ship.hpp" +#include +#include +#include + namespace { // Called by shared_ptr when no more references to a display // list are held diff --git a/src/ConfigFile.cpp b/src/ConfigFile.cpp index e3d7332..a6bf4a0 100644 --- a/src/ConfigFile.cpp +++ b/src/ConfigFile.cpp @@ -17,6 +17,10 @@ #include "ConfigFile.hpp" +#include +#include +#include + ConfigFile::ConfigFile(string filename) : dirty(false), filename(filename) { diff --git a/src/ConfigFile.hpp b/src/ConfigFile.hpp index bf7df28..b026715 100644 --- a/src/ConfigFile.hpp +++ b/src/ConfigFile.hpp @@ -21,6 +21,9 @@ #include "Platform.hpp" +#include +#include + class ConfigFile { public: ConfigFile(string filename = ".lander.config"); diff --git a/src/ElectricGate.cpp b/src/ElectricGate.cpp index 71a4a36..d7b7c52 100644 --- a/src/ElectricGate.cpp +++ b/src/ElectricGate.cpp @@ -19,6 +19,8 @@ #include "ElectricGate.hpp" #include "Ship.hpp" +#include + ElectricGate::ElectricGate(Viewport* v, int length, bool vertical, int x, int y) : StaticObject(x, y), length(length), vertical(vertical), viewport(v), gateImage("images/gateway.png") diff --git a/src/ElectricGate.hpp b/src/ElectricGate.hpp index 783f75c..5a4904e 100644 --- a/src/ElectricGate.hpp +++ b/src/ElectricGate.hpp @@ -24,6 +24,8 @@ #include "Image.hpp" #include "GameObjFwd.hpp" +#include + // // A line strip used for rendering lightning. // diff --git a/src/Emitter.cpp b/src/Emitter.cpp index 0f461fa..9cdb442 100644 --- a/src/Emitter.cpp +++ b/src/Emitter.cpp @@ -20,6 +20,9 @@ #include "Emitter.hpp" #include "OpenGL.hpp" +#include +#include + // // Creates a new particle emitter. // x, y -> Starting position. diff --git a/src/Fade.cpp b/src/Fade.cpp index bec5da4..836f612 100644 --- a/src/Fade.cpp +++ b/src/Fade.cpp @@ -18,6 +18,8 @@ #include "Fade.hpp" #include "OpenGL.hpp" +#include + const double Fade::DEFAULT_FADE_SPEED(0.05); Fade::Fade(double s) diff --git a/src/Font.cpp b/src/Font.cpp index 2b602a2..9536e2c 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -19,6 +19,9 @@ #include "Font.hpp" +#include +#include + int Font::fontRefCount = 0; FT_Library Font::library; diff --git a/src/Font.hpp b/src/Font.hpp index 321171d..9457d91 100644 --- a/src/Font.hpp +++ b/src/Font.hpp @@ -22,6 +22,8 @@ #include "Platform.hpp" +#include + #include #include FT_FREETYPE_H #include FT_GLYPH_H diff --git a/src/Game.cpp b/src/Game.cpp index 7761995..1ae9b1d 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -23,6 +23,9 @@ #include "Input.hpp" #include "ConfigFile.hpp" +#include +#include + // // Constants affecting level generation. // diff --git a/src/HighScores.cpp b/src/HighScores.cpp index a64dcd3..1f663a6 100644 --- a/src/HighScores.cpp +++ b/src/HighScores.cpp @@ -21,6 +21,8 @@ #include "Input.hpp" #include "InterfaceSounds.hpp" +#include + #include const float HighScores::FADE_IN_SPEED(0.2f); diff --git a/src/Input.cpp b/src/Input.cpp index d6091e2..d512940 100644 --- a/src/Input.cpp +++ b/src/Input.cpp @@ -20,6 +20,10 @@ #include "Input.hpp" #include "OpenGL.hpp" +#include +#include +#include + #include const int Input::RESET_TIMEOUT(7); diff --git a/src/InterfaceSounds.cpp b/src/InterfaceSounds.cpp index 1db011b..d2bfafb 100644 --- a/src/InterfaceSounds.cpp +++ b/src/InterfaceSounds.cpp @@ -20,6 +20,8 @@ #include "InterfaceSounds.hpp" #include "SoundEffect.hpp" +#include + void InterfaceSounds::PlayBleep() { static SoundEffect bleepSound(LocateResource("sounds/bleep.wav")); diff --git a/src/Key.cpp b/src/Key.cpp index a1dfb80..6de2efe 100644 --- a/src/Key.cpp +++ b/src/Key.cpp @@ -21,6 +21,9 @@ #include "ObjectGrid.hpp" #include "Ship.hpp" +#include +#include + Key::Key(bool active, int xpos, int ypos, ArrowColour acol) : StaticObject(xpos, ypos, 1, 1), active(active), diff --git a/src/LandingPad.cpp b/src/LandingPad.cpp index 1e7e05c..797d2c4 100644 --- a/src/LandingPad.cpp +++ b/src/LandingPad.cpp @@ -21,6 +21,8 @@ #include "Texture.hpp" #include "Viewport.hpp" +#include + LandingPad::LandingPad(Viewport* v, int index, int length) : index(index), length(length), viewport(v), landTexture_(LoadTexture("images/landingpad.png")), diff --git a/src/LandingPad.hpp b/src/LandingPad.hpp index 038224a..c04aecb 100644 --- a/src/LandingPad.hpp +++ b/src/LandingPad.hpp @@ -21,11 +21,11 @@ #include "GameObjFwd.hpp" #include "GraphicsFwd.hpp" - #include "OpenGL.hpp" -class LandingPad -{ +#include + +class LandingPad { public: LandingPad(Viewport* v, int index, int length); diff --git a/src/Main.cpp b/src/Main.cpp index 8a926e6..05f669b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -25,6 +25,8 @@ #include "ConfigFile.hpp" #include "SoundEffect.hpp" +#include + #ifdef MACOSX namespace CF { #include "CoreFoundation/CoreFoundation.h" diff --git a/src/Menu.cpp b/src/Menu.cpp index dcfc23d..f1b358f 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -24,6 +24,8 @@ #include "HighScores.hpp" #include "InterfaceSounds.hpp" +#include + const double MenuStar::ROTATE_SPEED(0.005); const double MenuStar::ENLARGE_RATE(0.001); const double MenuStar::INIT_SCALE(0.01); diff --git a/src/Mine.cpp b/src/Mine.cpp index b7294c5..81d9f22 100644 --- a/src/Mine.cpp +++ b/src/Mine.cpp @@ -20,6 +20,8 @@ #include "OpenGL.hpp" #include "Ship.hpp" +#include + Mine::Mine(ObjectGrid* o, Viewport* v, int x, int y) : objgrid(o), viewport(v), image("images/mine.png", 64, 64, MINE_FRAME_COUNT) diff --git a/src/Missile.cpp b/src/Missile.cpp index 26b8524..d9a7e24 100644 --- a/src/Missile.cpp +++ b/src/Missile.cpp @@ -23,6 +23,7 @@ #include "Ship.hpp" #include +#include SoundEffect* Missile::fireSound(NULL); diff --git a/src/ObjectGrid.cpp b/src/ObjectGrid.cpp index 36b59f5..14f67b0 100644 --- a/src/ObjectGrid.cpp +++ b/src/ObjectGrid.cpp @@ -17,6 +17,8 @@ #include "ObjectGrid.hpp" +#include + ObjectGrid::ObjectGrid() : grid(NULL), width(0), height(0) diff --git a/src/OpenGL.cpp b/src/OpenGL.cpp index 1caafff..2c91696 100644 --- a/src/OpenGL.cpp +++ b/src/OpenGL.cpp @@ -21,7 +21,10 @@ #include "Input.hpp" #include "ScreenManager.hpp" -#include +#include +#include +#include +#include #include diff --git a/src/Options.cpp b/src/Options.cpp index 8966f08..3865e33 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -23,6 +23,8 @@ #include "SoundEffect.hpp" #include "InterfaceSounds.hpp" +#include + const double Options::FADE_SPEED = 0.1; Options::Options() diff --git a/src/Platform.hpp b/src/Platform.hpp index f9835ab..6c9245a 100644 --- a/src/Platform.hpp +++ b/src/Platform.hpp @@ -20,18 +20,6 @@ #ifndef INC_PLATFORM_HPP #define INC_PLATFORM_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #ifdef HAVE_CONFIG_H #include "config.h" #else @@ -102,6 +90,9 @@ #include #include +// Probably using GCC +#include + #endif /* #ifdef WIN32 */ // Mac OS X specifics */ diff --git a/src/ScreenManager.cpp b/src/ScreenManager.cpp index 369467c..545bcf2 100644 --- a/src/ScreenManager.cpp +++ b/src/ScreenManager.cpp @@ -20,6 +20,9 @@ #include "ScreenManager.hpp" #include "OpenGL.hpp" +#include +#include +#include ScreenManager::ScreenManager() { diff --git a/src/ScreenManager.hpp b/src/ScreenManager.hpp index 075f536..898bc40 100644 --- a/src/ScreenManager.hpp +++ b/src/ScreenManager.hpp @@ -22,6 +22,8 @@ #include "Platform.hpp" +#include + // // A screen within the game that can be displayed. // diff --git a/src/Ship.cpp b/src/Ship.cpp index e15175a..301af9e 100644 --- a/src/Ship.cpp +++ b/src/Ship.cpp @@ -18,6 +18,9 @@ #include "Ship.hpp" #include "OpenGL.hpp" +#include +#include + // // Defines a simplified polygon representing the ship. // diff --git a/src/SoundEffect.cpp b/src/SoundEffect.cpp index 772a87e..df53e66 100644 --- a/src/SoundEffect.cpp +++ b/src/SoundEffect.cpp @@ -18,6 +18,10 @@ #include "SoundEffect.hpp" #include "ConfigFile.hpp" +#include +#include +#include + int SoundEffect::loadCount(0); int SoundEffect::audioRate(44100); int SoundEffect::audioChannels(2); @@ -62,7 +66,6 @@ SoundEffect::~SoundEffect() if (enabled) Mix_FreeChunk(sound); - if (--loadCount == 0) Mix_CloseAudio(); } diff --git a/src/Surface.cpp b/src/Surface.cpp index 1f8c1ff..744d475 100644 --- a/src/Surface.cpp +++ b/src/Surface.cpp @@ -18,6 +18,8 @@ #include "Surface.hpp" #include "Ship.hpp" +#include + const int Surface::VARIANCE(65); // Bumpyness of landscape const int Surface::MAX_SURFACE_HEIGHT(300); const int Surface::MIN_SURFACE_HEIGHT(10); diff --git a/src/Texture.cpp b/src/Texture.cpp index 5e025b5..0f4e60a 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -19,6 +19,10 @@ #include "OpenGL.hpp" #include +#include +#include +#include +#include #include -- 2.39.2