Changeset - r9723:ed84b192ea1c
[Not reviewed]
master
0 1 0
frosch - 16 years ago 2008-07-27 12:35:14
frosch@openttd.org
(svn r13847) -Codechange: Add MAX_ARTICULATED_PARTS and set it to 100.
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -11,6 +11,8 @@
 
#include "newgrf_engine.h"
 
#include "vehicle_func.h"
 

	
 
static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback.
 

	
 
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
 
{
 
	if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
 
@@ -22,7 +24,7 @@ uint CountArticulatedParts(EngineID engi
 
	}
 

	
 
	uint i;
 
	for (i = 1; i < MAX_UVALUE(EngineID); i++) {
 
	for (i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine_type, v);
 
		if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
 
	}
 
@@ -49,7 +51,7 @@ uint16 *GetCapacityOfArticulatedParts(En
 

	
 
	if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
 

	
 
	for (uint i = 1; i < MAX_UVALUE(EngineID); i++) {
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
		if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break;
 

	
 
@@ -75,7 +77,7 @@ void AddArticulatedParts(Vehicle **vl, V
 

	
 
	if (!HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return;
 

	
 
	for (uint i = 1; i < MAX_UVALUE(EngineID); i++) {
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, v->engine_type, v);
 
		if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) return;
 

	
0 comments (0 inline, 0 general)