Changeset - r7593:eb8fa3c88a8e
[Not reviewed]
master
0 3 0
rubidium - 17 years ago 2007-09-16 20:48:00
rubidium@openttd.org
(svn r11120) -Codechange: remove the arbitrary limit of 10 articulated parts for a vehicle.
3 files changed with 11 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -20,7 +20,7 @@ uint CountArticulatedParts(EngineID engi
 
	if (!HASBIT(EngInfo(engine_type)->callbackmask, CBM_ARTIC_ENGINE)) return 0;
 

	
 
	uint i;
 
	for (i = 1; i < 10; i++) {
 
	for (i = 1; i < MAX_UVALUE(EngineID); i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine_type, NULL);
 
		if (callback == CALLBACK_FAILED || callback == 0xFF) break;
 
	}
 
@@ -35,7 +35,7 @@ void AddArticulatedParts(Vehicle **vl, V
 

	
 
	if (!HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_ARTIC_ENGINE)) return;
 

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

	
src/roadveh_cmd.cpp
Show inline comments
 
@@ -181,9 +181,9 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 

	
 
	uint num_vehicles = 1 + CountArticulatedParts(p1);
 

	
 
	/* Allow for the front and up to 10 articulated parts. */
 
	Vehicle *vl[11];
 
	memset(&vl, 0, sizeof(vl));
 
	/* Allow for the front and the articulated parts. */
 
	Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * num_vehicles);
 
	memset(vl, 0, sizeof(*vl) * num_vehicles);
 

	
 
	if (!Vehicle::AllocateList(vl, num_vehicles)) {
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
src/train_cmd.cpp
Show inline comments
 
@@ -517,9 +517,9 @@ static CommandCost CmdBuildRailWagon(Eng
 
	uint num_vehicles = 1 + CountArticulatedParts(engine);
 

	
 
	if (!(flags & DC_QUERY_COST)) {
 
		Vehicle *vl[11]; // Allow for wagon and upto 10 artic parts.
 

	
 
		memset(&vl, 0, sizeof(vl));
 
		/* Allow for the wagon and the articulated parts. */
 
		Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * num_vehicles);
 
		memset(vl, 0, sizeof(*vl) * num_vehicles);
 

	
 
		if (!Vehicle::AllocateList(vl, num_vehicles))
 
			return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
@@ -685,9 +685,9 @@ CommandCost CmdBuildRailVehicle(TileInde
 
		CountArticulatedParts(p1);
 

	
 
	if (!(flags & DC_QUERY_COST)) {
 
		Vehicle *vl[12]; // Allow for upto 10 artic parts and dual-heads
 

	
 
		memset(&vl, 0, sizeof(vl));
 
		/* Allow for the dual-heads and the articulated parts. */
 
		Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * num_vehicles);
 
		memset(vl, 0, sizeof(*vl) * num_vehicles);
 

	
 
		if (!Vehicle::AllocateList(vl, num_vehicles))
 
			return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
0 comments (0 inline, 0 general)