Add: Progress reporting.

This commit is contained in:
Alberth
2014-12-30 11:49:16 +01:00
parent fd0469ad9b
commit ed373f7609
2 changed files with 16 additions and 1 deletions

View File

@@ -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'.

View File

@@ -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}