Skip to content

Commit 11e2b26

Browse files
committed
Initial implementation of cyclic map queue [big description]
Inside there are many things, including: - added server config option cyclic-tracks-queue - both queue options in the config allow filters enclosed in {} now - in parallel to /queue commands, added /qcyclic and /qboth to manipulate only cyclic queue and both queues at the same time - queue commands are completely rewritten - /queue pf commands (for filters) are united with /queue push (for single maps) by making everything a filter - the above also includes slight changes to hasTypo and TrackFilter so that parts of arguments could also be checked for typos and fixed interactively (maybe it's slightly dirty because the code around hasTypo call has to do some stuff too, but I cannot think where else I could need it) - pushing only to regular queue (no matter from which end) triggers pushing a placeholder into the FRONT (!) of cyclic queue so that first the regular queue is executed. Popping works the same way, and as placeholders should be only at the front (even though you can theoretically push one to the end), shuffling the cyclic queue also only affects non-placeholders. - fixed a bug where splitQuoted produced one empty item for an empty string - running a command now updates last activity, so you won't be kicked for being idle - some auxiliary stuff is added to CommandManager so that corresponding queues for karts could be easily integrated later (and also functions for simultaneous addition to several queues, no idea how to push the same thing as a map and as a kart but I'll see) - NETWORKING.md, data/commands.xml and server_config.hpp are updated ofc
1 parent b8d6300 commit 11e2b26

10 files changed

+543
-141
lines changed

NETWORKING.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,12 @@ The current server configuration xml looks like this (this is only an example, j
261261
<!-- If true and no track is selected, then an addon track can be picked. -->
262262
<random-selects-addons value="false" />
263263

264-
<!-- If non-empty, these tracks are played in the order until the list ends. Can be useful for grands prix. -->
264+
<!-- If non-empty, these tracks (or track filters if enclosed in curly braces) are played in the order until the list ends. -->
265265
<tracks-queue value="" />
266266

267+
<!-- If non-empty, these tracks (or track filters if enclosed in curly braces) are played in the order cyclically, except if something is in the regular tracks queue. -->
268+
<cyclic-tracks-queue value="" />
269+
267270
<!-- A custom Grand Prix scoring system to be used, empty for default. -->
268271
<grand-prix-scoring value="" />
269272

data/commands.xml

+127-22
Original file line numberDiff line numberDiff line change
@@ -245,84 +245,189 @@ here later. For now, please refer to the code for the strings being used. -->
245245
<command name="queue"
246246
usage="/queue"
247247
permissions-verbose="everyone"
248-
description="Contains functions related to track queue. Without arguments, shows the current queue. Arguments can be used only with permissions, check /commands queue and /help queue (argument) for more details."
248+
description="Contains functions related to track queue (regular one). Without arguments, shows the current queue. Arguments can be used only with permissions, check /commands queue and /help queue (argument) for more details."
249249
permissions="UP_EVERYONE"
250250
state-scope="SS_ALWAYS"
251251
>
252252
<command name="push"
253253
usage="/queue push (item)"
254254
permissions-verbose="hammers, singleplayers"
255-
description="Pushes an item (usually the map id) to the back of the track queue."
255+
description="Pushes an item (map id or filter) to the back of the track queue."
256256
permissions="UP_SINGLE"
257257
state-scope="SS_LOBBY"
258258
/>
259259
<command name="push_back"
260260
usage="/queue push_back (item)"
261261
permissions-verbose="hammers, singleplayers"
262-
description="Pushes an item (usually the map id) to the back of the track queue."
262+
description="Pushes an item (map id or filter) to the back of the track queue."
263263
permissions="UP_SINGLE"
264264
state-scope="SS_LOBBY"
265265
/>
266266
<command name="push_front"
267267
usage="/queue push_front (item)"
268268
permissions-verbose="hammers, singleplayers"
269-
description="Pushes an item (usually the map id) to the front of the track queue."
269+
description="Pushes an item (map id or filter) to the front of the track queue."
270270
permissions="UP_SINGLE"
271271
state-scope="SS_LOBBY"
272272
/>
273-
<!-- pf commands are temporary -->
274-
<command name="pf"
275-
usage="/queue pf (filter)"
273+
<command name="pop"
274+
usage="/queue pop"
276275
permissions-verbose="hammers, singleplayers"
277-
description="Pushes a track filter to the back of the track queue. The command will be removed once it's united with push."
276+
description="Pops an item from the front of the track queue."
278277
permissions="UP_SINGLE"
279278
state-scope="SS_LOBBY"
280279
/>
281-
<command name="pf_back"
282-
usage="/queue pf_back (filter)"
280+
<command name="pop_back"
281+
usage="/queue pop_back"
283282
permissions-verbose="hammers, singleplayers"
284-
description="Pushes a track filter to the back of the track queue. The command will be removed once it's united with push_back."
283+
description="Pops an item from the back of the track queue."
285284
permissions="UP_SINGLE"
286285
state-scope="SS_LOBBY"
287286
/>
288-
<command name="pf_front"
289-
usage="/queue pf_front (filter)"
287+
<command name="pop_front"
288+
usage="/queue pop_front"
290289
permissions-verbose="hammers, singleplayers"
291-
description="Pushes a track filter to the front of the track queue. The command will be removed once it's united with push_front."
290+
description="Pops an item from the front of the track queue."
291+
permissions="UP_SINGLE"
292+
state-scope="SS_LOBBY"
293+
/>
294+
<command name="clear"
295+
usage="/queue clear"
296+
permissions-verbose="hammers, singleplayers"
297+
description="Clears the track queue."
298+
permissions="UP_SINGLE"
299+
state-scope="SS_LOBBY"
300+
/>
301+
<command name="shuffle"
302+
usage="/queue shuffle"
303+
permissions-verbose="hammers, singleplayers"
304+
description="Shuffles the track queue."
305+
permissions="UP_SINGLE"
306+
state-scope="SS_LOBBY"
307+
/>
308+
</command>
309+
<command name="qcyclic"
310+
usage="/qcyclic"
311+
permissions-verbose="everyone"
312+
description="Contains functions related to track queue (cyclic one). Without arguments, shows the current queue. Arguments can be used only with permissions, check /commands queue and /help queue (argument) for more details."
313+
permissions="UP_EVERYONE"
314+
state-scope="SS_ALWAYS"
315+
>
316+
<command name="push"
317+
usage="/qcyclic push (item)"
318+
permissions-verbose="hammers, singleplayers"
319+
description="Pushes an item (map id or filter) to the back of the track queue."
320+
permissions="UP_SINGLE"
321+
state-scope="SS_LOBBY"
322+
/>
323+
<command name="push_back"
324+
usage="/qcyclic push_back (item)"
325+
permissions-verbose="hammers, singleplayers"
326+
description="Pushes an item (map id or filter) to the back of the track queue."
327+
permissions="UP_SINGLE"
328+
state-scope="SS_LOBBY"
329+
/>
330+
<command name="push_front"
331+
usage="/qcyclic push_front (item)"
332+
permissions-verbose="hammers, singleplayers"
333+
description="Pushes an item (map id or filter) to the front of the track queue."
292334
permissions="UP_SINGLE"
293335
state-scope="SS_LOBBY"
294336
/>
295-
<!-- end of pf commands -->
296337
<command name="pop"
297-
usage="/queue pop"
338+
usage="/qcyclic pop"
298339
permissions-verbose="hammers, singleplayers"
299340
description="Pops an item from the front of the track queue."
300341
permissions="UP_SINGLE"
301342
state-scope="SS_LOBBY"
302343
/>
303344
<command name="pop_back"
304-
usage="/queue pop_back"
345+
usage="/qcyclic pop_back"
305346
permissions-verbose="hammers, singleplayers"
306347
description="Pops an item from the back of the track queue."
307348
permissions="UP_SINGLE"
308349
state-scope="SS_LOBBY"
309350
/>
310351
<command name="pop_front"
311-
usage="/queue pop_front"
352+
usage="/qcyclic pop_front"
312353
permissions-verbose="hammers, singleplayers"
313354
description="Pops an item from the front of the track queue."
314355
permissions="UP_SINGLE"
315356
state-scope="SS_LOBBY"
316357
/>
317358
<command name="clear"
318-
usage="/queue clear"
359+
usage="/qcyclic clear"
319360
permissions-verbose="hammers, singleplayers"
320361
description="Clears the track queue."
321362
permissions="UP_SINGLE"
322363
state-scope="SS_LOBBY"
323364
/>
324365
<command name="shuffle"
325-
usage="/queue shuffle"
366+
usage="/qcyclic shuffle"
367+
permissions-verbose="hammers, singleplayers"
368+
description="Shuffles the track queue."
369+
permissions="UP_SINGLE"
370+
state-scope="SS_LOBBY"
371+
/>
372+
</command>
373+
<command name="qboth"
374+
usage="/qboth"
375+
permissions-verbose="everyone"
376+
description="Contains functions related to track queue (both regular and cyclic). Without arguments, shows the current queue. Arguments can be used only with permissions, check /commands queue and /help queue (argument) for more details."
377+
permissions="UP_EVERYONE"
378+
state-scope="SS_ALWAYS"
379+
>
380+
<command name="push"
381+
usage="/qboth push (item)"
382+
permissions-verbose="hammers, singleplayers"
383+
description="Pushes an item (map id or filter) to the back of the track queue."
384+
permissions="UP_SINGLE"
385+
state-scope="SS_LOBBY"
386+
/>
387+
<command name="push_back"
388+
usage="/qboth push_back (item)"
389+
permissions-verbose="hammers, singleplayers"
390+
description="Pushes an item (map id or filter) to the back of the track queue."
391+
permissions="UP_SINGLE"
392+
state-scope="SS_LOBBY"
393+
/>
394+
<command name="push_front"
395+
usage="/qboth push_front (item)"
396+
permissions-verbose="hammers, singleplayers"
397+
description="Pushes an item (map id or filter) to the front of the track queue."
398+
permissions="UP_SINGLE"
399+
state-scope="SS_LOBBY"
400+
/>
401+
<command name="pop"
402+
usage="/qboth pop"
403+
permissions-verbose="hammers, singleplayers"
404+
description="Pops an item from the front of the track queue."
405+
permissions="UP_SINGLE"
406+
state-scope="SS_LOBBY"
407+
/>
408+
<command name="pop_back"
409+
usage="/qboth pop_back"
410+
permissions-verbose="hammers, singleplayers"
411+
description="Pops an item from the back of the track queue."
412+
permissions="UP_SINGLE"
413+
state-scope="SS_LOBBY"
414+
/>
415+
<command name="pop_front"
416+
usage="/qboth pop_front"
417+
permissions-verbose="hammers, singleplayers"
418+
description="Pops an item from the front of the track queue."
419+
permissions="UP_SINGLE"
420+
state-scope="SS_LOBBY"
421+
/>
422+
<command name="clear"
423+
usage="/qboth clear"
424+
permissions-verbose="hammers, singleplayers"
425+
description="Clears the track queue."
426+
permissions="UP_SINGLE"
427+
state-scope="SS_LOBBY"
428+
/>
429+
<command name="shuffle"
430+
usage="/qboth shuffle"
326431
permissions-verbose="hammers, singleplayers"
327432
description="Shuffles the track queue."
328433
permissions="UP_SINGLE"
@@ -653,11 +758,11 @@ here later. For now, please refer to the code for the strings being used. -->
653758
<command name="preserve"
654759
usage="/preserve"
655760
permissions-verbose="everyone"
656-
description="Shows which settings are preserved when all players leave. Possible settings: mode, elim, laps, queue, replay, direction."
761+
description="Shows which settings are preserved when all players leave. Possible settings: mode, elim, laps, queue, qcyclic, replay, direction."
657762
permissions="UP_EVERYONE"
658763
>
659764
<command name="="
660-
usage="/preserve (mode|elim|laps|queue|replay|direction) (0|1)"
765+
usage="/preserve (mode|elim|laps|queue|qcyclic|replay|direction) (0|1)"
661766
omit-name="true"
662767
permissions-verbose="hammers"
663768
description="Changes whether the specified setting is preserved (if 1; or reset if 0) when all players quit."

0 commit comments

Comments
 (0)