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)
Change History (6)
by , 8 years ago
Attachment: | test_visibilities.patch added |
---|
comment:1 by , 8 years ago
Keywords: | rfc removed |
---|
comment:2 by , 8 years ago
Keywords: | simple added |
---|---|
Milestone: | Alpha 21 → Backlog |
comment:3 by , 5 years ago
Component: | UI & Simulation → Simulation |
---|
Move tickets to Simulation
as UI & Simulation
got some sub components.
comment:4 by , 3 years ago
Keywords: | simple removed |
---|---|
severity: | → simple |
comment:5 by , 3 years ago
Keywords: | simple added |
---|
Note:
See TracTickets
for help on using tickets.
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 52With 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 haveGetVisibility
called. My suggestion would be adding a warning if neitherthis.corpse
northis.preview
are true. The return value could be anything, butVIS_HIDDEN
might make more sense.