From 348be4329ce3fd8fc80f3077168f3d472df9ee68 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Mon, 9 Apr 2018 15:05:00 +0200 Subject: [PATCH] no longer using namespace std --- BloodXL/BloodXL_Game.cpp | 12 +- BloodXL/BloodXL_Game.h | 9 +- CommonTypes.h | 2 +- DaggerXL/DaggerXL_Game.cpp | 2 +- DaggerXL/DaggerXL_Game.h | 4 +- DarkXL/CutscenePlayer.cpp | 6 +- DarkXL/DarkXL_Game.cpp | 2 +- DarkXL/DarkXL_Game.h | 4 +- EngineSettings.cpp | 4 +- EngineSettings.h | 5 +- OutlawsXL/OutlawsXL_Game.cpp | 8 +- OutlawsXL/OutlawsXL_Game.h | 8 +- fileformats/ART_Reader.cpp | 6 +- fileformats/ART_Reader.h | 2 +- fileformats/Archive.h | 2 +- fileformats/ArchiveManager.cpp | 12 +- fileformats/ArchiveManager.h | 5 +- fileformats/BSA_Reader.cpp | 6 +- fileformats/BSA_Reader.h | 2 +- fileformats/CellLoader.h | 4 +- fileformats/CellLoader_BloodMap.cpp | 13 +- fileformats/CellLoader_BloodMap.h | 2 +- fileformats/CellLoader_Daggerfall.cpp | 50 ++--- fileformats/CellLoader_Daggerfall.h | 2 +- fileformats/CellLoader_OutlawsMap.cpp | 12 +- fileformats/CellLoader_OutlawsMap.h | 2 +- fileformats/CellManager.cpp | 2 +- fileformats/CellManager.h | 4 +- fileformats/GOB_Reader.cpp | 4 +- fileformats/GOB_Reader.h | 2 +- fileformats/LFD_Anim.cpp | 6 +- fileformats/LFD_Anim.h | 2 +- fileformats/LFD_Reader.cpp | 4 +- fileformats/LFD_Reader.h | 2 +- fileformats/Location_Daggerfall.cpp | 24 +- fileformats/Location_Daggerfall.h | 12 +- fileformats/MeshLoader_Daggerfall.cpp | 11 +- fileformats/MeshLoader_Daggerfall.h | 2 +- fileformats/Parser.cpp | 6 +- fileformats/RFF_Reader.cpp | 4 +- fileformats/RFF_Reader.h | 2 +- fileformats/SkyLoader_Daggerfall.cpp | 8 +- fileformats/SkyLoader_Daggerfall.h | 2 - fileformats/TextureConv_IMG.cpp | 2 +- fileformats/TextureConv_PCX.cpp | 2 +- fileformats/TextureLoader.cpp | 11 +- fileformats/TextureLoader.h | 10 +- linux/main.cpp | 8 +- math/FixedPoint.h | 2 +- math/Math.h | 2 +- math/Plane.cpp | 2 +- math/Vector2.cpp | 2 +- math/Vector2.h | 2 +- math/Vector3.cpp | 2 +- math/Vector3.h | 2 +- math/Vector4.cpp | 2 +- math/Vector4.h | 2 +- memory/ScratchPad.cpp | 6 +- movieplayback/LFD_Film.cpp | 20 +- movieplayback/LFD_Film.h | 7 +- movieplayback/MovieManager.cpp | 10 +- movieplayback/MovieManager.h | 6 +- os/Input.cpp | 20 +- os/Input.h | 5 +- os/Win/Clock_Win.cpp | 4 +- os/linux/Clock_Linux.cpp | 4 +- plugin_framework/DynamicLibrary.cpp | 10 +- plugin_framework/DynamicLibrary.h | 5 +- plugin_framework/PluginManager.cpp | 4 +- plugin_framework/PluginManager.h | 3 +- procedural/Noise.cpp | 2 +- procedural/ProceduralFunc.cpp | 2 +- render/CommandBuffer.cpp | 4 +- render/CommandBuffer.h | 4 +- render/Driver3D_OGL.cpp | 2 +- render/Driver3D_OGL.h | 2 +- render/Driver3D_Soft.cpp | 11 +- render/Driver3D_Soft.h | 10 +- render/Font.cpp | 13 +- render/Font.h | 8 +- render/FontManager.cpp | 15 +- render/FontManager.h | 14 +- render/IDriver3D.cpp | 2 +- render/IDriver3D.h | 2 +- render/ImageLoader.cpp | 4 +- render/ImageLoader.h | 1 - render/IndexBuffer.cpp | 4 +- render/Mesh.cpp | 4 +- render/MeshCache.cpp | 8 +- render/MeshCache.h | 10 +- render/RenderQue.cpp | 10 +- render/RenderQue.h | 7 +- render/TextureCache.cpp | 19 +- render/TextureCache.h | 16 +- render/VertexBuffer.cpp | 4 +- render/linux/Driver3D_OGL_Linux.cpp | 2 +- render/triangleRasterizer/DrawScanline.cpp | 4 +- render/triangleRasterizer/DrawScanline.h | 2 +- .../triangleRasterizer/TriangleRasterizer.cpp | 4 +- .../triangleRasterizer/TriangleRasterizer.h | 2 +- scriptsystem/ScriptSystem.cpp | 8 +- scriptsystem/ScriptSystem.h | 5 +- scriptsystem/scriptarray.cpp | 8 +- scriptsystem/scriptstdstring.cpp | 212 +++++++++--------- ui/Console.cpp | 39 ++-- ui/Console.h | 25 +-- ui/UI_System.cpp | 81 +++---- ui/UI_System.h | 45 ++-- ui/XL_Console.cpp | 20 +- ui/XL_Console.h | 16 +- win/main.h | 2 +- world/LevelFunc.cpp | 13 +- world/LevelFunc.h | 9 +- world/LevelFuncMgr.cpp | 36 +-- world/LevelFuncMgr.h | 15 +- world/LevelFunc_Default.cpp | 2 +- world/Logic.cpp | 2 +- world/Logic.h | 5 +- world/LogicManager.cpp | 12 +- world/LogicManager.h | 8 +- world/MeshCollision.cpp | 4 +- world/Object.cpp | 17 +- world/Object.h | 13 +- world/ObjectManager.cpp | 34 +-- world/ObjectManager.h | 13 +- world/Sector.cpp | 8 +- world/Sector.h | 9 +- world/Sector_2_5D.cpp | 29 +-- world/Sector_2_5D.h | 20 +- world/Sector_GeoBlock.cpp | 16 +- world/Sprite_ZAxis.cpp | 1 + world/Sprite_ZAxis.h | 5 +- world/Terrain.h | 7 +- world/World.cpp | 39 ++-- world/World.h | 6 +- world/WorldCell.cpp | 4 +- world/WorldCell.h | 6 +- 137 files changed, 693 insertions(+), 731 deletions(-) diff --git a/BloodXL/BloodXL_Game.cpp b/BloodXL/BloodXL_Game.cpp index b2fd580..967e059 100644 --- a/BloodXL/BloodXL_Game.cpp +++ b/BloodXL/BloodXL_Game.cpp @@ -145,9 +145,9 @@ void BloodXL_Game::SC_Game_NewGameSettings(int episode, int difficulty) s_pGame_Console->NewGame(episode, difficulty); } -void BloodXL_Game::SC_Game_LoadMap(const string& mapName) +void BloodXL_Game::SC_Game_LoadMap(const std::string& mapName) { - string mapNameFinal = mapName + ".MAP"; + std::string mapNameFinal = mapName + ".MAP"; s_pGame_Console->m_pAPI->World_UnloadAllCells(); s_pGame_Console->m_pAPI->World_LoadCell( CELLTYPE_BLOOD_MAP, ARCHIVETYPE_RFF, "BLOOD.RFF", mapNameFinal.c_str(), 0, 0 ); } @@ -155,12 +155,12 @@ void BloodXL_Game::SC_Game_LoadMap(const string& mapName) /************************ *** Console commands *** ************************/ -void BloodXL_Game::CC_GameVersion(const vector& args, void *pUserData) +void BloodXL_Game::CC_GameVersion(const std::vector& args, void *pUserData) { s_pGame_Console->m_pAPI->PrintToConsole("BloodXL version %d.%03d", s_pGame_Console->m_nVersionMajor, s_pGame_Console->m_nVersionMinor); } -void BloodXL_Game::CC_LoadMap(const vector& args, void *pUserData) +void BloodXL_Game::CC_LoadMap(const std::vector& args, void *pUserData) { BloodXL_Game *pGame = (BloodXL_Game *)pUserData; if ( args.size() < 2 ) @@ -169,13 +169,13 @@ void BloodXL_Game::CC_LoadMap(const vector& args, void *pUserData) } else { - string mapName = args[1] + ".MAP"; + std::string mapName = args[1] + ".MAP"; pGame->m_pAPI->World_UnloadAllCells(); pGame->m_pAPI->World_LoadCell( CELLTYPE_BLOOD_MAP, ARCHIVETYPE_RFF, "BLOOD.RFF", mapName.c_str(), 0, 0 ); } } -void BloodXL_Game::CC_PassThruAdjoins(const vector& args, void *pUserData) +void BloodXL_Game::CC_PassThruAdjoins(const std::vector& args, void *pUserData) { BloodXL_Game *pGame = (BloodXL_Game *)pUserData; diff --git a/BloodXL/BloodXL_Game.h b/BloodXL/BloodXL_Game.h index c9cb617..d2e5c07 100644 --- a/BloodXL/BloodXL_Game.h +++ b/BloodXL/BloodXL_Game.h @@ -4,7 +4,6 @@ #include "../plugin_framework/plugin.h" #include -using namespace std; class BloodXL_Player; class BloodXL_Game @@ -32,13 +31,13 @@ class BloodXL_Game //Script commands static void SC_Game_NewGameSettings(int episode, int difficulty); - static void SC_Game_LoadMap(const string& mapName); + static void SC_Game_LoadMap(const std::string& mapName); //Console commands static BloodXL_Game *s_pGame_Console; - static void CC_GameVersion(const vector& args, void *pUserData); - static void CC_LoadMap(const vector& args, void *pUserData); - static void CC_PassThruAdjoins(const vector& args, void *pUserData); + static void CC_GameVersion(const std::vector& args, void *pUserData); + static void CC_LoadMap(const std::vector& args, void *pUserData); + static void CC_PassThruAdjoins(const std::vector& args, void *pUserData); }; #endif //BLOODXL_GAME_H \ No newline at end of file diff --git a/CommonTypes.h b/CommonTypes.h index d120a5e..7a11125 100644 --- a/CommonTypes.h +++ b/CommonTypes.h @@ -11,7 +11,7 @@ //Enable this to check memory allocations. //This is currently only available on Windows #ifdef _CRTDBG_MAP_ALLOC - #include + #include #include #define xlMalloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__) diff --git a/DaggerXL/DaggerXL_Game.cpp b/DaggerXL/DaggerXL_Game.cpp index 1e03c28..9eb0a4a 100644 --- a/DaggerXL/DaggerXL_Game.cpp +++ b/DaggerXL/DaggerXL_Game.cpp @@ -224,7 +224,7 @@ void DaggerXL_Game::SC_Game_NewGame() /************************ *** Console commands *** ************************/ -void DaggerXL_Game::CC_GameVersion(const vector& args, void *pUserData) +void DaggerXL_Game::CC_GameVersion(const std::vector& args, void *pUserData) { s_pGame_Console->m_pAPI->PrintToConsole("DaggerXL version %d.%03d", s_pGame_Console->m_nVersionMajor, s_pGame_Console->m_nVersionMinor); } diff --git a/DaggerXL/DaggerXL_Game.h b/DaggerXL/DaggerXL_Game.h index 6640451..a35fe9d 100644 --- a/DaggerXL/DaggerXL_Game.h +++ b/DaggerXL/DaggerXL_Game.h @@ -2,10 +2,10 @@ #define DAGGERXL_GAME_H #include "../plugin_framework/plugin.h" + #include #include -using namespace std; class DaggerXL_Player; class Logic_Door; class Logic_Obj_Action; @@ -71,7 +71,7 @@ class DaggerXL_Game //Console commands static DaggerXL_Game *s_pGame_Console; - static void CC_GameVersion(const vector& args, void *pUserData); + static void CC_GameVersion(const std::vector& args, void *pUserData); }; #endif //BLOODXL_GAME_H \ No newline at end of file diff --git a/DarkXL/CutscenePlayer.cpp b/DarkXL/CutscenePlayer.cpp index 4f66932..84b2b0e 100644 --- a/DarkXL/CutscenePlayer.cpp +++ b/DarkXL/CutscenePlayer.cpp @@ -2,9 +2,9 @@ #include "../plugin_framework/plugin.h" #include "../fileformats/ArchiveTypes.h" #include "../movieplayback/MovieTypes.h" -#include -#include -#include +#include +#include +#include bool CutscenePlayer::m_bCutscenePlaying; CutscenePlayer::Cutscene CutscenePlayer::m_CutSceneList[256]; diff --git a/DarkXL/DarkXL_Game.cpp b/DarkXL/DarkXL_Game.cpp index 32ce0e7..71c5200 100644 --- a/DarkXL/DarkXL_Game.cpp +++ b/DarkXL/DarkXL_Game.cpp @@ -75,7 +75,7 @@ void DarkXL_Game::KeyDown(int32_t key) /************************ *** Console commands *** ************************/ -void DarkXL_Game::CC_GameVersion(const vector& args, void *pUserData) +void DarkXL_Game::CC_GameVersion(const std::vector& args, void *pUserData) { s_pGame_Console->m_pAPI->PrintToConsole("DarkXL version %d.%03d", s_pGame_Console->m_nVersionMajor, s_pGame_Console->m_nVersionMinor); } diff --git a/DarkXL/DarkXL_Game.h b/DarkXL/DarkXL_Game.h index 34f4021..3317b56 100644 --- a/DarkXL/DarkXL_Game.h +++ b/DarkXL/DarkXL_Game.h @@ -4,8 +4,6 @@ #include "../plugin_framework/plugin.h" #include -using namespace std; - class DarkXL_Game { public: @@ -28,7 +26,7 @@ class DarkXL_Game //Console commands static DarkXL_Game *s_pGame_Console; - static void CC_GameVersion(const vector& args, void *pUserData); + static void CC_GameVersion(const std::vector& args, void *pUserData); }; #endif //DARKXL_GAME_H \ No newline at end of file diff --git a/EngineSettings.cpp b/EngineSettings.cpp index 3382ba1..10755ac 100644 --- a/EngineSettings.cpp +++ b/EngineSettings.cpp @@ -1,8 +1,8 @@ #include "EngineSettings.h" #include #include -#include -#include +#include +#include #include #if PLATFORM_WIN diff --git a/EngineSettings.h b/EngineSettings.h index 45a7cb1..3acec96 100644 --- a/EngineSettings.h +++ b/EngineSettings.h @@ -6,8 +6,6 @@ #include #include -using namespace std; - class EngineSettings { public: @@ -76,8 +74,7 @@ class EngineSettings //callback methods static const char *GetStartMapCB() { return sSettings.GetStartMap(); } static XL_BOOL IsServerCB() { return sSettings.IsServer(); } - static void GetStartMap_StrOutCB(string& map_name) - { sSettings.GetStartMap_StrOut(map_name); } + static void GetStartMap_StrOutCB(std::string& map_name) { sSettings.GetStartMap_StrOut(map_name); } private: static EngineSettings sSettings; diff --git a/OutlawsXL/OutlawsXL_Game.cpp b/OutlawsXL/OutlawsXL_Game.cpp index 10e59c3..f227d95 100644 --- a/OutlawsXL/OutlawsXL_Game.cpp +++ b/OutlawsXL/OutlawsXL_Game.cpp @@ -79,13 +79,13 @@ void OutlawsXL_Game::SC_Game_NewGameSettings(int episode, int difficulty) /************************ *** Console commands *** ************************/ -void OutlawsXL_Game::CC_GameVersion(const vector& args, void *pUserData) +void OutlawsXL_Game::CC_GameVersion(const std::vector& args, void *pUserData) { OutlawsXL_Game *pGame = (OutlawsXL_Game *)pUserData; pGame->m_pAPI->PrintToConsole("OutlawsXL version %d.%03d", pGame->m_nVersionMajor, pGame->m_nVersionMinor); } -void OutlawsXL_Game::CC_LoadMap(const vector& args, void *pUserData) +void OutlawsXL_Game::CC_LoadMap(const std::vector& args, void *pUserData) { OutlawsXL_Game *pGame = (OutlawsXL_Game *)pUserData; if ( args.size() < 2 ) @@ -94,14 +94,14 @@ void OutlawsXL_Game::CC_LoadMap(const vector& args, void *pUserData) } else { - string mapName = args[1] + ".LVT"; + std::string mapName = args[1] + ".LVT"; pGame->m_pAPI->World_UnloadAllCells(); pGame->m_pAPI->World_LoadCell( CELLTYPE_OUTLAWS_MAP, ARCHIVETYPE_LAB, "OLGEO_1.LAB", mapName.c_str(), 0, 0 ); } } -void OutlawsXL_Game::CC_PassThruAdjoins(const vector& args, void *pUserData) +void OutlawsXL_Game::CC_PassThruAdjoins(const std::vector& args, void *pUserData) { OutlawsXL_Game *pGame = (OutlawsXL_Game *)pUserData; diff --git a/OutlawsXL/OutlawsXL_Game.h b/OutlawsXL/OutlawsXL_Game.h index c6d23ab..fc01d9b 100644 --- a/OutlawsXL/OutlawsXL_Game.h +++ b/OutlawsXL/OutlawsXL_Game.h @@ -2,9 +2,9 @@ #define OUTLAWSXL_GAME_H #include "../plugin_framework/plugin.h" + #include -using namespace std; class OutlawsXL_Player; class OutlawsXL_Game @@ -34,9 +34,9 @@ class OutlawsXL_Game //Console commands static OutlawsXL_Game *s_pGame_Console; - static void CC_GameVersion(const vector& args, void *pUserData); - static void CC_LoadMap(const vector& args, void *pUserData); - static void CC_PassThruAdjoins(const vector& args, void *pUserData); + static void CC_GameVersion(const std::vector& args, void *pUserData); + static void CC_LoadMap(const std::vector& args, void *pUserData); + static void CC_PassThruAdjoins(const std::vector& args, void *pUserData); }; #endif //BLOODXL_GAME_H \ No newline at end of file diff --git a/fileformats/ART_Reader.cpp b/fileformats/ART_Reader.cpp index 099d6b5..3317d65 100644 --- a/fileformats/ART_Reader.cpp +++ b/fileformats/ART_Reader.cpp @@ -1,9 +1,9 @@ #include "ART_Reader.h" #include "../EngineSettings.h" #include "../ui/XL_Console.h" -#include -#include -#include +#include +#include +#include #define MAX_NB_TILES 9216 #define PALETTE_SIZE (256 * 3) diff --git a/fileformats/ART_Reader.h b/fileformats/ART_Reader.h index bb908bf..06f26d7 100644 --- a/fileformats/ART_Reader.h +++ b/fileformats/ART_Reader.h @@ -3,7 +3,7 @@ #include "../CommonTypes.h" #include "Archive.h" -#include +#include class ART_Reader : public Archive { diff --git a/fileformats/Archive.h b/fileformats/Archive.h index 0f47dfd..2eca17e 100644 --- a/fileformats/Archive.h +++ b/fileformats/Archive.h @@ -1,7 +1,7 @@ #ifndef ARCHIVE_H #define ARCHIVE_H -#include +#include class Archive { diff --git a/fileformats/ArchiveManager.cpp b/fileformats/ArchiveManager.cpp index 7a0bc5e..fc01541 100644 --- a/fileformats/ArchiveManager.cpp +++ b/fileformats/ArchiveManager.cpp @@ -19,8 +19,8 @@ const char *ArchiveManager::m_apszArchiveExt[]= "BSA", }; -map ArchiveManager::m_OpenArchives; -vector ArchiveManager::m_ArchiveList; +std::map ArchiveManager::m_OpenArchives; +std::vector ArchiveManager::m_ArchiveList; Archive *ArchiveManager::m_pCurArchive; FILE *ArchiveManager::s_pCurrentSysFile; @@ -34,9 +34,9 @@ void ArchiveManager::Init() void ArchiveManager::Destroy() { m_OpenArchives.clear(); - - vector::iterator iArchive = m_ArchiveList.begin(); - vector::iterator eArchive = m_ArchiveList.end(); + + std::vector::iterator iArchive = m_ArchiveList.begin(); + std::vector::iterator eArchive = m_ArchiveList.end(); for (; iArchive != eArchive; ++iArchive) { (*iArchive)->Close(); @@ -48,7 +48,7 @@ void ArchiveManager::Destroy() Archive *ArchiveManager::OpenArchive(uint32_t uArchiveType, const char *pszArchiveName) { - map::iterator iArchive = m_OpenArchives.find(pszArchiveName); + std::map::iterator iArchive = m_OpenArchives.find(pszArchiveName); if ( iArchive != m_OpenArchives.end() ) { Archive *pArchive = iArchive->second; diff --git a/fileformats/ArchiveManager.h b/fileformats/ArchiveManager.h index 48c064e..0dc07d0 100644 --- a/fileformats/ArchiveManager.h +++ b/fileformats/ArchiveManager.h @@ -7,7 +7,6 @@ #include #include -using namespace std; class Archive; class ArchiveManager @@ -36,8 +35,8 @@ class ArchiveManager private: static const char *m_apszArchiveExt[]; - static map m_OpenArchives; - static vector m_ArchiveList; + static std::map m_OpenArchives; + static std::vector m_ArchiveList; static Archive *m_pCurArchive; static FILE *s_pCurrentSysFile; }; diff --git a/fileformats/BSA_Reader.cpp b/fileformats/BSA_Reader.cpp index 8f5f012..65f0f15 100644 --- a/fileformats/BSA_Reader.cpp +++ b/fileformats/BSA_Reader.cpp @@ -1,9 +1,9 @@ #include "BSA_Reader.h" #include "../EngineSettings.h" #include "../ui/XL_Console.h" -#include -#include -#include +#include +#include +#include BSA_Reader::BSA_Reader() : Archive() { diff --git a/fileformats/BSA_Reader.h b/fileformats/BSA_Reader.h index 11f34dc..7f8871b 100644 --- a/fileformats/BSA_Reader.h +++ b/fileformats/BSA_Reader.h @@ -3,7 +3,7 @@ #include "../CommonTypes.h" #include "Archive.h" -#include +#include class BSA_Reader : public Archive { diff --git a/fileformats/CellLoader.h b/fileformats/CellLoader.h index 066a84a..06b4152 100644 --- a/fileformats/CellLoader.h +++ b/fileformats/CellLoader.h @@ -7,8 +7,6 @@ class WorldCell; class IDriver3D; class World; -using namespace std; - class CellLoader { public: @@ -18,7 +16,7 @@ class CellLoader //returns true if this CellLoader handles file handling itself. virtual bool UsesOwnFiles() { return false; } //load (normal) - virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ) {return 0;} + virtual WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) {return 0;} virtual WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr) {return 0;} }; diff --git a/fileformats/CellLoader_BloodMap.cpp b/fileformats/CellLoader_BloodMap.cpp index f50b18b..ef6deab 100644 --- a/fileformats/CellLoader_BloodMap.cpp +++ b/fileformats/CellLoader_BloodMap.cpp @@ -7,18 +7,15 @@ #include "../world/Sprite_ZAxis.h" #include "../world/LevelFuncMgr.h" #include "../render/TextureCache.h" - #include "../fileformats/TextureTypes.h" #include "../fileformats/ArchiveTypes.h" - #include "../math/Math.h" - #include "../ui/XL_Console.h" - #include "../EngineSettings.h" -#include -#include -#include + +#include +#include +#include #define MAX_TILES 9216 @@ -389,7 +386,7 @@ TextureHandle CellLoader_BloodMap::AddBloodTile(int32_t picnum, uint32_t uPalIdx return hTex; } -WorldCell *CellLoader_BloodMap::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ) +WorldCell *CellLoader_BloodMap::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) { WorldCell *pCell = NULL; ObjectManager::FreeAllObjects(); diff --git a/fileformats/CellLoader_BloodMap.h b/fileformats/CellLoader_BloodMap.h index 23e745d..b2c604b 100644 --- a/fileformats/CellLoader_BloodMap.h +++ b/fileformats/CellLoader_BloodMap.h @@ -13,7 +13,7 @@ class CellLoader_BloodMap : public CellLoader CellLoader_BloodMap(); ~CellLoader_BloodMap(); - WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ); + WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ); private: struct HeaderPart1 diff --git a/fileformats/CellLoader_Daggerfall.cpp b/fileformats/CellLoader_Daggerfall.cpp index 7531e28..73cfe74 100644 --- a/fileformats/CellLoader_Daggerfall.cpp +++ b/fileformats/CellLoader_Daggerfall.cpp @@ -25,16 +25,14 @@ #include "../ui/XL_Console.h" #include "Parser.h" -#include -#include -#include -#include +#include +#include +#include +#include #include "../os/Clock.h" #include -using namespace std; - struct MeshAction { int nParentID; //-1 = no parent. @@ -353,7 +351,7 @@ WorldCell *CellLoader_Daggerfall::LoadFromLocation( IDriver3D *pDriver, World *p return pCell; } -WorldCell *CellLoader_Daggerfall::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ) +WorldCell *CellLoader_Daggerfall::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) { Location_Daggerfall *pLocation = WorldMap::GetLocation(sFile.c_str()); //Don't reload a location already in memory. @@ -489,8 +487,8 @@ Sector *CellLoader_Daggerfall::LoadBlock_Ext(IDriver3D *pDriver, uint32_t uLengt szModel[5] = 0; sprintf(szModelName, "%d_c%d", objID, nClimate); - Mesh *pMesh = MeshCache::GetMesh( string(szModelName) ); - MeshCollision *pCol = MeshCache::GetMeshCollision( string(szModelName) ); + Mesh *pMesh = MeshCache::GetMesh( std::string(szModelName) ); + MeshCollision *pCol = MeshCache::GetMeshCollision( std::string(szModelName) ); if ( pMesh->IsLoaded() == false ) { m_MeshLoader.Load(pDriver, pMesh, pCol, szModel, nClimate, 0); @@ -667,8 +665,8 @@ Sector *CellLoader_Daggerfall::LoadBlock_Ext(IDriver3D *pDriver, uint32_t uLengt char szModelName[32]; sprintf(szModel, "%d", objID); sprintf(szModelName, "%d_c%d", objID, nClimate); - Mesh *pMesh = MeshCache::GetMesh( string(szModelName) ); - MeshCollision *pCol = MeshCache::GetMeshCollision( string(szModelName) ); + Mesh *pMesh = MeshCache::GetMesh( std::string(szModelName) ); + MeshCollision *pCol = MeshCache::GetMeshCollision( std::string(szModelName) ); if ( pMesh->IsLoaded() == false ) { m_MeshLoader.Load(pDriver, pMesh, pCol, szModel, nClimate, 0); @@ -709,8 +707,8 @@ Sector *CellLoader_Daggerfall::LoadBlock_Ext(IDriver3D *pDriver, uint32_t uLengt { bool bValidNode = true; //is this point inside a mesh? - vector::iterator iObj = pSector->m_Objects.begin(); - vector::iterator eObj = pSector->m_Objects.end(); + std::vector::iterator iObj = pSector->m_Objects.begin(); + std::vector::iterator eObj = pSector->m_Objects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = ObjectManager::GetObjectFromID( *iObj ); @@ -948,7 +946,7 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i m_nModelCnt++; } } - vector pLights; + std::vector pLights; unsigned int *pModelDataList = (unsigned int *)&pData[index]; int mIndex = 0; unsigned int anModelData[750]; @@ -972,8 +970,8 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i pszModel[4] = m_aModels[ anIndex[i] ].modelID[4]; pszModel[5] = 0; sprintf(szModelName, "%s_%d", pszModel, dungeonType); - m_apModels[i] = MeshCache::GetMesh( string(szModelName) ); - m_apModelsCol[i] = MeshCache::GetMeshCollision( string(szModelName) ); + m_apModels[i] = MeshCache::GetMesh( std::string(szModelName) ); + m_apModelsCol[i] = MeshCache::GetMeshCollision( std::string(szModelName) ); if ( dungeonType == 2 || dungeonType == 3 ) { @@ -1480,8 +1478,8 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i } //now resolve action records. - vector::iterator iObj = pSector->m_Objects.begin(); - vector::iterator eObj = pSector->m_Objects.end(); + std::vector::iterator iObj = pSector->m_Objects.begin(); + std::vector::iterator eObj = pSector->m_Objects.end(); int idx=0; for (; iObj != eObj; ++iObj) { @@ -1494,7 +1492,7 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i MeshAction *pGameDataParent = (MeshAction *)pObj->GetGameData(); int idxTarget = 0; - vector::iterator iObjTarget = pSector->m_Objects.begin(); + std::vector::iterator iObjTarget = pSector->m_Objects.begin(); for (; iObjTarget != eObj; ++iObjTarget) { if ( objRecordID[idxTarget] == objTarget[idx] ) @@ -1583,7 +1581,7 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i xlDelete [] lightAdded; //assign lights to objects. - const vector& lightList = pSector->GetLightList(); + const std::vector& lightList = pSector->GetLightList(); iObj = pSector->m_Objects.begin(); for (; iObj != eObj; ++iObj) { @@ -1607,14 +1605,14 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i #if 0 //now assign geometry to each light. - vector::iterator iMesh = m_MeshObjs.begin(); - vector::iterator iMEnd = m_MeshObjs.end(); + std::vector::iterator iMesh = m_MeshObjs.begin(); + std::vector::iterator iMEnd = m_MeshObjs.end(); for (; iMesh != iMEnd; ++iMesh) { DungeonMeshObj_t *pMesh = *iMesh; - vector::iterator iLight = m_Lights.begin(); - vector::iterator iLEnd = m_Lights.end(); + std::vector::iterator iLight = m_Lights.begin(); + std::vector::iterator iLEnd = m_Lights.end(); Vector3 vOffs; for( ; iLight != iLEnd; ++iLight) @@ -1634,8 +1632,8 @@ Sector *CellLoader_Daggerfall::LoadBlock(IDriver3D *pDriver, uint32_t uLength, i { //search for the target... bool bMatchFound = false; - vector::iterator iMesh2 = m_MeshObjs.begin(); - vector::iterator iMEnd2 = m_MeshObjs.end(); + std::vector::iterator iMesh2 = m_MeshObjs.begin(); + std::vector::iterator iMEnd2 = m_MeshObjs.end(); for (; iMesh2 != iMEnd2; ++iMesh2) { DungeonMeshObj_t *pMesh2 = *iMesh2; diff --git a/fileformats/CellLoader_Daggerfall.h b/fileformats/CellLoader_Daggerfall.h index 2687d20..73daf61 100644 --- a/fileformats/CellLoader_Daggerfall.h +++ b/fileformats/CellLoader_Daggerfall.h @@ -15,7 +15,7 @@ class CellLoader_Daggerfall : public CellLoader CellLoader_Daggerfall(); ~CellLoader_Daggerfall(); - WorldCell *Load(IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY); + WorldCell *Load(IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY); WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, void *pLocPtr); //returns true if this CellLoader handles file handling itself. diff --git a/fileformats/CellLoader_OutlawsMap.cpp b/fileformats/CellLoader_OutlawsMap.cpp index f1d8410..1d841ab 100644 --- a/fileformats/CellLoader_OutlawsMap.cpp +++ b/fileformats/CellLoader_OutlawsMap.cpp @@ -6,19 +6,17 @@ #include "../world/OrientedSprite.h" #include "../world/Sprite_ZAxis.h" #include "../render/TextureCache.h" - #include "../fileformats/TextureTypes.h" #include "../fileformats/ArchiveTypes.h" #include "../fileformats/ArchiveManager.h" - #include "../memory/ScratchPad.h" - #include "../math/Math.h" #include "../ui/XL_Console.h" #include "Parser.h" -#include -#include -#include + +#include +#include +#include const float m_fWorldToTexel_X = 8.0f; const float m_fWorldToTexel_Z = 8.0f; @@ -201,7 +199,7 @@ TextureHandle LoadNWX(uint8_t *pData, uint32_t uLen, const char *pszName, uint32 //CELL_NWX *pCell2 = (CELL_NWX *)&pData[48+sizeof(CELL_NWX)+pCell0->size+4 + sizeof(CELL_NWX)+pCell1->size+4]; } -WorldCell *CellLoader_OutlawsMap::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ) +WorldCell *CellLoader_OutlawsMap::Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ) { WorldCell *pCell = NULL; ObjectManager::FreeAllObjects(); diff --git a/fileformats/CellLoader_OutlawsMap.h b/fileformats/CellLoader_OutlawsMap.h index 6581595..926c034 100644 --- a/fileformats/CellLoader_OutlawsMap.h +++ b/fileformats/CellLoader_OutlawsMap.h @@ -13,7 +13,7 @@ class CellLoader_OutlawsMap : public CellLoader CellLoader_OutlawsMap(); ~CellLoader_OutlawsMap(); - WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const string& sFile, int32_t worldX, int32_t worldY ); + WorldCell *Load( IDriver3D *pDriver, World *pWorld, uint8_t *pData, uint32_t uLen, const std::string& sFile, int32_t worldX, int32_t worldY ); private: diff --git a/fileformats/CellManager.cpp b/fileformats/CellManager.cpp index 72d4b25..4f50828 100644 --- a/fileformats/CellManager.cpp +++ b/fileformats/CellManager.cpp @@ -47,7 +47,7 @@ WorldCell *CellManager::LoadFromLocation(IDriver3D *pDriver, World *pWorld, uint return pCell; } -WorldCell *CellManager::LoadCell(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, Archive *pCellArchive, const string& sFile, int32_t worldX, int32_t worldY) +WorldCell *CellManager::LoadCell(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, Archive *pCellArchive, const std::string& sFile, int32_t worldX, int32_t worldY) { WorldCell *pCell = NULL; diff --git a/fileformats/CellManager.h b/fileformats/CellManager.h index af833e7..ae7a6c2 100644 --- a/fileformats/CellManager.h +++ b/fileformats/CellManager.h @@ -3,9 +3,9 @@ #include "../CommonTypes.h" #include "CellTypes.h" + #include -using namespace std; class WorldCell; class CellLoader; class Archive; @@ -21,7 +21,7 @@ class CellManager //This loads a cell from disk and then formats it for the engine. //The WorldCell is then returned, ready to be added to the world. //Cell types include: levels, dungeon tiles, location tiles, etc. - static WorldCell *LoadCell(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, Archive *pCellArchive, const string& sFile, int32_t worldX, int32_t worldY); + static WorldCell *LoadCell(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, Archive *pCellArchive, const std::string& sFile, int32_t worldX, int32_t worldY); static WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, void *pLocPtr); private: diff --git a/fileformats/GOB_Reader.cpp b/fileformats/GOB_Reader.cpp index 51ef9a0..476248d 100644 --- a/fileformats/GOB_Reader.cpp +++ b/fileformats/GOB_Reader.cpp @@ -1,8 +1,8 @@ #include "GOB_Reader.h" #include "../EngineSettings.h" #include "../ui/XL_Console.h" -#include -#include +#include +#include #include GOB_Reader::GOB_Reader() : Archive() diff --git a/fileformats/GOB_Reader.h b/fileformats/GOB_Reader.h index 3d42371..c26e95b 100644 --- a/fileformats/GOB_Reader.h +++ b/fileformats/GOB_Reader.h @@ -3,7 +3,7 @@ #include "../CommonTypes.h" #include "Archive.h" -#include +#include #include class GOB_Reader : public Archive diff --git a/fileformats/LFD_Anim.cpp b/fileformats/LFD_Anim.cpp index 2bf870d..517b9a6 100644 --- a/fileformats/LFD_Anim.cpp +++ b/fileformats/LFD_Anim.cpp @@ -2,9 +2,9 @@ #include "../math/Math.h" #include "../render/IDriver3D.h" #include "../render/TextureCache.h" -#include -#include -#include +#include +#include +#include PLTT_File LFD_Anim::m_PalFile; uint32_t _ImgBuffer[2048*2048]; diff --git a/fileformats/LFD_Anim.h b/fileformats/LFD_Anim.h index e360476..79fa8b9 100644 --- a/fileformats/LFD_Anim.h +++ b/fileformats/LFD_Anim.h @@ -1,7 +1,7 @@ #ifndef LFD_ANIM_H #define LFD_ANIM_H -#include +#include #include "../CommonTypes.h" class IDriver3D; diff --git a/fileformats/LFD_Reader.cpp b/fileformats/LFD_Reader.cpp index 3a04921..d53d0a8 100644 --- a/fileformats/LFD_Reader.cpp +++ b/fileformats/LFD_Reader.cpp @@ -1,8 +1,8 @@ #include "LFD_Reader.h" #include "../EngineSettings.h" #include "../ui/XL_Console.h" -#include -#include +#include +#include LFD_Reader::LFD_Reader() : Archive() { diff --git a/fileformats/LFD_Reader.h b/fileformats/LFD_Reader.h index 386cf74..e05bc3b 100644 --- a/fileformats/LFD_Reader.h +++ b/fileformats/LFD_Reader.h @@ -3,7 +3,7 @@ #include "../CommonTypes.h" #include "Archive.h" -#include +#include class LFD_Reader : public Archive { diff --git a/fileformats/Location_Daggerfall.cpp b/fileformats/Location_Daggerfall.cpp index 1348a4f..9ce0b93 100644 --- a/fileformats/Location_Daggerfall.cpp +++ b/fileformats/Location_Daggerfall.cpp @@ -3,19 +3,19 @@ #include "../fileformats/ArchiveTypes.h" #include "../fileformats/ArchiveManager.h" #include "../memory/ScratchPad.h" -#include -#include +#include +#include #include -#include -#include +#include +#include #define CACHED_FILE_VERSION 0x01 uint32_t WorldMap::m_uRegionCount; Region_Daggerfall *WorldMap::m_pRegions; -map WorldMap::m_MapLoc; -map WorldMap::m_MapCell; -map WorldMap::m_MapNames; +std::map WorldMap::m_MapLoc; +std::map WorldMap::m_MapCell; +std::map WorldMap::m_MapNames; bool WorldMap::m_bMapLoaded = false; /////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ void Location_Daggerfall::Save(FILE *f) } } -bool Location_Daggerfall::Load(FILE *f, map& mapLoc, map& mapNames) +bool Location_Daggerfall::Load(FILE *f, std::map& mapLoc, std::map& mapNames) { fread(m_szName, 1, 32, f); fread(&m_x, 1, sizeof(float), f); @@ -139,7 +139,7 @@ void Region_Daggerfall::Save(FILE *f) } } -bool Region_Daggerfall::Load(FILE *f, map& mapLoc, map& mapNames) +bool Region_Daggerfall::Load(FILE *f, std::map& mapLoc, std::map& mapNames) { fread(&m_uLocationCount, 1, sizeof(uint32_t), f); m_pLocations = new Location_Daggerfall[ m_uLocationCount ]; @@ -667,7 +667,7 @@ Location_Daggerfall *WorldMap::GetLocation(int32_t x, int32_t y) Location_Daggerfall *pLoc = NULL; uint64_t uKey = (uint64_t)y<<32ULL | (uint64_t)x; - map::iterator iLoc = m_MapLoc.find(uKey); + std::map::iterator iLoc = m_MapLoc.find(uKey); if ( iLoc != m_MapLoc.end() ) { pLoc = iLoc->second; @@ -680,7 +680,7 @@ Location_Daggerfall *WorldMap::GetLocation(const char *pszName) { Location_Daggerfall *pLoc = NULL; - map::iterator iLoc = m_MapNames.find(pszName); + std::map::iterator iLoc = m_MapNames.find(pszName); if ( iLoc != m_MapNames.end() ) { pLoc = iLoc->second; @@ -699,7 +699,7 @@ WorldCell *WorldMap::GetWorldCell(int32_t x, int32_t y) { WorldCell *pCell = NULL; uint64_t uKey = (uint64_t)y<<32ULL | (uint64_t)x; - map::iterator iLoc = m_MapCell.find(uKey); + std::map::iterator iLoc = m_MapCell.find(uKey); if ( iLoc != m_MapCell.end() ) { diff --git a/fileformats/Location_Daggerfall.h b/fileformats/Location_Daggerfall.h index 4a5dda1..c1fd59d 100644 --- a/fileformats/Location_Daggerfall.h +++ b/fileformats/Location_Daggerfall.h @@ -5,8 +5,6 @@ #include #include -using namespace std; - class WorldCell; class Location_Daggerfall @@ -17,7 +15,7 @@ class Location_Daggerfall //Save and Load cached data. void Save(FILE *f); - bool Load(FILE *f, map& mapLoc, map& mapNames); + bool Load(FILE *f, std::map& mapLoc, std::map& mapNames); public: struct LocName @@ -64,7 +62,7 @@ class Region_Daggerfall //Save and load cached data. void Save(FILE *f); - bool Load(FILE *f, map& mapLoc, map& mapNames); + bool Load(FILE *f, std::map& mapLoc, std::map& mapNames); public: uint32_t m_uLocationCount; @@ -95,9 +93,9 @@ class WorldMap public: static uint32_t m_uRegionCount; static Region_Daggerfall *m_pRegions; - static map m_MapLoc; - static map m_MapCell; - static map m_MapNames; + static std::map m_MapLoc; + static std::map m_MapCell; + static std::map m_MapNames; static bool m_bMapLoaded; }; diff --git a/fileformats/MeshLoader_Daggerfall.cpp b/fileformats/MeshLoader_Daggerfall.cpp index a52e7b1..894130c 100644 --- a/fileformats/MeshLoader_Daggerfall.cpp +++ b/fileformats/MeshLoader_Daggerfall.cpp @@ -11,9 +11,10 @@ #include "../math/Math.h" #include "../render/VertexBuffer.h" #include "../render/IndexBuffer.h" -#include -#include -#include + +#include +#include +#include #define STO_TERRAIN 2 #define STO_RUINS 7 @@ -140,7 +141,7 @@ struct SM_Polygon struct SM_Material { TextureHandle hTex; - vector PolyList; + std::vector PolyList; short ImageIndex; short FileIndex; @@ -683,7 +684,7 @@ bool MeshLoader_Daggerfall::LoadMesh(IDriver3D *pDriver, Mesh *pMesh, MeshCollis } //then create a polygon list per material. - vector polyList[128]; + std::vector polyList[128]; for (int i=0; i #include #include -using namespace std; class IDriver3D; class MeshLoader_Daggerfall diff --git a/fileformats/Parser.cpp b/fileformats/Parser.cpp index d7f524d..437a46c 100644 --- a/fileformats/Parser.cpp +++ b/fileformats/Parser.cpp @@ -1,8 +1,8 @@ #include "Parser.h" -#include -#include +#include +#include #include -#include +#include const char *Parser::m_pMemory=0; uint32_t Parser::m_uFilePtr=0; diff --git a/fileformats/RFF_Reader.cpp b/fileformats/RFF_Reader.cpp index 9d9bd63..8893512 100644 --- a/fileformats/RFF_Reader.cpp +++ b/fileformats/RFF_Reader.cpp @@ -2,8 +2,8 @@ #include "../EngineSettings.h" #include "../ui/XL_Console.h" #include "../memory/ScratchPad.h" -#include -#include +#include +#include bool m_bEncrypt; diff --git a/fileformats/RFF_Reader.h b/fileformats/RFF_Reader.h index 5ec2af3..45ae55a 100644 --- a/fileformats/RFF_Reader.h +++ b/fileformats/RFF_Reader.h @@ -3,7 +3,7 @@ #include "../CommonTypes.h" #include "Archive.h" -#include +#include class RFF_Reader : public Archive { diff --git a/fileformats/SkyLoader_Daggerfall.cpp b/fileformats/SkyLoader_Daggerfall.cpp index 075f348..9341f7a 100644 --- a/fileformats/SkyLoader_Daggerfall.cpp +++ b/fileformats/SkyLoader_Daggerfall.cpp @@ -4,11 +4,11 @@ #include "../fileformats/ArchiveManager.h" #include "../render/TextureCache.h" #include "../memory/ScratchPad.h" -#include -#include +#include +#include #include -#include -#include +#include +#include SkyLoader_Daggerfall::SkyLoader_Daggerfall() : SkyLoader() { diff --git a/fileformats/SkyLoader_Daggerfall.h b/fileformats/SkyLoader_Daggerfall.h index 0d12df1..27a3740 100644 --- a/fileformats/SkyLoader_Daggerfall.h +++ b/fileformats/SkyLoader_Daggerfall.h @@ -4,8 +4,6 @@ #include "SkyLoader.h" #include "TextureLoader.h" -using namespace std; - struct SkyData { bool bLoaded; diff --git a/fileformats/TextureConv_IMG.cpp b/fileformats/TextureConv_IMG.cpp index 1e1ab0a..74577a5 100644 --- a/fileformats/TextureConv_IMG.cpp +++ b/fileformats/TextureConv_IMG.cpp @@ -3,7 +3,7 @@ #include "../memory/ScratchPad.h" #include "../fileformats/TextureLoader.h" #include "../math/Math.h" -#include +#include #include enum diff --git a/fileformats/TextureConv_PCX.cpp b/fileformats/TextureConv_PCX.cpp index 331670a..0b7cf50 100644 --- a/fileformats/TextureConv_PCX.cpp +++ b/fileformats/TextureConv_PCX.cpp @@ -2,7 +2,7 @@ #include "ArchiveManager.h" #include "../memory/ScratchPad.h" #include "../fileformats/TextureLoader.h" -#include +#include #include TextureConv_PCX::TextureConv_PCX() : TextureConverter() diff --git a/fileformats/TextureLoader.cpp b/fileformats/TextureLoader.cpp index 52415c2..a9b57ee 100644 --- a/fileformats/TextureLoader.cpp +++ b/fileformats/TextureLoader.cpp @@ -6,7 +6,8 @@ #include "TextureConv_IMG.h" #include "../memory/ScratchPad.h" #include "../ui/XL_Console.h" -#include + +#include #include #define MAX_PAL_COUNT 32 @@ -49,7 +50,7 @@ void TextureLoader::Destroy() m_pCurConverter=NULL; } -bool TextureLoader::LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const string& sFile, bool bCopyPal) +bool TextureLoader::LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const std::string& sFile, bool bCopyPal) { TextureConverter *pConvert = m_TextureConverters[uTextureType]; m_pCurConverter = pConvert; @@ -92,7 +93,7 @@ bool TextureLoader::LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, Archi return false; } -uint32_t TextureLoader::LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const string& sFile, int nRecord) +uint32_t TextureLoader::LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const std::string& sFile, int nRecord) { uint32_t uFrameCnt = 1; @@ -136,7 +137,7 @@ uint32_t TextureLoader::LoadTexture_TexList(uint32_t uTextureType, uint32_t uPal return 0; } -bool TextureLoader::LoadTexture_NoArchive(uint32_t uTextureType, uint32_t uPalIndex, const string& sFile, bool bCopyPal) +bool TextureLoader::LoadTexture_NoArchive(uint32_t uTextureType, uint32_t uPalIndex, const std::string& sFile, bool bCopyPal) { TextureConverter *pConvert = m_TextureConverters[uTextureType]; m_pCurConverter = pConvert; @@ -176,7 +177,7 @@ bool TextureLoader::LoadTexture_NoArchive(uint32_t uTextureType, uint32_t uPalIn return false; } -uint32_t TextureLoader::LoadTexture_NoArchive_TexList(uint32_t uTextureType, uint32_t uPalIndex, const string& sFile, int nRecord) +uint32_t TextureLoader::LoadTexture_NoArchive_TexList(uint32_t uTextureType, uint32_t uPalIndex, const std::string& sFile, int nRecord) { uint32_t uFrameCnt = 1; diff --git a/fileformats/TextureLoader.h b/fileformats/TextureLoader.h index 90573a6..c304b42 100644 --- a/fileformats/TextureLoader.h +++ b/fileformats/TextureLoader.h @@ -3,11 +3,11 @@ #include "../CommonTypes.h" #include "TextureTypes.h" + #include #include #include -using namespace std; class TextureConverter; class Archive; @@ -35,10 +35,10 @@ class TextureLoader static void Init(); static void Destroy(); - static bool LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const string& sFile, bool bCopyPal); - static uint32_t LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const string& sFile, int nRecord); - static bool LoadTexture_NoArchive(uint32_t uTextureType, uint32_t uPalIndex, const string& sFile, bool bCopyPal); - static uint32_t LoadTexture_NoArchive_TexList(uint32_t uTextureType, uint32_t uPalIndex, const string& sFile, int nRecord); + static bool LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const std::string& sFile, bool bCopyPal); + static uint32_t LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, Archive *pTexArchive, const std::string& sFile, int nRecord); + static bool LoadTexture_NoArchive(uint32_t uTextureType, uint32_t uPalIndex, const std::string& sFile, bool bCopyPal); + static uint32_t LoadTexture_NoArchive_TexList(uint32_t uTextureType, uint32_t uPalIndex, const std::string& sFile, int nRecord); static bool LoadTexture_Mem( const uint8_t *pImgBuffer, uint32_t uPalIndex, uint32_t width, uint32_t height ); static void GetTextureSize(int32_t& nOffsX, int32_t& nOffsY, uint32_t& uWidth, uint32_t& uHeight); static void *GetTexExtraData(uint32_t& uDataSize) { uDataSize = m_uExtraDataSize; return m_pTexExtraData; } diff --git a/linux/main.cpp b/linux/main.cpp index a8f4a9b..0e661f4 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -1,10 +1,10 @@ -#include -#include +#include +#include -#include +#include #include -#include +#include #include "SDL.h" diff --git a/math/FixedPoint.h b/math/FixedPoint.h index 80ed923..65099ab 100644 --- a/math/FixedPoint.h +++ b/math/FixedPoint.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "../CommonTypes.h" typedef int32_t fixed28_4; diff --git a/math/Math.h b/math/Math.h index b053bae..1fe7c80 100644 --- a/math/Math.h +++ b/math/Math.h @@ -1,7 +1,7 @@ #ifndef MATH_H #define MATH_H -#include +#include #include "../CommonTypes.h" #include "Vector2.h" #include "Vector3.h" diff --git a/math/Plane.cpp b/math/Plane.cpp index 7932a2e..513e2e0 100644 --- a/math/Plane.cpp +++ b/math/Plane.cpp @@ -1,5 +1,5 @@ #include "Plane.h" -#include +#include float Plane::Normalize() { diff --git a/math/Vector2.cpp b/math/Vector2.cpp index 5a2f1c3..b7fe39b 100644 --- a/math/Vector2.cpp +++ b/math/Vector2.cpp @@ -1,5 +1,5 @@ #include "Vector2.h" -#include +#include Vector2 Vector2::One(1.0f, 1.0f); Vector2 Vector2::Half(0.5f, 0.5f); diff --git a/math/Vector2.h b/math/Vector2.h index dab8b08..699e26e 100644 --- a/math/Vector2.h +++ b/math/Vector2.h @@ -2,7 +2,7 @@ #define VECTOR2_H #include "../Engine.h" -#include +#include #ifndef VEC_EPS #define VEC_EPS 0.0001f diff --git a/math/Vector3.cpp b/math/Vector3.cpp index b067e52..0d7d526 100644 --- a/math/Vector3.cpp +++ b/math/Vector3.cpp @@ -1,5 +1,5 @@ #include "Vector3.h" -#include +#include Vector3 Vector3::One(1.0f, 1.0f, 1.0f); Vector3 Vector3::Half(0.5f, 0.5f, 0.5f); diff --git a/math/Vector3.h b/math/Vector3.h index cf505a6..1f4d87c 100644 --- a/math/Vector3.h +++ b/math/Vector3.h @@ -2,7 +2,7 @@ #define VECTOR3_H #include "../Engine.h" -#include +#include #ifndef VEC_EPS #define VEC_EPS 0.0001f diff --git a/math/Vector4.cpp b/math/Vector4.cpp index 0e60c71..1a595b7 100644 --- a/math/Vector4.cpp +++ b/math/Vector4.cpp @@ -1,5 +1,5 @@ #include "Vector4.h" -#include +#include Vector4 Vector4::One(1.0f, 1.0f, 1.0f, 1.0f); Vector4 Vector4::Half(0.5f, 0.5f, 0.5f, 0.5f); diff --git a/math/Vector4.h b/math/Vector4.h index d5cdeaf..b5f99a1 100644 --- a/math/Vector4.h +++ b/math/Vector4.h @@ -2,7 +2,7 @@ #define VECTOR4_H #include "../Engine.h" -#include +#include #include "Vector3.h" class Vector4 diff --git a/memory/ScratchPad.cpp b/memory/ScratchPad.cpp index aff235e..ce26a7d 100644 --- a/memory/ScratchPad.cpp +++ b/memory/ScratchPad.cpp @@ -1,8 +1,8 @@ #include "ScratchPad.h" -#include -#include +#include +#include #include -#include +#include #define SCRATCH_PAD_SIZE 64*1024*1024 #define MAX_FRAME_COUNT 128 diff --git a/movieplayback/LFD_Film.cpp b/movieplayback/LFD_Film.cpp index 4e4d64f..379122c 100644 --- a/movieplayback/LFD_Film.cpp +++ b/movieplayback/LFD_Film.cpp @@ -3,8 +3,8 @@ #include "../fileformats/Archive.h" #include "../fileformats/LFD_Anim.h" #include "../render/IDriver3D.h" -#include -#include +#include +#include //#include "SoundSystem.h" @@ -81,8 +81,8 @@ void LFD_Film::Stop() if ( m_Graphics.size() > 0 ) { - vector::iterator iter = m_Graphics.begin(); - vector::iterator end = m_Graphics.end(); + std::vector::iterator iter = m_Graphics.begin(); + std::vector::iterator end = m_Graphics.end(); for (; iter!=end; ++iter) { if ( *iter ) @@ -581,8 +581,8 @@ bool LFD_Film::Update() { m_Commands[m_nTime].bActivated = true; - vector::iterator iter = m_Commands[m_nTime].commands.begin(); - vector::iterator end = m_Commands[m_nTime].commands.end(); + std::vector::iterator iter = m_Commands[m_nTime].commands.begin(); + std::vector::iterator end = m_Commands[m_nTime].commands.end(); for (; iter!=end; ++iter) { @@ -706,8 +706,8 @@ bool LFD_Film::Update() { if ( !bFilmFinished ) { - vector::iterator iter = m_Graphics.begin(); - vector::iterator end = m_Graphics.end(); + std::vector::iterator iter = m_Graphics.begin(); + std::vector::iterator end = m_Graphics.end(); for (; iter!=end; ++iter) { Graphic *pGraphic = *iter; @@ -970,8 +970,8 @@ void LFD_Film::Render(float fDeltaTime) } //render all the graphics that are visible... - vector::iterator iter = m_Graphics.begin(); - vector::iterator end = m_Graphics.end(); + std::vector::iterator iter = m_Graphics.begin(); + std::vector::iterator end = m_Graphics.end(); for (; iter!=end; ++iter) { Graphic *pGraphic = *iter; diff --git a/movieplayback/LFD_Film.h b/movieplayback/LFD_Film.h index 3142502..59755c3 100644 --- a/movieplayback/LFD_Film.h +++ b/movieplayback/LFD_Film.h @@ -1,13 +1,12 @@ #ifndef LFD_FILM_H #define LFD_FILM_H -#include #include "../CommonTypes.h" #include "../fileformats/LFD_Anim.h" #include "../movieplayback/MoviePlayer.h" +#include #include -using namespace std; class LFD_Anim; class Archive; @@ -49,7 +48,7 @@ class LFD_Film : public MoviePlayer struct CommandSet { bool bActivated; - vector commands; + std::vector commands; }; struct Graphic @@ -89,7 +88,7 @@ class LFD_Film : public MoviePlayer FADE_CLEAR, }; - vector m_Graphics; + std::vector m_Graphics; PLTT_File m_Pal[32]; int32_t m_nPalCount; int16_t m_nFilmLength; diff --git a/movieplayback/MovieManager.cpp b/movieplayback/MovieManager.cpp index cad0518..afec163 100644 --- a/movieplayback/MovieManager.cpp +++ b/movieplayback/MovieManager.cpp @@ -5,8 +5,8 @@ #include "LFD_Film.h" #include "../ui/XL_Console.h" -map MovieManager::m_MoviePlayers; -vector MovieManager::m_MoviePlayerList; +std::map MovieManager::m_MoviePlayers; +std::vector MovieManager::m_MoviePlayerList; MoviePlayer *MovieManager::m_pCurPlayer; Archive *MovieManager::m_apArchives[2]; IDriver3D *MovieManager::m_pDriver; @@ -22,9 +22,9 @@ void MovieManager::Init(IDriver3D *pDriver) void MovieManager::Destroy() { m_MoviePlayers.clear(); - - vector::iterator iMoviePlayer = m_MoviePlayerList.begin(); - vector::iterator eMoviePlayer = m_MoviePlayerList.end(); + + std::vector::iterator iMoviePlayer = m_MoviePlayerList.begin(); + std::vector::iterator eMoviePlayer = m_MoviePlayerList.end(); for (; iMoviePlayer != eMoviePlayer; ++iMoviePlayer) { xlDelete (*iMoviePlayer); diff --git a/movieplayback/MovieManager.h b/movieplayback/MovieManager.h index 232fd2b..b93a999 100644 --- a/movieplayback/MovieManager.h +++ b/movieplayback/MovieManager.h @@ -3,11 +3,11 @@ #include "../CommonTypes.h" #include "MovieTypes.h" + #include #include #include -using namespace std; class MoviePlayer; class Archive; class IDriver3D; @@ -26,8 +26,8 @@ class MovieManager static void RenderMovie(float fDeltaTime); private: - static map m_MoviePlayers; - static vector m_MoviePlayerList; + static std::map m_MoviePlayers; + static std::vector m_MoviePlayerList; static Archive *m_apArchives[2]; static MoviePlayer *m_pCurPlayer; static IDriver3D *m_pDriver; diff --git a/os/Input.cpp b/os/Input.cpp index 6664d5d..052da79 100644 --- a/os/Input.cpp +++ b/os/Input.cpp @@ -9,8 +9,8 @@ #endif int8_t Input::m_aKeyState[512]; -vector Input::m_KeyDownCB; -vector Input::m_CharDownCB; +std::vector Input::m_KeyDownCB; +std::vector Input::m_CharDownCB; float Input::m_fMouseX; float Input::m_fMouseY; float Input::m_fMouseDeltaX; @@ -33,16 +33,16 @@ void Input::Init() void Input::Destroy() { - vector::iterator iKeyCB = m_KeyDownCB.begin(); - vector::iterator eKeyCB = m_KeyDownCB.end(); + std::vector::iterator iKeyCB = m_KeyDownCB.begin(); + std::vector::iterator eKeyCB = m_KeyDownCB.end(); for (; iKeyCB != eKeyCB; ++iKeyCB) { xlDelete (*iKeyCB); } m_KeyDownCB.clear(); - vector::iterator iCharCB = m_CharDownCB.begin(); - vector::iterator eCharCB = m_CharDownCB.end(); + std::vector::iterator iCharCB = m_CharDownCB.begin(); + std::vector::iterator eCharCB = m_CharDownCB.end(); for (; iCharCB != eCharCB; ++iCharCB) { xlDelete (*iCharCB); @@ -63,8 +63,8 @@ void Input::SetKeyDown(int32_t key) key = s_OS_KeyMapping[key]; //now fire off any callbacks... - vector::iterator iter = m_KeyDownCB.begin(); - vector::iterator end = m_KeyDownCB.end(); + std::vector::iterator iter = m_KeyDownCB.begin(); + std::vector::iterator end = m_KeyDownCB.end(); for (; iter != end; ++iter) { KeyDownCB_t *pKeyDownCB = *iter; @@ -97,8 +97,8 @@ void Input::SetCharacterDown(char c) if ( c >= 32 && c < 127 ) { //fire off any "character" callbacks. - vector::iterator iter = m_CharDownCB.begin(); - vector::iterator end = m_CharDownCB.end(); + std::vector::iterator iter = m_CharDownCB.begin(); + std::vector::iterator end = m_CharDownCB.end(); for (; iter != end; ++iter) { KeyDownCB_t *pCharDownCB = *iter; diff --git a/os/Input.h b/os/Input.h index 723e3b6..0658afb 100644 --- a/os/Input.h +++ b/os/Input.h @@ -3,7 +3,6 @@ #include "VirtualKeys.h" #include -using std::vector; typedef void (*Input_KeyDownCB)(int32_t); @@ -53,8 +52,8 @@ class Input } KeyDownCB_t; static int8_t m_aKeyState[512]; - static vector m_KeyDownCB; - static vector m_CharDownCB; + static std::vector m_KeyDownCB; + static std::vector m_CharDownCB; static float m_fMouseX; static float m_fMouseY; static float m_fMouseDeltaX; diff --git a/os/Win/Clock_Win.cpp b/os/Win/Clock_Win.cpp index f6d738d..88d3365 100644 --- a/os/Win/Clock_Win.cpp +++ b/os/Win/Clock_Win.cpp @@ -1,7 +1,7 @@ #include "../Clock.h" #include -#include -#include +#include +#include #define SEC_TO_uS 1000000.0 diff --git a/os/linux/Clock_Linux.cpp b/os/linux/Clock_Linux.cpp index 70a944e..023b282 100644 --- a/os/linux/Clock_Linux.cpp +++ b/os/linux/Clock_Linux.cpp @@ -1,7 +1,7 @@ #include "../Clock.h" #include -#include -#include +#include +#include #define SEC_TO_uS 1000000.0 diff --git a/plugin_framework/DynamicLibrary.cpp b/plugin_framework/DynamicLibrary.cpp index 66db430..d748620 100644 --- a/plugin_framework/DynamicLibrary.cpp +++ b/plugin_framework/DynamicLibrary.cpp @@ -13,7 +13,7 @@ #if PLATFORM_OSX static string dynamicLibraryExtension("dylib"); #elif PLATFORM_LINUX - static string dynamicLibraryExtension("so"); + static std::string dynamicLibraryExtension("so"); #elif PLATFORM_WIN static string dynamicLibraryExtension("dll"); #endif @@ -35,7 +35,7 @@ DynamicLibrary::~DynamicLibrary() } } -DynamicLibrary *DynamicLibrary::Load(const string& name, string& errorString) +DynamicLibrary *DynamicLibrary::Load(const std::string& name, std::string& errorString) { if (name.empty()) { @@ -44,14 +44,14 @@ DynamicLibrary *DynamicLibrary::Load(const string& name, string& errorString) } void *handle = NULL; - string path = name + "." + dynamicLibraryExtension; + std::string path = name + "." + dynamicLibraryExtension; #if PLATFORM_WIN handle = LoadLibraryA( path.c_str() ); if ( !handle ) { DWORD errorCode = GetLastError(); - stringstream ss; + std::stringstream ss; ss << std::string("LoadLibrary(") << name << std::string(") Failed. errorCode: ") << errorCode; @@ -63,7 +63,7 @@ DynamicLibrary *DynamicLibrary::Load(const string& name, string& errorString) handle = dlopen( path.c_str(), RTLD_NOW ); if (!handle) { - string dlErrorString; + std::string dlErrorString; const char *zErrorString = dlerror(); if (zErrorString) dlErrorString = zErrorString; diff --git a/plugin_framework/DynamicLibrary.h b/plugin_framework/DynamicLibrary.h index eba5ac8..b12123e 100644 --- a/plugin_framework/DynamicLibrary.h +++ b/plugin_framework/DynamicLibrary.h @@ -2,16 +2,15 @@ #define DYNAMIC_LIBRARY_H #include -using namespace std; class DynamicLibrary { public: - static DynamicLibrary *Load(const string& path, string& errorString); + static DynamicLibrary *Load(const std::string& path, std::string& errorString); ~DynamicLibrary(); - void *GetSymbol(const string& name); + void *GetSymbol(const std::string& name); private: DynamicLibrary(); diff --git a/plugin_framework/PluginManager.cpp b/plugin_framework/PluginManager.cpp index bd6c7fb..ac2de95 100644 --- a/plugin_framework/PluginManager.cpp +++ b/plugin_framework/PluginManager.cpp @@ -22,13 +22,13 @@ void PluginManager::Destroy() UnloadGame(); } -bool PluginManager::InitGame(const string& path) +bool PluginManager::InitGame(const std::string& path) { //first unload the game, since we can only have one at a time right now. UnloadGame(); //load the game lib. - string errorString; + std::string errorString; m_pGameLib = DynamicLibrary::Load(path, errorString); if (!m_pGameLib) // not a dynamic library? return false; diff --git a/plugin_framework/PluginManager.h b/plugin_framework/PluginManager.h index 39ce8cd..68a1264 100644 --- a/plugin_framework/PluginManager.h +++ b/plugin_framework/PluginManager.h @@ -2,7 +2,6 @@ #define PLUGIN_MANAGER_H #include -using namespace std; class DynamicLibrary; struct XLEngine_Plugin_API; @@ -14,7 +13,7 @@ class PluginManager static bool Init(XLEngine_Plugin_API *pluginAPI); static void Destroy(); - static bool InitGame(const string& path); + static bool InitGame(const std::string& path); static void UnloadGame(); private: diff --git a/procedural/Noise.cpp b/procedural/Noise.cpp index 6b7ef35..424a412 100644 --- a/procedural/Noise.cpp +++ b/procedural/Noise.cpp @@ -1,5 +1,5 @@ #include "Noise.h" -#include +#include namespace Noise { diff --git a/procedural/ProceduralFunc.cpp b/procedural/ProceduralFunc.cpp index 5f485c0..352131e 100644 --- a/procedural/ProceduralFunc.cpp +++ b/procedural/ProceduralFunc.cpp @@ -1,7 +1,7 @@ #include "ProceduralFunc.h" #include "Noise.h" #include "../math/Math.h" -#include +#include namespace ProceduralFunc { diff --git a/render/CommandBuffer.cpp b/render/CommandBuffer.cpp index 8aa2647..0dc4b9b 100644 --- a/render/CommandBuffer.cpp +++ b/render/CommandBuffer.cpp @@ -2,8 +2,8 @@ #include "IDriver3D.h" #include "VertexBuffer.h" #include -#include -#include +#include +#include uint8_t *CommandBuffer::s_pCommandBuffer[ CommandBuffer::BUFFER_COUNT ]; uint32_t CommandBuffer::s_uReadBuffer; diff --git a/render/CommandBuffer.h b/render/CommandBuffer.h index 7d0eb8c..1cea7a4 100644 --- a/render/CommandBuffer.h +++ b/render/CommandBuffer.h @@ -6,15 +6,13 @@ #include "../math/Vector3.h" #include "../math/Vector4.h" #include "../math/Matrix.h" + #include class IDriver3D; class VertexBuffer; class IndexBuffer; -using namespace std; - - class CommandBuffer { public: diff --git a/render/Driver3D_OGL.cpp b/render/Driver3D_OGL.cpp index b6d47b4..c9636e8 100644 --- a/render/Driver3D_OGL.cpp +++ b/render/Driver3D_OGL.cpp @@ -2,7 +2,7 @@ #include "../Engine.h" #include "../math/Math.h" #include "IndexBuffer.h" -#include +#include #include #if PLATFORM_WIN //we have to include Windows.h before gl.h on Windows platforms. diff --git a/render/Driver3D_OGL.h b/render/Driver3D_OGL.h index 39c4f41..08cc928 100644 --- a/render/Driver3D_OGL.h +++ b/render/Driver3D_OGL.h @@ -6,7 +6,7 @@ #include "../math/Matrix.h" #include "../math/Vector2.h" #include "../math/Vector4.h" -#include +#include class IndexBuffer; diff --git a/render/Driver3D_Soft.cpp b/render/Driver3D_Soft.cpp index 07f4235..abad1a8 100644 --- a/render/Driver3D_Soft.cpp +++ b/render/Driver3D_Soft.cpp @@ -1,5 +1,4 @@ #include "Driver3D_Soft.h" -#include #include "../Engine.h" #include "../math/Math.h" #include "../math/FixedPoint.h" @@ -10,9 +9,11 @@ #include "triangleRasterizer/DrawScanline.h" #include "IndexBuffer.h" #include "../os/Clock.h" -#include + +#include #include -#include +#include +#include #include #if PLATFORM_WIN //we have to include Windows.h before gl.h on Windows platforms. @@ -108,8 +109,8 @@ Driver3D_Soft::~Driver3D_Soft() //delete textures. if ( m_Textures.size() ) { - vector::iterator iTex = m_Textures.begin(); - vector::iterator eTex = m_Textures.end(); + std::vector::iterator iTex = m_Textures.begin(); + std::vector::iterator eTex = m_Textures.end(); for (; iTex != eTex; ++iTex) { Texture *pTex = *iTex; diff --git a/render/Driver3D_Soft.h b/render/Driver3D_Soft.h index e987673..fbabaf6 100644 --- a/render/Driver3D_Soft.h +++ b/render/Driver3D_Soft.h @@ -6,7 +6,7 @@ #include "../math/Matrix.h" #include "../math/Vector2.h" #include "../math/Vector4.h" -#include +#include #include class IndexBuffer; @@ -18,8 +18,6 @@ struct TriGradients; struct TriEdge; class Camera; -using namespace std; - struct Texture { int32_t m_nWidth; @@ -119,9 +117,9 @@ class Driver3D_Soft : public IDriver3D void GenerateMips(uint32_t uWidth, uint32_t uHeight, uint8_t *pData); private: - vector m_Textures; - vector m_VBO; - vector m_IBO; + std::vector m_Textures; + std::vector m_VBO; + std::vector m_IBO; int32_t m_nBitDepth; Matrix m_ProjMtx; Matrix m_ViewProj; diff --git a/render/Font.cpp b/render/Font.cpp index 7a59a36..071dd4c 100644 --- a/render/Font.cpp +++ b/render/Font.cpp @@ -2,9 +2,10 @@ #include "FontManager.h" #include "TextureCache.h" #include "IDriver3D.h" -#include -#include -#include + +#include +#include +#include #include XLFont::XLFont(void) @@ -16,7 +17,7 @@ XLFont::~XLFont(void) { } -bool XLFont::Load( const string& szFile, IDriver3D *pDriver ) +bool XLFont::Load( const std::string& szFile, IDriver3D *pDriver ) { bool bResult = false; @@ -145,7 +146,7 @@ bool XLFont::Load( const string& szFile, IDriver3D *pDriver ) return bResult; } -uint32_t XLFont::ComputePixelPos(const string& szString, uint32_t uPos) +uint32_t XLFont::ComputePixelPos(const std::string& szString, uint32_t uPos) { const char *pszText = szString.c_str(); int32_t nCurX = 0; @@ -156,7 +157,7 @@ uint32_t XLFont::ComputePixelPos(const string& szString, uint32_t uPos) return (uint32_t)nCurX; } -int32_t XLFont::FillVB(int32_t x, int32_t y, const string& szString, FontVertex *pVB_Data) +int32_t XLFont::FillVB(int32_t x, int32_t y, const std::string& szString, FontVertex *pVB_Data) { int32_t nCurX = x; int32_t nCurY = y; diff --git a/render/Font.h b/render/Font.h index f5459c2..954b509 100644 --- a/render/Font.h +++ b/render/Font.h @@ -6,8 +6,6 @@ #include "../math/Vector3.h" #include -using namespace std; - class IDriver3D; struct FontVertex @@ -45,11 +43,11 @@ class XLFont XLFont(void); ~XLFont(void); - bool Load( const string& szFile, IDriver3D *pDriver ); + bool Load( const std::string& szFile, IDriver3D *pDriver ); TextureHandle GetTexture() { return m_hTex; } - int32_t FillVB(int32_t x, int32_t y, const string& szString, FontVertex *pVB_Data); + int32_t FillVB(int32_t x, int32_t y, const std::string& szString, FontVertex *pVB_Data); - uint32_t ComputePixelPos(const string& szString, uint32_t uPos); + uint32_t ComputePixelPos(const std::string& szString, uint32_t uPos); private: TextureHandle m_hTex; diff --git a/render/FontManager.cpp b/render/FontManager.cpp index 9d99632..ef2b1c1 100644 --- a/render/FontManager.cpp +++ b/render/FontManager.cpp @@ -4,8 +4,9 @@ #include "VertexBuffer.h" #include "IndexBuffer.h" #include "TextureCache.h" -#include -#include + +#include +#include #include IDriver3D *FontManager::m_pDriver; @@ -14,9 +15,9 @@ FontManager::FontMap FontManager::m_Fonts; VertexBuffer *FontManager::m_pVB; IndexBuffer *FontManager::m_pIB; -string FontManager::m_FontPath; +std::string FontManager::m_FontPath; -bool FontManager::Init(const string& szFontPath, IDriver3D *pDriver) +bool FontManager::Init(const std::string& szFontPath, IDriver3D *pDriver) { m_pDriver = pDriver; m_FontPath = szFontPath; @@ -92,7 +93,7 @@ void FontManager::Destroy() } } -XLFont *FontManager::LoadFont(const string& szFile) +XLFont *FontManager::LoadFont(const std::string& szFile) { // Don't load the same font twice FontMap::iterator iFont = m_Fonts.find(szFile); @@ -135,7 +136,7 @@ void FontManager::EndTextRendering() m_pDriver->SetColor( &Vector4::One ); } -void FontManager::RenderString(int32_t x, int32_t y, const string& szString, XLFont *pFont, Vector4 *pColor) +void FontManager::RenderString(int32_t x, int32_t y, const std::string& szString, XLFont *pFont, Vector4 *pColor) { TextureHandle hTex = pFont->GetTexture(); @@ -159,7 +160,7 @@ void FontManager::RenderString(int32_t x, int32_t y, const string& szString, XLF } } -uint32_t FontManager::GetLength(const string& szString, uint32_t uPosInString, XLFont *pFont) +uint32_t FontManager::GetLength(const std::string& szString, uint32_t uPosInString, XLFont *pFont) { uint32_t uPos = uPosInString; uint32_t uStrLen = (uint32_t)szString.size(); diff --git a/render/FontManager.h b/render/FontManager.h index 2346076..884ea04 100644 --- a/render/FontManager.h +++ b/render/FontManager.h @@ -7,8 +7,6 @@ #include #include -using namespace std; - class XLFont; class IDriver3D; class VertexBuffer; @@ -18,20 +16,20 @@ class IndexBuffer; class FontManager { - typedef map FontMap; + typedef std::map FontMap; public: - static bool Init(const string& szFontPath, IDriver3D *pDriver); + static bool Init(const std::string& szFontPath, IDriver3D *pDriver); static void Destroy(); - static XLFont *LoadFont(const string& szFile); + static XLFont *LoadFont(const std::string& szFile); //Set render states for text rendering. static void BeginTextRendering(); static void EndTextRendering(); //Render a string at location(x,y) using font pFont - static void RenderString(int32_t x, int32_t y, const string& szString, XLFont *pFont, Vector4 *pColor=&Vector4::One); - static uint32_t GetLength(const string& szString, uint32_t uPosInString, XLFont *pFont); + static void RenderString(int32_t x, int32_t y, const std::string& szString, XLFont *pFont, Vector4 *pColor=&Vector4::One); + static uint32_t GetLength(const std::string& szString, uint32_t uPosInString, XLFont *pFont); private: static IDriver3D *m_pDriver; @@ -39,7 +37,7 @@ class FontManager static IndexBuffer *m_pIB; static FontMap m_Fonts; - static string m_FontPath; + static std::string m_FontPath; }; #endif //FONTMANAGER_H diff --git a/render/IDriver3D.cpp b/render/IDriver3D.cpp index 20ad5dd..e470247 100644 --- a/render/IDriver3D.cpp +++ b/render/IDriver3D.cpp @@ -1,6 +1,6 @@ #include "IDriver3D.h" #include "../math/Vector3.h" -#include +#include #include float LightObject::s_fAnimOffset0 = 0.0f; diff --git a/render/IDriver3D.h b/render/IDriver3D.h index ac35d5d..c39729e 100644 --- a/render/IDriver3D.h +++ b/render/IDriver3D.h @@ -6,7 +6,7 @@ #include "../math/Vector2.h" #include "../math/Vector3.h" #include "../math/Vector4.h" -#include +#include class IndexBuffer; diff --git a/render/ImageLoader.cpp b/render/ImageLoader.cpp index 546e01f..1af54ff 100644 --- a/render/ImageLoader.cpp +++ b/render/ImageLoader.cpp @@ -1,7 +1,7 @@ #include "ImageLoader.h" -#include +#include #include -#include +#include #define IL_USE_PRAGMA_LIBS #include diff --git a/render/ImageLoader.h b/render/ImageLoader.h index af006d4..5dfb106 100644 --- a/render/ImageLoader.h +++ b/render/ImageLoader.h @@ -4,7 +4,6 @@ #include "../CommonTypes.h" #include -using namespace std; class ImageLoader { diff --git a/render/IndexBuffer.cpp b/render/IndexBuffer.cpp index f0d2613..cf6e8af 100644 --- a/render/IndexBuffer.cpp +++ b/render/IndexBuffer.cpp @@ -1,7 +1,7 @@ #include "IndexBuffer.h" #include "IDriver3D.h" -#include -#include +#include +#include #include IndexBuffer::IndexBuffer(IDriver3D *pDriver) diff --git a/render/Mesh.cpp b/render/Mesh.cpp index 8a684dc..3934963 100644 --- a/render/Mesh.cpp +++ b/render/Mesh.cpp @@ -4,8 +4,8 @@ #include "VertexBuffer.h" #include "IndexBuffer.h" #include "../world/Object.h" -#include -#include +#include +#include #include Mesh::Mesh() diff --git a/render/MeshCache.cpp b/render/MeshCache.cpp index 20fee14..376bf71 100644 --- a/render/MeshCache.cpp +++ b/render/MeshCache.cpp @@ -1,8 +1,8 @@ #include "MeshCache.h" #include "Mesh.h" #include "../world/MeshCollision.h" -#include -#include +#include +#include #include MeshCache::MeshMap MeshCache::m_MeshMap; @@ -32,7 +32,7 @@ void MeshCache::Destroy() m_MeshCollisionMap.clear(); } -Mesh *MeshCache::GetMesh(const string& sName) +Mesh *MeshCache::GetMesh(const std::string& sName) { Mesh *pMesh = NULL; MeshMap::iterator iMesh = m_MeshMap.find(sName); @@ -49,7 +49,7 @@ Mesh *MeshCache::GetMesh(const string& sName) return pMesh; } -MeshCollision *MeshCache::GetMeshCollision(const string& sName) +MeshCollision *MeshCache::GetMeshCollision(const std::string& sName) { MeshCollision *pMeshCollision = NULL; MeshCollisionMap::iterator iMeshCol = m_MeshCollisionMap.find(sName); diff --git a/render/MeshCache.h b/render/MeshCache.h index 3716970..9d425a5 100644 --- a/render/MeshCache.h +++ b/render/MeshCache.h @@ -6,22 +6,20 @@ #include #include -using namespace std; - class Mesh; class MeshCollision; class MeshCache { - typedef map MeshMap; - typedef map MeshCollisionMap; + typedef std::map MeshMap; + typedef std::map MeshCollisionMap; public: static bool Init(); static void Destroy(); - static Mesh *GetMesh(const string& sName); - static MeshCollision *GetMeshCollision(const string& sName); + static Mesh *GetMesh(const std::string& sName); + static MeshCollision *GetMeshCollision(const std::string& sName); private: static MeshMap m_MeshMap; diff --git a/render/RenderQue.cpp b/render/RenderQue.cpp index cce4a68..c17291d 100644 --- a/render/RenderQue.cpp +++ b/render/RenderQue.cpp @@ -5,15 +5,15 @@ #include "IndexBuffer.h" #include -#include +#include #include IDriver3D *RenderQue::m_pDriver; RenderQuad *RenderQue::m_pQuads=NULL; uint32_t RenderQue::m_uQuadCnt; -vector RenderQue::m_apRenderBuckets[RBUCKET_COUNT]; -vector RenderQue::m_RenderEntryPool; +std::vector RenderQue::m_apRenderBuckets[RBUCKET_COUNT]; +std::vector RenderQue::m_RenderEntryPool; uint32_t RenderQue::m_uRenderEntryLoc; int RenderQue::m_nCurLightCnt; @@ -130,8 +130,8 @@ void RenderQue::Render() m_pDriver->EnableCulling(true); m_pDriver->SetWorldMatrix(NULL, 0, 0); //go through the list. - vector::iterator iEntry = m_apRenderBuckets[RBUCKET_OPAQUE].begin(); - vector::iterator eEntry = m_apRenderBuckets[RBUCKET_OPAQUE].end(); + std::vector::iterator iEntry = m_apRenderBuckets[RBUCKET_OPAQUE].begin(); + std::vector::iterator eEntry = m_apRenderBuckets[RBUCKET_OPAQUE].end(); for (; iEntry != eEntry; ++iEntry) { const MaterialEntry *pEntry = *iEntry; diff --git a/render/RenderQue.h b/render/RenderQue.h index 76fc8a9..7c4ed5e 100644 --- a/render/RenderQue.h +++ b/render/RenderQue.h @@ -6,6 +6,7 @@ #include "../math/Vector3.h" #include "../math/Vector4.h" #include "../math/Matrix.h" + #include class IDriver3D; @@ -13,8 +14,6 @@ class VertexBuffer; class IndexBuffer; class LightObject; -using namespace std; - struct RenderQuad { TextureHandle hTex; @@ -76,8 +75,8 @@ class RenderQue static RenderQuad *m_pQuads; static uint32_t m_uQuadCnt; - static vector m_apRenderBuckets[RBUCKET_COUNT]; - static vector m_RenderEntryPool; + static std::vector m_apRenderBuckets[RBUCKET_COUNT]; + static std::vector m_RenderEntryPool; static uint32_t m_uRenderEntryLoc; static int m_nCurLightCnt; diff --git a/render/TextureCache.cpp b/render/TextureCache.cpp index b113fa0..a13529b 100644 --- a/render/TextureCache.cpp +++ b/render/TextureCache.cpp @@ -5,10 +5,11 @@ #include "../fileformats/ArchiveManager.h" #include "../fileformats/TextureLoader.h" #include "../memory/ScratchPad.h" -#include -#include + +#include +#include #include -#include +#include ImageLoader *TextureCache::m_pLoader; IDriver3D *TextureCache::m_pDriver; @@ -22,7 +23,7 @@ uint32_t TextureCache::m_uPrevTexHeight= 0; float TextureCache::m_fRelSizeX = 1.0f; float TextureCache::m_fRelSizeY = 1.0f; void *TextureCache::m_pPrevExtraData = NULL; -string TextureCache::m_SavedPath; +std::string TextureCache::m_SavedPath; bool TextureCache::Init(IDriver3D *pDriver) { @@ -46,7 +47,7 @@ void TextureCache::Destroy() m_TextureMap.clear(); } -void TextureCache::SetPath(const string& path) +void TextureCache::SetPath(const std::string& path) { if ( m_pLoader ) { @@ -64,7 +65,7 @@ void TextureCache::RestorePath() m_pLoader->SetPath( m_SavedPath.c_str() ); } -TextureHandle TextureCache::LoadTexture(const string& szFile, bool bGenMips) +TextureHandle TextureCache::LoadTexture(const std::string& szFile, bool bGenMips) { // Don't load the same texture twice TextureMap::iterator iTexMap = m_TextureMap.find(szFile); @@ -147,7 +148,7 @@ TextureHandle TextureCache::LoadTextureFromMem(const uint8_t *pImgBuffer, uint32 return XL_INVALID_TEXTURE; } -TextureHandle TextureCache::LoadTextureFromMem_Pal(const uint8_t *pImgBuffer, uint32_t uPalIndex, uint32_t width, uint32_t height, const string& sName, bool bGenMips) +TextureHandle TextureCache::LoadTextureFromMem_Pal(const uint8_t *pImgBuffer, uint32_t uPalIndex, uint32_t width, uint32_t height, const std::string& sName, bool bGenMips) { // We have to modify the file name a little... char szName[32]; @@ -211,7 +212,7 @@ TextureHandle TextureCache::GameFile_LoadTexture_TexList_API(uint32_t uTextureTy return GameFile_LoadTexture_TexList(uTextureType, uPalIndex, uArchiveType, pszArchive, pszFile, nRecord, bGenMips!=0); } -TextureHandle TextureCache::GameFile_LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const string& sArchive, const string& szFile, int32_t nRecord, bool bGenMips) +TextureHandle TextureCache::GameFile_LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const std::string& sArchive, const std::string& szFile, int32_t nRecord, bool bGenMips) { // We have to modify the file name a little... char szName[32]; @@ -332,7 +333,7 @@ TextureHandle TextureCache::GameFile_LoadTexture_TexList(uint32_t uTextureType, return XL_INVALID_TEXTURE; } -TextureHandle TextureCache::GameFile_LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const string& sArchive, const string& szFile, bool bGenMips, bool bCopyPal) +TextureHandle TextureCache::GameFile_LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const std::string& sArchive, const std::string& szFile, bool bGenMips, bool bCopyPal) { // We have to modify the file name a little... char szName[32]; diff --git a/render/TextureCache.h b/render/TextureCache.h index b8cfcf9..b5ee7bd 100644 --- a/render/TextureCache.h +++ b/render/TextureCache.h @@ -6,8 +6,6 @@ #include #include -using namespace std; - class ImageLoader; class IDriver3D; @@ -24,20 +22,20 @@ class TextureCache float fRelSizeY; void *pExtraData; }; - typedef map TextureMap; + typedef std::map TextureMap; public: static bool Init(IDriver3D *pDriver); static void Destroy(); - static void SetPath(const string& path); + static void SetPath(const std::string& path); static void SavePath(); static void RestorePath(); - static TextureHandle LoadTexture(const string& szFile, bool bGenMips=true); - static TextureHandle GameFile_LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const string& sArchive, const string& szFile, bool bGenMips=true, bool bCopyPal=false); - static TextureHandle GameFile_LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const string& sArchive, const string& szFile, int32_t nRecord, bool bGenMips=true); + static TextureHandle LoadTexture(const std::string& szFile, bool bGenMips=true); + static TextureHandle GameFile_LoadTexture(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const std::string& sArchive, const std::string& szFile, bool bGenMips=true, bool bCopyPal=false); + static TextureHandle GameFile_LoadTexture_TexList(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const std::string& sArchive, const std::string& szFile, int32_t nRecord, bool bGenMips=true); static TextureHandle GameFile_LoadTexture_TexList_API(uint32_t uTextureType, uint32_t uPalIndex, uint32_t uArchiveType, const char *pszArchive, const char *pszFile, int32_t nRecord, XL_BOOL bGenMips); - static TextureHandle LoadTextureFromMem_Pal(const uint8_t *pImgBuffer, uint32_t uPalIndex, uint32_t width, uint32_t height, const string& sName, bool bGenMips=true); + static TextureHandle LoadTextureFromMem_Pal(const uint8_t *pImgBuffer, uint32_t uPalIndex, uint32_t width, uint32_t height, const std::string& sName, bool bGenMips=true); static TextureHandle LoadTextureFromMem(const uint8_t *pImgBuffer, uint32_t width, uint32_t height, bool bGenMips=true); static void FreeTexture(TextureHandle hTex); static void GetTextureSize( int32_t& nOffsX, int32_t& nOffsY, uint32_t& uTexWidth, uint32_t& uTexHeight, float& fRelSizeX, float& fRelSizeY ); @@ -47,7 +45,7 @@ class TextureCache static ImageLoader *m_pLoader; static IDriver3D *m_pDriver; - static string m_SavedPath; + static std::string m_SavedPath; static TextureMap m_TextureMap; //dimensions of the previously loaded texture. diff --git a/render/VertexBuffer.cpp b/render/VertexBuffer.cpp index 1f18e7a..2f5a12e 100644 --- a/render/VertexBuffer.cpp +++ b/render/VertexBuffer.cpp @@ -1,7 +1,7 @@ #include "VertexBuffer.h" #include "IDriver3D.h" -#include -#include +#include +#include #include VertexBuffer::VertexBuffer(IDriver3D *pDriver) diff --git a/render/linux/Driver3D_OGL_Linux.cpp b/render/linux/Driver3D_OGL_Linux.cpp index fd46faa..384bb20 100644 --- a/render/linux/Driver3D_OGL_Linux.cpp +++ b/render/linux/Driver3D_OGL_Linux.cpp @@ -2,7 +2,7 @@ #include "SDL.h" -#include +#include namespace { diff --git a/render/triangleRasterizer/DrawScanline.cpp b/render/triangleRasterizer/DrawScanline.cpp index 54eae67..8e8d1f3 100644 --- a/render/triangleRasterizer/DrawScanline.cpp +++ b/render/triangleRasterizer/DrawScanline.cpp @@ -5,9 +5,9 @@ #include "../../math/Math.h" #include "../../math/FixedPoint.h" #include "../../fileformats/TextureLoader.h" -#include +#include #include -#include +#include namespace DrawScanline { diff --git a/render/triangleRasterizer/DrawScanline.h b/render/triangleRasterizer/DrawScanline.h index 40179c1..f7bf544 100644 --- a/render/triangleRasterizer/DrawScanline.h +++ b/render/triangleRasterizer/DrawScanline.h @@ -7,7 +7,7 @@ #include "../../math/Vector2.h" #include "../../math/Vector4.h" #include "../../math/FixedPoint.h" -#include +#include #define DRAW_FUNC(bpp8, pow2, bilinear, alpha, gouraud, persp) void Draw_##bpp8##_##pow2##_##bilinear##_##alpha##_##gouraud##_##persp##_(const TriGradients& Gradients, TriEdge *pLeft, TriEdge *pRight) diff --git a/render/triangleRasterizer/TriangleRasterizer.cpp b/render/triangleRasterizer/TriangleRasterizer.cpp index 7780995..0b6e9d5 100644 --- a/render/triangleRasterizer/TriangleRasterizer.cpp +++ b/render/triangleRasterizer/TriangleRasterizer.cpp @@ -5,9 +5,9 @@ #include "../../math/Math.h" #include "../../math/FixedPoint.h" #include "../../render/Camera.h" -#include +#include #include -#include +#include #if PLATFORM_WIN //we have to include Windows.h before gl.h on Windows platforms. #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers diff --git a/render/triangleRasterizer/TriangleRasterizer.h b/render/triangleRasterizer/TriangleRasterizer.h index 10ae5d3..c48cdf9 100644 --- a/render/triangleRasterizer/TriangleRasterizer.h +++ b/render/triangleRasterizer/TriangleRasterizer.h @@ -6,7 +6,7 @@ #include "../../math/Vector2.h" #include "../../math/Vector4.h" #include "../../math/FixedPoint.h" -#include +#include struct Texture; struct PolygonData; diff --git a/scriptsystem/ScriptSystem.cpp b/scriptsystem/ScriptSystem.cpp index 8bfea83..c534d93 100644 --- a/scriptsystem/ScriptSystem.cpp +++ b/scriptsystem/ScriptSystem.cpp @@ -4,8 +4,8 @@ #endif //#include "System.h" #include "../ui/XL_Console.h" -#include -#include +#include +#include #include asIScriptEngine *m_Engine; @@ -323,7 +323,7 @@ int ScriptSystem::GetTimer(int timer) return 0; } -void ScriptSystem::System_Print(string &szItem) +void ScriptSystem::System_Print(std::string &szItem) { //System::SetTextDisp( szItem.c_str() ); } @@ -343,7 +343,7 @@ void ScriptSystem::System_EndString() //System::SetTextDisp(_szTempString); } -void ScriptSystem::System_AppendString(string& szStr) +void ScriptSystem::System_AppendString(std::string& szStr) { sprintf(_szTempString, "%s%s", _szTempString, szStr.c_str()); } diff --git a/scriptsystem/ScriptSystem.h b/scriptsystem/ScriptSystem.h index 7e54cef..9b959d3 100644 --- a/scriptsystem/ScriptSystem.h +++ b/scriptsystem/ScriptSystem.h @@ -7,7 +7,6 @@ #include "scriptarray.h" #include -using namespace std; typedef int32_t SHANDLE; @@ -78,11 +77,11 @@ class ScriptSystem //Timers static void SetTimer(int timer, int delay); static int GetTimer(int timer); - static void System_Print(string &szItem); + static void System_Print(std::string &szItem); static void System_PrintIndex(int idx); static void System_StartString(); static void System_EndString(); - static void System_AppendString(string& szStr); + static void System_AppendString(std::string& szStr); static void System_AppendFloat(float fVal); static void System_AppendInt(int iVal); }; diff --git a/scriptsystem/scriptarray.cpp b/scriptsystem/scriptarray.cpp index 803e914..38f71bb 100644 --- a/scriptsystem/scriptarray.cpp +++ b/scriptsystem/scriptarray.cpp @@ -1,8 +1,8 @@ #include -#include -#include -#include -#include // sprintf +#include +#include +#include +#include // sprintf #include "scriptarray.h" diff --git a/scriptsystem/scriptstdstring.cpp b/scriptsystem/scriptstdstring.cpp index 39157bf..f6a066f 100644 --- a/scriptsystem/scriptstdstring.cpp +++ b/scriptsystem/scriptstdstring.cpp @@ -1,62 +1,62 @@ -#include +#include #include #include "scriptstdstring.h" -#include // strstr +#include // strstr -using namespace std; +// using namespace std; BEGIN_AS_NAMESPACE static void StringFactoryGeneric(asIScriptGeneric *gen) { asUINT length = gen->GetArgDWord(0); const char *s = (const char*)gen->GetArgAddress(1); - string str(s, length); + std::string str(s, length); gen->SetReturnObject(&str); } static void ConstructStringGeneric(asIScriptGeneric * gen) { - new (gen->GetObject()) string(); + new (gen->GetObject()) std::string(); } static void CopyConstructStringGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgObject(0)); - new (gen->GetObject()) string(*a); + std::string * a = static_cast(gen->GetArgObject(0)); + new (gen->GetObject()) std::string(*a); } static void DestructStringGeneric(asIScriptGeneric * gen) { - string * ptr = static_cast(gen->GetObject()); - ptr->~string(); + std::string * ptr = static_cast(gen->GetObject()); + ptr->std::string::~string(); } static void AssignStringGeneric(asIScriptGeneric *gen) { - string * a = static_cast(gen->GetArgObject(0)); - string * self = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetArgObject(0)); + std::string * self = static_cast(gen->GetObject()); *self = *a; gen->SetReturnAddress(self); } static void AddAssignStringGeneric(asIScriptGeneric *gen) { - string * a = static_cast(gen->GetArgObject(0)); - string * self = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetArgObject(0)); + std::string * self = static_cast(gen->GetObject()); *self += *a; gen->SetReturnAddress(self); } static void StringEqualGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a == *b); } static void StringEqualsGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); - string * b = static_cast(gen->GetArgAddress(0)); + std::string * a = static_cast(gen->GetObject()); + std::string * b = static_cast(gen->GetArgAddress(0)); *(bool*)gen->GetAddressOfReturnLocation() = (*a == *b); } static void StringCmpGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); - string * b = static_cast(gen->GetArgAddress(0)); + std::string * a = static_cast(gen->GetObject()); + std::string * b = static_cast(gen->GetArgAddress(0)); int cmp = 0; if( *a < *b ) cmp = -1; @@ -66,55 +66,55 @@ static void StringCmpGeneric(asIScriptGeneric * gen) { } static void StringNotEqualGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a != *b); } static void StringLEqualGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a <= *b); } static void StringGEqualGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a >= *b); } static void StringLessThanGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a < *b); } static void StringGreaterThanGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetArgAddress(0)); - string * b = static_cast(gen->GetArgAddress(1)); + std::string * a = static_cast(gen->GetArgAddress(0)); + std::string * b = static_cast(gen->GetArgAddress(1)); *(bool*)gen->GetAddressOfReturnLocation() = (*a > *b); } static void StringAddGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); - string * b = static_cast(gen->GetArgAddress(0)); - string ret_val = *a + *b; + std::string * a = static_cast(gen->GetObject()); + std::string * b = static_cast(gen->GetArgAddress(0)); + std::string ret_val = *a + *b; gen->SetReturnObject(&ret_val); } static void StringLengthGeneric(asIScriptGeneric * gen) { - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); *static_cast(gen->GetAddressOfReturnLocation()) = (asUINT)self->length(); } static void StringResizeGeneric(asIScriptGeneric * gen) { - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); self->resize(*static_cast(gen->GetAddressOfArg(0))); } static void StringCharAtGeneric(asIScriptGeneric * gen) { unsigned int index = gen->GetArgDWord(0); - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); if (index >= self->size()) { // Set a script exception @@ -130,7 +130,7 @@ static void StringCharAtGeneric(asIScriptGeneric * gen) { static void AssignInt2StringGeneric(asIScriptGeneric *gen) { int *a = static_cast(gen->GetAddressOfArg(0)); - string *self = static_cast(gen->GetObject()); + std::string *self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self = sstr.str(); @@ -140,7 +140,7 @@ static void AssignInt2StringGeneric(asIScriptGeneric *gen) static void AssignUInt2StringGeneric(asIScriptGeneric *gen) { unsigned int *a = static_cast(gen->GetAddressOfArg(0)); - string *self = static_cast(gen->GetObject()); + std::string *self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self = sstr.str(); @@ -150,7 +150,7 @@ static void AssignUInt2StringGeneric(asIScriptGeneric *gen) static void AssignDouble2StringGeneric(asIScriptGeneric *gen) { double *a = static_cast(gen->GetAddressOfArg(0)); - string *self = static_cast(gen->GetObject()); + std::string *self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self = sstr.str(); @@ -160,7 +160,7 @@ static void AssignDouble2StringGeneric(asIScriptGeneric *gen) static void AssignBool2StringGeneric(asIScriptGeneric *gen) { bool *a = static_cast(gen->GetAddressOfArg(0)); - string *self = static_cast(gen->GetObject()); + std::string *self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << (*a ? "true" : "false"); *self = sstr.str(); @@ -169,7 +169,7 @@ static void AssignBool2StringGeneric(asIScriptGeneric *gen) static void AddAssignDouble2StringGeneric(asIScriptGeneric * gen) { double * a = static_cast(gen->GetAddressOfArg(0)); - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self += sstr.str(); @@ -178,7 +178,7 @@ static void AddAssignDouble2StringGeneric(asIScriptGeneric * gen) { static void AddAssignInt2StringGeneric(asIScriptGeneric * gen) { int * a = static_cast(gen->GetAddressOfArg(0)); - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self += sstr.str(); @@ -187,7 +187,7 @@ static void AddAssignInt2StringGeneric(asIScriptGeneric * gen) { static void AddAssignUInt2StringGeneric(asIScriptGeneric * gen) { unsigned int * a = static_cast(gen->GetAddressOfArg(0)); - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a; *self += sstr.str(); @@ -196,7 +196,7 @@ static void AddAssignUInt2StringGeneric(asIScriptGeneric * gen) { static void AddAssignBool2StringGeneric(asIScriptGeneric * gen) { bool * a = static_cast(gen->GetAddressOfArg(0)); - string * self = static_cast(gen->GetObject()); + std::string * self = static_cast(gen->GetObject()); std::stringstream sstr; sstr << (*a ? "true" : "false"); *self += sstr.str(); @@ -204,7 +204,7 @@ static void AddAssignBool2StringGeneric(asIScriptGeneric * gen) { } static void AddString2DoubleGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetObject()); double * b = static_cast(gen->GetAddressOfArg(0)); std::stringstream sstr; sstr << *a << *b; @@ -213,7 +213,7 @@ static void AddString2DoubleGeneric(asIScriptGeneric * gen) { } static void AddString2IntGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetObject()); int * b = static_cast(gen->GetAddressOfArg(0)); std::stringstream sstr; sstr << *a << *b; @@ -222,7 +222,7 @@ static void AddString2IntGeneric(asIScriptGeneric * gen) { } static void AddString2UIntGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetObject()); unsigned int * b = static_cast(gen->GetAddressOfArg(0)); std::stringstream sstr; sstr << *a << *b; @@ -231,7 +231,7 @@ static void AddString2UIntGeneric(asIScriptGeneric * gen) { } static void AddString2BoolGeneric(asIScriptGeneric * gen) { - string * a = static_cast(gen->GetObject()); + std::string * a = static_cast(gen->GetObject()); bool * b = static_cast(gen->GetAddressOfArg(0)); std::stringstream sstr; sstr << *a << (*b ? "true" : "false"); @@ -241,7 +241,7 @@ static void AddString2BoolGeneric(asIScriptGeneric * gen) { static void AddDouble2StringGeneric(asIScriptGeneric * gen) { double* a = static_cast(gen->GetAddressOfArg(0)); - string * b = static_cast(gen->GetObject()); + std::string * b = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a << *b; std::string ret_val = sstr.str(); @@ -250,7 +250,7 @@ static void AddDouble2StringGeneric(asIScriptGeneric * gen) { static void AddInt2StringGeneric(asIScriptGeneric * gen) { int* a = static_cast(gen->GetAddressOfArg(0)); - string * b = static_cast(gen->GetObject()); + std::string * b = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a << *b; std::string ret_val = sstr.str(); @@ -259,7 +259,7 @@ static void AddInt2StringGeneric(asIScriptGeneric * gen) { static void AddUInt2StringGeneric(asIScriptGeneric * gen) { unsigned int* a = static_cast(gen->GetAddressOfArg(0)); - string * b = static_cast(gen->GetObject()); + std::string* b = static_cast(gen->GetObject()); std::stringstream sstr; sstr << *a << *b; std::string ret_val = sstr.str(); @@ -268,7 +268,7 @@ static void AddUInt2StringGeneric(asIScriptGeneric * gen) { static void AddBool2StringGeneric(asIScriptGeneric * gen) { bool* a = static_cast(gen->GetAddressOfArg(0)); - string * b = static_cast(gen->GetObject()); + std::string* b = static_cast(gen->GetObject()); std::stringstream sstr; sstr << (*a ? "true" : "false") << *b; std::string ret_val = sstr.str(); @@ -283,17 +283,17 @@ static void AddBool2StringGeneric(asIScriptGeneric * gen) { static void StringSubString_Generic(asIScriptGeneric *gen) { // Get the arguments - string *str = (string*)gen->GetObject(); + std::string*str = (std::string*)gen->GetObject(); asUINT start = *(int*)gen->GetAddressOfArg(0); int count = *(int*)gen->GetAddressOfArg(1); // Check for out-of-bounds - string ret; + std::string ret; if( start < str->length() && count != 0 ) ret = str->substr(start, count); // Return the substring - new(gen->GetAddressOfReturnLocation()) string(ret); + new(gen->GetAddressOfReturnLocation()) std::string(ret); } void RegisterStdString_Generic(asIScriptEngine *engine) @@ -301,7 +301,7 @@ void RegisterStdString_Generic(asIScriptEngine *engine) int r; // Register the string type - r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); + r = engine->RegisterObjectType("string", sizeof(std::string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); // Register the string factory r = engine->RegisterStringFactory("string", asFUNCTION(StringFactoryGeneric), asCALL_GENERIC); assert( r >= 0 ); @@ -349,139 +349,139 @@ void RegisterStdString_Generic(asIScriptEngine *engine) r = engine->RegisterObjectMethod("string", "string substr(uint start = 0, int count = -1) const", asFUNCTION(StringSubString_Generic), asCALL_GENERIC); assert( r >= 0 ); } -static string StringFactory(asUINT length, const char *s) +static std::string StringFactory(asUINT length, const char *s) { - return string(s, length); + return std::string(s, length); } -static void ConstructString(string *thisPointer) +static void ConstructString(std::string*thisPointer) { - new(thisPointer) string(); + new(thisPointer) std::string(); } -static void CopyConstructString(const string &other, string *thisPointer) +static void CopyConstructString(const std::string &other, std::string *thisPointer) { - new(thisPointer) string(other); + new(thisPointer) std::string(other); } -static void DestructString(string *thisPointer) +static void DestructString(std::string*thisPointer) { - thisPointer->~string(); + thisPointer->std::string::~string(); } -static string &AssignUIntToString(unsigned int i, string &dest) +static std::string &AssignUIntToString(unsigned int i, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << i; dest = stream.str(); return dest; } -static string &AddAssignUIntToString(unsigned int i, string &dest) +static std::string &AddAssignUIntToString(unsigned int i, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << i; dest += stream.str(); return dest; } -static string AddStringUInt(const string &str, unsigned int i) +static std::string AddStringUInt(const std::string &str, unsigned int i) { - ostringstream stream; + std::ostringstream stream; stream << i; return str + stream.str(); } -static string AddIntString(int i, const string &str) +static std::string AddIntString(int i, const std::string &str) { - ostringstream stream; + std::ostringstream stream; stream << i; return stream.str() + str; } -static string &AssignIntToString(int i, string &dest) +static std::string &AssignIntToString(int i, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << i; dest = stream.str(); return dest; } -static string &AddAssignIntToString(int i, string &dest) +static std::string &AddAssignIntToString(int i, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << i; dest += stream.str(); return dest; } -static string AddStringInt(const string &str, int i) +static std::string AddStringInt(const std::string &str, int i) { - ostringstream stream; + std::ostringstream stream; stream << i; return str + stream.str(); } -static string AddUIntString(unsigned int i, const string &str) +static std::string AddUIntString(unsigned int i, const std::string &str) { - ostringstream stream; + std::ostringstream stream; stream << i; return stream.str() + str; } -static string &AssignDoubleToString(double f, string &dest) +static std::string &AssignDoubleToString(double f, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << f; dest = stream.str(); return dest; } -static string &AddAssignDoubleToString(double f, string &dest) +static std::string &AddAssignDoubleToString(double f, std::string &dest) { - ostringstream stream; + std::ostringstream stream; stream << f; dest += stream.str(); return dest; } -static string &AssignBoolToString(bool b, string &dest) +static std::string &AssignBoolToString(bool b, std::string &dest) { dest = (b ? "true" : "false"); return dest; } -static string &AddAssignBoolToString(bool b, string &dest) +static std::string &AddAssignBoolToString(bool b, std::string &dest) { dest += (b ? "true" : "false"); return dest; } -static string AddStringDouble(const string &str, double f) +static std::string AddStringDouble(const std::string &str, double f) { - ostringstream stream; + std::ostringstream stream; stream << f; return str + stream.str(); } -static string AddDoubleString(double f, const string &str) +static std::string AddDoubleString(double f, const std::string &str) { - ostringstream stream; + std::ostringstream stream; stream << f; return stream.str() + str; } -static string AddStringBool(const string &str, bool b) +static std::string AddStringBool(const std::string &str, bool b) { return str + (b ? "true" : "false"); } -static string AddBoolString(bool b, const string &str) +static std::string AddBoolString(bool b, const std::string &str) { return (b ? "true" : "false") + str; } -static char *StringCharAt(unsigned int i, string &str) +static char *StringCharAt(unsigned int i, std::string &str) { if( i >= str.size() ) { @@ -498,15 +498,15 @@ static char *StringCharAt(unsigned int i, string &str) // AngelScript signature: -// bool string::opEquals(const string &in) const -static bool StringEquals(const string &a, const string &b) +// bool string::opEquals(const std::string &in) const +static bool StringEquals(const std::string &a, const std::string &b) { return a == b; } // AngelScript signature: -// int string::opCmp(const string &in) const -static int StringCmp(const string &a, const string &b) +// int string::opCmp(const std::string &in) const +static int StringCmp(const std::string &a, const std::string &b) { int cmp = 0; if( a < b ) cmp = -1; @@ -519,8 +519,8 @@ static int StringCmp(const string &a, const string &b) // string -1 is returned. // // AngelScript signature: -// int string::findFirst(const string &in sub, uint start = 0) const -static int StringFindFirst(const string &sub, asUINT start, const string &str) +// int string::findFirst(const std::string &in sub, uint start = 0) const +static int StringFindFirst(const std::string &sub, asUINT start, const std::string &str) { // We don't register the method directly because the argument types change between 32bit and 64bit platforms return (int)str.find(sub, start); @@ -531,8 +531,8 @@ static int StringFindFirst(const string &sub, asUINT start, const string &str) // string -1 is returned. // // AngelScript signature: -// int string::findLast(const string &in sub, int start = -1) const -static int StringFindLast(const string &sub, int start, const string &str) +// int string::findLast(const std::string &in sub, int start = -1) const +static int StringFindLast(const std::string &sub, int start, const std::string &str) { // We don't register the method directly because the argument types change between 32bit and 64bit platforms return (int)str.rfind(sub, (size_t)start); @@ -540,7 +540,7 @@ static int StringFindLast(const string &sub, int start, const string &str) // AngelScript signature: // uint string::length() const -static asUINT StringLength(const string &str) +static asUINT StringLength(const std::string &str) { // We don't register the method directly because the return type changes between 32bit and 64bit platforms return (asUINT)str.length(); @@ -549,7 +549,7 @@ static asUINT StringLength(const string &str) // AngelScript signature: // void string::resize(uint l) -static void StringResize(asUINT l, string &str) +static void StringResize(asUINT l, std::string &str) { // We don't register the method directly because the argument types change between 32bit and 64bit platforms str.resize(l); @@ -561,7 +561,7 @@ void RegisterStdString_Native(asIScriptEngine *engine) int r; // Register the string type - r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); + r = engine->RegisterObjectType("string", sizeof(std::string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); // Register the string factory r = engine->RegisterStringFactory("string", asFUNCTION(StringFactory), asCALL_CDECL); assert( r >= 0 ); @@ -570,12 +570,12 @@ void RegisterStdString_Native(asIScriptEngine *engine) r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &in)", asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructString), asCALL_CDECL_OBJLAST); assert( r >= 0 ); - r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 ); - r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asMETHODPR(string, operator+=, (const string&), string&), asCALL_THISCALL); assert( r >= 0 ); + r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(std::string, operator =, (const std::string&), std::string&), asCALL_THISCALL); assert( r >= 0 ); + r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asMETHODPR(std::string, operator+=, (const std::string&), std::string&), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTION(StringEquals), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); r = engine->RegisterObjectMethod("string", "int opCmp(const string &in) const", asFUNCTION(StringCmp), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); - r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(operator +, (const string &, const string &), string), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); + r = engine->RegisterObjectMethod("string", "string opAdd(const string &in) const", asFUNCTIONPR(std::operator +, (const std::string &, const std::string &), std::string), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); // Register the object methods r = engine->RegisterObjectMethod("string", "uint length() const", asFUNCTION(StringLength), asCALL_CDECL_OBJLAST); assert( r >= 0 ); diff --git a/ui/Console.cpp b/ui/Console.cpp index ced74ed..2c19829 100644 --- a/ui/Console.cpp +++ b/ui/Console.cpp @@ -5,10 +5,11 @@ #include "../networking/NetworkMgr.h" #include "../os/Input.h" #include "../math/Math.h" -#include -#include + +#include +#include #include -#include +#include #include #include @@ -77,12 +78,12 @@ bool Console::_Compare_nocase(ConsoleItem first, ConsoleItem second) return (cmp < 0) ? true : false; } -void Console::SetGameInfo(const string& gameName, int32_t versionMajor, int32_t versionMinor) +void Console::SetGameInfo(const std::string& gameName, int32_t versionMajor, int32_t versionMinor) { sprintf(m_szGameInfo, "%s version %d.%03d", gameName.c_str(), versionMajor, versionMinor); } -void Console::AddItem(const string& itemName, void *ptr, ConsoleItemType type, const string& itemHelp, void *pUserData) +void Console::AddItem(const std::string& itemName, void *ptr, ConsoleItemType type, const std::string& itemHelp, void *pUserData) { ConsoleItem item; item.name = itemName; @@ -98,7 +99,7 @@ void Console::AddItem(const string& itemName, void *ptr, ConsoleItemType type, c m_ItemList.sort( _Compare_nocase ); } -void Console::RemoveItem(const string& itemName) +void Console::RemoveItem(const std::string& itemName) { //add ability to remove an item, later... } @@ -108,7 +109,7 @@ void Console::SetDefaultCommand(ConsoleFunction func) m_DefaultCommand = func; } -void Console::Print(const string& text) +void Console::Print(const std::string& text) { m_TextBuffer.push_back(text); if ( m_TextBuffer.size() > m_MaxTextLines ) @@ -128,10 +129,10 @@ void Console::Print(const string& text) } } -void Console::PrintCommandHelp(const string& cmd) +void Console::PrintCommandHelp(const std::string& cmd) { bool bCmdFound = false; - list::const_iterator iter; + std::list::const_iterator iter; for (iter = m_ItemList.begin(); iter != m_ItemList.end(); ++iter) { if ( (*iter).name == cmd ) @@ -472,7 +473,7 @@ void Console::PrintCommands(const char *pszText/*=NULL*/) l--; } - list::const_iterator iter; + std::list::const_iterator iter; for (iter = m_ItemList.begin(); iter != m_ItemList.end(); ++iter) { if ( pszText != NULL && l > 0 ) @@ -487,10 +488,10 @@ void Console::PrintCommands(const char *pszText/*=NULL*/) bool Console::ParseCommandLine() { - ostringstream out; - string::size_type index = 0; - vector arguments; - list::const_iterator iter; + std::ostringstream out; + std::string::size_type index = 0; + std::vector arguments; + std::list::const_iterator iter; //add to text buffer - command echo. if ( m_bEchoCommands ) @@ -505,8 +506,8 @@ bool Console::ParseCommandLine() int32_t count; int32_t prev_index = 0; bool bInQuotes = false; - string::size_type l = m_CommandLine.length(); - for ( string::size_type c=0; c&, void *); + typedef void (*ConsoleFunction)(const std::vector&, void *); public: Console(IDriver3D *pDriver3D); ~Console(void); - void SetGameInfo(const string& gameName, int32_t versionMinor, int32_t versionMajor); + void SetGameInfo(const std::string& gameName, int32_t versionMinor, int32_t versionMajor); - void AddItem(const string& itemName, void *ptr, ConsoleItemType type, const string& itemHelp, void *pUserData=NULL); - void RemoveItem(const string& itemName); + void AddItem(const std::string& itemName, void *ptr, ConsoleItemType type, const std::string& itemHelp, void *pUserData=NULL); + void RemoveItem(const std::string& itemName); void SetDefaultCommand(ConsoleFunction func); void SetMaxCommands(int maxCmd) { m_MaxCommands = maxCmd; } void SetFont(XLFont *pFont) { m_pFont = pFont; } - void Print(const string& text); - void PrintCommandHelp(const string& cmd); + void Print(const std::string& text); + void PrintCommandHelp(const std::string& cmd); void PassKey(char key); void PassEnter(); @@ -70,8 +69,8 @@ class Console public: struct ConsoleItem { - string name; - string help; + std::string name; + std::string help; ConsoleItemType type; union @@ -82,12 +81,12 @@ class Console void *userData; }; - vector m_CommandBuffer; - list m_ItemList; - vector m_TextBuffer; + std::vector m_CommandBuffer; + std::list m_ItemList; + std::vector m_TextBuffer; ConsoleFunction m_DefaultCommand; - string m_CommandLine; + std::string m_CommandLine; char m_szGameInfo[128]; IDriver3D *m_pDriver; diff --git a/ui/UI_System.cpp b/ui/UI_System.cpp index 844fa30..ef3598a 100644 --- a/ui/UI_System.cpp +++ b/ui/UI_System.cpp @@ -9,9 +9,10 @@ #include "../fileformats/TextureTypes.h" #include "../math/Math.h" #include "../EngineSettings.h" -#include -#include -#include + +#include +#include +#include #include /**************************** @@ -32,9 +33,9 @@ UI_Screen *UI_System::m_PopScreen; //float UI_System::m_fVirt_Scr_H; bool UI_System::m_bFlipX; bool UI_System::m_bFlipY; -map UI_System::m_ScreenMap; -vector UI_System::m_ScreenList; -vector UI_System::m_WindowList; +std::map UI_System::m_ScreenMap; +std::vector UI_System::m_ScreenList; +std::vector UI_System::m_WindowList; IDriver3D *UI_System::m_pDriver; Engine *UI_System::m_pEngine; Vector2 UI_System::m_uvTop(0,0); @@ -97,8 +98,8 @@ void UI_System::Destroy() UI_FreeImage( Editor_UI_Atlas ); } - vector::iterator iScreen = m_ScreenList.begin(); - vector::iterator eScreen = m_ScreenList.end(); + std::vector::iterator iScreen = m_ScreenList.begin(); + std::vector::iterator eScreen = m_ScreenList.end(); for (; iScreen != eScreen; ++iScreen) { xlDelete *iScreen; @@ -106,8 +107,8 @@ void UI_System::Destroy() m_ScreenList.clear(); m_ScreenMap.clear(); - vector::iterator iWindow = m_WindowList.begin(); - vector::iterator eWindow = m_WindowList.end(); + std::vector::iterator iWindow = m_WindowList.begin(); + std::vector::iterator eWindow = m_WindowList.end(); for (; iWindow != eWindow; ++iWindow) { xlDelete *iWindow; @@ -191,7 +192,7 @@ void UI_System::StartScript(const char *pszFile) m_pUI_Atlas = AllocRenderFrame(); //Load Frame texture. - m_pUI_Atlas->hFrame = TextureCache::LoadTexture( (string)"XLEngineUI.png", false ); + m_pUI_Atlas->hFrame = TextureCache::LoadTexture( (std::string)"XLEngineUI.png", false ); //Then get the texture size and relative scale from the Texture Cache. int32_t nOffsX, nOffsY; @@ -364,10 +365,10 @@ void UI_System::RenderChildWindows(UI_Window *pWin, int x, int y) }; } -UI_Screen *UI_System::AddScreen(const string& sName) +UI_Screen *UI_System::AddScreen(const std::string& sName) { UI_Screen *pScreen = NULL; - map::iterator iScreen = m_ScreenMap.find(sName); + std::map::iterator iScreen = m_ScreenMap.find(sName); if ( iScreen != m_ScreenMap.end() ) { pScreen = iScreen->second; @@ -384,7 +385,7 @@ UI_Screen *UI_System::AddScreen(const string& sName) return pScreen; } -UI_Window *UI_System::AddWindow(const string& sName, const string& sText, uint32_t uType, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t flags, UI_Window *parent) +UI_Window *UI_System::AddWindow(const std::string& sName, const std::string& sText, uint32_t uType, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t flags, UI_Window *parent) { //m_Context is the parent screen. UI_Window *pWindow = xlNew UI_Window(); @@ -468,7 +469,7 @@ UI_Window *UI_System::AddWindow(const string& sName, const string& sText, uint32 UI_Window *_pCurWindow = NULL; UI_Window *_apWindowStack[16]; int _stackPtr = 0; -void UI_System::UI_CreateWindow(string& sName, string& sText, int type, int x, int y, int w, int h, int flags) +void UI_System::UI_CreateWindow(std::string& sName, std::string& sText, int type, int x, int y, int w, int h, int flags) { if ( m_Context ) { @@ -477,7 +478,7 @@ void UI_System::UI_CreateWindow(string& sName, string& sText, int type, int x, i } } -void UI_System::UI_PushWindow(string& sName, string& sText, int type, int x, int y, int w, int h, int flags) +void UI_System::UI_PushWindow(std::string& sName, std::string& sText, int type, int x, int y, int w, int h, int flags) { if ( m_Context && _stackPtr < 16 ) { @@ -506,10 +507,10 @@ void UI_System::UI_PopWindow() } } -void UI_System::UI_EnableWindow(string& sName, int enable) +void UI_System::UI_EnableWindow(std::string& sName, int enable) { - vector::iterator iWindow = m_WindowList.begin(); - vector::iterator eWindow = m_WindowList.end(); + std::vector::iterator iWindow = m_WindowList.begin(); + std::vector::iterator eWindow = m_WindowList.end(); for (; iWindow != eWindow; ++iWindow) { UI_Window *pWindow = *iWindow; @@ -521,7 +522,7 @@ void UI_System::UI_EnableWindow(string& sName, int enable) } } -void UI_System::UI_CreateWindow_FromLFDFrame(string& sName, int LFDAnim_ID, int frame, int x0, int y0) +void UI_System::UI_CreateWindow_FromLFDFrame(std::string& sName, int LFDAnim_ID, int frame, int x0, int y0) { if ( LFDAnim_ID >= 0 && LFDAnim_ID < MAX_LFD_ANIM && m_pLFD_Anim_List[LFDAnim_ID] ) { @@ -532,7 +533,7 @@ void UI_System::UI_CreateWindow_FromLFDFrame(string& sName, int LFDAnim_ID, int } } -void UI_System::UI_StartScreen(string& sUI_Start) +void UI_System::UI_StartScreen(std::string& sUI_Start) { char szFuncName[128]; sprintf(szFuncName, "%s_OnEnter", sUI_Start.c_str()); @@ -565,7 +566,7 @@ void UI_System::UI_StartScreen(string& sUI_Start) } } -void UI_System::UI_PushScreen(const string& uiName, int flags, int backgrndFX) +void UI_System::UI_PushScreen(const std::string& uiName, int flags, int backgrndFX) { char szFuncName[128]; sprintf(szFuncName, "%s_OnEnter", uiName.c_str()); @@ -659,7 +660,7 @@ UI_RenderFrame *UI_System::GetRenderFrame(uint32_t uFrameID) *** A valid m_Context is required **** **************************************/ -void LoadLFD_Pal(LFD_Anim *pAnim, Archive *pArchive, string& sFile) +void LoadLFD_Pal(LFD_Anim *pAnim, Archive *pArchive, std::string& sFile) { if ( ArchiveManager::GameFile_Open(pArchive, sFile.c_str()) ) { @@ -676,7 +677,7 @@ void LoadLFD_Pal(LFD_Anim *pAnim, Archive *pArchive, string& sFile) } } -void LoadLFD_File(LFD_Anim *pAnim, Archive *pArchive, string& sFile) +void LoadLFD_File(LFD_Anim *pAnim, Archive *pArchive, std::string& sFile) { if ( ArchiveManager::GameFile_Open(pArchive, sFile.c_str()) ) { @@ -693,7 +694,7 @@ void LoadLFD_File(LFD_Anim *pAnim, Archive *pArchive, string& sFile) } } -int UI_System::UI_CreateLFD_Anim(string& sArchive, string& sAnim, string& sPal) +int UI_System::UI_CreateLFD_Anim(std::string& sArchive, std::string& sAnim, std::string& sPal) { //find a free slot. int32_t ID = -1; @@ -741,7 +742,7 @@ void UI_System::UI_RenderLFD_Anim(int ID, int frame, int x, int y) } } -int UI_System::UI_AddImage(string& sImage, int cutoutMinIdx, int cutoutMaxIdx) +int UI_System::UI_AddImage(std::string& sImage, int cutoutMinIdx, int cutoutMaxIdx) { int hImageHandle = -1; if ( m_Context ) @@ -767,7 +768,7 @@ int UI_System::UI_AddImage(string& sImage, int cutoutMinIdx, int cutoutMaxIdx) return hImageHandle; } -int UI_System::UI_AddGameImage(uint32_t uImageType, string &sArchive, string &sImage) +int UI_System::UI_AddGameImage(uint32_t uImageType, std::string &sArchive, std::string &sImage) { int hImageHandle = -1; if ( m_Context ) @@ -1019,7 +1020,7 @@ void UI_System::UI_RenderImage(int hImage, int x, int y, float intensity, int al } } -void UI_System::UI_RenderString(const string& sString, int x, int y, int size, float r, float g, float b, float a) +void UI_System::UI_RenderString(const std::string& sString, int x, int y, int size, float r, float g, float b, float a) { XLFont *pFont = m_pEngine->GetSystemFont(size); if ( pFont ) @@ -1206,10 +1207,10 @@ void UI_System::KeyDownCallback(int32_t key) } } -UI_Screen *UI_System::FindScreen(const string& sName) +UI_Screen *UI_System::FindScreen(const std::string& sName) { UI_Screen *pScreen = NULL; - map::iterator iScreen = m_ScreenMap.find(sName); + std::map::iterator iScreen = m_ScreenMap.find(sName); if ( iScreen != m_ScreenMap.end() ) { pScreen = iScreen->second; @@ -1359,7 +1360,7 @@ void UI_Window::Draw(int x, int y) //////////////////////////////////////////////////////// // Default UI Rendering //////////////////////////////////////////////////////// -void UI_Window::RenderWindow(int x, int y, int w, int h, const string& name) +void UI_Window::RenderWindow(int x, int y, int w, int h, const std::string& name) { if ( w < 28 ) w = 28; if ( h < 69 ) h = 69; @@ -1380,8 +1381,8 @@ void UI_Window::RenderWindow(int x, int y, int w, int h, const string& name) xx += 10; //Draw title bar text. - UI_System::UI_RenderString((string)name, x+25, y+9, 24, 0.0f, 0.0f, 0.0f, 1.0f); - UI_System::UI_RenderString((string)name, x+24, y+8, 24, 0.8f, 0.8f, 0.8f, 1.0f); + UI_System::UI_RenderString((std::string)name, x+25, y+9, 24, 0.0f, 0.0f, 0.0f, 1.0f); + UI_System::UI_RenderString((std::string)name, x+24, y+8, 24, 0.8f, 0.8f, 0.8f, 1.0f); //Render the window background. int yy = y+41; @@ -1426,7 +1427,7 @@ void UI_Window::RenderWindow(int x, int y, int w, int h, const string& name) UI_System::UI_RenderImageRect(Editor_UI_Atlas, xx, yy, 14, (h-69), 1.0f, UI_System::UI_Align_Left, UI_System::UI_Align_Bottom); } -void UI_Window::RenderButton(int x, int y, int w, const string& text, int state) +void UI_Window::RenderButton(int x, int y, int w, const std::string& text, int state) { UI_System::UI_EnableImageFilter(0); @@ -1442,8 +1443,8 @@ void UI_Window::RenderButton(int x, int y, int w, const string& text, int state) UI_System::UI_RenderImageRect(Editor_UI_Atlas, x+w-10, y, 10, 28, 1.0f, UI_System::UI_Align_Left, UI_System::UI_Align_Bottom); //Draw title bar text. - UI_System::UI_RenderString((string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); - UI_System::UI_RenderString((string)text, x+14, y+5, 16, 0.8f, 0.8f, 0.8f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+14, y+5, 16, 0.8f, 0.8f, 0.8f, 1.0f); } else if ( state == 1 ) //pressed. { @@ -1457,8 +1458,8 @@ void UI_Window::RenderButton(int x, int y, int w, const string& text, int state) UI_System::UI_RenderImageRect(Editor_UI_Atlas, x+w-10, y, 10, 28, 1.0f, UI_System::UI_Align_Left, UI_System::UI_Align_Bottom); //Draw title bar text. - UI_System::UI_RenderString((string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); - UI_System::UI_RenderString((string)text, x+14, y+5, 16, 0.6f, 0.6f, 0.6f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+14, y+5, 16, 0.6f, 0.6f, 0.6f, 1.0f); } else //mouse over. { @@ -1472,8 +1473,8 @@ void UI_Window::RenderButton(int x, int y, int w, const string& text, int state) UI_System::UI_RenderImageRect(Editor_UI_Atlas, x+w-10, y, 10, 28, 1.0f, UI_System::UI_Align_Left, UI_System::UI_Align_Bottom); //Draw title bar text. - UI_System::UI_RenderString((string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); - UI_System::UI_RenderString((string)text, x+14, y+5, 16, 1.0f, 1.0f, 0.8f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+15, y+6, 16, 0.0f, 0.0f, 0.0f, 1.0f); + UI_System::UI_RenderString((std::string)text, x+14, y+5, 16, 1.0f, 1.0f, 0.8f, 1.0f); } UI_System::UI_EnableImageFilter(1); diff --git a/ui/UI_System.h b/ui/UI_System.h index 95b3414..c0bfe04 100644 --- a/ui/UI_System.h +++ b/ui/UI_System.h @@ -4,12 +4,11 @@ #include "../CommonTypes.h" #include "../scriptsystem/ScriptSystem.h" #include "../math/Vector2.h" + #include #include #include -using namespace std; - class asIScriptArray; class IDriver3D; class Engine; @@ -50,7 +49,7 @@ class UI_Screen UI_Screen(); ~UI_Screen(); public: - string m_sName; + std::string m_sName; SHANDLE m_hOnEnter; SHANDLE m_hOnExit; SHANDLE m_hOnRender; @@ -95,16 +94,16 @@ class UI_Window uint32_t m_uFlags; uint32_t m_uState; - string m_name; - string m_text; + std::string m_name; + std::string m_text; UI_Screen *m_parentScreen; UI_Window *m_parent; UI_Window *m_child; UI_Window *m_sibling; private: - void RenderWindow(int x, int y, int w, int h, const string& name); - void RenderButton(int x, int y, int w, const string& text, int state); + void RenderWindow(int x, int y, int w, int h, const std::string& name); + void RenderButton(int x, int y, int w, const std::string& text, int state); }; class UI_System @@ -117,7 +116,7 @@ friend UI_Window; static void Update(); static void Render(); - static UI_Screen *FindScreen(const string& sName); + static UI_Screen *FindScreen(const std::string& sName); static void UpdateChildWindows(UI_Window *pWin, int x, int y, int nMouseX, int nMouseY); static void RenderChildWindows(UI_Window *pWin, int x, int y); @@ -157,9 +156,9 @@ friend UI_Window; static UI_Screen *m_PushScreen; static UI_Screen *m_PopScreen; - static map m_ScreenMap; - static vector m_ScreenList; - static vector m_WindowList; + static std::map m_ScreenMap; + static std::vector m_ScreenList; + static std::vector m_WindowList; static UI_RenderFrame *m_pRenderFramePool; static LFD_Anim *m_pLFD_Anim_List[]; @@ -168,20 +167,20 @@ friend UI_Window; static uint32_t m_auImage_ArchiveType[]; //Add a new screen, if it hasn't already been added. - static UI_Screen *AddScreen(const string& sName); - static UI_Window *AddWindow(const string& sName, const string& sText, uint32_t uType, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t flags, UI_Window *parent=NULL); + static UI_Screen *AddScreen(const std::string& sName); + static UI_Window *AddWindow(const std::string& sName, const std::string& sText, uint32_t uType, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t flags, UI_Window *parent=NULL); //Script Functions, these are call by the UI Scripts. //UI_StartScreen is the first UI screen to start up, the program entry point. //There will probably be other entry points due to parameters passed in or other data. - static void UI_StartScreen(string& sUI_Start); - static void UI_CreateWindow(string& sName, string& sText, int type, int x, int y, int w, int h, int flags); - static void UI_PushWindow(string& sName, string& sText, int type, int x, int y, int w, int h, int flags); + static void UI_StartScreen(std::string& sUI_Start); + static void UI_CreateWindow(std::string& sName, std::string& sText, int type, int x, int y, int w, int h, int flags); + static void UI_PushWindow(std::string& sName, std::string& sText, int type, int x, int y, int w, int h, int flags); static void UI_PopWindow(); - static void UI_EnableWindow(string& sName, int enable); - static void UI_CreateWindow_FromLFDFrame(string& sName, int LFDAnim_ID, int frame, int x0, int y0); - static int UI_AddImage(string& sImage, int cutoutMinIdx, int cutoutMaxIdx); - static int UI_AddGameImage(uint32_t uImageType, string &sArchive, string &sImage); + static void UI_EnableWindow(std::string& sName, int enable); + static void UI_CreateWindow_FromLFDFrame(std::string& sName, int LFDAnim_ID, int frame, int x0, int y0); + static int UI_AddImage(std::string& sImage, int cutoutMinIdx, int cutoutMaxIdx); + static int UI_AddGameImage(uint32_t uImageType, std::string &sArchive, std::string &sImage); static void UI_FreeImage(int hImageHandle); static void UI_EnableImageFilter(int enable); static void UI_EnableImageBlending(int enable); @@ -193,7 +192,7 @@ friend UI_Window; static void UI_SetImageUV_RangeI(int hImage, int u0, int v0, int w, int h); static void UI_RenderPolygon(int npt, asIScriptArray *x, asIScriptArray *y, float r, float g, float b, float a, int alignHoriz, int alignVert); static void UI_RenderRect(int x, int y, int w, int h, float r, float g, float b, float a, int alignHoriz, int alignVert); - static void UI_RenderString(const string& sString, int x, int y, int size, float r, float g, float b, float a); + static void UI_RenderString(const std::string& sString, int x, int y, int size, float r, float g, float b, float a); static void UI_PrintMousePos(int x, int y, int size); static void UI_GetMousePos(int& x, int& y); static void UI_SetVirtualScreenSize(int w, int h); @@ -204,11 +203,11 @@ friend UI_Window; static float UI_GetCurrentBrightness(); static float UI_GetSpeed(); //LFD_Anim - static int UI_CreateLFD_Anim(string& sArchive, string& sAnim, string& sPal); + static int UI_CreateLFD_Anim(std::string& sArchive, std::string& sAnim, std::string& sPal); static void UI_DestroyLFD_Anim(int ID); static void UI_RenderLFD_Anim(int ID, int frame, int x, int y); //use different flags for overlay versus fullscreen. - static void UI_PushScreen(const string& uiName, int flags, int backgrndFX); + static void UI_PushScreen(const std::string& uiName, int flags, int backgrndFX); //pops the current screen off the stack, returning control to the previous. static void UI_PopScreen(); diff --git a/ui/XL_Console.cpp b/ui/XL_Console.cpp index 18bb1bf..bd9f0f0 100644 --- a/ui/XL_Console.cpp +++ b/ui/XL_Console.cpp @@ -1,24 +1,24 @@ #include "XL_Console.h" -#include -#include +#include +#include Console *XL_Console::s_pConsole; static char _tmpStr[512]; -void XL_Console::_DefaultConsoleFunc(const vector& args, void *pUserData) +void XL_Console::_DefaultConsoleFunc(const std::vector& args, void *pUserData) { - string errorStr; + std::string errorStr; errorStr = "^1'" + args[0] + "' is not a recognized command."; s_pConsole->Print(errorStr); } -void XL_Console::_Echo(const vector& args, void *pUserData) +void XL_Console::_Echo(const std::vector& args, void *pUserData) { s_pConsole->Print(args[1]); } -void XL_Console::_CmdList(const vector& args, void *pUserData) +void XL_Console::_CmdList(const std::vector& args, void *pUserData) { if ( args.size() <= 1 ) s_pConsole->PrintCommands(); @@ -26,7 +26,7 @@ void XL_Console::_CmdList(const vector& args, void *pUserData) s_pConsole->PrintCommands(args[1].c_str()); } -void XL_Console::_ConsoleTex(const vector& args, void *pUserData) +void XL_Console::_ConsoleTex(const std::vector& args, void *pUserData) { if ( args.size() > 1 ) { @@ -34,7 +34,7 @@ void XL_Console::_ConsoleTex(const vector& args, void *pUserData) } } -void XL_Console::_Help(const vector& args, void *pUserData) +void XL_Console::_Help(const std::vector& args, void *pUserData) { if ( args.size() == 1 ) { @@ -111,7 +111,7 @@ void XL_Console::Render() s_pConsole->Render(); } -void XL_Console::RegisterCmd(const string& itemName, void *ptr, Console::ConsoleItemType type, const string& itemHelp, void *pUserData) +void XL_Console::RegisterCmd(const std::string& itemName, void *ptr, Console::ConsoleItemType type, const std::string& itemHelp, void *pUserData) { s_pConsole->AddItem(itemName, ptr, type, itemHelp, pUserData); } @@ -140,7 +140,7 @@ bool XL_Console::IsPaused() return s_pConsole->IsPaused(); } -void XL_Console::Print(const string& szMsg) +void XL_Console::Print(const std::string& szMsg) { if ( s_pConsole == NULL ) return; diff --git a/ui/XL_Console.h b/ui/XL_Console.h index b7185f2..bb99ede 100644 --- a/ui/XL_Console.h +++ b/ui/XL_Console.h @@ -13,25 +13,25 @@ class XL_Console static void Render(); - static void RegisterCmd(const string& itemName, void *ptr, Console::ConsoleItemType type, const string& itemHelp, void *pUserData); + static void RegisterCmd(const std::string& itemName, void *ptr, Console::ConsoleItemType type, const std::string& itemHelp, void *pUserData); - static void Print(const string& szMsg); + static void Print(const std::string& szMsg); static void PrintF(const char *pszString, ...); static bool IsActive(); static bool IsPaused(); static bool IsChatActive(); - static void SetGameInfo(const string& gameName, int32_t versionMinor, int32_t versionMajor) { s_pConsole->SetGameInfo(gameName, versionMinor, versionMajor); } + static void SetGameInfo(const std::string& gameName, int32_t versionMinor, int32_t versionMajor) { s_pConsole->SetGameInfo(gameName, versionMinor, versionMajor); } static void SetConsoleColor(float fRed, float fGreen, float fBlue, float fAlpha); private: static Console *s_pConsole; - static void _DefaultConsoleFunc(const vector& args, void *pUserData); - static void _Echo(const vector& args, void *pUserData); - static void _CmdList(const vector& args, void *pUserData); - static void _Help(const vector& args, void *pUserData); - static void _ConsoleTex(const vector& args, void *pUserData); + static void _DefaultConsoleFunc(const std::vector& args, void *pUserData); + static void _Echo(const std::vector& args, void *pUserData); + static void _CmdList(const std::vector& args, void *pUserData); + static void _Help(const std::vector& args, void *pUserData); + static void _ConsoleTex(const std::vector& args, void *pUserData); static void _KeyDownCallback(int32_t key); static void _CharDownCallback(int32_t key); diff --git a/win/main.h b/win/main.h index 52368c4..b2808db 100644 --- a/win/main.h +++ b/win/main.h @@ -8,7 +8,7 @@ #include // C RunTime Header Files -#include +#include #include #include #include diff --git a/world/LevelFunc.cpp b/world/LevelFunc.cpp index f4ffae4..f5311e7 100644 --- a/world/LevelFunc.cpp +++ b/world/LevelFunc.cpp @@ -1,7 +1,8 @@ #include "LevelFunc.h" #include "LevelFuncMgr.h" #include "Object.h" -#include + +#include LevelFunc::LevelFunc(WorldCell *pWorldCell, int32_t nSector, int32_t nWall) { @@ -26,16 +27,16 @@ LevelFunc::LevelFunc(WorldCell *pWorldCell, int32_t nSector, int32_t nWall) LevelFunc::~LevelFunc() { - vector::iterator iState = m_States.begin(); - vector::iterator eState = m_States.end(); + std::vector::iterator iState = m_States.begin(); + std::vector::iterator eState = m_States.end(); for (; iState != eState; ++iState) { xlDelete (*iState); } - vector::iterator iCObj = m_ClientObjects.begin(); - vector::iterator eCObj = m_ClientObjects.end(); + std::vector::iterator iCObj = m_ClientObjects.begin(); + std::vector::iterator eCObj = m_ClientObjects.end(); for (; iCObj != eCObj; ++iCObj) { @@ -125,7 +126,7 @@ void LevelFunc::Update() else { m_fInterp += m_fDelta*m_fVel; - m_fVel = min(1.0f, m_fVel+m_fAccel); + m_fVel = std::min(1.0f, m_fVel+m_fAccel); } if ( m_fInterp > 1.0f ) { m_fInterp = 1.0f; } diff --git a/world/LevelFunc.h b/world/LevelFunc.h index 0590b78..440d0ab 100644 --- a/world/LevelFunc.h +++ b/world/LevelFunc.h @@ -7,7 +7,6 @@ #include #include -using namespace std; class WorldCell; class Object; @@ -115,10 +114,10 @@ class LevelFunc int32_t delay; uint8_t type; }; - vector m_States; - vector m_Clients; - vector m_ClientObjects; - vector m_Slaves; + std::vector m_States; + std::vector m_Clients; + std::vector m_ClientObjects; + std::vector m_Slaves; LevelFunc::LFunc_ActivateCB m_ActivateCB; LevelFunc::LFunc_SetValueCB m_SetValueCB; diff --git a/world/LevelFuncMgr.cpp b/world/LevelFuncMgr.cpp index 9031689..e65fcf3 100644 --- a/world/LevelFuncMgr.cpp +++ b/world/LevelFuncMgr.cpp @@ -2,13 +2,13 @@ #include "WorldCell.h" #include "LevelFunc_Default.h" -vector LevelFuncMgr::m_FuncList; -vector LevelFuncMgr::m_Active; -vector LevelFuncMgr::m_AddList; -vector LevelFuncMgr::m_RemoveList; +std::vector LevelFuncMgr::m_FuncList; +std::vector LevelFuncMgr::m_Active; +std::vector LevelFuncMgr::m_AddList; +std::vector LevelFuncMgr::m_RemoveList; WorldCell *LevelFuncMgr::m_pWorldCell; -map LevelFuncMgr::m_LevelFuncCB; +std::map LevelFuncMgr::m_LevelFuncCB; bool LevelFuncMgr::Init() { @@ -23,8 +23,8 @@ void LevelFuncMgr::Destroy() m_AddList.clear(); m_RemoveList.clear(); - vector::iterator iFunc = m_FuncList.begin(); - vector::iterator eFunc = m_FuncList.end(); + std::vector::iterator iFunc = m_FuncList.begin(); + std::vector::iterator eFunc = m_FuncList.end(); for (; iFunc != eFunc; ++iFunc) { delete (*iFunc); @@ -32,9 +32,9 @@ void LevelFuncMgr::Destroy() m_FuncList.clear(); } -void LevelFuncMgr::AddLevelFuncCB(const string& sFuncName, LevelFunc::LFunc_ActivateCB pActivate, LevelFunc::LFunc_SetValueCB pSetValue) +void LevelFuncMgr::AddLevelFuncCB(const std::string& sFuncName, LevelFunc::LFunc_ActivateCB pActivate, LevelFunc::LFunc_SetValueCB pSetValue) { - map::iterator iFunc = m_LevelFuncCB.find(sFuncName); + std::map::iterator iFunc = m_LevelFuncCB.find(sFuncName); if ( iFunc == m_LevelFuncCB.end() ) { //ok to add it... @@ -54,7 +54,7 @@ LevelFunc *LevelFuncMgr::CreateLevelFunc(const char *pszFuncName, int32_t nSecto //now find the appropriate callbacks. if ( pFunc ) { - map::iterator iFunc = m_LevelFuncCB.find(pszFuncName); + std::map::iterator iFunc = m_LevelFuncCB.find(pszFuncName); if ( iFunc != m_LevelFuncCB.end() ) { pFunc->SetActivateCB( iFunc->second.activateCB ); @@ -73,8 +73,8 @@ void LevelFuncMgr::DestroyLevelFunc(LevelFunc *pFunc) RemoveFromActiveList(pFunc); - vector::iterator iter = m_FuncList.begin(); - vector::iterator end = m_FuncList.end(); + std::vector::iterator iter = m_FuncList.begin(); + std::vector::iterator end = m_FuncList.end(); for (; iter != end; ++iter) { @@ -100,8 +100,8 @@ void LevelFuncMgr::RemoveFromActiveList(LevelFunc *pFunc) void LevelFuncMgr::Update() { - vector::iterator iActive = m_Active.begin(); - vector::iterator eActive = m_Active.end(); + std::vector::iterator iActive = m_Active.begin(); + std::vector::iterator eActive = m_Active.end(); for (; iActive!=eActive; ++iActive) { if (*iActive) { (*iActive)->Update(); } @@ -110,8 +110,8 @@ void LevelFuncMgr::Update() //go through the add list and add classes... if ( m_AddList.size() ) { - vector::iterator iAdd = m_AddList.begin(); - vector::iterator eAdd = m_AddList.end(); + std::vector::iterator iAdd = m_AddList.begin(); + std::vector::iterator eAdd = m_AddList.end(); for (; iAdd!=eAdd; ++iAdd) { if (*iAdd) { m_Active.push_back( *iAdd ); } @@ -122,8 +122,8 @@ void LevelFuncMgr::Update() //go through the remove list and remove classes... if ( m_RemoveList.size() ) { - vector::iterator iRem = m_RemoveList.begin(); - vector::iterator eRem = m_RemoveList.end(); + std::vector::iterator iRem = m_RemoveList.begin(); + std::vector::iterator eRem = m_RemoveList.end(); for (; iRem!=eRem; ++iRem) { iActive = m_Active.begin(); diff --git a/world/LevelFuncMgr.h b/world/LevelFuncMgr.h index 6136687..e35afd1 100644 --- a/world/LevelFuncMgr.h +++ b/world/LevelFuncMgr.h @@ -3,12 +3,11 @@ #include "../CommonTypes.h" #include "LevelFunc.h" + #include #include #include -using namespace std; - class WorldCell; class LevelFuncMgr @@ -25,7 +24,7 @@ class LevelFuncMgr static void RemoveFromActiveList(LevelFunc *pFunc); static void Update(); - static void AddLevelFuncCB(const string& sFuncName, LevelFunc::LFunc_ActivateCB pActivate, LevelFunc::LFunc_SetValueCB pSetValue); + static void AddLevelFuncCB(const std::string& sFuncName, LevelFunc::LFunc_ActivateCB pActivate, LevelFunc::LFunc_SetValueCB pSetValue); private: struct LevelFuncCB @@ -34,14 +33,14 @@ class LevelFuncMgr LevelFunc::LFunc_SetValueCB setValueCB; }; - static vector m_FuncList; - static vector m_Active; - static vector m_AddList; - static vector m_RemoveList; + static std::vector m_FuncList; + static std::vector m_Active; + static std::vector m_AddList; + static std::vector m_RemoveList; static WorldCell *m_pWorldCell; - static map m_LevelFuncCB; + static std::map m_LevelFuncCB; }; #endif //LEVELFUNCMGR_H diff --git a/world/LevelFunc_Default.cpp b/world/LevelFunc_Default.cpp index 16acce4..87d7ac0 100644 --- a/world/LevelFunc_Default.cpp +++ b/world/LevelFunc_Default.cpp @@ -3,7 +3,7 @@ #include "WorldCell.h" #include "Sector_2_5D.h" #include "Object.h" -#include +#include //SlidingDoor void LFunc_SlidingDoor_SetValue(LevelFunc *pFunc, int32_t nSector, float value, bool bInstant) diff --git a/world/Logic.cpp b/world/Logic.cpp index 5a1fe65..c7672ab 100644 --- a/world/Logic.cpp +++ b/world/Logic.cpp @@ -3,7 +3,7 @@ Logic *Logic::s_pCurLogic = NULL; -Logic::Logic(const string& sName, void *pOwner, uint32_t uType) +Logic::Logic(const std::string& sName, void *pOwner, uint32_t uType) { m_sName = sName; m_pOwner = pOwner; diff --git a/world/Logic.h b/world/Logic.h index ea3ae2c..9ee4a74 100644 --- a/world/Logic.h +++ b/world/Logic.h @@ -6,14 +6,13 @@ #include "LogicDef.h" #include -using namespace std; class Object; class Logic { public: - Logic(const string& sName, void *pOwner, uint32_t uType=LTYPE_SCRIPT); + Logic(const std::string& sName, void *pOwner, uint32_t uType=LTYPE_SCRIPT); virtual ~Logic(); //used for code based logics. @@ -29,7 +28,7 @@ class Logic protected: uint32_t m_uType; uint32_t m_uMsgMask; - string m_sName; + std::string m_sName; LogicParam m_ParamList[MAX_LOGIC_PARAM]; void *m_pOwner; diff --git a/world/LogicManager.cpp b/world/LogicManager.cpp index 7ca56cd..abc7f05 100644 --- a/world/LogicManager.cpp +++ b/world/LogicManager.cpp @@ -1,6 +1,6 @@ #include "LogicManager.h" -map LogicManager::m_Logics; +std::map LogicManager::m_Logics; bool LogicManager::Init() { @@ -9,8 +9,8 @@ bool LogicManager::Init() void LogicManager::Destroy() { - map::iterator iLogic = m_Logics.begin(); - map::iterator eLogic = m_Logics.end(); + std::map::iterator iLogic = m_Logics.begin(); + std::map::iterator eLogic = m_Logics.end(); for (; iLogic != eLogic; ++iLogic) { @@ -20,9 +20,9 @@ void LogicManager::Destroy() m_Logics.clear(); } -Logic *LogicManager::GetLogic(const string& sName) +Logic *LogicManager::GetLogic(const std::string& sName) { - map::iterator iLogic = m_Logics.find(sName); + std::map::iterator iLogic = m_Logics.find(sName); if ( iLogic != m_Logics.end() ) { return iLogic->second; @@ -31,7 +31,7 @@ Logic *LogicManager::GetLogic(const string& sName) return NULL; } -Logic *LogicManager::CreateLogicFromCode(const string& sName, void *pOwner, LogicFunction *pFunc) +Logic *LogicManager::CreateLogicFromCode(const std::string& sName, void *pOwner, LogicFunction *pFunc) { Logic *pLogic = xlNew Logic(sName, pOwner, LTYPE_CODE); if ( pLogic ) diff --git a/world/LogicManager.h b/world/LogicManager.h index 10ae37e..a6a2a16 100644 --- a/world/LogicManager.h +++ b/world/LogicManager.h @@ -6,20 +6,18 @@ #include #include -using namespace std; - class LogicManager { public: static bool Init(); static void Destroy(); - static Logic *GetLogic(const string& sName); - static Logic *CreateLogicFromCode(const string& sName, void *pOwner, LogicFunction *pFunc); + static Logic *GetLogic(const std::string& sName); + static Logic *CreateLogicFromCode(const std::string& sName, void *pOwner, LogicFunction *pFunc); static void CreateLogicFromCode_API(const char *pszName, void *pOwner, LogicFunction *pFunc); private: - static map m_Logics; + static std::map m_Logics; }; #endif //LOGICMANAGER_H diff --git a/world/MeshCollision.cpp b/world/MeshCollision.cpp index fe635d7..1979143 100644 --- a/world/MeshCollision.cpp +++ b/world/MeshCollision.cpp @@ -1,7 +1,7 @@ #include "MeshCollision.h" #include "../math/Math.h" -#include -#include +#include +#include #include MeshCollision::MeshCollision() diff --git a/world/Object.cpp b/world/Object.cpp index 8149b78..ba2f337 100644 --- a/world/Object.cpp +++ b/world/Object.cpp @@ -2,8 +2,9 @@ #include "ObjectManager.h" #include "Logic.h" #include "Sector.h" -#include -#include + +#include +#include Object::Object() { @@ -93,8 +94,8 @@ void Object::AddLogic(Logic *pLogic) //initialize the object void Object::Init() { - vector::iterator iLogic = m_Logics.begin(); - vector::iterator eLogic = m_Logics.end(); + std::vector::iterator iLogic = m_Logics.begin(); + std::vector::iterator eLogic = m_Logics.end(); for (; iLogic != eLogic; ++iLogic) { @@ -104,8 +105,8 @@ void Object::Init() void Object::SendMessage(uint32_t uMsgID, float fValue) { - vector::iterator iLogic = m_Logics.begin(); - vector::iterator eLogic = m_Logics.end(); + std::vector::iterator iLogic = m_Logics.begin(); + std::vector::iterator eLogic = m_Logics.end(); for (; iLogic != eLogic; ++iLogic) { @@ -117,8 +118,8 @@ void Object::Update() { if ( m_uFlags&OBJFLAGS_ACTIVE ) { - vector::iterator iLogic = m_Logics.begin(); - vector::iterator eLogic = m_Logics.end(); + std::vector::iterator iLogic = m_Logics.begin(); + std::vector::iterator eLogic = m_Logics.end(); for (; iLogic != eLogic; ++iLogic) { diff --git a/world/Object.h b/world/Object.h index dc5b34d..e118e7c 100644 --- a/world/Object.h +++ b/world/Object.h @@ -7,11 +7,10 @@ #include "ObjectDef.h" #include "RenderComponent.h" #include "CollisionComponent.h" + #include #include -#include - -using namespace std; +#include class Logic; class IDriver3D; @@ -28,8 +27,8 @@ class Object Object(); virtual ~Object(); - void SetName(const string& sName) { m_Name = sName; } - const string& GetName() { return m_Name; } + void SetName(const std::string& sName) { m_Name = sName; } + const std::string& GetName() { return m_Name; } void Update(); void Init(); @@ -114,7 +113,7 @@ class Object }; protected: - string m_Name; + std::string m_Name; uint16_t m_uPad; uint16_t m_uRefCnt; @@ -125,7 +124,7 @@ class Object uint32_t m_uID; uint32_t m_uGameID; //used for game specific purposes. float m_fBrightness; - vector m_Logics; + std::vector m_Logics; void *m_pDataComp; RenderComponent *m_pRenderComp; CollisionComponent *m_pCollisionComp; diff --git a/world/ObjectManager.cpp b/world/ObjectManager.cpp index ab2428e..7937f66 100644 --- a/world/ObjectManager.cpp +++ b/world/ObjectManager.cpp @@ -5,9 +5,9 @@ #include "../world/World.h" #include "../world/Terrain.h" -vector ObjectManager::m_ObjectPool; -vector ObjectManager::m_FreeObjects; -vector ObjectManager::m_ActiveObjects; +std::vector ObjectManager::m_ObjectPool; +std::vector ObjectManager::m_FreeObjects; +std::vector ObjectManager::m_ActiveObjects; uint32_t ObjectManager::m_uReservedCount; World *ObjectManager::m_pWorld; @@ -40,8 +40,8 @@ void ObjectManager::Destroy() { LogicManager::Destroy(); - vector::iterator iObjPool = m_ObjectPool.begin(); - vector::iterator eObjPool = m_ObjectPool.end(); + std::vector::iterator iObjPool = m_ObjectPool.begin(); + std::vector::iterator eObjPool = m_ObjectPool.end(); for (; iObjPool != eObjPool; ++iObjPool) { Object *pool = *iObjPool; @@ -52,7 +52,7 @@ void ObjectManager::Destroy() m_ActiveObjects.clear(); } -Object *ObjectManager::CreateObject(const string& sName) +Object *ObjectManager::CreateObject(const std::string& sName) { Object *pObj = NULL; if ( m_FreeObjects.size() ) @@ -178,8 +178,8 @@ uint32_t ObjectManager::CreateObjectID(const char *pszName, int32_t nSector) void ObjectManager::MoveDynamicObjects(const Vector3& vMove) { - vector::iterator iObj = m_ActiveObjects.begin(); - vector::iterator eObj = m_ActiveObjects.end(); + std::vector::iterator iObj = m_ActiveObjects.begin(); + std::vector::iterator eObj = m_ActiveObjects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = *iObj; @@ -207,10 +207,10 @@ void ObjectManager::MoveDynamicObjects(const Vector3& vMove) } } -Object *ObjectManager::FindObject(const string& sName) +Object *ObjectManager::FindObject(const std::string& sName) { - vector::iterator iObj = m_ActiveObjects.begin(); - vector::iterator eObj = m_ActiveObjects.end(); + std::vector::iterator iObj = m_ActiveObjects.begin(); + std::vector::iterator eObj = m_ActiveObjects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = *iObj; @@ -239,8 +239,8 @@ void ObjectManager::FreeObject(Object *pObj) m_FreeObjects.push_back( pObj ); //remove this from the active object list. - vector::iterator iObj = m_ActiveObjects.begin(); - vector::iterator eObj = m_ActiveObjects.end(); + std::vector::iterator iObj = m_ActiveObjects.begin(); + std::vector::iterator eObj = m_ActiveObjects.end(); for (; iObj != eObj; ++iObj) { if ( (*iObj) == pObj ) @@ -264,8 +264,8 @@ void ObjectManager::FreeAllObjects() { m_FreeObjects.clear(); uint32_t uStartObj = m_uReservedCount; - vector::iterator iBank = m_ObjectPool.begin(); - vector::iterator eBank = m_ObjectPool.end(); + std::vector::iterator iBank = m_ObjectPool.begin(); + std::vector::iterator eBank = m_ObjectPool.end(); for (; iBank != eBank; ++iBank) { Object *pool = *iBank; @@ -288,8 +288,8 @@ void ObjectManager::FreeAllObjects() void ObjectManager::Update() { - vector::iterator iObj = m_ActiveObjects.begin(); - vector::iterator eObj = m_ActiveObjects.end(); + std::vector::iterator iObj = m_ActiveObjects.begin(); + std::vector::iterator eObj = m_ActiveObjects.end(); for (; iObj != eObj; ++iObj) { (*iObj)->Update(); diff --git a/world/ObjectManager.h b/world/ObjectManager.h index 00e60f1..6e80630 100644 --- a/world/ObjectManager.h +++ b/world/ObjectManager.h @@ -3,11 +3,10 @@ #include "../CommonTypes.h" #include "Object.h" + #include #include -using namespace std; - class World; class ObjectManager @@ -21,8 +20,8 @@ class ObjectManager //Set Always update to true if this object is constantly updated regardless of it's place in the map. //Only use this for "permanent" objects like the player. - static Object *CreateObject(const string& sName); - static Object *FindObject(const string& sName); + static Object *CreateObject(const std::string& sName); + static Object *FindObject(const std::string& sName); static void MoveDynamicObjects(const Vector3& vMove); static void FreeObject(Object *pObj); static Object *GetObjectFromID(uint32_t uID); @@ -50,9 +49,9 @@ class ObjectManager static void ReserveObjects(uint32_t uCount) { m_uReservedCount = uCount; } private: - static vector m_ObjectPool; - static vector m_FreeObjects; - static vector m_ActiveObjects; + static std::vector m_ObjectPool; + static std::vector m_FreeObjects; + static std::vector m_ActiveObjects; static uint32_t m_uReservedCount; static World *m_pWorld; }; diff --git a/world/Sector.cpp b/world/Sector.cpp index 10f23e0..60a595b 100644 --- a/world/Sector.cpp +++ b/world/Sector.cpp @@ -15,8 +15,8 @@ Sector::Sector() Sector::~Sector() { - vector::iterator iLight = m_Lights.begin(); - vector::iterator eLight = m_Lights.end(); + std::vector::iterator iLight = m_Lights.begin(); + std::vector::iterator eLight = m_Lights.end(); for (; iLight != eLight; ++iLight) { xlDelete *iLight; @@ -33,8 +33,8 @@ void Sector::AddObject(uint32_t uHandle) void Sector::RemoveObject(uint32_t uHandle) { //search for object handle and then erase it. - vector::iterator iObj = m_Objects.begin(); - vector::iterator eObj = m_Objects.end(); + std::vector::iterator iObj = m_Objects.begin(); + std::vector::iterator eObj = m_Objects.end(); for ( ; iObj != eObj; ++iObj ) { if ( *iObj == uHandle ) diff --git a/world/Sector.h b/world/Sector.h index 9205358..f816650 100644 --- a/world/Sector.h +++ b/world/Sector.h @@ -4,9 +4,8 @@ #include "../CommonTypes.h" #include "../math/Vector3.h" #include "../render/IDriver3D.h" -#include -using namespace std; +#include class IDriver3D; class Camera; @@ -31,7 +30,7 @@ class Sector void AddLight(const Vector3& rvLoc) { m_Lights.push_back( xlNew LightObject(rvLoc) ); } void AddLight(LightObject *pLight) { m_Lights.push_back( pLight ); } - const vector& GetLightList() { return m_Lights; } + const std::vector& GetLightList() { return m_Lights; } virtual void Render(IDriver3D *pDriver, Camera *pCamera) {}; virtual void Collide(CollisionPacket *packet, Vector3 *bounds, const Vector3& vOffset) {}; @@ -43,8 +42,8 @@ class Sector int32_t m_x, m_y; bool m_bActive; Vector3 m_Bounds[2]; //24 bytes. - vector m_Objects; //4*cbjCnt + ~8 - vector m_Lights; + std::vector m_Objects; //4*cbjCnt + ~8 + std::vector m_Lights; char m_szName[64]; uint8_t *m_pValidNodes; diff --git a/world/Sector_2_5D.cpp b/world/Sector_2_5D.cpp index 000f8b3..3eada1a 100644 --- a/world/Sector_2_5D.cpp +++ b/world/Sector_2_5D.cpp @@ -7,6 +7,7 @@ #include "../render/Camera.h" #include "../render/RenderQue.h" #include "WorldCell.h" + #include Vector2 Sector_2_5D::m_nearPlane[2]; @@ -275,7 +276,7 @@ void Sector_2_5D::RenderSky(IDriver3D *pDriver, WorldCell *pCell) pDriver->EnableStencilTesting(false); } -void Sector_2_5D::RenderSectors(IDriver3D *pDriver, WorldCell *pCell, Camera *pCamera, Sector_2_5D *pStart, const vector& Sectors) +void Sector_2_5D::RenderSectors(IDriver3D *pDriver, WorldCell *pCell, Camera *pCamera, Sector_2_5D *pStart, const std::vector& Sectors) { //1. Compute world space 2D edges. const Vector3& vDir3D = pCamera->GetDir(); @@ -524,7 +525,7 @@ bool _AddToCollideList(int32_t s) return bInList; } -void Sector_2_5D::_AddSectorToList(int32_t s, Vector3 *p0, Vector2& vPathMin, Vector2& vPathMax, const vector& Sectors) +void Sector_2_5D::_AddSectorToList(int32_t s, Vector3 *p0, Vector2& vPathMin, Vector2& vPathMax, const std::vector& Sectors) { //now go through and add any portals that overlap the path... if ( _AddToCollideList(s) == true ) @@ -609,7 +610,7 @@ void Sector_2_5D::_AddSectorToList(int32_t s, Vector3 *p0, Vector2& vPathMin, Ve } } -bool _PushOutPositionList(Vector3 *p0, float fRadius, const vector& Sectors) +bool _PushOutPositionList(Vector3 *p0, float fRadius, const std::vector& Sectors) { bool bNeedPush = false; @@ -671,7 +672,7 @@ bool _PushOutPositionList(Vector3 *p0, float fRadius, const vector& Se float ood = 1.0f/sqrtf(d2); lu = ( (p0->x - v0.x)*(v1.x-v0.x) + (p0->y-v0.y)*(v1.y-v0.y) ) / d2; - lu = min( max(lu, 0.0f), 1.0f ); + lu = std::min( std::max(lu, 0.0f), 1.0f ); ix = v0.x + lu*(v1.x-v0.x); iy = v0.y + lu*(v1.y-v0.y); @@ -711,7 +712,7 @@ bool _PushOutPositionList(Vector3 *p0, float fRadius, const vector& Se return bNeedPush; } -void Sector_2_5D::RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector, const vector& Sectors) +void Sector_2_5D::RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector, const std::vector& Sectors) { bool bHit = false; uint32_t s = uSector; @@ -836,7 +837,7 @@ void Sector_2_5D::RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector } } -void Sector_2_5D::Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRadius, const vector& Sectors, bool bPassThruAdjoins) +void Sector_2_5D::Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRadius, const std::vector& Sectors, bool bPassThruAdjoins) { s_bPassThruAdjoins = bPassThruAdjoins; //start from p0, move to p1. @@ -899,7 +900,7 @@ void Sector_2_5D::Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRa } } -float Sector_2_5D::GetZ_Floor(float x, float y, const vector& Sectors) +float Sector_2_5D::GetZ_Floor(float x, float y, const std::vector& Sectors) { float z = m_ZRangeCur.x + s_vCurrentOffs.z; if ( (m_uFlags&SEC_FLAGS_FLOOR_SLOPE) && m_auSlopeSector[0] < 0xffff ) @@ -919,7 +920,7 @@ float Sector_2_5D::GetZ_Floor(float x, float y, const vector& Sectors) return z; } -float Sector_2_5D::GetZ_Ceil(float x, float y, const vector& Sectors) +float Sector_2_5D::GetZ_Ceil(float x, float y, const std::vector& Sectors) { float z = m_ZRangeCur.y + s_vCurrentOffs.z; if ( (m_uFlags&SEC_FLAGS_CEIL_SLOPE) && m_auSlopeSector[1] < 0xffff ) @@ -970,7 +971,7 @@ void Sector_2_5D::RenderObjects(IDriver3D *pDriver) pDriver->SetBlendMode(); } -void Sector_2_5D::_DrawFloor(IDriver3D *pDriver, Sector_2_5D *pCurSec, const Vector2 *worldPos, const Vector2& a, const Vector2& n0, const Vector2& n1, const vector& Sectors) +void Sector_2_5D::_DrawFloor(IDriver3D *pDriver, Sector_2_5D *pCurSec, const Vector2 *worldPos, const Vector2& a, const Vector2& n0, const Vector2& n1, const std::vector& Sectors) { const float fOO255 = (1.0f/255.0f); float fI; @@ -1065,7 +1066,7 @@ void Sector_2_5D::_DrawFloor(IDriver3D *pDriver, Sector_2_5D *pCurSec, const Vec } } -void Sector_2_5D::_DrawWall(IDriver3D *pDriver, Sector_2_5D *pCurSec, Sector_2_5D *pNextSec, Sector_2_5D *pBotSec, Sector_2_5D *pTopSec, uint16_t w, Vector2 *worldPos, const vector& Sectors) +void Sector_2_5D::_DrawWall(IDriver3D *pDriver, Sector_2_5D *pCurSec, Sector_2_5D *pNextSec, Sector_2_5D *pBotSec, Sector_2_5D *pTopSec, uint16_t w, Vector2 *worldPos, const std::vector& Sectors) { const float fOO255 = (1.0f/255.0f); float fI; @@ -1474,7 +1475,7 @@ void Sector_2_5D::_SetupCameraParameters(const Vector3& cPos, const Vector3& cDi _cpos = cPos; } -void Sector_2_5D::WallRasterizer(const Vector3& cPos, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const vector& Sectors) +void Sector_2_5D::WallRasterizer(const Vector3& cPos, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const std::vector& Sectors) { //transform all vertices into 2D projected space (x, 1/w) m_Camera2D.TransformPointsSS_2D(pCurSec->m_uVertexCount, pCurSec->m_pVertexCur, ssPos, Vector2::Zero); @@ -1663,7 +1664,7 @@ void Sector_2_5D::WallRasterizer(const Vector3& cPos, uint32_t uStartX, uint32_t } } -void Sector_2_5D::Visibility2D(const Vector3& cPos, Vector2 fL, Vector2 fR, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const vector& Sectors, bool bUsePortalClip, IDriver3D *pDriver) +void Sector_2_5D::Visibility2D(const Vector3& cPos, Vector2 fL, Vector2 fR, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const std::vector& Sectors, bool bUsePortalClip, IDriver3D *pDriver) { //insert vadjoins first? if ( _bAllowVAdjoin ) @@ -2023,8 +2024,8 @@ void Sector_2_5D::Visibility2D(const Vector3& cPos, Vector2 fL, Vector2 fR, uint fI = fOO255 * (float)shade; //now add objects to the list... - vector::iterator iObj = pCurSec->m_Objects.begin(); - vector::iterator eObj = pCurSec->m_Objects.end(); + std::vector::iterator iObj = pCurSec->m_Objects.begin(); + std::vector::iterator eObj = pCurSec->m_Objects.end(); for (; iObj != eObj; ++iObj) { uint32_t uObjID = *iObj; diff --git a/world/Sector_2_5D.h b/world/Sector_2_5D.h index e100d1f..213840a 100644 --- a/world/Sector_2_5D.h +++ b/world/Sector_2_5D.h @@ -74,12 +74,12 @@ class Sector_2_5D : public Sector void Render(IDriver3D *pDriver, Camera *pCamera); bool PointInsideSector(float x, float y); - float GetZ_Floor(float x, float y, const vector& Sectors); - float GetZ_Ceil(float x, float y, const vector& Sectors); + float GetZ_Floor(float x, float y, const std::vector& Sectors); + float GetZ_Ceil(float x, float y, const std::vector& Sectors); - static void RenderSectors(IDriver3D *pDriver, WorldCell *pCell, Camera *pCamera, Sector_2_5D *pStart, const vector& Sectors); - static void Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRadius, const vector& Sectors, bool bPassThruAdjoins); - static void RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector, const vector& Sectors); + static void RenderSectors(IDriver3D *pDriver, WorldCell *pCell, Camera *pCamera, Sector_2_5D *pStart, const std::vector& Sectors); + static void Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRadius, const std::vector& Sectors, bool bPassThruAdjoins); + static void RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector, const std::vector& Sectors); public: enum { @@ -153,14 +153,14 @@ class Sector_2_5D : public Sector static void VisStack_Push(Vector2& fL, Vector2& fR, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pNext, bool bUsePortalClip=true, Vector3& vOffset=s_vCurrentOffs); static VisStack *VisStack_Pop(); static void VisStack_Clear(); - static void Visibility2D(const Vector3& cPos, Vector2 fL, Vector2 fR, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const vector& Sectors, bool bUsePortalClip, IDriver3D *pDriver); - static void WallRasterizer(const Vector3& cPos, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const vector& Sectors); + static void Visibility2D(const Vector3& cPos, Vector2 fL, Vector2 fR, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const std::vector& Sectors, bool bUsePortalClip, IDriver3D *pDriver); + static void WallRasterizer(const Vector3& cPos, uint32_t uStartX, uint32_t uEndX, Sector_2_5D *pCurSec, const std::vector& Sectors); - static void _DrawWall(IDriver3D *pDriver, Sector_2_5D *pCurSec, Sector_2_5D *pNextSec, Sector_2_5D *pBotSec, Sector_2_5D *pTopSec, uint16_t w, Vector2 *worldPos, const vector& Sectors); - static void _DrawFloor(IDriver3D *pDriver, Sector_2_5D *pCurSec, const Vector2 *worldPos, const Vector2& a, const Vector2& n0, const Vector2& n1, const vector& Sectors); + static void _DrawWall(IDriver3D *pDriver, Sector_2_5D *pCurSec, Sector_2_5D *pNextSec, Sector_2_5D *pBotSec, Sector_2_5D *pTopSec, uint16_t w, Vector2 *worldPos, const std::vector& Sectors); + static void _DrawFloor(IDriver3D *pDriver, Sector_2_5D *pCurSec, const Vector2 *worldPos, const Vector2& a, const Vector2& n0, const Vector2& n1, const std::vector& Sectors); static void _SetupCameraParameters(const Vector3& cPos, const Vector3& cDir, Vector2 fL, Vector2 fR); - static void _AddSectorToList(int32_t s, Vector3 *p0, Vector2& vPathMin, Vector2& vPathMax, const vector& Sectors); + static void _AddSectorToList(int32_t s, Vector3 *p0, Vector2& vPathMin, Vector2& vPathMax, const std::vector& Sectors); static void AddObjectToRender(Object *pObj, float fIntensity, const Vector3& vOffs); static void RenderObjects(IDriver3D *pDriver); diff --git a/world/Sector_GeoBlock.cpp b/world/Sector_GeoBlock.cpp index 7d7f04a..f92cd40 100644 --- a/world/Sector_GeoBlock.cpp +++ b/world/Sector_GeoBlock.cpp @@ -23,8 +23,8 @@ void Sector_GeoBlock::Render(IDriver3D *pDriver, Camera *pCamera) if ( !m_bActive ) return; - vector::iterator iObj = m_Objects.begin(); - vector::iterator eObj = m_Objects.end(); + std::vector::iterator iObj = m_Objects.begin(); + std::vector::iterator eObj = m_Objects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = ObjectManager::GetObjectFromID( *iObj ); @@ -49,8 +49,8 @@ void Sector_GeoBlock::Collide(CollisionPacket *packet, Vector3 *bounds, const Ve if ( !m_bActive ) return; - vector::iterator iObj = m_Objects.begin(); - vector::iterator eObj = m_Objects.end(); + std::vector::iterator iObj = m_Objects.begin(); + std::vector::iterator eObj = m_Objects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = ObjectManager::GetObjectFromID( *iObj ); @@ -70,8 +70,8 @@ void Sector_GeoBlock::Raycast(RaycastPacket *packet, const Vector3& vOffset) if ( !m_bActive ) return; - vector::iterator iObj = m_Objects.begin(); - vector::iterator eObj = m_Objects.end(); + std::vector::iterator iObj = m_Objects.begin(); + std::vector::iterator eObj = m_Objects.end(); for (; iObj != eObj; ++iObj) { Object *pObj = ObjectManager::GetObjectFromID( *iObj ); @@ -91,8 +91,8 @@ void Sector_GeoBlock::Update(float dt) if ( !m_bActive ) return; - vector::iterator iLight = m_Lights.begin(); - vector::iterator eLight = m_Lights.end(); + std::vector::iterator iLight = m_Lights.begin(); + std::vector::iterator eLight = m_Lights.end(); for (; iLight != eLight; ++iLight) { (*iLight)->Update( dt ); diff --git a/world/Sprite_ZAxis.cpp b/world/Sprite_ZAxis.cpp index ffac9de..e11c0e0 100644 --- a/world/Sprite_ZAxis.cpp +++ b/world/Sprite_ZAxis.cpp @@ -3,6 +3,7 @@ #include "../render/IDriver3D.h" #include "../render/RenderQue.h" #include "../render/Camera.h" + #include #define _FRAME_DELAY 4 diff --git a/world/Sprite_ZAxis.h b/world/Sprite_ZAxis.h index 68863bb..e525f63 100644 --- a/world/Sprite_ZAxis.h +++ b/world/Sprite_ZAxis.h @@ -3,9 +3,8 @@ #include "../CommonTypes.h" #include "RenderComponent.h" -#include -using namespace std; +#include class IDriver3D; class Object; @@ -49,7 +48,7 @@ class Sprite_ZAxis : public RenderComponent }; TextureHandle m_hTex; - vector m_fxFrames; + std::vector m_fxFrames; uint32_t m_uFlags; uint32_t m_uCurFrame; int32_t m_nFrameDelay; diff --git a/world/Terrain.h b/world/Terrain.h index 3b0b630..10be13d 100644 --- a/world/Terrain.h +++ b/world/Terrain.h @@ -7,11 +7,10 @@ #include "../render/IDriver3D.h" #include "../render/VertexBuffer.h" #include "../render/IndexBuffer.h" + #include #include -using namespace std; - class IDriver3D; class Camera; class SkyLoader; @@ -154,10 +153,10 @@ class Terrain Chunk m_aChunks[CHUNK_COUNT]; }; - typedef map LocationMap; + typedef std::map LocationMap; LOD m_LOD[2]; - vector m_ChunkRenderList; + std::vector m_ChunkRenderList; LocationMap m_LocationMap; SkyLoader *m_pSkyLoader; diff --git a/world/World.cpp b/world/World.cpp index d047dc5..b5ff018 100644 --- a/world/World.cpp +++ b/world/World.cpp @@ -8,8 +8,9 @@ #include "../math/Math.h" #include "../fileformats/Location_Daggerfall.h" #include "../fileformats/CellManager.h" -#include -#include + +#include +#include World::World() { @@ -31,8 +32,8 @@ World::~World() void World::UnloadWorldCells() { - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { xlDelete *iCell; @@ -52,8 +53,8 @@ bool World::AddWorldCell(WorldCell *pCell) void World::RemoveWorldCell(WorldCell *pCell) { - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { if ( *iCell == pCell ) @@ -74,8 +75,8 @@ void World::Collide(Vector3 *p0, Vector3 *p1, uint32_t& uSector, float fRadius, int32_t camY = m_pCamera->GetWorldPosY()>>3; int32_t cx, cy; - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { WorldCell *pCell = *iCell; @@ -119,8 +120,8 @@ void World::RayCastAndActivate(Vector3 *p0, Vector3 *p1, uint32_t& uSector) int32_t camY = m_pCamera->GetWorldPosY()>>3; int32_t cx, cy; - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { WorldCell *pCell = *iCell; @@ -148,8 +149,8 @@ bool World::Raycast(Vector3 *p0, Vector3 *p1, Vector3 *pInter) int32_t camY = m_pCamera->GetWorldPosY()>>3; int32_t cx, cy; - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { WorldCell *pCell = *iCell; @@ -198,8 +199,8 @@ bool World::Update(float dt, IDriver3D *pDriver) if ( !player || !m_pCamera ) return false; - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { //add culling, won't affect games that only have a single cell.. @@ -461,8 +462,8 @@ void World::Render(IDriver3D *pDriver) m_pTerrain->Render( m_pCamera ); } - vector::iterator iCell = m_WorldCells.begin(); - vector::iterator eCell = m_WorldCells.end(); + std::vector::iterator iCell = m_WorldCells.begin(); + std::vector::iterator eCell = m_WorldCells.end(); for (; iCell != eCell; ++iCell) { //add culling, won't affect games that only have a single cell.. @@ -470,7 +471,7 @@ void World::Render(IDriver3D *pDriver) } } -void World::CC_LockCamera(const vector& args, void *pUserData) +void World::CC_LockCamera(const std::vector& args, void *pUserData) { World *pThis = (World *)pUserData; @@ -483,8 +484,8 @@ void World::CC_LockCamera(const vector& args, void *pUserData) } Camera::EnableCameraUpdating( !bLock ); - vector::iterator iCell = pThis->m_WorldCells.begin(); - vector::iterator eCell = pThis->m_WorldCells.end(); + std::vector::iterator iCell = pThis->m_WorldCells.begin(); + std::vector::iterator eCell = pThis->m_WorldCells.end(); for (; iCell != eCell; ++iCell) { //add culling, won't affect games that only have a single cell.. diff --git a/world/World.h b/world/World.h index 16ae292..ba50b6e 100644 --- a/world/World.h +++ b/world/World.h @@ -4,10 +4,10 @@ #include "../CommonTypes.h" #include "../math/Vector2.h" #include "../math/Vector3.h" + #include #include -using namespace std; class WorldCell; class IDriver3D; class Object; @@ -54,14 +54,14 @@ class World bool CheckNode(int32_t nodeX, int32_t nodeY); //Console commands - static void CC_LockCamera(const vector& args, void *pUserData); + static void CC_LockCamera(const std::vector& args, void *pUserData); protected: void ClearPathingNodes(int32_t wx, int32_t wy); void AddPathingNodes(int32_t dwX, int32_t dwY, uint8_t *pValidNodes); - vector m_WorldCells; + std::vector m_WorldCells; Object *m_Player; //There's only one player (for now). Camera *m_pCamera; //The current camera. Terrain *m_pTerrain; //World terrain. diff --git a/world/WorldCell.cpp b/world/WorldCell.cpp index 35c6736..84c2293 100644 --- a/world/WorldCell.cpp +++ b/world/WorldCell.cpp @@ -8,8 +8,8 @@ #include "../world/CollisionComponent.h" #include "../world/Object.h" #include "../world/LogicDef.h" -#include -#include +#include +#include #define MAX_COLLISION_ITER 3 diff --git a/world/WorldCell.h b/world/WorldCell.h index b0766a9..02c9f8e 100644 --- a/world/WorldCell.h +++ b/world/WorldCell.h @@ -4,9 +4,9 @@ #include "../CommonTypes.h" #include "../math/Vector3.h" #include "../render/Camera.h" + #include -using namespace std; class Sector; class IDriver3D; class Camera; @@ -23,7 +23,7 @@ class WorldCell uint32_t GetSectorCount(); void AddSector(Sector *pSector); Sector *GetSector(uint32_t uIndex); - const vector& GetSectors() { return m_Sectors; } + const std::vector& GetSectors() { return m_Sectors; } int32_t FindSector(const char *pszName); void SetWorldPos(int32_t x, int32_t y) { m_nWorldPosX = x; m_nWorldPosY = y; } @@ -50,7 +50,7 @@ class WorldCell protected: Vector3 m_Bounds[2]; //world space bounds [min,max] - vector m_Sectors; + std::vector m_Sectors; int32_t m_nWorldPosX, m_nWorldPosY; int32_t m_nType; Camera m_LockCamera;