Browse Source

Remove excessive includes from porting.h

sfan5 3 months ago
parent
commit
1ba26d67bd

+ 2 - 0
src/client/clientlauncher.cpp

@@ -34,6 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "version.h"
 #include "renderingengine.h"
 #include "network/networkexceptions.h"
+#include <IGUISpriteBank.h>
+#include <ICameraSceneNode.h>
 
 #if USE_SOUND
 	#include "sound/sound_openal.h"

+ 1 - 0
src/client/game.cpp

@@ -74,6 +74,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "script/scripting_client.h"
 #include "hud.h"
 #include "clientdynamicinfo.h"
+#include <IAnimatedMeshSceneNode.h>
 
 #if USE_SOUND
 	#include "client/sound/sound_openal.h"

+ 1 - 1
src/client/renderingengine.cpp

@@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include <optional>
-#include <IrrlichtDevice.h>
+#include <irrlicht.h>
 #include "fontengine.h"
 #include "client.h"
 #include "clouds.h"

+ 1 - 0
src/client/tile.cpp

@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <algorithm>
 #include <ICameraSceneNode.h>
 #include <IVideoDriver.h>
+#include <IFileSystem.h>
 #include "util/string.h"
 #include "util/container.h"
 #include "util/thread.h"

+ 2 - 0
src/filesys.cpp

@@ -30,6 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "porting.h"
 #ifndef SERVER
 #include "irr_ptr.h"
+#include <IFileArchive.h>
+#include <IFileSystem.h>
 #endif
 
 namespace fs

+ 2 - 1
src/gui/guiFormSpecMenu.cpp

@@ -33,9 +33,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <IGUICheckBox.h>
 #include <IGUIComboBox.h>
 #include <IGUIEditBox.h>
-#include <IGUIStaticText.h>
 #include <IGUIFont.h>
 #include <IGUITabControl.h>
+#include <IGUIImage.h>
+#include <IAnimatedMeshSceneNode.h>
 #include "client/renderingengine.h"
 #include "log.h"
 #include "client/tile.h" // ITextureSource

+ 1 - 0
src/gui/guiFormSpecMenu.h

@@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/string.h"
 #include "util/enriched_string.h"
 #include "StyleSpec.h"
+#include <IGUIStaticText.h>
 
 class InventoryManager;
 class ISimpleTextureSource;

+ 2 - 0
src/gui/modalMenu.cpp

@@ -20,6 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <cstdlib>
 #include <IEventReceiver.h>
+#include <IGUIComboBox.h>
+#include <IGUIEditBox.h>
 #include "client/renderingengine.h"
 #include "modalMenu.h"
 #include "gettext.h"

+ 1 - 0
src/gui/touchscreengui.cpp

@@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client/keycode.h"
 #include "client/renderingengine.h"
 #include "util/numeric.h"
+#include <ISceneCollisionManager.h>
 
 #include <iostream>
 #include <algorithm>

+ 2 - 4
src/porting.h

@@ -27,11 +27,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 	#define _GNU_SOURCE
 #endif
 
+// Be mindful of what you include here!
 #include <string>
-#include <vector>
-#include "irrlicht.h"
-#include "irrlichttypes.h" // u32
-#include "irrlichttypes_extrabloated.h"
+#include "irrlichttypes.h" // u64
 #include "debug.h"
 #include "constants.h"
 #include "gettime.h"

+ 2 - 0
src/porting_android.h

@@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <android_native_app_glue.h>
 #include <android/log.h>
 
+#include "irrlichttypes_bloated.h"
+
 #include <string>
 
 namespace porting {

+ 2 - 0
src/script/cpp_api/s_security.cpp

@@ -22,7 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "filesys.h"
 #include "porting.h"
 #include "server.h"
+#ifndef SERVER
 #include "client/client.h"
+#endif
 #include "settings.h"
 
 #include <cerrno>

+ 1 - 1
src/terminal_chat_console.cpp

@@ -280,7 +280,7 @@ void TerminalChatConsole::handleInput(int ch, bool &complete_redraw_needed)
 				ChatPrompt::CURSOROP_DIR_RIGHT,
 				ChatPrompt::CURSOROP_SCOPE_LINE);
 			break;
-		case KEY_TAB:
+		case '\t':
 			// Tab pressed
 			// Nick completion
 			prompt.nickCompletion(m_nicks, false);

+ 2 - 0
src/util/ieee_float.cpp

@@ -22,11 +22,13 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+
 #include "ieee_float.h"
 #include "log.h"
 #include "porting.h"
 #include <limits>
 #include <cmath>
+#include <cstring>
 
 // Given an unsigned 32-bit integer representing an IEEE-754 single-precision
 // float, return the float.

+ 2 - 2
src/util/string.cpp

@@ -255,7 +255,7 @@ std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask)
 	return result;
 }
 
-size_t mystrlcpy(char *dst, const char *src, size_t size)
+size_t mystrlcpy(char *dst, const char *src, size_t size) noexcept
 {
 	size_t srclen  = strlen(src) + 1;
 	size_t copylen = MYMIN(srclen, size);
@@ -268,7 +268,7 @@ size_t mystrlcpy(char *dst, const char *src, size_t size)
 	return srclen;
 }
 
-char *mystrtok_r(char *s, const char *sep, char **lasts)
+char *mystrtok_r(char *s, const char *sep, char **lasts) noexcept
 {
 	char *t;
 

+ 2 - 2
src/util/string.h

@@ -83,8 +83,8 @@ std::string urlencode(const std::string &str);
 std::string urldecode(const std::string &str);
 u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask);
 std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask);
-size_t mystrlcpy(char *dst, const char *src, size_t size);
-char *mystrtok_r(char *s, const char *sep, char **lasts);
+size_t mystrlcpy(char *dst, const char *src, size_t size) noexcept;
+char *mystrtok_r(char *s, const char *sep, char **lasts) noexcept;
 u64 read_seed(const char *str);
 bool parseColorString(const std::string &value, video::SColor &color, bool quiet,
 		unsigned char default_alpha = 0xff);