Merge lp:~qcumber-some/widelands/lumberjack-vision into lp:widelands

Proposed by Jens Beyer
Status: Merged
Approved by: Jens Beyer
Approved revision: no longer in the source branch.
Merge reported by: Jens Beyer
Merged at revision: not available
Proposed branch: lp:~qcumber-some/widelands/lumberjack-vision
Merge into: lp:widelands
Diff against target: 18 lines (+9/-0)
1 file modified
src/logic/worker.cc (+9/-0)
To merge this branch: bzr merge lp:~qcumber-some/widelands/lumberjack-vision
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
SirVer Approve
Review via email: mp+39755@code.launchpad.net

Description of the change

worker command findobject targetting an immovable is now honoring the known map, so lumberjacks and stonemasons don't magically know about existing resources the player has not discovered yet.

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

looks good to my puny eyes.

review: Approve
Revision history for this message
Nicolai Hähnle (nha) wrote :

I haven't tested it, but it certainly looks the right way to implement that feature.

It'll be another place where cheating will lead to desyncs.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/worker.cc'
2--- src/logic/worker.cc 2010-11-01 13:12:23 +0000
3+++ src/logic/worker.cc 2010-11-01 15:58:49 +0000
4@@ -404,6 +404,15 @@
5 found_reserved = true;
6 list.erase(list.begin() + idx);
7 }
8+ else
9+ {
10+ Coords const coord = imm->get_position();
11+ Map_Index mapidx = map.get_index(coord, map.get_width());
12+ Vision const visible = owner().vision(mapidx);
13+ if (!visible) {
14+ list.erase(list.begin() + idx);
15+ }
16+ }
17 }
18 }
19

Subscribers

People subscribed via source and target branches

to status/vote changes: