Opened 9 years ago
Closed 4 years ago
#3120 closed defect (fixed)
[PATCH] In Match Setup screen, selecting a map shouldn't change the selected civilizations
Reported by: | dg1727 | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 24 |
Component: | UI – Game setup | Keywords: | |
Cc: | Patch: | Phab:D2483 |
Description (last modified by )
In the Match Setup screen, if you first select one or more civilizations, then change the map (even to one with the same # of players), the selected civilization(s) revert to Random.
Instead, the civilizations should stay at what you selected. This should include if you change to a map with a smaller number of players. If you change to a map with a larger number of players (e.g., from 2 to 4), then (e.g.) the first 2 civilizations should stay at what you selected.
This issue was pointed out in a video by YouTube user WretchedJ, although when he did the video, he didn't notice that the civs had reverted to Random - he was only frustrated that when he began the game, his civ was different than he had selected.
I suppose many players would prefer that if they select 4 specific civs, then mistakenly change to a 2-player map, then change to a different 4-player map, the 3rd & 4th civs should reappear as the values that were just selected, instead of reverting to Random.
Attachments (10)
Change History (34)
comment:1 by , 8 years ago
Keywords: | simple added |
---|
comment:2 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | In Match Setup screen, selecting a map shouldn't change the selected civilizations → [Patch] In Match Setup screen, selecting a map shouldn't change the selected civilizations |
I attempted to fix the problem, please review.
comment:3 by , 8 years ago
Keywords: | patch review added |
---|---|
Milestone: | Backlog → Alpha 21 |
Resolution: | fixed |
Status: | closed → reopened |
comment:4 by , 8 years ago
Regarding the credits: the names are sorted according to the nickname, not the real name. Thus you need to look for "O". However, if you don't provide a nickname, then sort according to your surname. Thx
follow-up: 6 comment:5 by , 8 years ago
Keywords: | review removed |
---|
Review:
- As mentioned on IRC: unneeded parnthesis, newlines after
?
and:
and don't create variables for the length properties. If you usepData
as a variable name for the current player data, it will stay below the 80 character limit suggested in wiki:Coding_Conventions selectNumPlayers
has the same logic, it should use a common function- As mentioned by Palaxin the contributors entry should be sorted correctly.
If you fix these points, I would commit that.
The patch doesn't address the last point of the ticket description. In order to accomplish that, the civs would have to be saved in g_PlayerAssignments
and copied to the player data when starting the game. This however will mean that a lot of things will have to be changed, even the network protocol. Alternatively the assignments could also be stored in a global player data array. This however will introduce a lot of duplicate logic, as that array will have to be updated with every change of the assignments and on join/leave etc.
Not completely convinced we should do that, but if someone comes up with an elegant patch for that...
#4037 would help with not killing the currently selected players / civs / teams.
comment:6 by , 8 years ago
Keywords: | review added |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Summary: | [Patch] In Match Setup screen, selecting a map shouldn't change the selected civilizations → [PATCH] In Match Setup screen, selecting a map shouldn't change the selected civilizations |
Very well, I added the latest patch according to the latest criticism. I however contest that I should create variables for the .length properties because calling .length parses for string length each time. Though I didn't actually keep the variables to suit your demands.
comment:7 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 by , 8 years ago
You can't close the ticket. Need reviewed and committed , so the developer will close this.
comment:10 by , 8 years ago
- Since that code is only called when selecting a map and getting the string length takes some microseconds, the performance won't matter in comparison to readability.
- The code hasn't been merged with the similar code in
selectNumPlayers
(if you don't understand my comments, just ask instead of doing like that comment wasn't posted ;) ). source:ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js#L1054 Even if it's just one statement on three lines, the reader would probably appreciate an abbreviation so that he has to understand that code only once. You could call that functionresizePlayerData
and pass the desired length and the replacement playerdata, which is the maps playerdata in one case and the player defaults in the other.
- Also a space after
//
by , 8 years ago
Attachment: | 3120.v3.patch added |
---|
Made function applying the fix and applied in 2 different places
comment:11 by , 8 years ago
Keywords: | review removed |
---|
Thanks for the update!
- Unneeded newline in
resizePlayerData
- It seems cleaner to not use a default argument there, but just pass the length in both cases
- Notice everytime the playerdata is resized, some players might become unassigned.
Both
selectNumPlayers
andselectMap
have a check to unassign those players in multiplayer and in singleplayer reassign the player to slot 1 in case he became unassigned. So it would be really great for the code to also move that logic to the new function.
by , 8 years ago
Attachment: | 3120.v5.patch added |
---|
Cleaned up code and moved player (un)assignment into function.
comment:12 by , 8 years ago
Keywords: | review added |
---|
by , 8 years ago
Attachment: | 3120.v7.patch added |
---|
Fixed bug related to gaia player in skirmish maps.
comment:13 by , 8 years ago
Keywords: | review removed |
---|
Nice, you found a non-obvious bug! :)
Now take a look at what sanitizePlayerData
does and notice you just have to move the resizePlayerData
call one line below instead of duplicating the gaia check.
comment:15 by , 8 years ago
Keywords: | simple removed |
---|---|
Milestone: | Alpha 21 → Backlog |
Thanks for the patch!
- Always add the review keyword once you think the patch is ready to commit, otherwise it will not be considered.
- Trailing whitespace in 4 places
- Only reassigning the local player to 1 if it's outside of the valid range
- Renaming
ply
tomaxPlayers
anddefPData
totargetPlayerData
andplayer
toplayerID
, since those names are a bit more in line with the rest of the code. - Removing one
changes
from the comment, that unneeded "reassign player 1" and "on map change" comment.
Keeping the ticket open in case someone comes up with an elegant approach to also solve the persisting of teams/civs in case the number of players is changed from M > N to N back to M.
The g_PlayerAssignments
change can just be moved to launchGame
then, but the playerData
settings would have to be cached somewhere (-> likely not elegant).
comment:16 by , 8 years ago
Notice the commit broke the gamesetup when someone with playerID N disconnected, the host reduced the number of players to M<N, and that client rejoining the gamesetup again: #4120.
comment:19 by , 5 years ago
Component: | UI & Simulation → Game setup |
---|
Move tickets to Game Setup
as UI & Simulation
got some sub components.
comment:20 by , 4 years ago
Milestone: | Backlog → Alpha 24 |
---|---|
Owner: | set to |
Patch: | → Phab:D2483 |
Status: | reopened → new |
comment:21 by , 4 years ago
Component: | UI – Game setup → Atlas editor |
---|---|
Description: | modified (diff) |
Keywords: | patch removed |
Milestone: | Alpha 24 → Backlog |
Atlas writes the VictoryConditions to all saved maps, and Atlas doesn't work correctly if they're not specified, so the issue is not limited to the gamesetup part (but the gamesetup part will be fixed by Phab:D2483).
comment:22 by , 4 years ago
Component: | Atlas editor → UI – Game setup |
---|---|
Milestone: | Backlog → Alpha 24 |
wrong ticket (meant #4661)
Already the case for random maps, but not skrimish maps (scenario maps have fixed civs).