Merge branches 'template_train_replacement' and 'infrastructure_sharing' into jgrpp

This commit is contained in:
Jonathan G Rennison
2017-01-24 19:49:01 +00:00
2 changed files with 2 additions and 2 deletions

View File

@@ -109,7 +109,7 @@ Money CalculateOverallTemplateCost(const TemplateVehicle *tv)
{
Money val = 0;
for (; tv; tv = tv->Next()) {
for (; tv; tv = tv->GetNextUnit()) {
val += (Engine::Get(tv->engine_type))->GetCost();
}
return val;

View File

@@ -3364,7 +3364,7 @@ static Vehicle *FindTrainCollideEnum(Vehicle *v, void *data)
/* Slower check using multiplication */
int min_diff = (Train::From(v)->gcache.cached_veh_length + 1) / 2 + (tcc->v->gcache.cached_veh_length + 1) / 2 - 1;
if (x_diff * x_diff + y_diff * y_diff > min_diff * min_diff) return NULL;
if (x_diff * x_diff + y_diff * y_diff >= min_diff * min_diff) return NULL;
/* Happens when there is a train under bridge next to bridge head */
if (abs(v->z_pos - tcc->v->z_pos) > 5) return NULL;