Add: Progress reporting.
This commit is contained in:
16
company.nut
16
company.nut
@@ -59,7 +59,21 @@ function CompanyGoal::UpdateDelivered(mon)
|
||||
delivered = mon[this.cargo_id].town[this.accept.town];
|
||||
}
|
||||
|
||||
this.delivered_amount += delivered;
|
||||
if (delivered > 0) {
|
||||
this.delivered_amount += delivered;
|
||||
if (this.goal_id != null) {
|
||||
local perc;
|
||||
if (this.delivered_amount >= this.wanted_amount) {
|
||||
perc = 100;
|
||||
GSGoal.SetCompleted(this.goal_id, true);
|
||||
} else {
|
||||
perc = 100 * this.delivered_amount / this.wanted_amount;
|
||||
if (perc > 100) perc = 100;
|
||||
}
|
||||
local progress_text = GSText(GSText.STR_PROGRESS, perc);
|
||||
GSGoal.SetProgress(this.goal_id, progress_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test whether the goal can be considered 'done'.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
STR_LAKE_NEWS :There are {NUM} {}fish here
|
||||
STR_COMPANY_GOAL :Deliver {CARGO_LONG} to {STRING}
|
||||
STR_PROGRESS :{NUM}% done
|
||||
STR_TOWN_NAME :{TOWN}
|
||||
STR_INDUSTRY_NAME :{INDUSTRY}
|
||||
|
||||
Reference in New Issue
Block a user