comparison src/train_cmd.cpp @ 20307:93d7e37bd666 draft

(svn r25259) -Codechange: track capacities and usage of links
author rubidium <rubidium@openttd.org>
date Sun, 19 May 2013 14:22:04 +0000
parents b961719a03d6
children cecc29b45313
comparison
equal deleted inserted replaced
20306:824359db5de9 20307:93d7e37bd666
198 uint16 speed = GetVehicleProperty(u, PROP_TRAIN_SPEED, rvi_u->max_speed); 198 uint16 speed = GetVehicleProperty(u, PROP_TRAIN_SPEED, rvi_u->max_speed);
199 if (speed != 0) max_speed = min(speed, max_speed); 199 if (speed != 0) max_speed = min(speed, max_speed);
200 } 200 }
201 } 201 }
202 202
203 u->cargo_cap = e_u->DetermineCapacity(u); 203 uint16 new_cap = e_u->DetermineCapacity(u);
204 u->refit_cap = min(new_cap, u->refit_cap);
205 u->cargo_cap = new_cap;
204 u->vcache.cached_cargo_age_period = GetVehicleProperty(u, PROP_TRAIN_CARGO_AGE_PERIOD, e_u->info.cargo_age_period); 206 u->vcache.cached_cargo_age_period = GetVehicleProperty(u, PROP_TRAIN_CARGO_AGE_PERIOD, e_u->info.cargo_age_period);
205 207
206 /* check the vehicle length (callback) */ 208 /* check the vehicle length (callback) */
207 uint16 veh_len = CALLBACK_FAILED; 209 uint16 veh_len = CALLBACK_FAILED;
208 if (e_u->GetGRF() != NULL && e_u->GetGRF()->grf_version >= 8) { 210 if (e_u->GetGRF() != NULL && e_u->GetGRF()->grf_version >= 8) {
604 v->SetFreeWagon(); 606 v->SetFreeWagon();
605 InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); 607 InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
606 608
607 v->cargo_type = e->GetDefaultCargoType(); 609 v->cargo_type = e->GetDefaultCargoType();
608 v->cargo_cap = rvi->capacity; 610 v->cargo_cap = rvi->capacity;
611 v->refit_cap = 0;
609 612
610 v->railtype = rvi->railtype; 613 v->railtype = rvi->railtype;
611 614
612 v->build_year = _cur_year; 615 v->build_year = _cur_year;
613 v->cur_image = SPR_IMG_QUERY; 616 v->cur_image = SPR_IMG_QUERY;
671 u->vehstatus = v->vehstatus & ~VS_STOPPED; 674 u->vehstatus = v->vehstatus & ~VS_STOPPED;
672 u->spritenum = v->spritenum + 1; 675 u->spritenum = v->spritenum + 1;
673 u->cargo_type = v->cargo_type; 676 u->cargo_type = v->cargo_type;
674 u->cargo_subtype = v->cargo_subtype; 677 u->cargo_subtype = v->cargo_subtype;
675 u->cargo_cap = v->cargo_cap; 678 u->cargo_cap = v->cargo_cap;
679 u->refit_cap = v->refit_cap;
676 u->railtype = v->railtype; 680 u->railtype = v->railtype;
677 u->engine_type = v->engine_type; 681 u->engine_type = v->engine_type;
678 u->build_year = v->build_year; 682 u->build_year = v->build_year;
679 u->cur_image = SPR_IMG_QUERY; 683 u->cur_image = SPR_IMG_QUERY;
680 u->random_bits = VehicleRandomBits(); 684 u->random_bits = VehicleRandomBits();
723 v->track = TRACK_BIT_DEPOT; 727 v->track = TRACK_BIT_DEPOT;
724 v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; 728 v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
725 v->spritenum = rvi->image_index; 729 v->spritenum = rvi->image_index;
726 v->cargo_type = e->GetDefaultCargoType(); 730 v->cargo_type = e->GetDefaultCargoType();
727 v->cargo_cap = rvi->capacity; 731 v->cargo_cap = rvi->capacity;
732 v->refit_cap = 0;
728 v->last_station_visited = INVALID_STATION; 733 v->last_station_visited = INVALID_STATION;
734 v->last_loading_station = INVALID_STATION;
729 735
730 v->engine_type = e->index; 736 v->engine_type = e->index;
731 v->gcache.first_engine = INVALID_ENGINE; // needs to be set before first callback 737 v->gcache.first_engine = INVALID_ENGINE; // needs to be set before first callback
732 738
733 v->reliability = e->reliability; 739 v->reliability = e->reliability;