void Stats::onSegmentNew(Segment::PtrConst _p) { FWK_DEBUG("Stats::onSegmentNew(" << _p->name() << ")"); if (_p->type() == Segment::boatSegment()) { boatSegmentCount_++; } else if (_p->type() == Segment::truckSegment()) { truckSegmentCount_++; } else if (_p->type() == Segment::planeSegment()) { planeSegmentCount_++; } if (_p->expediteSupport() == Segment::fullExpediteSupport()) { expeditedSupportCount_++; } totalSegmentCount_++; updateExpPercentage(); }
float PathTree::segmentTime(Segment::PtrConst s,Segment::ExpediteSupport expediteSupport) const{ Segment::SegmentType st = s->type(); float tSpeed = speed(st).value(); if (s->expediteSupport() == Segment::fullExpediteSupport() && expediteSupport == Segment::fullExpediteSupport()){ tSpeed *= 1.3; }; return s->length().value() / tSpeed; };
float PathTree::segmentCost(Segment::PtrConst s, Segment::ExpediteSupport expediteSupport) const{ Segment::SegmentType st = s->type(); float newCost = s->length().value() * cost(st).value() * s->difficulty().value(); if (s->expediteSupport() == Segment::fullExpediteSupport() && expediteSupport == Segment::fullExpediteSupport()){ newCost*= 1.5; }; return newCost; };