From f6348b9617180f66bc33efc424b9a01ab3d23d93 Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 21 Nov 2020 11:20:29 +0000 Subject: [PATCH] Clean up header includes, add new forward declarations. This cleans up many un-necessary header includes, either simply providing nothing or forward declarations in their place. No major compilation time change here, though this does reduce depencies in some headers. Also fix up old MacOS STL-include fixes that are no longer relevant. Differential Revision: https://code.wildfiregames.com/D3128 This was SVN commit r24227. --- source/graphics/Font.h | 1 - source/graphics/HeightMipmap.h | 3 +- source/graphics/LOSTexture.h | 4 +- source/graphics/MapReader.h | 3 +- source/graphics/ModelDef.h | 1 + source/graphics/ShaderTechnique.h | 3 +- source/graphics/ShaderTechniquePtr.h | 30 +++++ source/graphics/SkeletonAnimDef.cpp | 1 + source/gui/CGUISprite.h | 4 + source/gui/GUIRenderer.h | 10 +- source/gui/IGUIScrollBar.h | 2 + source/gui/ObjectBases/IGUIButtonBehavior.h | 1 + source/gui/ObjectTypes/CHotkeyPicker.h | 2 - source/gui/ObjectTypes/CMiniMap.cpp | 1 + source/gui/SettingTypes/CGUIColor.h | 6 +- source/gui/SettingTypes/CGUISize.h | 7 +- source/lib/secure_crt.h | 4 +- source/lib/sysdep/os/osx/osx_stl_fixes.h | 121 ------------------ source/lib/sysdep/stl.h | 6 - source/maths/Quaternion.cpp | 2 + source/maths/Quaternion.h | 3 +- source/network/NetServerTurnManager.cpp | 1 + source/ps/FileIo.h | 6 +- source/ps/Filesystem.h | 7 +- source/ps/GUID.h | 4 +- source/ps/Game.h | 1 + source/ps/Profile.h | 3 - source/ps/XML/XMLWriter.h | 10 +- source/renderer/PostprocManager.h | 3 +- source/scriptinterface/ScriptForward.h | 26 ++++ .../simulation2/components/CCmpSelectable.cpp | 1 + .../components/ICmpObstructionManager.h | 6 +- .../simulation2/components/ICmpPathfinder.h | 2 +- .../components/tests/test_Position.h | 1 + .../components/tests/test_RangeManager.h | 1 + .../helpers/HierarchicalPathfinder.h | 1 + source/simulation2/helpers/Pathfinding.cpp | 4 +- source/simulation2/helpers/Pathfinding.h | 4 +- source/simulation2/helpers/Rasterize.cpp | 1 + source/simulation2/helpers/Rasterize.h | 1 + source/simulation2/helpers/Render.cpp | 1 + source/simulation2/helpers/Selection.h | 2 +- .../simulation2/helpers/SimulationCommand.h | 2 +- .../scripting/JSInterface_Simulation.cpp | 1 + source/simulation2/system/ComponentTest.h | 1 - source/simulation2/system/IComponent.h | 3 +- .../tools/atlas/GameInterface/ActorViewer.h | 5 +- .../GameInterface/Handlers/MapHandlers.cpp | 1 + 48 files changed, 136 insertions(+), 178 deletions(-) create mode 100644 source/graphics/ShaderTechniquePtr.h delete mode 100644 source/lib/sysdep/os/osx/osx_stl_fixes.h create mode 100644 source/scriptinterface/ScriptForward.h diff --git a/source/graphics/Font.h b/source/graphics/Font.h index 3a739e766e..81de4dd286 100644 --- a/source/graphics/Font.h +++ b/source/graphics/Font.h @@ -23,7 +23,6 @@ #include -class CStrW; struct UnifontGlyphData; /** diff --git a/source/graphics/HeightMipmap.h b/source/graphics/HeightMipmap.h index 6bdaa47f03..fa764c5a2d 100644 --- a/source/graphics/HeightMipmap.h +++ b/source/graphics/HeightMipmap.h @@ -24,7 +24,8 @@ #ifndef INCLUDED_HEIGHTMIPMAP #define INCLUDED_HEIGHTMIPMAP -#include "lib/file/vfs/vfs_path.h" +class Path; +using VfsPath = Path; struct SMipmap { diff --git a/source/graphics/LOSTexture.h b/source/graphics/LOSTexture.h index 984b64c98b..4c08c5b6ec 100644 --- a/source/graphics/LOSTexture.h +++ b/source/graphics/LOSTexture.h @@ -18,11 +18,11 @@ #include "lib/ogl.h" #include "maths/Matrix3D.h" -#include "simulation2/components/ICmpRangeManager.h" #include "graphics/ShaderManager.h" +#include "graphics/ShaderTechniquePtr.h" - +class CLosQuerier; class CSimulation2; /** diff --git a/source/graphics/MapReader.h b/source/graphics/MapReader.h index 744c1da839..f7c6e5b08d 100644 --- a/source/graphics/MapReader.h +++ b/source/graphics/MapReader.h @@ -19,9 +19,10 @@ #define INCLUDED_MAPREADER #include "MapIO.h" + +#include "graphics/LightEnv.h" #include "lib/res/handle.h" #include "ps/CStr.h" -#include "LightEnv.h" #include "ps/FileIo.h" #include "scriptinterface/ScriptInterface.h" #include "simulation2/system/Entity.h" diff --git a/source/graphics/ModelDef.h b/source/graphics/ModelDef.h index 6cebb5c27f..b97d4b8f8c 100644 --- a/source/graphics/ModelDef.h +++ b/source/graphics/ModelDef.h @@ -23,6 +23,7 @@ #define INCLUDED_MODELDEF #include "ps/CStr.h" +#include "maths/Matrix3D.h" #include "maths/Vector2D.h" #include "maths/Vector3D.h" #include "maths/Quaternion.h" diff --git a/source/graphics/ShaderTechnique.h b/source/graphics/ShaderTechnique.h index fa94b7d197..7b19103d77 100644 --- a/source/graphics/ShaderTechnique.h +++ b/source/graphics/ShaderTechnique.h @@ -19,6 +19,7 @@ #define INCLUDED_SHADERTECHNIQUE #include "graphics/ShaderProgramPtr.h" +#include "graphics/ShaderTechniquePtr.h" #include "lib/ogl.h" /** @@ -110,6 +111,4 @@ private: bool m_SortByDistance; }; -typedef shared_ptr CShaderTechniquePtr; - #endif // INCLUDED_SHADERTECHNIQUE diff --git a/source/graphics/ShaderTechniquePtr.h b/source/graphics/ShaderTechniquePtr.h new file mode 100644 index 0000000000..7bee0f0cba --- /dev/null +++ b/source/graphics/ShaderTechniquePtr.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2020 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * 0 A.D. is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + + + +#ifndef INCLUDED_SHADERTECHNIQUEPTR +#define INCLUDED_SHADERTECHNIQUEPTR + +/* + * Forward declaration, to reduce the number of header files that have to pull + * in the whole of ShaderTechnique.h + */ +class CShaderTechnique; +typedef std::shared_ptr CShaderTechniquePtr; + +#endif // INCLUDED_SHADERTECHNIQUEPTR diff --git a/source/graphics/SkeletonAnimDef.cpp b/source/graphics/SkeletonAnimDef.cpp index 555faccf54..8ed49d0a4d 100644 --- a/source/graphics/SkeletonAnimDef.cpp +++ b/source/graphics/SkeletonAnimDef.cpp @@ -23,6 +23,7 @@ #include "SkeletonAnimDef.h" #include "maths/MathUtil.h" +#include "maths/Matrix3D.h" #include "ps/FileIo.h" diff --git a/source/gui/CGUISprite.h b/source/gui/CGUISprite.h index 938bf80d4d..23efdb939e 100644 --- a/source/gui/CGUISprite.h +++ b/source/gui/CGUISprite.h @@ -25,6 +25,10 @@ #include "gui/GUIRenderer.h" #include "gui/SettingTypes/CGUISize.h" +#include "gui/SettingTypes/CGUIColor.h" +#include "lib/ogl.h" +#include "lib/file/vfs/vfs_path.h" +#include "ps/CStr.h" #include #include diff --git a/source/gui/GUIRenderer.h b/source/gui/GUIRenderer.h index a4a2572b6d..6829be0756 100644 --- a/source/gui/GUIRenderer.h +++ b/source/gui/GUIRenderer.h @@ -18,17 +18,19 @@ #ifndef INCLUDED_GUIRENDERER #define INCLUDED_GUIRENDERER -#include "graphics/ShaderTechnique.h" +#include "graphics/Color.h" +#include "graphics/ShaderTechniquePtr.h" #include "graphics/Texture.h" -#include "gui/SettingTypes/CGUIColor.h" #include "lib/res/handle.h" -#include "ps/CStr.h" #include "ps/Shapes.h" #include #include +class CGUI; class CGUISprite; +class CStr8; +struct CGUIColor; struct SGUIImage; namespace GUIRenderer @@ -67,7 +69,7 @@ namespace GUIRenderer DrawCalls& operator=(const DrawCalls&); }; - void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr& SpriteName, const CRect& Size, int CellID, std::map& Sprites); + void UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const CStr8& SpriteName, const CRect& Size, int CellID, std::map& Sprites); void Draw(DrawCalls& Calls, float Z); } diff --git a/source/gui/IGUIScrollBar.h b/source/gui/IGUIScrollBar.h index 32d1b5bb68..5a55e1dedb 100644 --- a/source/gui/IGUIScrollBar.h +++ b/source/gui/IGUIScrollBar.h @@ -25,7 +25,9 @@ #define INCLUDED_IGUISCROLLBAR #include "gui/CGUISprite.h" +#include "ps/CStr.h" +class CGUI; class IGUIScrollBarOwner; struct SGUIMessage; diff --git a/source/gui/ObjectBases/IGUIButtonBehavior.h b/source/gui/ObjectBases/IGUIButtonBehavior.h index 4559a99220..e1a7c9f239 100644 --- a/source/gui/ObjectBases/IGUIButtonBehavior.h +++ b/source/gui/ObjectBases/IGUIButtonBehavior.h @@ -27,6 +27,7 @@ #define INCLUDED_IGUIBUTTONBEHAVIOR #include "gui/ObjectBases/IGUIObject.h" +#include "ps/CStr.h" class CGUISpriteInstance; diff --git a/source/gui/ObjectTypes/CHotkeyPicker.h b/source/gui/ObjectTypes/CHotkeyPicker.h index 0c41f39b0f..fdffef8ffb 100644 --- a/source/gui/ObjectTypes/CHotkeyPicker.h +++ b/source/gui/ObjectTypes/CHotkeyPicker.h @@ -32,8 +32,6 @@ class ScriptInterface; * * Used to create new hotkey combinations in-game. Mostly custom. * This object does not draw anything. - * - * NB: because of how input is handled, mouse clicks */ class CHotkeyPicker : public IGUIObject { diff --git a/source/gui/ObjectTypes/CMiniMap.cpp b/source/gui/ObjectTypes/CMiniMap.cpp index d96bc6b4fe..ba69152007 100644 --- a/source/gui/ObjectTypes/CMiniMap.cpp +++ b/source/gui/ObjectTypes/CMiniMap.cpp @@ -46,6 +46,7 @@ #include "scriptinterface/ScriptInterface.h" #include "simulation2/Simulation2.h" #include "simulation2/components/ICmpMinimap.h" +#include "simulation2/components/ICmpRangeManager.h" #include "simulation2/helpers/Los.h" #include "simulation2/system/ParamNode.h" diff --git a/source/gui/SettingTypes/CGUIColor.h b/source/gui/SettingTypes/CGUIColor.h index c82ed09108..0c4006f6e0 100644 --- a/source/gui/SettingTypes/CGUIColor.h +++ b/source/gui/SettingTypes/CGUIColor.h @@ -19,9 +19,9 @@ #define INCLUDED_GUICOLOR #include "graphics/Color.h" -#include "ps/CStr.h" class CGUI; +class CStr8; /** * Same as the CColor class, but this one can also parse colors predefined in the GUI page (such as "yellow"). @@ -51,11 +51,11 @@ struct CGUIColor : CColor /** * Load color depending on current GUI page. */ - bool ParseString(const CGUI& pGUI, const CStr& value, int defaultAlpha = 255); + bool ParseString(const CGUI& pGUI, const CStr8& value, int defaultAlpha = 255); /** * Ensure that all users check for predefined colors. */ - bool ParseString(const CStr& value, int defaultAlpha = 255) = delete; + bool ParseString(const CStr8& value, int defaultAlpha = 255) = delete; }; #endif // INCLUDED_GUICOLOR diff --git a/source/gui/SettingTypes/CGUISize.h b/source/gui/SettingTypes/CGUISize.h index e547be78ba..e033c626fc 100644 --- a/source/gui/SettingTypes/CGUISize.h +++ b/source/gui/SettingTypes/CGUISize.h @@ -18,9 +18,10 @@ #ifndef INCLUDED_CGUISIZE #define INCLUDED_CGUISIZE -#include "ps/CStr.h" #include "ps/Shapes.h" -#include "scriptinterface/ScriptInterface.h" +#include "scriptinterface/ScriptForward.h" + +class CStr8; /** * This class represents a rectangle relative to a parent rectangle @@ -60,7 +61,7 @@ public: * * @return true if success, otherwise size will remain unchanged. */ - bool FromString(const CStr& Value); + bool FromString(const CStr8& Value); bool operator==(const CGUISize& other) const { diff --git a/source/lib/secure_crt.h b/source/lib/secure_crt.h index 1eaa8f7247..d059e01bd2 100644 --- a/source/lib/secure_crt.h +++ b/source/lib/secure_crt.h @@ -52,8 +52,8 @@ namespace ERR // null character. to protect against access violations, only the // first characters are examined; if the null character is // not encountered by then, is returned. -// strnlen is available on OpenBSD -#if !OS_OPENBSD +// strnlen is available on OpenBSD and MacOS +#if !OS_OPENBSD && !OS_MACOSX extern size_t strnlen(const char* str, size_t max_len); #endif extern size_t wcsnlen(const wchar_t* str, size_t max_len); diff --git a/source/lib/sysdep/os/osx/osx_stl_fixes.h b/source/lib/sysdep/os/osx/osx_stl_fixes.h deleted file mode 100644 index d4371c2a19..0000000000 --- a/source/lib/sysdep/os/osx/osx_stl_fixes.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (C) 2013 Wildfire Games. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef OSX_STL_FIXES_H -#define OSX_STL_FIXES_H - -#include -#include -#include // MAC_OS_X_VERSION_* - -/** - * This file adds some explicit template instantiations that are - * declared external on 10.6+ SDKs but are missing from stdc++ on 10.5 - * (this causes a failure to load due to missing symbols on 10.5) - **/ - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 && MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - -_GLIBCXX_BEGIN_NAMESPACE(std) - - -// ostream_insert.h: -# if _GLIBCXX_EXTERN_TEMPLATE - template ostream& __ostream_insert(ostream&, const char*, streamsize); -# ifdef _GLIBCXX_USE_WCHAR_T - template wostream& __ostream_insert(wostream&, const wchar_t*, - streamsize); -# endif -# endif - - -// istream.tcc: -# if _GLIBCXX_EXTERN_TEMPLATE - template istream& istream::_M_extract(unsigned short&); - template istream& istream::_M_extract(unsigned int&); - template istream& istream::_M_extract(long&); - template istream& istream::_M_extract(unsigned long&); - template istream& istream::_M_extract(bool&); -# ifdef _GLIBCXX_USE_LONG_LONG - template istream& istream::_M_extract(long long&); - template istream& istream::_M_extract(unsigned long long&); -# endif - template istream& istream::_M_extract(float&); - template istream& istream::_M_extract(double&); - template istream& istream::_M_extract(long double&); - template istream& istream::_M_extract(void*&); - - template class basic_iostream; - -# ifdef _GLIBCXX_USE_WCHAR_T - template wistream& wistream::_M_extract(unsigned short&); - template wistream& wistream::_M_extract(unsigned int&); - template wistream& wistream::_M_extract(long&); - template wistream& wistream::_M_extract(unsigned long&); - template wistream& wistream::_M_extract(bool&); -# ifdef _GLIBCXX_USE_LONG_LONG - template wistream& wistream::_M_extract(long long&); - template wistream& wistream::_M_extract(unsigned long long&); -# endif - template wistream& wistream::_M_extract(float&); - template wistream& wistream::_M_extract(double&); - template wistream& wistream::_M_extract(long double&); - template wistream& wistream::_M_extract(void*&); - - template class basic_iostream; -# endif -# endif - - -// ostream.tcc: -# if _GLIBCXX_EXTERN_TEMPLATE - template ostream& ostream::_M_insert(long); - template ostream& ostream::_M_insert(unsigned long); - template ostream& ostream::_M_insert(bool); -# ifdef _GLIBCXX_USE_LONG_LONG - template ostream& ostream::_M_insert(long long); - template ostream& ostream::_M_insert(unsigned long long); -# endif - template ostream& ostream::_M_insert(double); - template ostream& ostream::_M_insert(long double); - template ostream& ostream::_M_insert(const void*); - -# ifdef _GLIBCXX_USE_WCHAR_T - template wostream& wostream::_M_insert(long); - template wostream& wostream::_M_insert(unsigned long); - template wostream& wostream::_M_insert(bool); -# ifdef _GLIBCXX_USE_LONG_LONG - template wostream& wostream::_M_insert(long long); - template wostream& wostream::_M_insert(unsigned long long); -# endif - template wostream& wostream::_M_insert(double); - template wostream& wostream::_M_insert(long double); - template wostream& wostream::_M_insert(const void*); -# endif -# endif - - -_GLIBCXX_END_NAMESPACE - -#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 && MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - -#endif // OSX_STL_FIXES_H diff --git a/source/lib/sysdep/stl.h b/source/lib/sysdep/stl.h index f4caa3ca48..350984d2be 100644 --- a/source/lib/sysdep/stl.h +++ b/source/lib/sysdep/stl.h @@ -72,10 +72,4 @@ # endif #endif - -// OS X - fix some stream template instantiations that break 10.5 compatibility on newer SDKs -#if OS_MACOSX -# include "os/osx/osx_stl_fixes.h" -#endif - #endif // #ifndef INCLUDED_STL diff --git a/source/maths/Quaternion.cpp b/source/maths/Quaternion.cpp index e8d5863192..1aac49b6fa 100644 --- a/source/maths/Quaternion.cpp +++ b/source/maths/Quaternion.cpp @@ -18,7 +18,9 @@ #include "precompiled.h" #include "Quaternion.h" + #include "MathUtil.h" +#include "Matrix3D.h" const float EPSILON=0.0001f; diff --git a/source/maths/Quaternion.h b/source/maths/Quaternion.h index d63852ffa4..c0574122d0 100644 --- a/source/maths/Quaternion.h +++ b/source/maths/Quaternion.h @@ -18,9 +18,10 @@ #ifndef INCLUDED_QUATERNION #define INCLUDED_QUATERNION -#include "Matrix3D.h" #include "Vector3D.h" +class CMatrix3D; + class CQuaternion { public: diff --git a/source/network/NetServerTurnManager.cpp b/source/network/NetServerTurnManager.cpp index f16e749931..7b15b25116 100644 --- a/source/network/NetServerTurnManager.cpp +++ b/source/network/NetServerTurnManager.cpp @@ -22,6 +22,7 @@ #include "NetServer.h" #include "NetSession.h" +#include "lib/utf8.h" #include "ps/CLogger.h" #include "simulation2/system/TurnManager.h" diff --git a/source/ps/FileIo.h b/source/ps/FileIo.h index 9426c6e73e..b3cc06ec3a 100644 --- a/source/ps/FileIo.h +++ b/source/ps/FileIo.h @@ -30,11 +30,13 @@ #ifndef INCLUDED_FILEPACKER #define INCLUDED_FILEPACKER -#include "CStr.h" #include "lib/file/vfs/vfs_path.h" #include "ps/Filesystem.h" // WriteBuffer #include "ps/Errors.h" + +class CStr8; + ERROR_GROUP(File); ERROR_TYPE(File, OpenFailed); ERROR_TYPE(File, WriteFailed); @@ -83,7 +85,7 @@ public: * pack a string onto the end of the data stream * (encoded as a 32-bit length followed by the characters) **/ - void PackString(const CStr& str); + void PackString(const CStr8& str); private: /** diff --git a/source/ps/Filesystem.h b/source/ps/Filesystem.h index ba87163b41..333e934a25 100644 --- a/source/ps/Filesystem.h +++ b/source/ps/Filesystem.h @@ -23,9 +23,10 @@ #include "lib/file/io/write_buffer.h" #include "lib/file/vfs/vfs_util.h" -#include "ps/CStr.h" #include "ps/Errors.h" +class CStr8; + extern PIVFS g_VFS; extern bool VfsFileExists(const VfsPath& pathname); @@ -92,13 +93,13 @@ public: * Returns contents of file as a string * @note file must have been successfully loaded */ - CStr GetAsString() const; + CStr8 GetAsString() const; /** * Returns contents of a UTF-8 encoded file as a string with optional BOM removed * @note file must have been successfully loaded */ - CStr DecodeUTF8() const; + CStr8 DecodeUTF8() const; private: shared_ptr m_Buffer; diff --git a/source/ps/GUID.h b/source/ps/GUID.h index a8c405d9a1..41a8252c77 100644 --- a/source/ps/GUID.h +++ b/source/ps/GUID.h @@ -18,8 +18,8 @@ #ifndef INCLUDED_GUID #define INCLUDED_GUID -#include "ps/CStr.h" +class CStr8; -CStr ps_generate_guid(void); +CStr8 ps_generate_guid(void); #endif diff --git a/source/ps/Game.h b/source/ps/Game.h index e888008f87..b6c7429ec7 100644 --- a/source/ps/Game.h +++ b/source/ps/Game.h @@ -20,6 +20,7 @@ #include +#include "ps/CStr.h" #include "ps/Errors.h" #include "ps/Filesystem.h" #include "scriptinterface/ScriptTypes.h" diff --git a/source/ps/Profile.h b/source/ps/Profile.h index a404f381a1..e914e613be 100644 --- a/source/ps/Profile.h +++ b/source/ps/Profile.h @@ -40,9 +40,6 @@ class CProfileManager; class CProfileNodeTable; -class CStr8; -class CStrW; - // To profile scripts usefully, we use a call hook that's called on every enter/exit, // and need to find the function name. But most functions are anonymous so we make do // with filename plus line number instead. diff --git a/source/ps/XML/XMLWriter.h b/source/ps/XML/XMLWriter.h index c243670484..0155d089f3 100644 --- a/source/ps/XML/XMLWriter.h +++ b/source/ps/XML/XMLWriter.h @@ -61,9 +61,9 @@ * end of XMLWriter.cpp. */ -#include "ps/CStr.h" #include "lib/file/vfs/vfs.h" +class CStr8; class XMBElement; class XMBFile; class XMLWriter_Element; @@ -80,7 +80,7 @@ public: void XMB(const XMBFile& file); bool StoreVFS(const PIVFS& vfs, const VfsPath& pathname); - const CStr& GetOutput(); + const CStr8& GetOutput(); private: @@ -94,11 +94,11 @@ private: void ElementClose(); void ElementEnd(const char* name, int type); - CStr Indent(); + CStr8 Indent(); bool m_PrettyPrint; - CStr m_Data; + CStr8 m_Data; int m_Indent; XMLWriter_Element* m_LastElement; }; @@ -119,7 +119,7 @@ private: friend class XMLWriter_File; XMLWriter_File* m_File; - CStr m_Name; + CStr8 m_Name; int m_Type; }; diff --git a/source/renderer/PostprocManager.h b/source/renderer/PostprocManager.h index 19698f65ee..ed7e19a536 100644 --- a/source/renderer/PostprocManager.h +++ b/source/renderer/PostprocManager.h @@ -18,7 +18,8 @@ #ifndef INCLUDED_POSTPROCMANAGER #define INCLUDED_POSTPROCMANAGER -#include "graphics/ShaderTechnique.h" +#include "graphics/ShaderTechniquePtr.h" +#include "lib/ogl.h" #include "ps/CStr.h" #include diff --git a/source/scriptinterface/ScriptForward.h b/source/scriptinterface/ScriptForward.h new file mode 100644 index 0000000000..eeace49384 --- /dev/null +++ b/source/scriptinterface/ScriptForward.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2020 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * 0 A.D. is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + +#ifndef INCLUDED_SCRIPTFORWARD +#define INCLUDED_SCRIPTFORWARD + +#include "js/TypeDecls.h" + +class ScriptInterface; +class ScriptRequest; + +#endif // INCLUDED_SCRIPTFORWARD diff --git a/source/simulation2/components/CCmpSelectable.cpp b/source/simulation2/components/CCmpSelectable.cpp index 219e171737..b5d7513861 100644 --- a/source/simulation2/components/CCmpSelectable.cpp +++ b/source/simulation2/components/CCmpSelectable.cpp @@ -27,6 +27,7 @@ #include "maths/Matrix3D.h" #include "maths/Vector3D.h" #include "maths/Vector2D.h" +#include "ps/CLogger.h" #include "ps/Profile.h" #include "renderer/Scene.h" #include "renderer/Renderer.h" diff --git a/source/simulation2/components/ICmpObstructionManager.h b/source/simulation2/components/ICmpObstructionManager.h index 1c656d1ee1..97ada2a035 100644 --- a/source/simulation2/components/ICmpObstructionManager.h +++ b/source/simulation2/components/ICmpObstructionManager.h @@ -20,14 +20,16 @@ #include "simulation2/system/Interface.h" -#include "simulation2/helpers/Pathfinding.h" - #include "maths/FixedVector2D.h" +#include "simulation2/helpers/Position.h" class IObstructionTestFilter; template class Grid; struct GridUpdateInformation; +using NavcellData = u16; +class PathfinderPassability; + /** * Obstruction manager: provides efficient spatial queries over objects in the world. diff --git a/source/simulation2/components/ICmpPathfinder.h b/source/simulation2/components/ICmpPathfinder.h index dcf9847eff..cc07011832 100644 --- a/source/simulation2/components/ICmpPathfinder.h +++ b/source/simulation2/components/ICmpPathfinder.h @@ -21,7 +21,6 @@ #include "simulation2/system/Interface.h" #include "simulation2/components/ICmpObstruction.h" -#include "simulation2/helpers/PathGoal.h" #include "simulation2/helpers/Pathfinding.h" #include "maths/FixedVector2D.h" @@ -30,6 +29,7 @@ #include class IObstructionTestFilter; +class PathGoal; template class Grid; diff --git a/source/simulation2/components/tests/test_Position.h b/source/simulation2/components/tests/test_Position.h index 96e3f885f3..0b9d137ced 100644 --- a/source/simulation2/components/tests/test_Position.h +++ b/source/simulation2/components/tests/test_Position.h @@ -17,6 +17,7 @@ #include "simulation2/system/ComponentTest.h" +#include "maths/Matrix3D.h" #include "simulation2/components/ICmpPosition.h" #include "simulation2/components/ICmpWaterManager.h" diff --git a/source/simulation2/components/tests/test_RangeManager.h b/source/simulation2/components/tests/test_RangeManager.h index 321494d708..dde0c68515 100644 --- a/source/simulation2/components/tests/test_RangeManager.h +++ b/source/simulation2/components/tests/test_RangeManager.h @@ -15,6 +15,7 @@ * along with 0 A.D. If not, see . */ +#include "maths/Matrix3D.h" #include "simulation2/system/ComponentTest.h" #include "simulation2/components/ICmpRangeManager.h" #include "simulation2/components/ICmpObstruction.h" diff --git a/source/simulation2/helpers/HierarchicalPathfinder.h b/source/simulation2/helpers/HierarchicalPathfinder.h index 87eb97d714..003fadf1a3 100644 --- a/source/simulation2/helpers/HierarchicalPathfinder.h +++ b/source/simulation2/helpers/HierarchicalPathfinder.h @@ -20,6 +20,7 @@ #include "Pathfinding.h" +#include "ps/CLogger.h" #include "renderer/TerrainOverlay.h" #include "Render.h" #include "graphics/SColor.h" diff --git a/source/simulation2/helpers/Pathfinding.cpp b/source/simulation2/helpers/Pathfinding.cpp index 31f84e320d..fcfd353c08 100644 --- a/source/simulation2/helpers/Pathfinding.cpp +++ b/source/simulation2/helpers/Pathfinding.cpp @@ -20,7 +20,9 @@ #include "Pathfinding.h" #include "graphics/Terrain.h" -#include "Grid.h" +#include "ps/CLogger.h" +#include "simulation2/helpers/Grid.h" +#include "simulation2/system/ParamNode.h" namespace Pathfinding { diff --git a/source/simulation2/helpers/Pathfinding.h b/source/simulation2/helpers/Pathfinding.h index 8cefaa96b2..a7dab4a387 100644 --- a/source/simulation2/helpers/Pathfinding.h +++ b/source/simulation2/helpers/Pathfinding.h @@ -20,12 +20,12 @@ #include "graphics/Terrain.h" #include "maths/MathUtil.h" -#include "ps/CLogger.h" #include "simulation2/system/Entity.h" -#include "simulation2/system/ParamNode.h" #include "PathGoal.h" +class CParamNode; + typedef u16 pass_class_t; template class Grid; diff --git a/source/simulation2/helpers/Rasterize.cpp b/source/simulation2/helpers/Rasterize.cpp index 9037300b68..c8ad5b606e 100644 --- a/source/simulation2/helpers/Rasterize.cpp +++ b/source/simulation2/helpers/Rasterize.cpp @@ -20,6 +20,7 @@ #include "Rasterize.h" #include "simulation2/helpers/Geometry.h" +#include "simulation2/helpers/Pathfinding.h" void SimRasterize::RasterizeRectWithClearance(Spans& spans, const ICmpObstructionManager::ObstructionSquare& shape, diff --git a/source/simulation2/helpers/Rasterize.h b/source/simulation2/helpers/Rasterize.h index bfee13ce8b..d1c6423b85 100644 --- a/source/simulation2/helpers/Rasterize.h +++ b/source/simulation2/helpers/Rasterize.h @@ -24,6 +24,7 @@ */ #include "simulation2/components/ICmpObstructionManager.h" +#include "simulation2/helpers/Position.h" namespace SimRasterize { diff --git a/source/simulation2/helpers/Render.cpp b/source/simulation2/helpers/Render.cpp index e5d6db66d3..5c29ebdb97 100644 --- a/source/simulation2/helpers/Render.cpp +++ b/source/simulation2/helpers/Render.cpp @@ -24,6 +24,7 @@ #include "maths/BoundingBoxAligned.h" #include "maths/BoundingBoxOriented.h" #include "maths/MathUtil.h" +#include "maths/Matrix3D.h" #include "maths/Quaternion.h" #include "maths/Vector2D.h" #include "ps/Profile.h" diff --git a/source/simulation2/helpers/Selection.h b/source/simulation2/helpers/Selection.h index 24bc2a4561..26158dfb49 100644 --- a/source/simulation2/helpers/Selection.h +++ b/source/simulation2/helpers/Selection.h @@ -19,10 +19,10 @@ #define INCLUDED_SELECTION #include "ps/Profiler2.h" -#include "simulation2/components/ICmpObstruction.h" #include "simulation2/helpers/Player.h" #include "simulation2/Simulation2.h" #include "simulation2/system/Entity.h" +#include "simulation2/system/IComponent.h" #include diff --git a/source/simulation2/helpers/SimulationCommand.h b/source/simulation2/helpers/SimulationCommand.h index 8845cfa39f..17e184deba 100644 --- a/source/simulation2/helpers/SimulationCommand.h +++ b/source/simulation2/helpers/SimulationCommand.h @@ -18,7 +18,7 @@ #ifndef INCLUDED_SIMULATIONCOMMAND #define INCLUDED_SIMULATIONCOMMAND -#include "scriptinterface/ScriptInterface.h" +#include "scriptinterface/ScriptTypes.h" #include "simulation2/helpers/Player.h" /** diff --git a/source/simulation2/scripting/JSInterface_Simulation.cpp b/source/simulation2/scripting/JSInterface_Simulation.cpp index b006fceee9..543afa7772 100644 --- a/source/simulation2/scripting/JSInterface_Simulation.cpp +++ b/source/simulation2/scripting/JSInterface_Simulation.cpp @@ -28,6 +28,7 @@ #include "simulation2/components/ICmpAIManager.h" #include "simulation2/components/ICmpCommandQueue.h" #include "simulation2/components/ICmpGuiInterface.h" +#include "simulation2/components/ICmpObstruction.h" #include "simulation2/components/ICmpPosition.h" #include "simulation2/components/ICmpSelectable.h" #include "simulation2/helpers/Geometry.h" diff --git a/source/simulation2/system/ComponentTest.h b/source/simulation2/system/ComponentTest.h index 88d978d227..5542758a43 100644 --- a/source/simulation2/system/ComponentTest.h +++ b/source/simulation2/system/ComponentTest.h @@ -20,7 +20,6 @@ #include "lib/self_test.h" -#include "maths/Matrix3D.h" #include "maths/Vector3D.h" #include "ps/XML/Xeromyces.h" #include "simulation2/MessageTypes.h" diff --git a/source/simulation2/system/IComponent.h b/source/simulation2/system/IComponent.h index 9743692c2a..0d5515b2f1 100644 --- a/source/simulation2/system/IComponent.h +++ b/source/simulation2/system/IComponent.h @@ -22,8 +22,7 @@ #include "Message.h" #include "Entity.h" #include "SimContext.h" - -#include "scriptinterface/ScriptTypes.h" +#include "scriptinterface/ScriptForward.h" class CParamNode; class CMessage; diff --git a/source/tools/atlas/GameInterface/ActorViewer.h b/source/tools/atlas/GameInterface/ActorViewer.h index da932d10c0..1740b49a7e 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.h +++ b/source/tools/atlas/GameInterface/ActorViewer.h @@ -18,13 +18,14 @@ #ifndef INCLUDED_ACTORVIEWER #define INCLUDED_ACTORVIEWER -#include "ps/CStr.h" #include "simulation2/helpers/Player.h" #include "simulation2/system/Entity.h" struct ActorViewerImpl; struct SColor4ub; class CSimulation2; +class CStr8; +class CStrW; class ActorViewer { @@ -35,7 +36,7 @@ public: CSimulation2* GetSimulation2(); entity_id_t GetEntity(); - void SetActor(const CStrW& id, const CStr& animation, player_id_t playerID); + void SetActor(const CStrW& id, const CStr8& animation, player_id_t playerID); void SetEnabled(bool enabled); void UnloadObjects(); void SetBackgroundColor(const SColor4ub& color); diff --git a/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp index d5b0f2a9ef..b5561d7ae8 100644 --- a/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp @@ -40,6 +40,7 @@ #include "ps/Game.h" #include "ps/GameSetup/GameSetup.h" #include "ps/Loader.h" +#include "ps/Shapes.h" #include "ps/World.h" #include "renderer/Renderer.h" #include "renderer/WaterManager.h"