Change: use GSText to handle prettified goal display

This commit is contained in:
Andy
2014-12-28 16:18:48 +00:00
parent 7d16de450f
commit 744419dd92
2 changed files with 11 additions and 5 deletions

View File

@@ -1 +1,4 @@
STR_LAKE_NEWS :There are {NUM} {}fish here STR_LAKE_NEWS :There are {NUM} {}fish here
STR_COMPANY_GOAL :Deliver {NUM} of {CARGO_LIST} to {STRING}
STR_TOWN_NAME :{TOWN}
STR_INDUSTRY_NAME :{INDUSTRY}

View File

@@ -166,15 +166,18 @@ function FMainClass::CreateChallenge(cid)
if (cdata != null) { if (cdata != null) {
cdata.AddActiveGoal(cargo, accept, amount); cdata.AddActiveGoal(cargo, accept, amount);
local destination_name = "foo"; local destination_name = "foo";
local destination_string = "foo";
if ("town" in accept) { if ("town" in accept) {
destination_name = GSTown.GetName(accept.town); destination_name = GSTown.GetName(accept.town);
destination_string = GSText(GSText.STR_TOWN_NAME, accept.town);
} else if ("ind" in accept) { } else if ("ind" in accept) {
destination_name = GSIndustry.GetName(accept.ind); destination_name = GSIndustry.GetName(accept.ind);
destination_string = GSText(GSText.STR_INDUSTRY_NAME, accept.ind);
} }
local goal_text = "Deliver " + amount + local goal_text = GSText(GSText.STR_COMPANY_GOAL, amount, 1 << cargo, destination_string);
" of " + GSCargo.GetCargoLabel(this.cargoes[cargo].cid) GSLog.Info("Company " + cid + ": " + amount + " of " +
+ " to " + destination_name; GSCargo.GetCargoLabel(this.cargoes[cargo].cid) +
GSLog.Info("Company " + cid + ": " + goal_text); " to " + destination_name);
GSGoal.New(cid, goal_text, GSGoal.GT_NONE, 0); GSGoal.New(cid, goal_text, GSGoal.GT_NONE, 0);
break; break;
} }