From 4c0654e1489402a71926acc1cedfedf375b77a49 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Fri, 13 Dec 2013 02:49:26 +0000 Subject: [PATCH] [Remove] My god! I was so stupid two years ago. Kill a shed load of unneeded namespaces. --- Bin/LibD.pro | 33 ----------------------------- src/Animation/AnimationSequence.cpp | 6 +----- src/Animation/AnimationSequence.h | 2 -- src/BattleSys/Slot.cpp | 2 -- src/Font/Font.cpp | 12 +++++------ src/IO/Input.cpp | 2 -- src/Level/Level.cpp | 2 -- src/Level/Warp.h | 2 -- src/Main/Game.cpp | 2 -- src/Main/main.cpp | 2 -- src/Sound/Music.cpp | 2 +- src/Sound/Music.h | 6 +++--- src/Sound/SoundEffect.cpp | 2 +- src/Sound/SoundEffect.h | 6 +++--- src/System/Convert/ConvertType.h | 6 ------ src/System/Convert/str2int.h | 5 ----- src/System/Debug.cpp | 6 ------ src/System/Debug.h | 10 ++------- src/System/ResourceManager.h | 6 ------ src/System/String.cpp | 8 +------ src/System/String.h | 6 ------ src/Texture/Texture.cpp | 4 +--- src/Texture/Texture.h | 6 +++--- src/UI/Button.h | 2 -- 24 files changed, 21 insertions(+), 119 deletions(-) diff --git a/Bin/LibD.pro b/Bin/LibD.pro index c4b8ccc..93a97a3 100644 --- a/Bin/LibD.pro +++ b/Bin/LibD.pro @@ -42,25 +42,7 @@ HEADERS += ../src/Actor/Player.h \ ../src/System/Debug.h \ ../src/System/ResourceManager.h \ ../src/System/Convert/str2int.h \ - ../src/System/Filesystem/SCpak.h \ - ../src/System/Filesystem/RlePackedFileWrapper.h \ - ../src/System/Filesystem/IOapi.h \ - ../src/System/Filesystem/FileTimestampChecker.h \ ../src/System/Convert/ConvertType.h \ - ../src/System/Filesystem/OutputCompressedFileStream.h \ - ../src/System/Filesystem/InputCompressedFileStream.h \ - ../src/System/Filesystem/ZipPackage.h \ - ../src/System/Filesystem/InputStream.h \ - ../src/System/Filesystem/OutputStream.h \ - ../src/System/Filesystem/EmptyBuffer.h \ - ../src/System/Filesystem/IFileList.h \ - ../src/System/Filesystem/IFilePackage.h \ - ../src/System/Filesystem/FileList.h \ - ../src/System/Filesystem/InputFileStream.h \ - ../src/System/Filesystem/FilePackageManager.h \ - ../src/System/Filesystem/InputStreamWrapper.h \ - ../src/System/Filesystem/MemoryStream.h \ - ../src/System/Filesystem/Checksum.h \ ../src/Texture/Texture.h \ ../src/Sound/Music.h \ ../src/TMXParser/base64.h \ @@ -112,21 +94,6 @@ SOURCES += ../src/Actor/Player.cpp \ ../src/Sprite/Sprite.cpp \ ../src/System/Debug.cpp \ ../src/System/Convert/str2int.cpp \ - ../src/System/Filesystem/SCpak.cpp \ - ../src/System/Filesystem/RlePackedFileWrapper.cpp \ - ../src/System/Filesystem/FileTimestampChecker.cpp \ - ../src/System/Filesystem/OutputCompressedFileStream.cpp \ - ../src/System/Filesystem/InputCompressedFileStream.cpp \ - ../src/System/Filesystem/ZipPackage.cpp \ - ../src/System/Filesystem/InputStream.cpp \ - ../src/System/Filesystem/OutputStream.cpp \ - ../src/System/Filesystem/FileList.cpp \ - ../src/System/Filesystem/InputFileStream.cpp \ - ../src/System/Filesystem/FilePackageManager.cpp \ - ../src/System/Filesystem/InputStreamWrapper.cpp \ - ../src/System/Filesystem/MemoryStream.cpp \ - ../src/System/Filesystem/SCCopyFile.cpp \ - ../src/System/Filesystem/Checksum.cpp \ ../src/Texture/Texture.cpp \ ../src/Sound/Music.cpp \ ../src/Actor/NPC.cpp \ diff --git a/src/Animation/AnimationSequence.cpp b/src/Animation/AnimationSequence.cpp index 3a6ec61..ebb64f8 100644 --- a/src/Animation/AnimationSequence.cpp +++ b/src/Animation/AnimationSequence.cpp @@ -2,12 +2,8 @@ #include #include "../System/Debug.h" -#include "../System/Filesystem/InputStreamWrapper.h" #include "AnimationSequence.h" -using saracraft::util::Debug; -using namespace saracraft::filesystem; - /* * Load and read a sequence file for an animating sprite then * stores the result so you can call the sprites animation at any time. @@ -47,7 +43,7 @@ void AnimationSequence::ReadFile(void) { fseek(file, 0, SEEK_END); int fileSize = ftell(file); rewind(file); - + String name; char* temp = new char[fileSize + 1]; temp[fileSize] = 0; diff --git a/src/Animation/AnimationSequence.h b/src/Animation/AnimationSequence.h index e7b004b..786eb5f 100644 --- a/src/Animation/AnimationSequence.h +++ b/src/Animation/AnimationSequence.h @@ -9,8 +9,6 @@ #define ENDOFLINE 59 #define SPACE 32 -using saracraft::util::String; - struct Animation { String _animationID; int frameBegin; diff --git a/src/BattleSys/Slot.cpp b/src/BattleSys/Slot.cpp index ab0f999..567270f 100644 --- a/src/BattleSys/Slot.cpp +++ b/src/BattleSys/Slot.cpp @@ -1,7 +1,5 @@ #include "Slot.h" -using saracraft::util::Debug; - Slot::Slot(void) { _triggered = false; _selected = false; diff --git a/src/Font/Font.cpp b/src/Font/Font.cpp index 4907e89..5604464 100644 --- a/src/Font/Font.cpp +++ b/src/Font/Font.cpp @@ -3,8 +3,6 @@ #include "../System/Debug.h" #include "Font.h" -using saracraft::util::Debug; - Font::Font(void) { _texture = 0; _spaceWidth = 0; @@ -105,13 +103,13 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) { glBegin(GL_QUADS); const int textLength = strlen(text); - + int x = 0; int y = 0; for(int i = 0; i < textLength; i++) { char c = text[i]; - + if(c == ' ') { x += _spaceWidth; continue; @@ -132,14 +130,14 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) { glVertex2i( charInfo.xOffset + x + xOffset, charInfo.yOffset + y + yOffset); - + glTexCoord2f( charInfo.uvX + charInfo.uvW, charInfo.uvY); glVertex2i( charInfo.xOffset + x + charInfo.width + xOffset, charInfo.yOffset + y + yOffset); - + glTexCoord2f( charInfo.uvX + charInfo.uvW, charInfo.uvY + charInfo.uvH); @@ -165,7 +163,7 @@ void Font::RenderText(int xOffset, int yOffset, const char* text) { void Font::TextSize(const char* text, int& width, int& height) { width = 0; height = _lineSkip; - + int textLength = strlen(text); for(int i = 0; i < textLength; i++) { char c = text[i]; diff --git a/src/IO/Input.cpp b/src/IO/Input.cpp index 35651ad..a983ef2 100644 --- a/src/IO/Input.cpp +++ b/src/IO/Input.cpp @@ -1,8 +1,6 @@ #include #include "Input.h" -using saracraft::util::Debug; - static mouse_t mouse; static keyboard_t keyboard; diff --git a/src/Level/Level.cpp b/src/Level/Level.cpp index 6ccbe4a..73bf1a9 100644 --- a/src/Level/Level.cpp +++ b/src/Level/Level.cpp @@ -20,8 +20,6 @@ #endif #endif -using saracraft::util::Debug; - Level::Level(Game* game) { _game = game; _width = 0; diff --git a/src/Level/Warp.h b/src/Level/Warp.h index 34f276d..ed78330 100644 --- a/src/Level/Warp.h +++ b/src/Level/Warp.h @@ -3,8 +3,6 @@ #include "../System/String.h" #include "../Math/Vec2.h" -using saracraft::util::String; - class Warp { public: Warp(void); diff --git a/src/Main/Game.cpp b/src/Main/Game.cpp index 2909a0b..f60d836 100644 --- a/src/Main/Game.cpp +++ b/src/Main/Game.cpp @@ -21,8 +21,6 @@ #include "Game.h" #include "TitleScreen.h" -using saracraft::util::Debug; - Game::Game(void) { _level = new Level(this); _player = new Player(_level); diff --git a/src/Main/main.cpp b/src/Main/main.cpp index 34d948b..7490514 100644 --- a/src/Main/main.cpp +++ b/src/Main/main.cpp @@ -20,8 +20,6 @@ #include "../Global/Constants.h" #include "../System/Debug.h" -using saracraft::util::Debug; - void Destroy(void) { TTF_Quit(); Mix_CloseAudio(); diff --git a/src/Sound/Music.cpp b/src/Sound/Music.cpp index d072630..9dd2799 100644 --- a/src/Sound/Music.cpp +++ b/src/Sound/Music.cpp @@ -2,7 +2,7 @@ #include "Music.h" -saracraft::util::ResourceManager musicManager; +ResourceManager musicManager; Music::Music() : Resource() { _music = NULL; diff --git a/src/Sound/Music.h b/src/Sound/Music.h index fe22160..5df09e5 100644 --- a/src/Sound/Music.h +++ b/src/Sound/Music.h @@ -4,8 +4,8 @@ struct _Mix_Music; -class Music : public saracraft::util::Resource { - template friend class saracraft::util::ResourceManager; +class Music : public Resource { + template friend class ResourceManager; public: Music(); @@ -21,4 +21,4 @@ private: struct _Mix_Music* _music; }; -extern saracraft::util::ResourceManager musicManager; +extern ResourceManager musicManager; diff --git a/src/Sound/SoundEffect.cpp b/src/Sound/SoundEffect.cpp index 6d77f5c..e72897b 100644 --- a/src/Sound/SoundEffect.cpp +++ b/src/Sound/SoundEffect.cpp @@ -2,7 +2,7 @@ #include "SoundEffect.h" -saracraft::util::ResourceManager sfxManager; +ResourceManager sfxManager; SoundEffect::SoundEffect() { _chunk = NULL; diff --git a/src/Sound/SoundEffect.h b/src/Sound/SoundEffect.h index b37ebbc..c77b8ef 100644 --- a/src/Sound/SoundEffect.h +++ b/src/Sound/SoundEffect.h @@ -4,8 +4,8 @@ struct Mix_Chunk; -class SoundEffect : public saracraft::util::Resource { - template friend class saracraft::util::ResourceManager; +class SoundEffect : public Resource { + template friend class ResourceManager; public: SoundEffect(); @@ -22,4 +22,4 @@ private: Mix_Chunk* _chunk; }; -extern saracraft::util::ResourceManager sfxManager; +extern ResourceManager sfxManager; diff --git a/src/System/Convert/ConvertType.h b/src/System/Convert/ConvertType.h index 1d4c4f6..9d7dead 100644 --- a/src/System/Convert/ConvertType.h +++ b/src/System/Convert/ConvertType.h @@ -5,9 +5,6 @@ #include #endif -namespace saracraft { -namespace util { - template struct ConvertBase { enum { charCount = sizeof(T) }; @@ -49,6 +46,3 @@ struct ConvertTo: private ConvertBase { }; typedef unsigned short uint16_t; - -} // Namespace util. -} // Namespace saracraft. diff --git a/src/System/Convert/str2int.h b/src/System/Convert/str2int.h index c763287..1f6cece 100644 --- a/src/System/Convert/str2int.h +++ b/src/System/Convert/str2int.h @@ -1,12 +1,7 @@ #pragma once -namespace saracraft { -namespace util { - extern char* int2str(int value); extern int str2int(const char* string); extern int str2int_errno(void); extern char* time2str(int secs); // hh:mm::ss. -} // Namespace util. -} // Namespace saracraft. diff --git a/src/System/Debug.cpp b/src/System/Debug.cpp index 7f83f2b..d743bbc 100644 --- a/src/System/Debug.cpp +++ b/src/System/Debug.cpp @@ -8,9 +8,6 @@ using namespace std; -namespace saracraft { -namespace util { - // =================================================================== // The Debug log allows us to display ever piece of data that // populates our class components, anything that is loaded, serialized, @@ -103,6 +100,3 @@ void Debug::closeLog(void) { delete logger; logger = NULL; } - -} // End of namespace util. -} // End of namespace saracraft. diff --git a/src/System/Debug.h b/src/System/Debug.h index 5699784..12d0e26 100644 --- a/src/System/Debug.h +++ b/src/System/Debug.h @@ -3,9 +3,6 @@ #include #include "string" -namespace saracraft { -namespace util { - class Debug { public: Debug(bool logToFile); @@ -16,14 +13,11 @@ public: void message(const char *msg, ...); static bool openLog(bool logToFile); static void closeLog(void); - + static Debug *logger; -private: +private: std::ofstream _logFile; }; -} // Namespace util. -} // Namespace saracraft. - #endif // _DEBUG_H_ diff --git a/src/System/ResourceManager.h b/src/System/ResourceManager.h index 8104643..a5b706e 100644 --- a/src/System/ResourceManager.h +++ b/src/System/ResourceManager.h @@ -5,9 +5,6 @@ #include "../System/String.h" -namespace saracraft { -namespace util { - class Resource { public: virtual bool Load(const std::string& filename) = 0; @@ -99,6 +96,3 @@ public: private: ResourceMap m_resources; }; - -} // Namespace util. -} // Namespace saracraft. diff --git a/src/System/String.cpp b/src/System/String.cpp index 50978c0..b2d4620 100644 --- a/src/System/String.cpp +++ b/src/System/String.cpp @@ -5,9 +5,6 @@ #include "String.h" #define _CRT_SECURE_NO_WARNINGS -namespace saracraft { -namespace util { - String::String(void) { _string = new char[1]; _string[0] = 0; @@ -62,7 +59,7 @@ void String::Format(const char* format, ...) { _length = 4095; _string = new char[_length + 1]; memset(_string, 0, _length + 1); - + va_list vlist; va_start(vlist, format); @@ -153,6 +150,3 @@ String String::operator+(const String& value) const { String::operator const char*() const { return _string; } - -} // End of namespace util. -} // End of namespace saracraft. diff --git a/src/System/String.h b/src/System/String.h index 869548e..2465e0b 100644 --- a/src/System/String.h +++ b/src/System/String.h @@ -1,9 +1,6 @@ #pragma once #define _CRT_SECURE_NO_WARNINGS -namespace saracraft { -namespace util { - class String { public: String(void); @@ -37,6 +34,3 @@ private: char* _string; int _length; }; - -} // Namespace util. -} // Namespace saracraft. diff --git a/src/Texture/Texture.cpp b/src/Texture/Texture.cpp index 502fcfc..1a669e1 100644 --- a/src/Texture/Texture.cpp +++ b/src/Texture/Texture.cpp @@ -11,9 +11,7 @@ using namespace std; #define GL_BGRA_EXT 0x80E1 #endif -using saracraft::util::Debug; - -saracraft::util::ResourceManager textureManager; +ResourceManager textureManager; static GLuint boundTexture = 0; diff --git a/src/Texture/Texture.h b/src/Texture/Texture.h index f780969..9b22a6b 100644 --- a/src/Texture/Texture.h +++ b/src/Texture/Texture.h @@ -27,8 +27,8 @@ void BindTexture(GLuint texID); #include "../System/ResourceManager.h" -class Texture : public saracraft::util::Resource { - template friend class saracraft::util::ResourceManager; +class Texture : public Resource { + template friend class ResourceManager; public: Texture(); @@ -46,4 +46,4 @@ private: int height; }; -extern saracraft::util::ResourceManager textureManager; +extern ResourceManager textureManager; diff --git a/src/UI/Button.h b/src/UI/Button.h index 82f8ce7..fbf3152 100644 --- a/src/UI/Button.h +++ b/src/UI/Button.h @@ -4,8 +4,6 @@ #include "../System/String.h" #include "../Font/Font.h" -using saracraft::util::String; - class Button { public: Button(void);