Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/aircraft_cmd.cpp # src/blitter/32bpp_anim.cpp # src/cargopacket.cpp # src/cheat_gui.cpp # src/company_cmd.cpp # src/company_gui.cpp # src/core/pool_func.hpp # src/date.cpp # src/economy.cpp # src/error_gui.cpp # src/ground_vehicle.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/industry_cmd.cpp # src/lang/dutch.txt # src/lang/french.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/linkgraph/mcf.cpp # src/network/network_content.cpp # src/network/network_server.cpp # src/network/network_udp.cpp # src/newgrf_engine.cpp # src/newgrf_station.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/pathfinder/follow_track.hpp # src/pathfinder/yapf/yapf_common.hpp # src/saveload/saveload.cpp # src/settings_gui.cpp # src/station_cmd.cpp # src/station_kdtree.h # src/string_func.h # src/table/settings.ini # src/tgp.cpp # src/timetable_cmd.cpp # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/tunnelbridge_cmd.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/video/win32_v.cpp # src/viewport.cpp # src/viewport_sprite_sorter_sse4.cpp # src/window.cpp
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li AICargo::GetName
|
||||
* \li AIPriorityQueue
|
||||
*
|
||||
* \b 1.10.0
|
||||
|
@@ -18,6 +18,7 @@
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li GSCargo::GetName
|
||||
* \li GSEventStoryPageButtonClick
|
||||
* \li GSEventStoryPageTileSelect
|
||||
* \li GSEventStoryPageVehicleSelect
|
||||
|
@@ -162,7 +162,7 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
|
||||
{
|
||||
if (!IsValidBridge(bridge_id)) return -1;
|
||||
|
||||
return min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2;
|
||||
return std::min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2;
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptBridge::GetMinLength(BridgeID bridge_id)
|
||||
|
@@ -11,7 +11,9 @@
|
||||
#include "script_cargo.hpp"
|
||||
#include "../../economy_func.h"
|
||||
#include "../../core/bitmath_func.hpp"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../settings_type.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
@@ -25,6 +27,14 @@
|
||||
return (towneffect_type >= (TownEffect)TE_BEGIN && towneffect_type < (TownEffect)TE_END);
|
||||
}
|
||||
|
||||
/* static */ char *ScriptCargo::GetName(CargoID cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return nullptr;
|
||||
|
||||
::SetDParam(0, 1ULL << cargo_type);
|
||||
return GetString(STR_JUST_CARGO_LIST);
|
||||
}
|
||||
|
||||
/* static */ char *ScriptCargo::GetCargoLabel(CargoID cargo_type)
|
||||
{
|
||||
if (!IsValidCargo(cargo_type)) return nullptr;
|
||||
@@ -70,4 +80,4 @@
|
||||
{
|
||||
if (!ScriptCargo::IsValidCargo(cargo_type)) return INVALID_DISTRIBUTION_TYPE;
|
||||
return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type);
|
||||
}
|
||||
}
|
||||
|
@@ -84,6 +84,14 @@ public:
|
||||
*/
|
||||
static bool IsValidTownEffect(TownEffect towneffect_type);
|
||||
|
||||
/**
|
||||
* Get the name of the cargo type.
|
||||
* @param cargo_type The cargo type to get the name of.
|
||||
* @pre IsValidCargo(cargo_type).
|
||||
* @return The name of the cargo type.
|
||||
*/
|
||||
static char *GetName(CargoID cargo_type);
|
||||
|
||||
/**
|
||||
* Gets the string representation of the cargo label.
|
||||
* @param cargo_type The cargo to get the string representation of.
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "../squirrel_helper.hpp"
|
||||
#include "../script_instance.hpp"
|
||||
#include "../../debug.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
|
@@ -178,7 +178,18 @@
|
||||
if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
|
||||
|
||||
const GRFFile *file;
|
||||
uint16 res = GetAiPurchaseCallbackResult(GSF_STATIONS, cargo_id, 0, source_industry, goal_industry, min(255, distance / 2), AICE_STATION_GET_STATION_ID, source_station ? 0 : 1, min(15, num_platforms) << 4 | min(15, platform_length), &file);
|
||||
uint16 res = GetAiPurchaseCallbackResult(
|
||||
GSF_STATIONS,
|
||||
cargo_id,
|
||||
0,
|
||||
source_industry,
|
||||
goal_industry,
|
||||
std::min(255, distance / 2),
|
||||
AICE_STATION_GET_STATION_ID,
|
||||
source_station ? 0 : 1,
|
||||
std::min(15u, num_platforms) << 4 | std::min(15u, platform_length),
|
||||
&file
|
||||
);
|
||||
uint32 p2 = (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
|
||||
if (res != CALLBACK_FAILED) {
|
||||
int index = 0;
|
||||
|
@@ -173,7 +173,7 @@
|
||||
default:
|
||||
EnforcePrecondition(false, (days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS) <= MAX_TOWN_GROWTH_TICKS);
|
||||
/* Don't use growth_rate 0 as it means GROWTH_NORMAL */
|
||||
growth_rate = max(days_between_town_growth * DAY_TICKS, 2u) - 1;
|
||||
growth_rate = std::max(days_between_town_growth * DAY_TICKS, 2u) - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
for (const Station *st : Station::Iterate()) {
|
||||
if (st->town == t && (st->facilities & FACIL_AIRPORT) && st->airport.type != AT_OILRIG) num++;
|
||||
}
|
||||
return max(0, 2 - num);
|
||||
return std::max(0, 2 - num);
|
||||
}
|
||||
|
||||
/* static */ ScriptTown::RoadLayout ScriptTown::GetRoadLayout(TownID town_id)
|
||||
|
Reference in New Issue
Block a user