Multi-part ships: Require feature test to enable callback 16

pull/507/head
Jonathan G Rennison 1 year ago
parent 87e4258fe3
commit 8cd7c9559f

@ -895,7 +895,8 @@
<h3 id="callbacks_ships"><a href="https://newgrf-specs.tt-wiki.net/wiki/Callbacks">Callbacks - Ships</a></h3>
<h4 id="callbacks_ships_articulated">Multi-part ships</h4>
<p><b><a href="https://newgrf-specs.tt-wiki.net/wiki/Callbacks#Articulated_engine_.2816.29">Callback 16 - Articulated engine</a> may also be used for ships.</b><br />
This functions the same as for trains and road vehicles, and is enabled in the same way (bit 4 of ship property 12).<br />
The feature name: <font face="monospace">multi_part_ships</font> must be tested for to enable this callback for ships.<br />
This functions the same as for trains and road vehicles, and is enabled for individual engines in the same way (bit 4 of ship property 12).<br />
Additional ship parts are not used for graphics, they are only used for additional cargo capacity.<br />
The graphics chain for the primary vehicle may check the cargo states of the other ship parts if required.<br />
Additional ship parts may be refitted individually.

@ -15,6 +15,7 @@
#include "engine_func.h"
#include "company_func.h"
#include "newgrf.h"
#include "newgrf_extension.h"
#include <vector>
#include "table/strings.h"
@ -37,6 +38,10 @@ static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle
const Engine *front_engine = Engine::Get(front_type);
if (front_engine->type == VEH_SHIP && !(front_engine->GetGRF() != nullptr && HasBit(front_engine->GetGRF()->observed_feature_tests, GFTOF_MULTI_PART_SHIPS))) {
return INVALID_ENGINE;
}
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, index, 0, front_type, front);
if (callback == CALLBACK_FAILED) return INVALID_ENGINE;

@ -66,7 +66,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("town_uncapped_variables", 1),
GRFFeatureInfo("town_zone_callback", 1, GFTOF_TOWN_ZONE_CALLBACK),
GRFFeatureInfo("more_varaction2_types", 1, GFTOF_MORE_VARACTION2_TYPES),
GRFFeatureInfo("multi_part_ships", 1),
GRFFeatureInfo("multi_part_ships", 1, GFTOF_MULTI_PART_SHIPS),
GRFFeatureInfo(),
};

@ -101,6 +101,7 @@ enum GRFFeatureTestObservationFlag : uint8 {
GFTOF_MORE_ACTION2_IDS,
GFTOF_TOWN_ZONE_CALLBACK,
GFTOF_MORE_VARACTION2_TYPES,
GFTOF_MULTI_PART_SHIPS,
GFTOF_INVALID = 0xFF,
};

Loading…
Cancel
Save