Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1668 closed enhancement (fixed)

[PATCH] Add "Random" option to map selection dropdown

Reported by: O.Davoodi Owned by: O.Davoodi
Priority: Nice to Have Milestone: Alpha 12
Component: UI & Simulation Keywords: gui match setup map patch
Cc: Patch:

Description

Here is a patch. Notice that there is no such an option for scenarios because of their non-fixed player count.

Attachments (3)

maprandomselect.patch (1.7 KB ) - added by O.Davoodi 12 years ago.
maprandomselect.2.patch (1.7 KB ) - added by O.Davoodi 12 years ago.
fixed patch
maprandomselect.3.patch (2.2 KB ) - added by Deiz 12 years ago.

Download all attachments as: .zip

Change History (17)

by O.Davoodi, 12 years ago

Attachment: maprandomselect.patch added

comment:1 by historic_bruno, 12 years ago

We could also add something like AOK's "Random land map" option, which would select a non-naval map, and "Random" would select from all random maps as in your patch.

Last edited 12 years ago by historic_bruno (previous) (diff)

comment:2 by O.Davoodi, 12 years ago

My patch already handles that. It selects a random map from the current "list" meaning that map filters are important.

comment:3 by historic_bruno, 12 years ago

Keywords: patch review added
Summary: Add "Random" option to map selection dropdown[PATCH] Add "Random" option to map selection dropdown

Ah, that works :)

comment:4 by historic_bruno, 12 years ago

After applying the patch I get these errors after trying to play Random:

WARNING: JavaScript warning: gui/gamesetup/gamesetup.js line 777 reference to undefined property g_GameAttributes.map.Name

WARNING: JavaScript warning: Script value conversion check failed: JSVAL_IS_STRING(v) || JSVAL_IS_NUMBER(v) (got type undefined)

ERROR: File 'maps/random/undefined' does not exist

ERROR: CMapGeneratorWorker::Run: Failed to load RMS 'maps/random/undefined'

The warnings also appear for scenarios.

I would suggest changing "Random" to a different color as we do for random civs, so it stands out more from the rest of the list.

comment:5 by Deiz, 12 years ago

Warning stems from :777, which is probably supposed to be:

if (g_GameAttributes.map == "random")

I assume so because g_GameAttributes.map is a string, not an object, and the random map "filename" to be swapped out is "random", not "Random".

comment:6 by O.Davoodi, 12 years ago

Oh I'm really sorry. I didn't copy the newer files into my checkout directory before creating the patches.

by O.Davoodi, 12 years ago

Attachment: maprandomselect.2.patch added

fixed patch

by Deiz, 12 years ago

Attachment: maprandomselect.3.patch added

comment:7 by Deiz, 12 years ago

Version I've uploaded trims some trailing whitespace. I also colourized the map name for the host; unsure if it should also be done at the map data level, as that would make both the client display and the label above the map description orange.

comment:8 by O.Davoodi, 12 years ago

Well, what are we waiting for now? Let's commit this. :)

comment:9 by Erik Johansson, 12 years ago

You've got commit powers you know ;)

comment:10 by O.Davoodi, 12 years ago

I wanted to make sure Deiz doesn't want to change anything. :)

comment:11 by O.Davoodi, 12 years ago

Resolution: fixed
Status: newclosed

In 12684:

Adding the "Random" option in map selection. Fixes #1668

comment:12 by fabio, 12 years ago

Nice! Can also be added to Scenario maps?

EDIT: Random is white here, not orange.

Last edited 12 years ago by fabio (previous) (diff)

comment:13 by O.Davoodi, 12 years ago

In 12685:

Making the "random" option in the map selection dropdown orange. Refs #1668

comment:14 by historic_bruno, 12 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.