Code review comment for lp:~widelands-dev/widelands/bug-1687100-reveal_fields

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have removed the playercommand now.

Here's what I remember of the vision code:

Vision state of a field is an integer. Everything in sight of a building with vision is always visible. Every time a worker walks past an area, the vision on the field is incremented. It then slowly gets decremented until the player loses vision. Then the fields are darkened and not updated any longer, but never blacked out.

What we needed in the hide/reveal code were 2 versions of hiding fields from the player:

1. Just the darkened state
2. A permanent black state that can be undone by scripting, field by field

Buildings and workers will interfere with the hiding state, so implementing this became a bit tricky and also needed some extra data in the savegame.

« Back to merge proposal