Closed Raptor007 closed 3 years ago
The problem is that it doesn't choose the random map until the current map ends. What nextmap
shows is the next map in sequential rotation. To fix this, it'll need to select the random map in advance.
Also, should remove the srand(rand());
on every map change, and start the game with a single srand(time(NULL));
instead.
https://www.geeksforgeeks.org/rand-and-srand-in-ccpp/
I think the cleanest way is to choose a random number from 1 to num_maps - 1
when it starts playing a new map, and then nextmap
and EndDMLevel
will advance that many if rrot
is enabled. This will also provide a safer mechanism to avoid playing the same map twice than the current strategy of check and re-roll.
The
nextmap
command returns the wrong map name withrrot 1
(random map rotation). This might have gotten broken when I sorted the votemap list alphabetically, or it might have been broken before that.