Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/ci-build.yml
#	src/ai/ai_gui.cpp
#	src/blitter/32bpp_optimized.cpp
#	src/blitter/32bpp_simple.cpp
#	src/blitter/32bpp_sse2.cpp
#	src/blitter/8bpp_optimized.cpp
#	src/blitter/8bpp_simple.cpp
#	src/blitter/null.cpp
#	src/blitter/null.hpp
#	src/company_gui.cpp
#	src/game/game_gui.cpp
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/gfx_func.h
#	src/graph_gui.cpp
#	src/industry_gui.cpp
#	src/linkgraph/linkgraphjob.cpp
#	src/network/network_gui.cpp
#	src/newgrf_debug_gui.cpp
#	src/openttd.cpp
#	src/pathfinder/npf/aystar.h
#	src/road_gui.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/script/api/script_log.cpp
#	src/script/api/script_town.cpp
#	src/script/script_gui.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_table.cpp
#	src/settings_type.h
#	src/smallmap_gui.cpp
#	src/sortlist_type.h
#	src/spritecache.cpp
#	src/spriteloader/grf.cpp
#	src/spriteloader/grf.hpp
#	src/spriteloader/spriteloader.hpp
#	src/station_cmd.cpp
#	src/station_cmd.h
#	src/station_gui.cpp
#	src/strings.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/town_gui.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
#	src/video/opengl.cpp
#	src/video/opengl.h
#	src/widgets/dropdown.cpp
#	src/widgets/dropdown_type.h
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-12-23 13:26:55 +00:00
249 changed files with 2737 additions and 2156 deletions

View File

@@ -15,7 +15,7 @@
#include "../../safeguards.h"
extern Town *AirportGetNearestTown(const struct AirportSpec *as, const TileIterator &it, uint &mindist);
extern Town *AirportGetNearestTown(const struct AirportSpec *as, TileIndex tile, const TileIterator &it, uint &mindist);
extern uint8 GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint distance);
/* static */ bool ScriptAirport::IsValidAirportType(AirportType type)
@@ -142,7 +142,7 @@ extern uint8 GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint
if (_settings_game.economy.station_noise_level) {
AirportTileTableIterator it(as->table[0], tile);
uint dist;
AirportGetNearestTown(as, it, dist);
AirportGetNearestTown(as, tile, it, dist);
return GetAirportNoiseLevelForDistance(as, dist);
}
@@ -158,7 +158,7 @@ extern uint8 GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint
if (!as->IsWithinMapBounds(0, tile)) return INVALID_TOWN;
uint dist;
return AirportGetNearestTown(as, AirportTileTableIterator(as->table[0], tile), dist)->index;
return AirportGetNearestTown(as, tile, AirportTileTableIterator(as->table[0], tile), dist)->index;
}
/* static */ SQInteger ScriptAirport::GetMaintenanceCostFactor(AirportType type)

View File

@@ -39,8 +39,8 @@ ScriptAsyncMode::ScriptAsyncMode(HSQUIRRELVM vm)
throw sq_throwerror(vm, "Argument must be a boolean");
}
this->last_mode = this->GetDoCommandMode();
this->last_instance = this->GetDoCommandModeInstance();
this->last_mode = this->GetDoCommandAsyncMode();
this->last_instance = this->GetDoCommandAsyncModeInstance();
this->SetDoCommandAsyncMode(sqasync ? &ScriptAsyncMode::AsyncModeProc : &ScriptAsyncMode::NonAsyncModeProc, this);
}
@@ -48,8 +48,8 @@ ScriptAsyncMode::ScriptAsyncMode(HSQUIRRELVM vm)
void ScriptAsyncMode::FinalRelease()
{
if (this->GetDoCommandAsyncModeInstance() != this) {
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
/* Ignore this error if the script is not alive. */
if (ScriptObject::GetActiveInstance()->IsAlive()) {
throw Script_FatalError("Asyncmode object was removed while it was not the latest *Mode object created.");
}
}

View File

@@ -31,8 +31,8 @@ ScriptExecMode::ScriptExecMode()
void ScriptExecMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
/* Ignore this error if the script is not alive. */
if (ScriptObject::GetActiveInstance()->IsAlive()) {
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
}
}

View File

@@ -58,7 +58,7 @@
/* Also still print to debug window */
DEBUG(script, level, "[%d] [%c] %s", (uint)ScriptObject::GetRootCompany(), logc, line.text.c_str());
InvalidateWindowData(WC_SCRIPT_DEBUG, 0, ScriptObject::GetRootCompany());
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, ScriptObject::GetRootCompany());
}
/* static */ void ScriptLog::LogOnce(ScriptLogTypes::ScriptLogType level, std::string &&message)

View File

@@ -34,6 +34,7 @@ namespace ScriptLogTypes {
struct LogLine {
std::string text; ///< The text
ScriptLogType type; ///< Text type
uint width; ///< The text width
};
/**

View File

@@ -31,8 +31,8 @@ ScriptTestMode::ScriptTestMode()
void ScriptTestMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
/* Ignore this error if the script is not alive. */
if (ScriptObject::GetActiveInstance()->IsAlive()) {
throw Script_FatalError("Testmode object was removed while it was not the latest *Mode object created.");
}
}

View File

@@ -206,7 +206,7 @@
if (!IsValidTown(town_id)) return false;
const Town *t = ::Town::Get(town_id);
return ((uint32)GetDistanceSquareToTile(town_id, tile) <= t->cache.squared_town_zone_radius[0]);
return ((uint32_t)GetDistanceSquareToTile(town_id, tile) <= t->cache.squared_town_zone_radius[HZB_TOWN_EDGE]);
}
/* static */ bool ScriptTown::HasStatue(TownID town_id)