Multi-part ships: Require feature test to enable callback 16
This commit is contained in:
@@ -895,7 +895,8 @@
|
|||||||
<h3 id="callbacks_ships"><a href="https://newgrf-specs.tt-wiki.net/wiki/Callbacks">Callbacks - Ships</a></h3>
|
<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>
|
<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 />
|
<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 />
|
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 />
|
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.
|
Additional ship parts may be refitted individually.
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include "engine_func.h"
|
#include "engine_func.h"
|
||||||
#include "company_func.h"
|
#include "company_func.h"
|
||||||
#include "newgrf.h"
|
#include "newgrf.h"
|
||||||
|
#include "newgrf_extension.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "table/strings.h"
|
#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);
|
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);
|
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, index, 0, front_type, front);
|
||||||
if (callback == CALLBACK_FAILED) return INVALID_ENGINE;
|
if (callback == CALLBACK_FAILED) return INVALID_ENGINE;
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
|
|||||||
GRFFeatureInfo("town_uncapped_variables", 1),
|
GRFFeatureInfo("town_uncapped_variables", 1),
|
||||||
GRFFeatureInfo("town_zone_callback", 1, GFTOF_TOWN_ZONE_CALLBACK),
|
GRFFeatureInfo("town_zone_callback", 1, GFTOF_TOWN_ZONE_CALLBACK),
|
||||||
GRFFeatureInfo("more_varaction2_types", 1, GFTOF_MORE_VARACTION2_TYPES),
|
GRFFeatureInfo("more_varaction2_types", 1, GFTOF_MORE_VARACTION2_TYPES),
|
||||||
GRFFeatureInfo("multi_part_ships", 1),
|
GRFFeatureInfo("multi_part_ships", 1, GFTOF_MULTI_PART_SHIPS),
|
||||||
GRFFeatureInfo(),
|
GRFFeatureInfo(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -101,6 +101,7 @@ enum GRFFeatureTestObservationFlag : uint8 {
|
|||||||
GFTOF_MORE_ACTION2_IDS,
|
GFTOF_MORE_ACTION2_IDS,
|
||||||
GFTOF_TOWN_ZONE_CALLBACK,
|
GFTOF_TOWN_ZONE_CALLBACK,
|
||||||
GFTOF_MORE_VARACTION2_TYPES,
|
GFTOF_MORE_VARACTION2_TYPES,
|
||||||
|
GFTOF_MULTI_PART_SHIPS,
|
||||||
|
|
||||||
GFTOF_INVALID = 0xFF,
|
GFTOF_INVALID = 0xFF,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user