Added increased load for onRoad movement

This commit is contained in:
Pax1601 2023-12-07 15:22:59 +01:00
parent e677968ba7
commit e5e7e9be14
3 changed files with 6 additions and 5 deletions

View File

@ -113,7 +113,7 @@ class Move : public Command
{
public:
Move(string groupName, Coords destination, double speed, string speedType, double altitude,
string altitudeType, string taskOptions, string category, function<void(void)> callback = []() {}) :
string altitudeType, string taskOptions, string category, bool onRoad, function<void(void)> callback = []() {}) :
Command(callback),
groupName(groupName),
destination(destination),
@ -122,12 +122,13 @@ public:
altitude(altitude),
altitudeType(altitudeType),
taskOptions(taskOptions),
category(category)
category(category),
onRoad(onRoad)
{
priority = CommandPriority::MEDIUM;
};
virtual string getString();
virtual unsigned int getLoad() { return 5; }
virtual unsigned int getLoad() { return onRoad? 45: 5; }
private:
const string groupName;
@ -138,6 +139,7 @@ private:
const string altitudeType;
const string taskOptions;
const string category;
const bool onRoad;
};
/* Smoke command */

View File

@ -9,7 +9,6 @@ extern UnitsManager* unitsManager;
/* Move command */
string Move::getString()
{
std::ostringstream commandSS;
commandSS.precision(10);
commandSS << "Olympus.move, "

View File

@ -712,7 +712,7 @@ void Unit::goToDestination(string enrouteTask)
{
if (activeDestination != NULL)
{
Command* command = dynamic_cast<Command*>(new Move(groupName, activeDestination, getDesiredSpeed(), getDesiredSpeedType() ? "GS" : "CAS", getDesiredAltitude(), getDesiredAltitudeType() ? "AGL" : "ASL", enrouteTask, getCategory(), [this]() { this->setHasTaskAssigned(true); }));
Command* command = dynamic_cast<Command*>(new Move(groupName, activeDestination, getDesiredSpeed(), getDesiredSpeedType() ? "GS" : "CAS", getDesiredAltitude(), getDesiredAltitudeType() ? "AGL" : "ASL", enrouteTask, getCategory(), getFollowRoads(), [this]() { this->setHasTaskAssigned(true); }));
scheduler->appendCommand(command);
setHasTask(true);
}