Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4161 closed enhancement (fixed)

[PATCH] cmpPlayer cleanup

Reported by: leper Owned by: leper
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Removes leakage of internal data, moves message registrations to the right place, cleans up a test, more leakage removal, adds utility function to clean up some things.

Change History (15)

comment:1 by Imarok, 8 years ago

Shouldn't we use let instead of var?

comment:2 by fatherbushido, 8 years ago

I am permitting myself to review your patches.

0001:

  • maps/scripts/ConquestCommon.js was forgotten

0002:

  • i was also disturbed by that when updating the docs.
  • Should we move those from interfaces/Trigger.js and interfaces/EndGameManager.js too ?

0003:

  • ok

0004:

  • ok

0005:

  • GuiInterface.js L80 -> L90 can also use those new functions
  • (perhaps var -> let)
Last edited 8 years ago by fatherbushido (previous) (diff)

comment:3 by leper, 8 years ago

3-5 weren't really updated apart from the last one, but the only change that remains is the removal of comments for the new functions that don't add anything more than what is in the name already. L80-90 needs a full array of booleans, so the new functions aren't a perfect fit for that and using them would very likely break lots of things in the gui.

My patches also aren't in the review queue to not get reviewed, so that first sentence leaves me puzzled.

EDIT: Now 005 also includes a bugfix.

Last edited 8 years ago by leper (previous) (diff)

comment:4 by fatherbushido, 8 years ago

(I looked too fast at those GuiInterface array.)

0001:

  • L88 of maps/scripts/ConquestCommon.js. If I'm not wrong you, the entities owned by gaia are also added, I don't know if it's intended.

0002:

  • perhaps the "PlayerDefeated" and "PlayerWon" messages from interfaces/EndGameManager.js can be moved too (as they are sent by Player component).

0003: ok

0004: ok

0005: ok

(by ok, I mean: I understood what is done in the patch, I checked the syntax, ran the tests, launched some games).

Last edited 8 years ago by fatherbushido (previous) (diff)

comment:5 by leper, 8 years ago

In 18645:

Remove cmpPlayerManager.GetAllPlayerEntities() which leaked internal data.

And all uses thereof could easily be replaced.
This changes the data structure of cmpTrigger.conquestEntitiesByPlayer to
not store the player entity at all, and since that is now gone replaces the
object by the array that was its sole property.

Refs #4161.
Reviewed by: fatherbushido

comment:6 by leper, 8 years ago

In 18646:

Move message registrations to the right file.

Refs #4161.
Reviewed by: fatherbushido

comment:7 by leper, 8 years ago

In 18647:

Remove unneeded includes.

Refs #4161.
Reviewed by: fatherbushido

comment:8 by leper, 8 years ago

In 18648:

Prevent leaking internal data in cmpPlayer.

Refs #4161.
Reviewed by: fatherbushido

comment:9 by leper, 8 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 18649:

Add GetPlayersByDiplomacy to cmpPlayer.

This is in turn used by GetEnemies and the new GetAllies and GetMutualAllies.
Use these in a few places as those are common queries.

Fixes #4161.
Reviewed by: fatherbushido

comment:10 by leper, 8 years ago

Keywords: review removed

Thanks.

Note: See TracTickets for help on using tickets.