Opened 8 years ago

Last modified 3 years ago

#4138 new enhancement

[PATCH] Visibility tests

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Simulation Keywords: patch, simple
Cc: Patch:

Description

The test component contains a duplicate check which should be removed. Then we'll need tests too for formal reasons.

Also there is a peculiarity: 'GetVisibility returns VIS_VISIBLE even if isVisible and isExplored are 'false. Is there an argument given which can never be false?

Attachments (1)

test_visibilities.patch (5.7 KB ) - added by elexis 8 years ago.

Download all attachments as: .zip

Change History (6)

by elexis, 8 years ago

Attachment: test_visibilities.patch added

comment:1 by Itms, 8 years ago

Keywords: rfc removed

With respect to the changes to Visibility.js, the corpse and preview cases should not be merged. They happen to share a part of the code, but there are differences in the behavior so it doesn't make sense to merge them (plus it obfuscates the code). On top of that, the new code will make it difficult to support adding cases (other than the current two that are corpse and preview). So the only change here that could stay is the early return, but it adds one line of code without saving indentation, and without the other changes it makes it possible to not return anything, so I'd scrap it too.

The tests look good (in my humble opinion, ternaries inside ternaries inside ternaries are impossible to read but that might be just me). Small style nitpicking: missing space before : line 52

With respect to the VIS_VISIBLE returned by default, you are right and this does not make a lot of sense. Actually this should never happen, as only activated entities have GetVisibility called. My suggestion would be adding a warning if neither this.corpse nor this.preview are true. The return value could be anything, but VIS_HIDDEN might make more sense.

comment:2 by elexis, 8 years ago

Keywords: simple added
Milestone: Alpha 21Backlog

comment:3 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:4 by Silier, 3 years ago

Keywords: simple removed
severity: simple

comment:5 by Silier, 3 years ago

Keywords: simple added
Note: See TracTickets for help on using tickets.