Merge lp:~widelands-dev/widelands/map-filter-dropdowns into lp:widelands

Proposed by GunChleoc
Status: Work in progress
Proposed branch: lp:~widelands-dev/widelands/map-filter-dropdowns
Merge into: lp:widelands
Diff against target: 961 lines (+284/-101)
44 files modified
data/maps/Archipelago_Sea.wmf/elemental (+1/-1)
data/maps/Calvisson.wmf/elemental (+1/-1)
data/maps/Checkmate.wmf/elemental (+1/-1)
data/maps/Crater.wmf/elemental (+1/-1)
data/maps/Crossing_the_Horizon_v2.wmf/elemental (+1/-1)
data/maps/Desert_Tournament.wmf/elemental (+1/-1)
data/maps/Dolomites_v2.wmf/elemental (+1/-1)
data/maps/Elven_Forests.wmf/elemental (+1/-1)
data/maps/Fellowships_v2.wmf/elemental (+1/-1)
data/maps/Four_Castles.wmf/elemental (+1/-1)
data/maps/Four_Mountains.wmf/elemental (+1/-1)
data/maps/Full_Moon_v2.wmf/elemental (+1/-1)
data/maps/Glacier_Lake_v2.wmf/elemental (+1/-1)
data/maps/Golden_Peninsula.wmf/elemental (+1/-1)
data/maps/Ice_wars.wmf/elemental (+1/-1)
data/maps/Lake_of_Tranquility.wmf/elemental (+1/-1)
data/maps/Last_Bastion_v2.wmf/elemental (+1/-1)
data/maps/Last_Survivors.wmf/elemental (+1/-1)
data/maps/MP_Scenarios/Island_Hopping.wmf/elemental (+1/-1)
data/maps/MP_Scenarios/Smugglers.wmf/elemental (+1/-1)
data/maps/Rendez-Vous.wmf/elemental (+1/-1)
data/maps/Sun_of_Fire.wmf/elemental (+1/-1)
data/maps/Swamp_Monks.wmf/elemental (+1/-1)
data/maps/The_Far_North.wmf/elemental (+1/-1)
data/maps/The_Green_Plateau.wmf/elemental (+1/-1)
data/maps/The_Nile_v2.wmf/elemental (+1/-1)
data/maps/The_Oasis_Triangle.wmf/elemental (+1/-1)
data/maps/The_Pass_Through_the_Mountains.wmf/elemental (+1/-1)
data/maps/The_Thaw.wmf/elemental (+1/-1)
data/maps/Three_Warriors.wmf/elemental (+1/-1)
data/maps/Together_We're_Strong.wmf/elemental (+1/-1)
data/maps/Trident_of_Fire.wmf/elemental (+1/-1)
data/maps/Twin_Lagoons_v2.wmf/elemental (+1/-1)
data/maps/Two_Frontiers.wmf/elemental (+1/-1)
data/maps/Volcanic_Winter.wmf/elemental (+1/-1)
data/maps/Wideworld.wmf/elemental (+1/-1)
src/editor/ui_menus/main_menu_map_options.cc (+21/-3)
src/editor/ui_menus/main_menu_map_options.h (+5/-1)
src/ui_basic/button.cc (+16/-6)
src/ui_basic/dropdown.cc (+18/-3)
src/ui_basic/dropdown.h (+5/-0)
src/ui_fsmenu/mapselect.cc (+168/-51)
src/ui_fsmenu/mapselect.h (+11/-1)
src/wui/map_tags.cc (+4/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/map-filter-dropdowns
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+372159@code.launchpad.net

Commit message

Redesign filters in Mapselect
- Add autofit text width capabilities to buttons and dropdowns
- Replace broken "Show all maps" checkbox with button
- Replace team-related checkboxes with dropdown
- New map tag "balanced" to complement "unbalanced", because the
  "balanced" state is the one that should be marked explicitly

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

With the upcoming ferry branch, we will run out of screen space for map tags. So, I have grouped them into dropdown menus.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have marked all official maps that didn't have an "unbalanced" tag as "balanced"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/maps/Archipelago_Sea.wmf/elemental'
2--- data/maps/Archipelago_Sea.wmf/elemental 2016-04-01 09:21:48 +0000
3+++ data/maps/Archipelago_Sea.wmf/elemental 2019-09-08 20:22:47 +0000
4@@ -9,4 +9,4 @@
5 author="King of nowhere"
6 descr=_"Between Sweden and Finland lies the archipelago sea. This place of incredible beauty is not land, and it is not sea, but it is both. Within a few hundred kilometers, there are no less than 50,000 islands and islets, most no more than a few acres across. The climate is quite mild for its latitude; farming thrives, berries are abundant, and fish plentiful. The small human population of this place never knew famine. You warlording bastards just couldn’t leave this little paradise in peace, could you?"
7 hint=_"Large plots are rare on those small islands. Prioritize construction of large buildings on them. Sometimes you will need big military buildings to expand all the way to the next island. The AI will perform poorly."
8-tags="official"
9+tags="balanced,official"
10
11=== modified file 'data/maps/Calvisson.wmf/elemental'
12--- data/maps/Calvisson.wmf/elemental 2016-03-25 09:45:18 +0000
13+++ data/maps/Calvisson.wmf/elemental 2019-09-08 20:22:47 +0000
14@@ -9,7 +9,7 @@
15 author="Kristin"
16 descr=_"It’s a pleasure to settle in the beauty of this fissured countryside. But the ways to encompass these large territories are long and meandering, so it is easy to err into the land of the foreign clans."
17 hint=
18-tags="2teams,official,seafaring"
19+tags="2teams,balanced,official,seafaring"
20
21 [teams00]
22 team1="0"
23
24=== modified file 'data/maps/Checkmate.wmf/elemental'
25--- data/maps/Checkmate.wmf/elemental 2016-03-25 09:45:18 +0000
26+++ data/maps/Checkmate.wmf/elemental 2019-09-08 20:22:47 +0000
27@@ -9,4 +9,4 @@
28 author="Winterwind"
29 descr=_"Whether just one of nature’s strangest features or the creation of a mad (and game-hungry) god, this weird battleground awaits two opponents for another confrontation."
30 hint=
31-tags="1v1,artifacts,official"
32+tags="1v1,artifacts,balanced,official"
33
34=== modified file 'data/maps/Crater.wmf/elemental'
35--- data/maps/Crater.wmf/elemental 2016-03-25 09:45:18 +0000
36+++ data/maps/Crater.wmf/elemental 2019-09-08 20:22:47 +0000
37@@ -9,4 +9,4 @@
38 author="Tarrei"
39 descr=_"Long after a meteor crashed into a couple of mountains, life blossoms in the crater. Two tribes are now fighting for the rich resources."
40 hint=
41-tags="1v1,artifacts,official"
42+tags="1v1,artifacts,balanced,official"
43
44=== modified file 'data/maps/Crossing_the_Horizon_v2.wmf/elemental'
45--- data/maps/Crossing_the_Horizon_v2.wmf/elemental 2018-02-16 11:34:08 +0000
46+++ data/maps/Crossing_the_Horizon_v2.wmf/elemental 2019-09-08 20:22:47 +0000
47@@ -9,4 +9,4 @@
48 author="Kristin – edited by 3plus4i"
49 descr=_"Man your ship and sail to the horizon."
50 hint=
51-tags="2teams,artifacts,ffa,official,seafaring"
52+tags="2teams,artifacts,balanced,ffa,official,seafaring"
53
54=== modified file 'data/maps/Desert_Tournament.wmf/elemental'
55--- data/maps/Desert_Tournament.wmf/elemental 2016-03-25 09:45:18 +0000
56+++ data/maps/Desert_Tournament.wmf/elemental 2019-09-08 20:22:47 +0000
57@@ -9,7 +9,7 @@
58 author="ivh"
59 descr=_"Four tribes struggle with their nearest neighbor to be the first to reach the mountain of gold that promises riches beyond belief. But can the two remaining ones share the resources wisely?"
60 hint=
61-tags="2teams,artifacts,ffa,official"
62+tags="2teams,artifacts,balanced,ffa,official"
63
64 [teams00]
65 team1="0,1"
66
67=== modified file 'data/maps/Dolomites_v2.wmf/elemental'
68--- data/maps/Dolomites_v2.wmf/elemental 2016-04-04 17:04:56 +0000
69+++ data/maps/Dolomites_v2.wmf/elemental 2019-09-08 20:22:47 +0000
70@@ -9,4 +9,4 @@
71 author="King of nowhere"
72 descr=_"The jewel of the Alps, the Dolomites mountain range has been declared a World Heritage Site for its pristine beauty. This map is an as-faithful-as-reasonable reconstruction of the area delimited by Cortina d’Ampezzo in the north-east and Canazei in the south-west. If you have to be pitted in a duel to the death against your enemies, it may as well be in a beautiful place."
73 hint=_"There is lot of flat ground on the mountains. Unfortunately, most of it is vertical. Use the little building space that you have wisely. A fortress at the mouth of a narrow mountain pass can be a formidable obstacle to an enemy army. Use the terrain to your advantage."
74-tags="1v1,2teams,3teams,official"
75+tags="1v1,2teams,3teams,balanced,official"
76
77=== modified file 'data/maps/Elven_Forests.wmf/elemental'
78--- data/maps/Elven_Forests.wmf/elemental 2016-03-25 09:45:18 +0000
79+++ data/maps/Elven_Forests.wmf/elemental 2019-09-08 20:22:47 +0000
80@@ -9,7 +9,7 @@
81 author="Winterwind"
82 descr=_"The breath-taking beauty of these emerald lands has lured many tribes into an attempt to take them for themselves."
83 hint=
84-tags="2teams,artifacts,ffa,official"
85+tags="2teams,artifacts,balanced,ffa,official"
86
87 [teams00]
88 team1="0,1"
89
90=== modified file 'data/maps/Fellowships_v2.wmf/elemental'
91--- data/maps/Fellowships_v2.wmf/elemental 2016-03-29 18:29:13 +0000
92+++ data/maps/Fellowships_v2.wmf/elemental 2019-09-08 20:22:47 +0000
93@@ -9,4 +9,4 @@
94 author="Teppo"
95 descr=_"Ships are your best fellows. Starting positions are similar, so the map should be fair."
96 hint=_"This is a somewhat technical map, and it is best suited for two or three human players. Coal is hard to find – consider making some. There is gold near the starting point – do you see it?"
97-tags="ffa,seafaring,official"
98+tags="balanced,ffa,seafaring,official"
99
100=== modified file 'data/maps/Four_Castles.wmf/elemental'
101--- data/maps/Four_Castles.wmf/elemental 2016-03-25 09:45:18 +0000
102+++ data/maps/Four_Castles.wmf/elemental 2019-09-08 20:22:47 +0000
103@@ -9,7 +9,7 @@
104 author="Winterwind"
105 descr=_"Well protected in their mighty fortresses, four power-hungry warlords are completing their schemes to dominate these lands…"
106 hint=
107-tags="2teams,artifacts,ffa,official"
108+tags="2teams,artifacts,balanced,ffa,official"
109
110 [teams00]
111 team1="0,1"
112
113=== modified file 'data/maps/Four_Mountains.wmf/elemental'
114--- data/maps/Four_Mountains.wmf/elemental 2016-03-31 07:40:54 +0000
115+++ data/maps/Four_Mountains.wmf/elemental 2019-09-08 20:22:47 +0000
116@@ -9,7 +9,7 @@
117 author="Quappo"
118 descr=_"Each tribe is surrounded by four mighty mountains. Who will first conquer them and claim the resources for his own tribe?"
119 hint=_"I: Water can be found along the river. II: Snowmen mark additional water sources. III: Each mountain contains only one resource."
120-tags="2teams,artifacts,ffa,official"
121+tags="2teams,artifacts,balanced,ffa,official"
122
123 [teams00]
124 team1="0,1"
125
126=== modified file 'data/maps/Full_Moon_v2.wmf/elemental'
127--- data/maps/Full_Moon_v2.wmf/elemental 2016-03-29 18:29:13 +0000
128+++ data/maps/Full_Moon_v2.wmf/elemental 2019-09-08 20:22:47 +0000
129@@ -9,7 +9,7 @@
130 author="fk"
131 descr=_"Whether it is the latest solstice, or lunar illness, something moves these tribes towards their final ordeal."
132 hint=
133-tags="2teams,ffa,official"
134+tags="2teams,balanced,ffa,official"
135
136 [teams00]
137 team1="0,1"
138
139=== modified file 'data/maps/Glacier_Lake_v2.wmf/elemental'
140--- data/maps/Glacier_Lake_v2.wmf/elemental 2016-03-29 18:29:13 +0000
141+++ data/maps/Glacier_Lake_v2.wmf/elemental 2019-09-08 20:22:47 +0000
142@@ -9,4 +9,4 @@
143 author=_"Nasenbaer – edited by king_of_nowhere"
144 descr=_"Your tribe has dwelt on this beautiful and lonely glacier lake for a long time. No one disturbed you and the resources were sufficient for your whole tribe, but a few months ago another tribe came over the mountains and settled down. And you are sure that there is only enough space for one tribe."
145 hint=
146-tags="1v1,artifacts,official"
147+tags="1v1,artifacts,balanced,official"
148
149=== modified file 'data/maps/Golden_Peninsula.wmf/elemental'
150--- data/maps/Golden_Peninsula.wmf/elemental 2016-03-25 09:45:18 +0000
151+++ data/maps/Golden_Peninsula.wmf/elemental 2019-09-08 20:22:47 +0000
152@@ -9,4 +9,4 @@
153 author="Winterwind"
154 descr=_"Two empires race for the treasures of a legendary peninsula…"
155 hint=
156-tags="1v1,artifacts,official"
157+tags="1v1,artifacts,balanced,official"
158
159=== modified file 'data/maps/Ice_wars.wmf/elemental'
160--- data/maps/Ice_wars.wmf/elemental 2016-03-25 09:45:18 +0000
161+++ data/maps/Ice_wars.wmf/elemental 2019-09-08 20:22:47 +0000
162@@ -9,4 +9,4 @@
163 author="Einstein13"
164 descr=_"Autumn became winter. Some things are frozen, but not the war."
165 hint=_"Start positions are clockwise"
166-tags="2teams,3teams,4teams,official,seafaring"
167+tags="2teams,3teams,4teams,balanced,official,seafaring"
168
169=== modified file 'data/maps/Lake_of_Tranquility.wmf/elemental'
170--- data/maps/Lake_of_Tranquility.wmf/elemental 2016-03-25 09:45:18 +0000
171+++ data/maps/Lake_of_Tranquility.wmf/elemental 2019-09-08 20:22:47 +0000
172@@ -9,4 +9,4 @@
173 author="Winterwind"
174 descr=_"This lake, deep in the most ancient forests, has long been known for its beauty and idyllic peace. However, its sanctity has been disturbed now, as two hostile tribes have arrived at its shores…"
175 hint=
176-tags="1v1,artifacts,official"
177+tags="1v1,artifacts,balanced,official"
178
179=== modified file 'data/maps/Last_Bastion_v2.wmf/elemental'
180--- data/maps/Last_Bastion_v2.wmf/elemental 2018-02-14 18:29:07 +0000
181+++ data/maps/Last_Bastion_v2.wmf/elemental 2019-09-08 20:22:47 +0000
182@@ -9,4 +9,4 @@
183 author=_"Another Barbarian – edited by king_of_nowhere"
184 descr=_"The whimsical Gods didn’t answer our prayers. Instead, the increasing sunlight heated up the Earth a thousandfold and melted glaciers and people were plunged into the deep. But now – high in the majestic mountains, on the last scrap of land – two surviving tribes are sheltering. Even though the Gods showed mercy and the climate thus turned cooler again, the water is still rising and rising. Onto the last secure place – the highest mountain range where the amount of gold and the space to live merely suffice for one tribe – only two opposite paths lead. But remember, be careful… this last living space is also a hard and small place to live."
185 hint=_"Don’t forget to take care of your timber supplies, you’ll need them."
186-tags="1v1,artifacts,official"
187+tags="1v1,artifacts,balanced,official"
188
189=== modified file 'data/maps/Last_Survivors.wmf/elemental'
190--- data/maps/Last_Survivors.wmf/elemental 2016-03-25 09:45:18 +0000
191+++ data/maps/Last_Survivors.wmf/elemental 2019-09-08 20:22:47 +0000
192@@ -9,7 +9,7 @@
193 author="fk"
194 descr=_"Four tribes fighting for dominance in a stark area. Resources are scattered all over the map."
195 hint=
196-tags="2teams,ffa,official"
197+tags="2teams,balanced,ffa,official"
198
199 [teams00]
200 team1="0,2"
201
202=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/elemental'
203--- data/maps/MP_Scenarios/Island_Hopping.wmf/elemental 2014-10-08 10:38:57 +0000
204+++ data/maps/MP_Scenarios/Island_Hopping.wmf/elemental 2019-09-08 20:22:47 +0000
205@@ -7,4 +7,4 @@
206 name=_"Island Hopping"
207 author="SirVer,Nasenbaer"
208 descr=_"A special tournament in Atlantean culture is the so-called ‘Island Hopping’, where two or more groups try to reach the center island as fast as possible, to be the first erecting a castle on the top of the central mountain."
209-tags="official"
210+tags="official,balanced"
211
212=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/elemental'
213--- data/maps/MP_Scenarios/Smugglers.wmf/elemental 2015-03-24 08:16:52 +0000
214+++ data/maps/MP_Scenarios/Smugglers.wmf/elemental 2019-09-08 20:22:47 +0000
215@@ -9,7 +9,7 @@
216 name=_"Smugglers"
217 author="Nasenbaer,SirVer"
218 descr=_"Your well established smuggling routes suddenly got busy: two other tribes have appeared and now a rivalry among smugglers has started. Which team will be the first to smuggle a certain number of wares?"
219-tags="official"
220+tags="official,balanced"
221
222 [teams00]
223 team1=0,1
224
225=== modified file 'data/maps/Rendez-Vous.wmf/elemental'
226--- data/maps/Rendez-Vous.wmf/elemental 2016-09-18 07:01:55 +0000
227+++ data/maps/Rendez-Vous.wmf/elemental 2019-09-08 20:22:47 +0000
228@@ -9,4 +9,4 @@
229 author="Quappo"
230 descr=_"Only a small hill in the centre of the map connects these four competing tribes. Lead your army to this hill right away and build a giant stronghold as a sign of your superiority!"
231 hint=_"There is space for only one stronghold in the centre. Water can be found everywhere, so there is no need to send out geologists."
232-tags="2teams,ffa,official"
233+tags="2teams,ffa,balanced,official"
234
235=== modified file 'data/maps/Sun_of_Fire.wmf/elemental'
236--- data/maps/Sun_of_Fire.wmf/elemental 2016-03-25 09:45:18 +0000
237+++ data/maps/Sun_of_Fire.wmf/elemental 2019-09-08 20:22:47 +0000
238@@ -9,4 +9,4 @@
239 author="Nasenbaer"
240 descr=_"For hundreds of years, this island was kept as a sanctuary of the Gods. No human ever ventured to set a foot on it. But now that a tribe had finally been barefaced enough to settle on the coast of that island, a lot of others followed in its wake."
241 hint=_"Start positions are clockwise"
242-tags="2teams,3teams,4teams,ffa,official"
243+tags="2teams,3teams,4teams,balanced,ffa,official"
244
245=== modified file 'data/maps/Swamp_Monks.wmf/elemental'
246--- data/maps/Swamp_Monks.wmf/elemental 2016-03-25 09:45:18 +0000
247+++ data/maps/Swamp_Monks.wmf/elemental 2019-09-08 20:22:47 +0000
248@@ -9,7 +9,7 @@
249 author="Nasenbaer"
250 descr=_"It is said that the old war monks, living in the even older swamps, are the key to control over the whole island."
251 hint=
252-tags="2teams,artifacts,official"
253+tags="2teams,artifacts,balanced,official"
254
255 [teams00]
256 team1="0,1"
257
258=== modified file 'data/maps/The_Far_North.wmf/elemental'
259--- data/maps/The_Far_North.wmf/elemental 2016-03-25 09:45:18 +0000
260+++ data/maps/The_Far_North.wmf/elemental 2019-09-08 20:22:47 +0000
261@@ -9,4 +9,4 @@
262 author="Another Barbarian"
263 descr=_"Some say that impenetrable lands to the far north scared away even the most courageous settlers and the bravest of the brave warriors. Big and old forests, full of big and predatory game, cut across by wetlands and hills were shrouded in mystery. The ones who had managed to come back mentioned tremendous buildings, decorated with carvings and gold from majestic mountain ranges somewhere amongst the wilderness. Dozens of years after only some crumbly ruins remain of these good old times, covered with moss and trees. Their shapes give only an idea about the craftsmanship of ancient constructors. Nobody knows why they (have) disappeared. Nobody knows why. People say that now nothing is blocking the road to wealth. But many will die pulled apart by wolves, engulfed by swamp… encircled by hostile tribes."
264 hint=
265-tags="1v1,artifacts,official"
266+tags="1v1,artifacts,balanced,official"
267
268=== modified file 'data/maps/The_Green_Plateau.wmf/elemental'
269--- data/maps/The_Green_Plateau.wmf/elemental 2016-03-25 09:45:18 +0000
270+++ data/maps/The_Green_Plateau.wmf/elemental 2019-09-08 20:22:47 +0000
271@@ -9,7 +9,7 @@
272 author="Nasenbaer"
273 descr=_"You are standing on an island, crowned by mighty mountains which keep a wonderful and mighty treasure in their middle – The Green Plateau, which is hard to conquer but easy to lose. So, if you want it, be aware of the other clans."
274 hint=
275-tags="1v1,artifacts,official"
276+tags="1v1,artifacts,balanced,official"
277
278 [teams00]
279 team1="0"
280
281=== modified file 'data/maps/The_Nile_v2.wmf/elemental'
282--- data/maps/The_Nile_v2.wmf/elemental 2016-03-29 18:29:13 +0000
283+++ data/maps/The_Nile_v2.wmf/elemental 2019-09-08 20:22:47 +0000
284@@ -10,7 +10,7 @@
285 descr=_"The river has always provided food and communication. This time, eight empires will fight for control over this land."
286 hint=_"Use the river wisely. Your opponents will do the same. You will find the main ore resources deep in the desert."
287 hint=
288-tags="1v1,2teams,3teams,4teams,seafaring,official"
289+tags="1v1,2teams,3teams,4teams,balanced,seafaring,official"
290
291 [teams00]
292 team1="0"
293
294=== modified file 'data/maps/The_Oasis_Triangle.wmf/elemental'
295--- data/maps/The_Oasis_Triangle.wmf/elemental 2016-03-25 09:45:18 +0000
296+++ data/maps/The_Oasis_Triangle.wmf/elemental 2019-09-08 20:22:47 +0000
297@@ -9,4 +9,4 @@
298 author="Nasenbaer"
299 descr=_"There is something mystical like a gray atmosphere around these three oases, which no one has found out about yet. Perhaps you will be the one, but be aware of the others who are searching too!"
300 hint=
301-tags="artifacts,ffa,official"
302+tags="artifacts,balanced,ffa,official"
303
304=== modified file 'data/maps/The_Pass_Through_the_Mountains.wmf/elemental'
305--- data/maps/The_Pass_Through_the_Mountains.wmf/elemental 2016-10-31 09:34:27 +0000
306+++ data/maps/The_Pass_Through_the_Mountains.wmf/elemental 2019-09-08 20:22:47 +0000
307@@ -9,4 +9,4 @@
308 author="Quappo"
309 descr=_"In this mountainous area two princes have settled. Now they are expanding their territories, unaware of the fact that they are not alone!"
310 hint=
311-tags="1v1,artifacts,official"
312+tags="1v1,artifacts,balanced,official"
313
314=== modified file 'data/maps/The_Thaw.wmf/elemental'
315--- data/maps/The_Thaw.wmf/elemental 2016-03-25 09:45:18 +0000
316+++ data/maps/The_Thaw.wmf/elemental 2019-09-08 20:22:47 +0000
317@@ -9,4 +9,4 @@
318 author="Another Barbarian"
319 descr=_"Another thaw set in. Three tribes were sheltering from severe winter among majestic mountains. At the time of the solstice they listened to the oracle and went to war. The only survivor will sacrifice his enemies’ treasures on the ancient altar, build there a splendid castle and gain the goodwill and respect of the Gods."
320 hint=
321-tags="artifacts,ffa,official"
322+tags="artifacts,balanced,ffa,official"
323
324=== modified file 'data/maps/Three_Warriors.wmf/elemental'
325--- data/maps/Three_Warriors.wmf/elemental 2016-03-25 09:45:18 +0000
326+++ data/maps/Three_Warriors.wmf/elemental 2019-09-08 20:22:47 +0000
327@@ -9,4 +9,4 @@
328 author="Quappo"
329 descr=_"Mighty mountains divide this land into three fertile valleys. But a path connects the valleys and thus a fight seems inescapable!"
330 hint=_"Water can be found around the lakes."
331-tags="ffa,official"
332+tags="ffa,balanced,official"
333
334=== modified file 'data/maps/Together_We're_Strong.wmf/elemental'
335--- data/maps/Together_We're_Strong.wmf/elemental 2016-03-29 18:23:38 +0000
336+++ data/maps/Together_We're_Strong.wmf/elemental 2019-09-08 20:22:47 +0000
337@@ -9,4 +9,4 @@
338 author="Nasenbaer"
339 descr=_"The four mighty harbors of the Craw Islands have been trading their goods among each other for ages. All of them needed resources that they could not produce in their own territory and in exchange provided other resources to those that could not produce them. Based on these trades, a very friendly commerce was common between the four harbors and the people living on the Craw Islands – until recently, when two of the harbors united to form an exclusive trade alliance, forcing the other two to do the same. Suddenly, it seems only a matter of time before the first fights between the harbors will shatter the peaceful life that has lasted for so long…"
340 hint=
341-tags="1v1,artifacts,seafaring,official"
342+tags="1v1,artifacts,balanced,seafaring,official"
343
344=== modified file 'data/maps/Trident_of_Fire.wmf/elemental'
345--- data/maps/Trident_of_Fire.wmf/elemental 2016-03-25 09:45:18 +0000
346+++ data/maps/Trident_of_Fire.wmf/elemental 2019-09-08 20:22:47 +0000
347@@ -9,7 +9,7 @@
348 author="Robnick"
349 descr=_"In the vicinity of three major volcanoes, six lovely islands are inviting settlers to start a new life. Deserts and a quickly growing forest wait to be discovered. But only by becoming a naval power will your tribe be able to explore enough resources to compete with its opponents."
350 hint=
351-tags="1v1,2teams,3teams,official,seafaring"
352+tags="1v1,2teams,3teams,balanced,official,seafaring"
353
354 [teams00]
355 team1="1"
356
357=== modified file 'data/maps/Twin_Lagoons_v2.wmf/elemental'
358--- data/maps/Twin_Lagoons_v2.wmf/elemental 2016-03-29 18:29:13 +0000
359+++ data/maps/Twin_Lagoons_v2.wmf/elemental 2019-09-08 20:22:47 +0000
360@@ -9,4 +9,4 @@
361 author="fk"
362 descr=_"When the wind swelled up and the first dunes were formed on these abandoned twin lagoons, nobody could have expected that two tribes that are desperately searching for more resources to support their endlessly ongoing wars, would end up in this forgotten place at the same time and for the same well-known reason."
363 hint=_"Defend your transport lines, or use ships to bypass the opponent. Then remove all enemy activity."
364-tags="1v1,seafaring,official"
365+tags="1v1,balanced,seafaring,official"
366
367=== modified file 'data/maps/Two_Frontiers.wmf/elemental'
368--- data/maps/Two_Frontiers.wmf/elemental 2016-03-25 09:45:18 +0000
369+++ data/maps/Two_Frontiers.wmf/elemental 2019-09-08 20:22:47 +0000
370@@ -9,4 +9,4 @@
371 author="ISCH"
372 descr=_"A multiplayer battle map on a small circle-shaped island."
373 hint=
374-tags="ffa,official"
375+tags="balanced,ffa,official"
376
377=== modified file 'data/maps/Volcanic_Winter.wmf/elemental'
378--- data/maps/Volcanic_Winter.wmf/elemental 2016-03-25 09:45:18 +0000
379+++ data/maps/Volcanic_Winter.wmf/elemental 2019-09-08 20:22:47 +0000
380@@ -9,4 +9,4 @@
381 author="Nasenbaer"
382 descr=_"In the middle of summer, a series of volcanic eruptions drew the winter in. Suddenly, the sun seemed to be gone and the only light and heat sources left were those that enforced this dramatic change. Continents, oceans and seas are frozen now, only the volcanic islands seem to be left as habitable land."
383 hint=
384-tags="1v1,artifacts,official,seafaring"
385+tags="1v1,artifacts,balanced,official,seafaring"
386
387=== modified file 'data/maps/Wideworld.wmf/elemental'
388--- data/maps/Wideworld.wmf/elemental 2016-03-25 09:45:18 +0000
389+++ data/maps/Wideworld.wmf/elemental 2019-09-08 20:22:47 +0000
390@@ -9,4 +9,4 @@
391 author="Einstein13"
392 descr=_"The world is not enough! If you want to win, you have to send some ships. But remember: your opponents are very close to you."
393 hint=
394-tags="seafaring,official"
395+tags="seafaring,official,balanced"
396
397=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
398--- src/editor/ui_menus/main_menu_map_options.cc 2019-08-25 14:50:16 +0000
399+++ src/editor/ui_menus/main_menu_map_options.cc 2019-09-08 20:22:47 +0000
400@@ -78,10 +78,18 @@
401 name_(&main_box_, 0, 0, max_w_, UI::PanelStyle::kWui),
402 author_(&main_box_, 0, 0, max_w_, UI::PanelStyle::kWui),
403 size_(&main_box_, 0, 0, max_w_ - indent_, labelh_, ""),
404-
405+ balancing_dropdown_(&tags_box_,
406+ "dropdown_balancing",
407+ 0,
408+ 0,
409+ 200,
410+ 50,
411+ 24,
412+ "",
413+ UI::DropdownType::kTextual,
414+ UI::PanelStyle::kWui, UI::ButtonStyle::kWuiSecondary),
415 teams_list_(
416 &teams_box_, 0, 0, max_w_, 60, UI::PanelStyle::kWui, UI::ListselectLayout::kShowCheck),
417-
418 registry_(registry) {
419
420 tab_box_.set_size(max_w_, get_inner_h() - labelh_ - 2 * padding_);
421@@ -120,13 +128,18 @@
422 main_box_.add_space(indent_);
423
424 tags_box_.add(new UI::Textarea(&tags_box_, 0, 0, max_w_, labelh_, _("Tags:")));
425- add_tag_checkbox(&tags_box_, "unbalanced", localize_tag("unbalanced"));
426 add_tag_checkbox(&tags_box_, "ffa", localize_tag("ffa"));
427 add_tag_checkbox(&tags_box_, "1v1", localize_tag("1v1"));
428 add_tag_checkbox(&tags_box_, "2teams", localize_tag("2teams"));
429 add_tag_checkbox(&tags_box_, "3teams", localize_tag("3teams"));
430 add_tag_checkbox(&tags_box_, "4teams", localize_tag("4teams"));
431
432+ balancing_dropdown_.set_autoexpand_display_button();
433+ balancing_dropdown_.add(localize_tag("balanced"), "balanced");
434+ balancing_dropdown_.add(localize_tag("unbalanced"), "unbalanced");
435+
436+ tags_box_.add(&balancing_dropdown_);
437+
438 teams_box_.add(new UI::Textarea(&teams_box_, 0, 0, max_w_, labelh_, _("Suggested Teams:")));
439 teams_box_.add(&teams_list_);
440 // TODO(GunChleoc): We need team images in the listselect here,
441@@ -156,6 +169,8 @@
442 tag.second->changed.connect(boost::bind(&MainMenuMapOptions::changed, this));
443 }
444
445+ balancing_dropdown_.selected.connect([this] { changed(); });
446+
447 ok_.sigclicked.connect(boost::bind(&MainMenuMapOptions::clicked_ok, boost::ref(*this)));
448 cancel_.sigclicked.connect(boost::bind(&MainMenuMapOptions::clicked_cancel, boost::ref(*this)));
449
450@@ -183,6 +198,8 @@
451 for (auto tag : tags_checkboxes_) {
452 tag.second->set_state(tags.count(tag.first) > 0);
453 }
454+
455+ balancing_dropdown_.select(tags.count("balanced") ? "balanced" : "unbalanced");
456 }
457
458 /**
459@@ -205,6 +222,7 @@
460 eia().egbase().mutable_map()->add_tag(tag.first);
461 }
462 }
463+ eia().egbase().mutable_map()->add_tag(balancing_dropdown_.get_selected());
464 Notifications::publish(NoteMapOptions());
465 registry_.destroy();
466 }
467
468=== modified file 'src/editor/ui_menus/main_menu_map_options.h'
469--- src/editor/ui_menus/main_menu_map_options.h 2019-06-01 09:55:57 +0000
470+++ src/editor/ui_menus/main_menu_map_options.h 2019-09-08 20:22:47 +0000
471@@ -24,6 +24,7 @@
472 #include "ui_basic/box.h"
473 #include "ui_basic/button.h"
474 #include "ui_basic/checkbox.h"
475+#include "ui_basic/dropdown.h"
476 #include "ui_basic/editbox.h"
477 #include "ui_basic/listselect.h"
478 #include "ui_basic/multilineeditbox.h"
479@@ -63,10 +64,13 @@
480 UI::Textarea size_;
481 UI::MultilineEditbox* descr_;
482 UI::MultilineEditbox* hint_;
483- UI::Listselect<std::string> teams_list_;
484
485 // Tag, Checkbox
486 std::map<std::string, UI::Checkbox*> tags_checkboxes_;
487+ UI::Dropdown<std::string> balancing_dropdown_;
488+
489+ UI::Listselect<std::string> teams_list_;
490+
491 UI::UniqueWindow::Registry& registry_;
492 };
493
494
495=== modified file 'src/ui_basic/button.cc'
496--- src/ui_basic/button.cc 2019-06-25 08:03:30 +0000
497+++ src/ui_basic/button.cc 2019-09-08 20:22:47 +0000
498@@ -63,7 +63,8 @@
499 assert(!get_can_focus());
500 }
501
502-Button::Button // for textual buttons. If h = 0, h will resize according to the font's height.
503+/// For textual buttons. If h = 0, h will resize according to the font's height. If both h = 0 and w = 0, will resize for text width as well.
504+Button::Button
505 (Panel* const parent,
506 const std::string& name,
507 int32_t const x,
508@@ -86,12 +87,21 @@
509 tooltip_text,
510 init_state,
511 UI::Button::ImageMode::kShrink) {
512- // Automatically resize for font height and give it a margin.
513- if (h < 1) {
514+ if (h == 0) {
515+ // Automatically resize for font height and give it a margin.
516+ int new_width = get_w();
517 const int new_height =
518- text_height(g_gr->styles().button_style(init_style).enabled().font()) + 4;
519- set_desired_size(w, new_height);
520- set_size(w, new_height);
521+ std::max(text_height(g_gr->styles().button_style(init_style).enabled().font()),
522+ text_height(g_gr->styles().button_style(init_style).disabled().font()))
523+ + 4 * kButtonImageMargin;
524+ if (w == 0) {
525+ // Automatically resize for text width too.
526+ new_width = std::max(text_width(richtext_escape(title_), style_->enabled().font()),
527+ text_width(richtext_escape(title_), style_->disabled().font()))
528+ + 8 * kButtonImageMargin;
529+ }
530+ set_desired_size(new_width, new_height);
531+ set_size(new_width, new_height);
532 }
533 }
534
535
536=== modified file 'src/ui_basic/dropdown.cc'
537--- src/ui_basic/dropdown.cc 2019-07-28 11:33:50 +0000
538+++ src/ui_basic/dropdown.cc 2019-09-08 20:22:47 +0000
539@@ -98,7 +98,9 @@
540 label),
541 label_(label),
542 type_(type),
543- is_enabled_(true) {
544+ is_enabled_(true),
545+ button_style_(button_style),
546+ autoexpand_display_button_(false) {
547 if (label.empty()) {
548 set_tooltip(pgettext("dropdown", "Select Item"));
549 } else {
550@@ -213,17 +215,30 @@
551 layout();
552 }
553
554+void BaseDropdown::set_autoexpand_display_button() {
555+ autoexpand_display_button_ = true;
556+}
557+
558 void BaseDropdown::add(const std::string& name,
559 const uint32_t value,
560 const Image* pic,
561 const bool select_this,
562- const std::string& tooltip_text,
563- const std::string& hotkey = std::string()) {
564+ const std::string& tooltip_text, const std::string& hotkey) {
565 assert(pic != nullptr || type_ != DropdownType::kPictorial);
566 list_->add(name, value, pic, select_this, tooltip_text, hotkey);
567 if (select_this) {
568 set_value();
569 }
570+
571+ if (autoexpand_display_button_) {
572+ /// Fit width of display button to make enough room for the entry's text
573+ const std::string fitme = label_.empty() ? name : (boost::format(_("%1%: %2%")) % label_ % name).str();
574+ const int new_width = text_width(richtext_escape(fitme), g_gr->styles().button_style(button_style_).enabled().font()) + 8;
575+ if (new_width > display_button_.get_w()) {
576+ set_desired_size(get_w() + new_width - display_button_.get_w(), get_h());
577+ set_size(get_w() + new_width - display_button_.get_w(), get_h());
578+ }
579+ }
580 layout();
581 }
582
583
584=== modified file 'src/ui_basic/dropdown.h'
585--- src/ui_basic/dropdown.h 2019-06-25 08:03:30 +0000
586+++ src/ui_basic/dropdown.h 2019-09-08 20:22:47 +0000
587@@ -141,6 +141,9 @@
588 void set_size(int nw, int nh) override;
589 void set_desired_size(int w, int h) override;
590
591+ /// Expand display button to make enough room for each entry's text. Call this before adding yna entries.
592+ void set_autoexpand_display_button();
593+
594 protected:
595 /// Add an element to the list
596 /// \param name the display name of the entry
597@@ -213,6 +216,8 @@
598 uint32_t current_selection_;
599 DropdownType type_;
600 bool is_enabled_;
601+ ButtonStyle button_style_;
602+ bool autoexpand_display_button_;
603 };
604
605 /// A dropdown menu that lets the user select a value of the datatype 'Entry'.
606
607=== modified file 'src/ui_fsmenu/mapselect.cc'
608--- src/ui_fsmenu/mapselect.cc 2019-05-26 17:21:15 +0000
609+++ src/ui_fsmenu/mapselect.cc 2019-09-08 20:22:47 +0000
610@@ -42,7 +42,7 @@
611 FullscreenMenuMapSelect::FullscreenMenuMapSelect(GameSettingsProvider* const settings,
612 GameController* const ctrl)
613 : FullscreenMenuLoadMapOrGame(),
614- checkbox_space_(25),
615+ checkbox_space_(20),
616 // Less padding for big fonts; space is tight.
617 checkbox_padding_(UI::g_fh->fontset()->size_offset() > 0 ? 0 : 2 * padding_),
618
619@@ -68,7 +68,8 @@
620 basedir_(kMapsDir),
621 settings_(settings),
622 ctrl_(ctrl),
623- has_translated_mapname_(false) {
624+ has_translated_mapname_(false),
625+ unspecified_balancing_found_(false) {
626 curdir_ = basedir_;
627 if (settings_->settings().multiplayer) {
628 back_.set_tooltip(_("Return to the multiplayer game setup"));
629@@ -89,52 +90,114 @@
630
631 UI::Box* hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
632
633- // Must be initialized before tag checkboxes
634+ show_all_maps_ = new UI::Button(hbox, "show_all_maps", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Show all maps"));
635 cb_dont_localize_mapnames_ =
636 new UI::Checkbox(hbox, Vector2i::zero(), _("Show original map names"));
637 cb_dont_localize_mapnames_->set_state(false);
638- cb_dont_localize_mapnames_->changedto.connect(
639- boost::bind(&FullscreenMenuMapSelect::fill_table, boost::ref(*this)));
640-
641- cb_show_all_maps_ = add_tag_checkbox(hbox, "blumba", _("Show all maps"));
642- tags_checkboxes_.clear(); // Remove this again, it is a special tag checkbox
643- cb_show_all_maps_->set_state(true);
644-
645+
646+ hbox->add(show_all_maps_, UI::Box::Resizing::kFullSize);
647+ hbox->add_space(checkbox_space_);
648 hbox->add(cb_dont_localize_mapnames_, UI::Box::Resizing::kFullSize);
649- checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
650-
651- hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
652- add_tag_checkbox(hbox, "official", localize_tag("official"));
653- add_tag_checkbox(hbox, "unbalanced", localize_tag("unbalanced"));
654+ hbox->add_inf_space();
655+ checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
656+
657+ // Row with dropdowns
658+
659+ hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
660+
661+ official_tags_dropdown_ = new UI::Dropdown<std::string>(hbox,
662+ "dropdown_official_tags",
663+ 0,
664+ 0,
665+ 200,
666+ 50,
667+ 24,
668+ "",
669+ UI::DropdownType::kTextual,
670+ UI::PanelStyle::kFsMenu, UI::ButtonStyle::kFsMenuMenu);
671+ official_tags_dropdown_->set_autoexpand_display_button();
672+ official_tags_dropdown_->add(_("Official & Unofficial"), "");
673+ official_tags_dropdown_->add(localize_tag("official"), "official");
674+ official_tags_dropdown_->add(localize_tag("unofficial"), "unofficial");
675+
676+ hbox->add(official_tags_dropdown_, UI::Box::Resizing::kFullSize);
677+
678+ hbox->add_space(checkbox_space_);
679+
680+ team_tags_dropdown_ = new UI::Dropdown<std::string>(hbox,
681+ "dropdown_team_tags",
682+ 0,
683+ 0,
684+ 200,
685+ 50,
686+ 24,
687+ "",
688+ UI::DropdownType::kTextual,
689+ UI::PanelStyle::kFsMenu, UI::ButtonStyle::kFsMenuMenu);
690+ team_tags_dropdown_->set_autoexpand_display_button();
691+ team_tags_dropdown_->add(_("Any Teams"), "");
692+ team_tags_dropdown_->add(localize_tag("ffa"), "ffa");
693+ team_tags_dropdown_->add(localize_tag("1v1"), "1v1");
694+ team_tags_dropdown_->add(localize_tag("2teams"), "2teams");
695+ team_tags_dropdown_->add(localize_tag("3teams"), "3teams");
696+ team_tags_dropdown_->add(localize_tag("4teams"), "4teams");
697+
698+ hbox->add(team_tags_dropdown_, UI::Box::Resizing::kFullSize);
699+
700+ hbox->add_space(checkbox_space_);
701+
702+ balancing_tags_dropdown_ = new UI::Dropdown<std::string>(hbox,
703+ "dropdown_balancing",
704+ 0,
705+ 0,
706+ 200,
707+ 50,
708+ 24,
709+ "",
710+ UI::DropdownType::kTextual,
711+ UI::PanelStyle::kFsMenu, UI::ButtonStyle::kFsMenuMenu);
712+ balancing_tags_dropdown_->set_autoexpand_display_button();
713+ rebuild_balancing_dropdown();
714+
715+ hbox->add(balancing_tags_dropdown_, UI::Box::Resizing::kFullSize);
716+
717+ checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
718+
719+ // Row with checkboxes
720+
721+ hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
722 add_tag_checkbox(hbox, "seafaring", localize_tag("seafaring"));
723 add_tag_checkbox(hbox, "artifacts", localize_tag("artifacts"));
724 add_tag_checkbox(hbox, "scenario", localize_tag("scenario"));
725- checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
726-
727- hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
728- add_tag_checkbox(hbox, "ffa", localize_tag("ffa"));
729- add_tag_checkbox(hbox, "1v1", localize_tag("1v1"));
730- checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
731-
732- hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
733- add_tag_checkbox(hbox, "2teams", localize_tag("2teams"));
734- add_tag_checkbox(hbox, "3teams", localize_tag("3teams"));
735- add_tag_checkbox(hbox, "4teams", localize_tag("4teams"));
736+ hbox->add_inf_space();
737 checkboxes_.add(hbox, UI::Box::Resizing::kFullSize);
738
739 table_.focus();
740- fill_table();
741+ clear_filter();
742
743 // We don't need the unlocalizing option if there is nothing to unlocalize.
744 // We know this after the list is filled.
745 cb_dont_localize_mapnames_->set_visible(has_translated_mapname_);
746+
747+ cb_dont_localize_mapnames_->changedto.connect(
748+ boost::bind(&FullscreenMenuMapSelect::fill_table, boost::ref(*this)));
749+
750+ for (size_t i = 0; i < tags_checkboxes_.size(); ++i) {
751+ tags_checkboxes_.at(i)->changedto.connect(boost::bind(&FullscreenMenuMapSelect::tagbox_changed, this, i, _1));
752+ }
753+
754+ balancing_tags_dropdown_->selected.connect([this] { fill_table(); });
755+ official_tags_dropdown_->selected.connect([this] { fill_table(); });
756+ team_tags_dropdown_->selected.connect([this] { fill_table(); });
757+ show_all_maps_->sigclicked.connect([this] { clear_filter(); });
758+
759 layout();
760 }
761
762 void FullscreenMenuMapSelect::layout() {
763 title_.set_size(get_w(), title_.get_h());
764 FullscreenMenuLoadMapOrGame::layout();
765- checkboxes_y_ = tabley_ - 4 * (cb_show_all_maps_->get_h() + checkbox_padding_) - 2 * padding_;
766+ checkboxes_y_ = tabley_ - 3 * (team_tags_dropdown_->get_h() + checkbox_padding_) - 2 * padding_;
767 title_.set_pos(Vector2i(0, checkboxes_y_ / 3));
768 checkboxes_.set_pos(Vector2i(tablex_, checkboxes_y_));
769 checkboxes_.set_size(get_w() - 2 * tablex_, tabley_ - checkboxes_y_);
770@@ -222,6 +285,7 @@
771 */
772 void FullscreenMenuMapSelect::fill_table() {
773 has_translated_mapname_ = false;
774+ bool unspecified_balancing_found = false;
775
776 maps_data_.clear();
777
778@@ -272,9 +336,45 @@
779 has_translated_mapname_ || (mapdata.name != mapdata.localized_name);
780
781 bool has_all_tags = true;
782+ if (team_tags_dropdown_->has_selection()) {
783+ const std::string selected_tag = team_tags_dropdown_->get_selected();
784+ if (!selected_tag.empty()) {
785+ has_all_tags &= mapdata.tags.count(selected_tag);
786+ }
787+ }
788+ if (official_tags_dropdown_->has_selection()) {
789+ const std::string selected_tag = official_tags_dropdown_->get_selected();
790+ if (!selected_tag.empty()) {
791+ if (selected_tag == "official") {
792+ has_all_tags &= mapdata.tags.count("official");
793+ } else {
794+ has_all_tags &= !mapdata.tags.count("official");
795+ }
796+ }
797+ }
798+ if (balancing_tags_dropdown_->has_selection()) {
799+ const std::string selected_tag = balancing_tags_dropdown_->get_selected();
800+ if (!selected_tag.empty()) {
801+ if (selected_tag == "unspecified") {
802+ has_all_tags &= !mapdata.tags.count("balanced");
803+ has_all_tags &= !mapdata.tags.count("unbalanced");
804+ } else {
805+ has_all_tags &= mapdata.tags.count(selected_tag);
806+ }
807+ }
808+ }
809+ // Backwards compatibility
810+ if (!mapdata.tags.count("balanced") && !mapdata.tags.count("unbalanced")) {
811+ unspecified_balancing_found = true;
812+ } else if (mapdata.tags.count("balanced") && mapdata.tags.count("unbalanced")) {
813+ log("WARNING: Map '%s' is both balanced and unbalanced - please fix the 'elemental' packet\n", mapfilename.c_str());
814+ }
815+
816 for (std::set<uint32_t>::const_iterator it = req_tags_.begin(); it != req_tags_.end();
817- ++it)
818+ ++it) {
819 has_all_tags &= mapdata.tags.count(tags_ordered_[*it]);
820+ }
821+
822 if (!has_all_tags) {
823 continue;
824 }
825@@ -298,6 +398,10 @@
826 table_.select(0);
827 }
828 set_has_selection();
829+ if (unspecified_balancing_found != unspecified_balancing_found_) {
830+ unspecified_balancing_found_ = unspecified_balancing_found;
831+ rebuild_balancing_dropdown();
832+ }
833 }
834
835 /*
836@@ -305,11 +409,9 @@
837 */
838 UI::Checkbox*
839 FullscreenMenuMapSelect::add_tag_checkbox(UI::Box* box, std::string tag, std::string displ_name) {
840- int32_t id = tags_ordered_.size();
841 tags_ordered_.push_back(tag);
842
843 UI::Checkbox* cb = new UI::Checkbox(box, Vector2i::zero(), displ_name);
844- cb->changedto.connect(boost::bind(&FullscreenMenuMapSelect::tagbox_changed, this, id, _1));
845
846 box->add(cb, UI::Box::Resizing::kFullSize);
847 box->add_space(checkbox_space_);
848@@ -322,24 +424,39 @@
849 * One of the tagboxes has changed
850 */
851 void FullscreenMenuMapSelect::tagbox_changed(int32_t id, bool to) {
852- if (id == 0) { // Show all maps checbox
853- if (to) {
854- for (UI::Checkbox* checkbox : tags_checkboxes_) {
855- checkbox->set_state(false);
856- }
857- }
858- } else { // Any tag
859- if (to) {
860- req_tags_.insert(id);
861- } else {
862- req_tags_.erase(id);
863- }
864- }
865- if (req_tags_.empty()) {
866- cb_show_all_maps_->set_state(true);
867- } else {
868- cb_show_all_maps_->set_state(false);
869- }
870-
871- fill_table();
872+ if (to) {
873+ req_tags_.insert(id);
874+ } else {
875+ req_tags_.erase(id);
876+ }
877+
878+ fill_table();
879+}
880+
881+void FullscreenMenuMapSelect::clear_filter() {
882+ req_tags_.clear();
883+ for (UI::Checkbox* checkbox : tags_checkboxes_) {
884+ checkbox->set_state(false);
885+ }
886+
887+ balancing_tags_dropdown_->select("");
888+ official_tags_dropdown_->select("");
889+ team_tags_dropdown_->select("");
890+ fill_table();
891+}
892+
893+void FullscreenMenuMapSelect::rebuild_balancing_dropdown() {
894+ const std::string selected = balancing_tags_dropdown_->has_selection() ? balancing_tags_dropdown_->get_selected() : "";
895+ balancing_tags_dropdown_->clear();
896+ balancing_tags_dropdown_->add(_("Balanced & Unbalanced"), "");
897+ balancing_tags_dropdown_->add(localize_tag("balanced"), "balanced");
898+ balancing_tags_dropdown_->add(localize_tag("unbalanced"), "unbalanced");
899+ if (unspecified_balancing_found_) {
900+ // Backwards compatibility with old maps
901+ balancing_tags_dropdown_->add(pgettext("balancing", "Unspecified"), "unspecified");
902+ balancing_tags_dropdown_->select(selected);
903+ } else {
904+ balancing_tags_dropdown_->select(selected == "unspecified" ? "" : selected);
905+ fill_table();
906+ }
907 }
908
909=== modified file 'src/ui_fsmenu/mapselect.h'
910--- src/ui_fsmenu/mapselect.h 2019-02-23 11:00:49 +0000
911+++ src/ui_fsmenu/mapselect.h 2019-09-08 20:22:47 +0000
912@@ -25,6 +25,7 @@
913
914 #include "ui_basic/box.h"
915 #include "ui_basic/checkbox.h"
916+#include "ui_basic/dropdown.h"
917 #include "ui_basic/textarea.h"
918 #include "ui_fsmenu/base.h"
919 #include "ui_fsmenu/load_map_or_game.h"
920@@ -62,6 +63,8 @@
921 bool set_has_selection();
922 UI::Checkbox* add_tag_checkbox(UI::Box*, std::string, std::string);
923 void tagbox_changed(int32_t, bool);
924+ void clear_filter();
925+ void rebuild_balancing_dropdown();
926
927 int32_t const checkbox_space_;
928 const int checkbox_padding_;
929@@ -84,9 +87,16 @@
930 UI::Checkbox* cb_dont_localize_mapnames_;
931 bool has_translated_mapname_;
932
933- UI::Checkbox* cb_show_all_maps_;
934+ UI::Button* show_all_maps_;
935 std::vector<UI::Checkbox*> tags_checkboxes_;
936
937+ UI::Dropdown<std::string>* official_tags_dropdown_;
938+
939+ UI::Dropdown<std::string>* balancing_tags_dropdown_;
940+ bool unspecified_balancing_found_; // Backwards compatibility
941+
942+ UI::Dropdown<std::string>* team_tags_dropdown_;
943+
944 std::vector<std::string> tags_ordered_;
945 std::set<uint32_t> req_tags_;
946
947
948=== modified file 'src/wui/map_tags.cc'
949--- src/wui/map_tags.cc 2019-02-23 11:00:49 +0000
950+++ src/wui/map_tags.cc 2019-09-08 20:22:47 +0000
951@@ -27,6 +27,10 @@
952 /** TRANSLATORS: This is a map tag */
953 {"official", _("Official")},
954 /** TRANSLATORS: This is a map tag */
955+ {"unofficial", _("Unofficial")},
956+ /** TRANSLATORS: This is a map tag */
957+ {"balanced", _("Balanced")},
958+ /** TRANSLATORS: This is a map tag */
959 {"unbalanced", _("Unbalanced")},
960 /** TRANSLATORS: This is a map tag */
961 {"seafaring", _("Seafaring")},

Subscribers

People subscribed via source and target branches

to status/vote changes: