From 7c579d3ef0a6667c18b53dad84c63c05d2760a84 Mon Sep 17 00:00:00 2001 From: Tim Goya Date: Fri, 2 Mar 2007 14:13:41 +0000 Subject: [PATCH] minimize some #includes and replace with forward decls SVN-Revision: 4903 --- src/Jamfile | 1 + src/addon_manager.cpp | 2 +- src/collision.cpp | 6 +++--- src/collision.hpp | 2 +- src/collision_hit.hpp | 4 ++-- src/flip_level_transformer.cpp | 2 ++ src/flip_level_transformer.hpp | 5 ++--- src/game_object.hpp | 1 - src/game_session.hpp | 4 +--- src/log.hpp | 2 +- src/main.cpp | 7 +++---- src/mainloop.cpp | 2 +- src/object/path.cpp | 1 + src/object_factory.cpp | 1 + src/object_factory.hpp | 6 +++--- src/player_status.cpp | 2 +- src/player_status.hpp | 10 ++++------ src/random_generator.cpp | 3 +-- src/random_generator.hpp | 2 -- src/refcounter.hpp | 2 +- src/sector.cpp | 4 ++-- src/sector.hpp | 7 +++---- src/serializable.hpp | 2 +- src/spawn_point.hpp | 2 +- src/squirrel/Jamfile | 4 ++-- src/statistics.cpp | 5 +++-- src/statistics.hpp | 9 +++++---- src/textscroller.hpp | 3 ++- src/tile.hpp | 3 ++- src/tile_manager.cpp | 2 +- src/tile_manager.hpp | 2 +- src/timer.cpp | 2 +- src/title.cpp | 8 ++++---- src/world.cpp | 2 +- src/worldmap/tux.cpp | 1 + src/worldmap/worldmap.cpp | 1 + 36 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/Jamfile b/src/Jamfile index 637125168..ec404cfdc 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -31,4 +31,5 @@ LinkWith supertux : squirrel ; ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC LIBCURL ; Help supertux : "Build the supertux executable" ; IncludeDir supertux : squirrel/include squirrel ; +Package [ Wildcard scripting : *.cpp *.hpp ] ; diff --git a/src/addon_manager.cpp b/src/addon_manager.cpp index 145998331..a7f19c5c5 100644 --- a/src/addon_manager.cpp +++ b/src/addon_manager.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include "addon_manager.hpp" #include "config.h" #include "log.hpp" diff --git a/src/collision.cpp b/src/collision.cpp index f96fdea53..6e9894061 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -23,9 +23,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "math/vector.hpp" #include "math/aatriangle.hpp" #include "math/rect.hpp" diff --git a/src/collision.hpp b/src/collision.hpp index ba6b6f8d9..fd90a9a34 100644 --- a/src/collision.hpp +++ b/src/collision.hpp @@ -20,7 +20,7 @@ #ifndef __COLLISION_H__ #define __COLLISION_H__ -#include +#include #include "collision_hit.hpp" #include diff --git a/src/collision_hit.hpp b/src/collision_hit.hpp index 02879039a..72531f1fe 100644 --- a/src/collision_hit.hpp +++ b/src/collision_hit.hpp @@ -19,8 +19,8 @@ #ifndef SUPERTUX_COLLISION_HIT_H #define SUPERTUX_COLLISION_HIT_H -#include -#include +#include +#include #include "math/vector.hpp" /** diff --git a/src/flip_level_transformer.cpp b/src/flip_level_transformer.cpp index 00d10046c..83b8c4dfe 100644 --- a/src/flip_level_transformer.cpp +++ b/src/flip_level_transformer.cpp @@ -26,6 +26,8 @@ #include "sector.hpp" #include "tile_manager.hpp" #include "spawn_point.hpp" +#include "object/platform.hpp" +#include "object/block.hpp" void FlipLevelTransformer::transform_sector(Sector* sector) diff --git a/src/flip_level_transformer.hpp b/src/flip_level_transformer.hpp index 12459c4e9..832fe08ab 100644 --- a/src/flip_level_transformer.hpp +++ b/src/flip_level_transformer.hpp @@ -21,14 +21,13 @@ #define __FLIP_LEVEL_TRANSFORMER_H__ #include "level_transformer.hpp" -#include "object/platform.hpp" -#include "object/path.hpp" -#include "object/block.hpp" class TileMap; class BadGuy; class SpawnPoint; class MovingObject; +class Platform; +class Block; /** Vertically or horizontally flip a level */ class FlipLevelTransformer : public LevelTransformer diff --git a/src/game_object.hpp b/src/game_object.hpp index 22aa3a6ad..5acc83338 100644 --- a/src/game_object.hpp +++ b/src/game_object.hpp @@ -21,7 +21,6 @@ #include #include "refcounter.hpp" -#include "lisp/lisp.hpp" class DrawingContext; class ObjectRemoveListener; diff --git a/src/game_session.hpp b/src/game_session.hpp index 4143286c3..ae2a80ae2 100644 --- a/src/game_session.hpp +++ b/src/game_session.hpp @@ -21,11 +21,9 @@ #include #include +#include #include "screen.hpp" -#include "timer.hpp" -#include "statistics.hpp" #include "math/vector.hpp" -#include "console.hpp" #include "video/surface.hpp" #include "object/endsequence.hpp" diff --git a/src/log.hpp b/src/log.hpp index 9cd5a6255..89dbec418 100644 --- a/src/log.hpp +++ b/src/log.hpp @@ -21,7 +21,7 @@ #define __SUPERTUX_MSG_H__ #include -#include +#include #include "console.hpp" diff --git a/src/main.cpp b/src/main.cpp index d1d58602f..5c2787488 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,19 +18,18 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #include -#include +#include #include "log.hpp" #include "main.hpp" #include #include -#include -#include +#include +#include #include #include #include -#include #include #include #include diff --git a/src/mainloop.cpp b/src/mainloop.cpp index 07d853619..5e2f3f76a 100644 --- a/src/mainloop.cpp +++ b/src/mainloop.cpp @@ -20,7 +20,7 @@ #include "mainloop.hpp" -#include +#include #include #include "video/drawing_context.hpp" #include "control/joystickkeyboardcontroller.hpp" diff --git a/src/object/path.cpp b/src/object/path.cpp index 6529cf338..b7a34af8e 100644 --- a/src/object/path.cpp +++ b/src/object/path.cpp @@ -23,6 +23,7 @@ #include "path.hpp" +#include "lisp/writer.hpp" #include "lisp/lisp.hpp" #include "lisp/list_iterator.hpp" #include "object_factory.hpp" diff --git a/src/object_factory.cpp b/src/object_factory.cpp index 4e40fd68b..533514059 100644 --- a/src/object_factory.cpp +++ b/src/object_factory.cpp @@ -25,6 +25,7 @@ #include "lisp/lisp.hpp" #include "lisp/parser.hpp" #include "object_factory.hpp" +#include "math/vector.hpp" Factories* object_factories = 0; diff --git a/src/object_factory.hpp b/src/object_factory.hpp index 7e06739c6..a6e431051 100644 --- a/src/object_factory.hpp +++ b/src/object_factory.hpp @@ -23,9 +23,9 @@ #include #include -#include "lisp/lisp.hpp" -#include "game_object.hpp" -#include "math/vector.hpp" +namespace lisp { class Lisp; } +class Vector; +class GameObject; class Factory { diff --git a/src/player_status.cpp b/src/player_status.cpp index 352fac3d5..41f5d75ae 100644 --- a/src/player_status.cpp +++ b/src/player_status.cpp @@ -19,7 +19,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#include +#include #include "lisp/writer.hpp" #include "lisp/lisp.hpp" #include "player_status.hpp" diff --git a/src/player_status.hpp b/src/player_status.hpp index e23177424..85ac0590b 100644 --- a/src/player_status.hpp +++ b/src/player_status.hpp @@ -20,14 +20,12 @@ #ifndef SUPERTUX_PLAYERSTATUS_H #define SUPERTUX_PLAYERSTATUS_H -#include #include -#include "lisp/lisp.hpp" -#include "timer.hpp" #include "serializable.hpp" -#include "sprite/sprite.hpp" -#include "console.hpp" -#include "video/surface.hpp" + +namespace lisp{ class Writer; } +namespace lisp{ class Lisp; } +class Surface; static const float BORDER_X = 10; static const float BORDER_Y = 10; diff --git a/src/random_generator.cpp b/src/random_generator.cpp index e48b45719..1cfeecf29 100644 --- a/src/random_generator.cpp +++ b/src/random_generator.cpp @@ -37,9 +37,8 @@ #include -#include +#include #include "random_generator.hpp" -#include "scripting/squirrel_util.hpp" RandomGenerator systemRandom; // global random number generator diff --git a/src/random_generator.hpp b/src/random_generator.hpp index 480a53ed0..5e5b3c651 100644 --- a/src/random_generator.hpp +++ b/src/random_generator.hpp @@ -34,8 +34,6 @@ #ifndef __RANDOM_GENERATOR__ #define __RANDOM_GENERATOR__ -#include "script_interface.hpp" - class RandomGenerator { private: diff --git a/src/refcounter.hpp b/src/refcounter.hpp index e810efe10..6b8735a2e 100644 --- a/src/refcounter.hpp +++ b/src/refcounter.hpp @@ -19,7 +19,7 @@ #ifndef __REFCOUNTER_HPP__ #define __REFCOUNTER_HPP__ -#include +#include /** * A base class that provides reference counting facilities diff --git a/src/sector.cpp b/src/sector.cpp index 125d18648..904e1b2b4 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/sector.hpp b/src/sector.hpp index 777ce937f..1fc487ea0 100644 --- a/src/sector.hpp +++ b/src/sector.hpp @@ -19,16 +19,13 @@ #ifndef SUPERTUX_SECTOR_H #define SUPERTUX_SECTOR_H -#include #include #include #include #include #include "direction.hpp" -#include "math/vector.hpp" -#include "video/drawing_context.hpp" -#include "script_interface.hpp" +#include "video/color.hpp" #include "scripting/ssector.hpp" namespace lisp { @@ -39,6 +36,7 @@ namespace collision { class Constraints; } +class Vector; class Rect; class Sprite; class GameObject; @@ -52,6 +50,7 @@ class MovingObject; class CollisionHit; class Level; class Portable; +class DrawingContext; enum MusicType { LEVEL_MUSIC, diff --git a/src/serializable.hpp b/src/serializable.hpp index ce4d3b73f..74adedc26 100644 --- a/src/serializable.hpp +++ b/src/serializable.hpp @@ -19,7 +19,7 @@ #ifndef SUPERTUX_SERIALIZABLE_H #define SUPERTUX_SERIALIZABLE_H -#include "lisp/writer.hpp" +namespace lisp { class Writer; } class Serializable { diff --git a/src/spawn_point.hpp b/src/spawn_point.hpp index 17d4908fc..23bafa837 100644 --- a/src/spawn_point.hpp +++ b/src/spawn_point.hpp @@ -21,7 +21,7 @@ #include #include "math/vector.hpp" -#include "lisp/lisp.hpp" +namespace lisp { class Lisp; } class SpawnPoint { diff --git a/src/squirrel/Jamfile b/src/squirrel/Jamfile index 813349c63..c89d20fb1 100644 --- a/src/squirrel/Jamfile +++ b/src/squirrel/Jamfile @@ -8,8 +8,7 @@ if $(enable_sqdbg) = "yes" { } Library squirrel - : [ Wildcard include : *.h ] - [ Wildcard squirrel : *.cpp *.h ] + : [ Wildcard squirrel : *.cpp *.h ] [ Wildcard sqstdlib : *.cpp *.c *.h ] $(EXTRA_SOURCES) : noinstall @@ -20,3 +19,4 @@ for i in $(squirrel_OBJECTS) { CFLAGS on $(i) = [ Filter [ on $(i) GetVar CFLAGS ] : -Wall -W -Werror ] -include $(top_builddir)/config.h ; } IncludeDir squirrel : include ; +Package [ Wildcard include : *.h ] ; diff --git a/src/statistics.cpp b/src/statistics.cpp index c21ec3d0c..8c0b1f809 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -20,12 +20,13 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#include -#include +#include +#include #include #include #include "video/drawing_context.hpp" #include "gettext.hpp" +#include "lisp/writer.hpp" #include "lisp/lisp.hpp" #include "resources.hpp" #include "main.hpp" diff --git a/src/statistics.hpp b/src/statistics.hpp index a7b194f94..d282e0e23 100644 --- a/src/statistics.hpp +++ b/src/statistics.hpp @@ -23,10 +23,11 @@ #define SUPERTUX_STATISTICS_H #include "timer.hpp" -#include "lisp/lisp.hpp" -#include "lisp/writer.hpp" -#include "video/surface.hpp" -#include "video/drawing_context.hpp" + +namespace lisp { class Writer; } +namespace lisp { class Lisp; } +class Surface; +class DrawingContext; /** This class is a layer between level and worldmap to keep * track of stuff like scores, and minor, but funny things, like diff --git a/src/textscroller.hpp b/src/textscroller.hpp index ad7f39790..5198eb922 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -26,10 +26,11 @@ #include #include "screen.hpp" -#include "video/font.hpp" +#include "math/vector.hpp" class DrawingContext; class Surface; +class Font; /** * Helper class for InfoBox: Represents a line of text diff --git a/src/tile.hpp b/src/tile.hpp index 7351a328f..f0668d56d 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -26,7 +26,8 @@ #include #include "video/surface.hpp" #include "math/rect.hpp" -#include "lisp/lisp.hpp" + +namespace lisp { class Lisp; } class DrawingContext; diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index df1f90d7a..cba2a81bd 100644 --- a/src/tile_manager.cpp +++ b/src/tile_manager.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "video/drawing_context.hpp" #include "log.hpp" diff --git a/src/tile_manager.hpp b/src/tile_manager.hpp index 64906cf09..aaf8a8139 100644 --- a/src/tile_manager.hpp +++ b/src/tile_manager.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "log.hpp" #include "tile.hpp" diff --git a/src/timer.cpp b/src/timer.cpp index 9c94f581c..6e9d3d035 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -19,7 +19,7 @@ // 02111-1307, USA. #include -#include +#include #include "timer.hpp" float game_time = 0; diff --git a/src/title.cpp b/src/title.cpp index 56b1e4517..6f006a285 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -23,10 +23,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/src/world.cpp b/src/world.cpp index 8fd459934..24d22c83c 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -19,7 +19,7 @@ // 02111-1307, USA. #include -#include +#include #include #include diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index b135933f9..8c4339feb 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -20,6 +20,7 @@ #include #include "tux.hpp" +#include "sprite/sprite.hpp" #include "sprite/sprite_manager.hpp" #include "video/drawing_context.hpp" #include "player_status.hpp" diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 65cb1f074..9441b43f4 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -36,6 +36,7 @@ #include "shrinkfade.hpp" #include "video/surface.hpp" #include "video/drawing_context.hpp" +#include "sprite/sprite.hpp" #include "sprite/sprite_manager.hpp" #include "audio/sound_manager.hpp" #include "lisp/parser.hpp" -- 2.11.0