#4010 closed defect (fixed)
[PATCH] Wonder victory messages need to be deleted after win
Reported by: | elexis | Owned by: | Itms |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
When someone wins a wonder victory game and an ally owns a wonder too, the message that he will win too should disappear (as only one player / team can win the game).
Furthermore building a new one shouldn't result in triggering the countdown again.
See EndGameManager.js
and WonderVictory.js
.
Attachments (4)
Change History (13)
by , 8 years ago
Attachment: | wondervictorymessagesfix.patch added |
---|
comment:1 by , 8 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
Summary: | Wonder victory messages need to be deleted after win → [PATCH] Wonder victory messages need to be deleted after win |
comment:2 by , 8 years ago
Keywords: | review removed |
---|
- Your patches are produced with windows line endings. Not sure if you can change that somehow, but it needs to be fixed everytime when applying / committing.
- The keys of
wonderVictoryMessages
are entities, not messages. Afor ... of
loop makes it a bit shorter.
- Since you don't need
cmpPlayerManager
nornumPlayers
, the new code should have been added above those 2 lines.
- Since you delete
wonderVictoryMessages
, move that code to the file that contains those, i.e.WonderVictory.js
.
- You also need to delete the timer that triggers the winning once a player won. You can likely just move line 8-19 of
WonderVictory.js
to a new function and reuse that.
- Wonder games can also be won by wiping out an enemy, so better check that on player defeat.
MarkPlayerAsWon
is only called fromSetPlayerWon
which is only called from some maps and wonder victory. The code should likely contain also a messageOnPlayerWon
for consistency. For the time being, you can most likely use theAlliedVictoryCheck
.
by , 8 years ago
Attachment: | wondervictorymessagesfix_v2.patch added |
---|
comment:3 by , 8 years ago
Keywords: | review added |
---|
comment:4 by , 8 years ago
Keywords: | review removed |
---|
- The "won" message was finally introduced in r18441.
- Inconsistent use of let/var.
- Use
this.messages
and timers instead of theQueryInterface
OnPlayerWon = true
whut?- The
Trigger.js
change doesn't look like it is needed to make it work
by , 8 years ago
Attachment: | wondervictorymessagesfix_v3.patch added |
---|
comment:5 by , 8 years ago
Keywords: | review added |
---|
comment:6 by , 8 years ago
Thanks for the update, that's nearly ready to commit:
QueryPlayerIDInterface
instead of L32+33- Use
this.wonderVictoryMessages
andthis.wonderVictoryTimers
directly instead of a new variable message
should beent
orentity
- Keep the components independent of each other. The
EndGameManager
should have no clue of stuff insideWonderVictory
. Move that code to that file. - If you read the code,
wonderVictoryMessages
norwonderVictoryMessages
can becomefalse/undefined/null
, so those checks are pointless. - There is a timer if and only if there is a message, so you can merge those two loops.
by , 8 years ago
Attachment: | wondervictorymessagesfix_v4.patch added |
---|
Also adds "PlayerWon" and "PlayerDefeated" as Trigger events, after discussion with elexis.
Note:
See TracTickets
for help on using tickets.
There's probably a better way to do this.