Merge lp:~widelands-dev/widelands/bug-1366725 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7185
Proposed branch: lp:~widelands-dev/widelands/bug-1366725
Merge into: lp:widelands
Diff against target: 63 lines (+18/-12)
1 file modified
tribes/scripting/format_help.lua (+18/-12)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1366725
Reviewer Review Type Date Requested Status
SirVer Approve
TiborB Approve
GunChleoc Needs Resubmitting
Review via email: mp+233750@code.launchpad.net

Description of the change

Bugfix: building help now displays multiple tools if needed, e.g. for the Imperial Vineyard

To post a comment you must log in.
Revision history for this message
SirVer (sirver) :
review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

Diff comments are addressed

review: Needs Resubmitting
Revision history for this message
SirVer (sirver) wrote :

I think the code contains a bug. See below.

review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

Good catch! Bug fixed.

Revision history for this message
TiborB (tiborb95) wrote :

hey, what is it waiting for?
I compiled it and it looks fine to me.

Revision history for this message
GunChleoc (gunchleoc) wrote :

It is probably waiting on SirVer to find the time to review it ;)

Revision history for this message
TiborB (tiborb95) wrote :

SirVer is too busy - generally not just now. I communicated with him and he suggested that also other developers should review/approve merge requests. (I had my AI branch in mind specifically)

So I can approve this one as this looks a simple one, and SirVer has looked at it before, and I tested it. Would you mind?

Revision history for this message
GunChleoc (gunchleoc) wrote :

> SirVer is too busy - generally not just now. I communicated with him and he suggested that also other developers should review/approve merge requests. (I had my AI branch in mind specifically)
>
> So I can approve this one as this looks a simple one, and SirVer has looked at it before, and I tested it. Would you mind?

OK, I'll merge this then. Thanks for the review.

I'd rather not review the AI branch for a merge, because that's over my
head unfortunately. I am quite OK with general architecture and
consistency of stuff, but the ins and outs of heuristics and the finer
points of C++ are beyond me.

Revision history for this message
TiborB (tiborb95) wrote :

And dont you need "approve" review from other developer? (I am setting it to approve now)

AI branch is indeed too complex, and from my perspective resolving text conflicts is also quite complicated for me (when there are significant changes in trunk).

I just hope that if I help with other merge requests, SirVer will find a time for my branch sooner. :)

review: Approve
Revision history for this message
SirVer (sirver) wrote :

+1 for cross team reviews! We really have to find a way forward that does not make me the bottleneck all the time. I am stressed out a bit over Widelands responsibilities anyways :).

Also, code reviews are very educational for the reviewer and the reviewee. And they are great for code quality. I will keep looking over code reviews and try to keep up with doing them, I will also skim all commits (also those that I did not review), but not having to do the in-depth review always will save quite some time.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tribes/scripting/format_help.lua'
2--- tribes/scripting/format_help.lua 2014-07-27 12:51:29 +0000
3+++ tribes/scripting/format_help.lua 2014-09-18 18:20:44 +0000
4@@ -667,15 +667,15 @@
5 local worker_description = building_description.working_positions[1]
6 local becomes_description = nil
7 local number_of_workers = 0
8- local toolname = nil
9+ local toolnames = {}
10
11 for i, worker_description in ipairs(building_description.working_positions) do
12
13- -- get the tool for the workers. This assumes that each building only uses 1 tool
14+ -- Get the tools for the workers.
15 if(worker_description.buildable) then
16 for j, buildcost in ipairs(worker_description.buildcost) do
17 if( not (buildcost == "carrier" or buildcost == "none" or buildcost == nil)) then
18- toolname = buildcost
19+ toolnames[#toolnames + 1] = buildcost
20 end
21 end
22 end
23@@ -692,7 +692,9 @@
24 end
25 end
26
27- if(toolname) then result = result .. building_help_tool_string(tribename, toolname, number_of_workers) end
28+ if(#toolnames > 0) then
29+ result = result .. building_help_tool_string(tribename, toolnames, number_of_workers)
30+ end
31
32 if(becomes_description) then
33
34@@ -723,17 +725,21 @@
35 -- RST
36 -- .. function building_help_tool_string(tribename, toolname)
37 --
38--- Displays a tool with an intro text and image
39+-- Displays tools with an intro text and images
40 --
41 -- :arg tribename: e.g. "barbarians".
42--- :arg toolname: e.g. "felling_axe".
43--- :arg no_of_workers: the number of workers using the tool; for plural formatting.
44--- :returns: text_line for the tool
45+-- :arg toolnames: e.g. {"shovel", "basket"}.
46+-- :arg no_of_workers: the number of workers using the tools; for plural formatting.
47+-- :returns: text_line for the tools
48 --
49-function building_help_tool_string(tribename, toolname, no_of_workers)
50- local ware_description = wl.Game():get_ware_description(tribename, toolname)
51- return text_line((ngettext("Worker uses:","Workers use:", no_of_workers)),
52- ware_description.descname, ware_description.icon_name)
53+function building_help_tool_string(tribename, toolnames, no_of_workers)
54+ local result = rt(h3(ngettext("Worker uses:","Workers use:", no_of_workers)))
55+ local game = wl.Game();
56+ for i, toolname in ipairs(toolnames) do
57+ local ware_description = game:get_ware_description(tribename, toolname)
58+ result = result .. image_line(ware_description.icon_name, 1, p(ware_description.descname))
59+ end
60+ return result
61 end
62
63 -- RST

Subscribers

People subscribed via source and target branches

to status/vote changes: