Opened 13 years ago

Closed 12 years ago

#918 closed defect (fixed)

Fix rendering of territories with holes

Reported by: Philip Taylor Owned by: vts
Priority: Should Have Milestone: Alpha 9
Component: Core engine Keywords:
Cc: Patch:

Description

Consider territory assignments like:

00000000
01111110
01012130
01111110
00000000

where 0 is neutral. CCmpTerritoryManager::ComputeBoundaries will find the outer edge of the 1s, but not the inner edge around the 0 hole or the 2 hole. (The 3 isn't a hole since the outer edge already surrounds it.)

Might need to add a 'already processed' flag to tiles instead of setting them to 0, and then add a 'already has territory boundary at the +j edge of this tile' flag which is set when walking the boundary, then if we find a tile with different owner to its -j neighbour and that neighbour isn't neutral and doesn't have the edge flag then start a new walk around that edge to produce the inner boundary (with inverted direction). Or something like that.

Change History (6)

comment:1 by Kieran P, 13 years ago

Milestone: Alpha 7Alpha 8

comment:2 by Kieran P, 12 years ago

Milestone: Alpha 8Alpha 9

comment:3 by vts, 12 years ago

Owner: set to vts
Status: newassigned

comment:4 by vts, 12 years ago

Progress report: I've implemented a custom version of the algorithm to deal with inner/nested boundaries (very similar to the one described above), and it's currently passing the test case mentioned above as well as some other ones I came up with.

The boundaries for tiles that have multiple borders on their edges (e.g. the enclosed '2'-tile and semi-inclosed '3'-tile in the example above) are still being rendered directly on top of each other though; that's something I'll be working on next.

comment:5 by vts, 12 years ago

The overlapping rendering issue is now fixed by simply inverting the winding order for inner edges. Will commit soon.

comment:6 by vts, 12 years ago

Resolution: fixed
Status: assignedclosed

(In [10929]) Implemented nested territory boundaries. Fixes #918. Fixed out of bounds memory access in Atlas due to always using global terrain in TerrainOverlay Fixed wrong player ID calculation in TerritoryOverlay

Note: See TracTickets for help on using tickets.