From 28c4f8e05af2c105f52b1e7b964794e9d9098723 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 20 Apr 2025 13:12:42 +0200 Subject: [PATCH] Codechange: Disable clang-format in some corner cases. --- src/script/api/script_rail.hpp | 3 +++ src/script/squirrel.cpp | 10 +++++++--- src/strings.cpp | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/script/api/script_rail.hpp b/src/script/api/script_rail.hpp index 5ef7e70e49..f206b30d7c 100644 --- a/src/script/api/script_rail.hpp +++ b/src/script/api/script_rail.hpp @@ -301,7 +301,10 @@ public: * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN * @return Whether the station has been/can be build or not. */ + /* clang-format off */ + /* wrapping breaks the squirrel-extractor */ static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, SQInteger num_platforms, SQInteger platform_length, StationID station_id, CargoType cargo_type, IndustryType source_industry, IndustryType goal_industry, SQInteger distance, bool source_station); + /* clang-format on */ /** * Build a rail waypoint. diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 35ada7bc1f..b2c38dd0a9 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -15,12 +15,16 @@ #include "../string_func.h" #include "script_fatalerror.hpp" #include "../settings_type.h" -#include -#include <../squirrel/sqpcheader.h> -#include <../squirrel/sqvm.h> #include "../core/math_func.hpp" #include "../core/string_consumer.hpp" +/* clang-format off */ +/* squirrel defines lots of generically named macros, which break some headers above, so move them to the end */ +#include "../3rdparty/squirrel/include/sqstdaux.h" +#include "../3rdparty/squirrel/squirrel/sqpcheader.h" +#include "../3rdparty/squirrel/squirrel/sqvm.h" +/* clang-format on */ + #include "../safeguards.h" /* diff --git a/src/strings.cpp b/src/strings.cpp index 2470962826..a8a700172d 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -42,12 +42,16 @@ #include "core/string_consumer.hpp" #include -#include "table/strings.h" #include "table/control_codes.h" #include "3rdparty/fmt/std.h" #include "strings_internal.h" +/* clang-format off */ +/* work around "main include" detection */ +#include "table/strings.h" +/* clang-format on */ + #include "safeguards.h" std::string _config_language_file; ///< The file (name) stored in the configuration.