diff --git a/scripts/sweep_linuxgame_includes.py b/scripts/sweep_linuxgame_includes.py index 9a13424f1..dcd693d67 100644 --- a/scripts/sweep_linuxgame_includes.py +++ b/scripts/sweep_linuxgame_includes.py @@ -48,10 +48,18 @@ USAGE_PATTERNS = [ ] +def strip_comments(text: str) -> str: + text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL) + text = re.sub(r'//[^\n]*', '', text) + return text + + def file_needs_linuxgame(text: str) -> bool: # Strip the LinuxGame.h include line itself before checking, to avoid - # the include path matching `LinuxGame`. + # the include path matching `LinuxGame`. Also strip comments so + # references in commented-out code don't keep the include alive. scan = INCLUDE_RE.sub("", text) + scan = strip_comments(scan) for pat in USAGE_PATTERNS: if pat.search(scan): return True diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 3fb436eec..7af1bd050 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -10,7 +10,6 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 319462fb7..464a2cab6 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -27,7 +27,6 @@ #include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/linux/LinuxGame.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index 66098b4f7..a90cecd5f 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h"