16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 18:19:19 +02:00

basic cargo attributes system, minor cargo enhancements and fixes

This commit is contained in:
tmj-fstate
2018-09-19 19:12:53 +02:00
parent 4c7d254539
commit 38591a09f2
8 changed files with 253 additions and 245 deletions

View File

@@ -49,20 +49,19 @@ basic_station::update_load( TDynamicObject *First, Mtable::TTrainParameters &Sch
auto &parameters { *vehicle->MoverParameters };
if( ( true == parameters.LoadType.empty() )
&& ( parameters.LoadAccepted.find( "passengers" ) != std::string::npos ) ) {
// set the type for empty cars
parameters.LoadType = "passengers";
if( parameters.LoadType.name.empty() ) {
// (try to) set the cargo type for empty cars
parameters.AssignLoad( "passengers" );
}
if( parameters.LoadType == "passengers" ) {
if( parameters.LoadType.name == "passengers" ) {
// NOTE: for the time being we're doing simple, random load change calculation
// TODO: exchange driven by station parameters and time of the day
auto unloadcount = static_cast<int>(
laststop ? parameters.Load :
laststop ? parameters.LoadAmount :
firststop ? 0 :
std::min<float>(
parameters.Load,
parameters.LoadAmount,
Random( parameters.MaxLoad * 0.10 * stationsizemodifier ) ) );
auto loadcount = static_cast<int>(
laststop ?