Changeset - r17298:f10752811f69
[Not reviewed]
master
0 1 0
glx - 14 years ago 2011-02-10 15:58:22
glx@openttd.org
(svn r22048) -Fix (r4495): company 0 does not always exist, so put temporary vehicles in a valid company
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -11,12 +11,13 @@
 

	
 
#include "stdafx.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "vehicle_func.h"
 
#include "engine_func.h"
 
#include "company_func.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

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

	
 
@@ -48,12 +49,13 @@ uint CountArticulatedParts(EngineID engi
 
	if (!Vehicle::CanAllocateItem()) return 0;
 

	
 
	Vehicle *v = NULL;
 
	if (!purchase_window) {
 
		v = new Vehicle();
 
		v->engine_type = engine_type;
 
		v->owner = _current_company;
 
	}
 

	
 
	uint i;
 
	for (i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		if (GetNextArticulatedPart(i, engine_type, v) == INVALID_ENGINE) break;
 
	}
0 comments (0 inline, 0 general)