Fixed compilation with latest mingw64

This commit is contained in:
xawotihs
2025-04-25 18:48:02 +02:00
parent 7c9fd90903
commit 0023c4a086
11 changed files with 30 additions and 15 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
#include "limits.h"
#if defined (_DEBUG) && defined (WIN32) && (!defined LINUX)
#if defined (_DEBUG) && defined (WIN32) && (!defined LINUX) && (!defined __GNUG__)
#include "crtdbg.h"
#define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#else
+1 -1
View File
@@ -91,7 +91,7 @@ void GameApp::Create()
{
srand((unsigned int) time(0)); // initialize random
#if !defined(QT_CONFIG) && !defined(IOS)
#if defined (WIN32)
#if defined (WIN32) && (!defined __GNUG__)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#elif defined (PSP)
pspFpuSetEnable(0); //disable FPU Exceptions until we find where the FPU errors come from
+9 -4
View File
@@ -16,6 +16,8 @@
#include "ModRules.h"
#include "GameApp.h"
#include <random>
#ifdef TESTSUITE
#include "TestSuiteAI.h"
#endif
@@ -2258,7 +2260,10 @@ std::string Tournament::exportTournamentDescription()
}
void Tournament::enableTournamantMode(int tournamentMode,int player)
{
{
std::random_device rd;
std::mt19937 g(rd());
if (mTournamentMode!=tournamentMode && tournamentMode>0)
{
@@ -2302,9 +2307,9 @@ void Tournament::enableTournamantMode(int tournamentMode,int player)
//shuffle remaining decks
// human player is always on first place
if (player>0)
std::random_shuffle ( TournamentsDecks.begin()+1, TournamentsDecks.end() );
std::shuffle ( TournamentsDecks.begin()+1, TournamentsDecks.end(), g );
else
std::random_shuffle ( TournamentsDecks.begin(), TournamentsDecks.end() );
std::shuffle ( TournamentsDecks.begin(), TournamentsDecks.end(), g );
Deck[0]=TournamentsDecks[0];
Deck[1]=TournamentsDecks[1];
}
@@ -2322,7 +2327,7 @@ void Tournament::enableTournamantMode(int tournamentMode,int player)
for (unsigned int i=0;i<nmbDecks;i++)
TournamentsDecks.push_back(TDeck(i+1,PLAYER_TYPE_CPU));
//shuffle remaining decks
std::random_shuffle ( TournamentsDecks.begin(), TournamentsDecks.end() );
std::shuffle ( TournamentsDecks.begin(), TournamentsDecks.end(), g );
Deck[0]=TournamentsDecks[0];
Deck[1]=TournamentsDecks[1];
}
+6 -1
View File
@@ -10,6 +10,7 @@
#include "DeckDataWrapper.h"
#include "MTGPack.h"
#include "tinyxml.h"
#include <random>
MTGPack MTGPacks::defaultBooster;
@@ -47,9 +48,13 @@ int MTGPackSlot::add(WSrcCards * ocean, MTGDeck *to, int carryover)
if (!myPool)
myPool = ocean;
std::random_device rd;
std::mt19937 g(rd());
for (int i = 0; i < amt; i++)
{
std::random_shuffle(entries.begin(), entries.end());
//std::random_shuffle(entries.begin(), entries.end());
std::shuffle(entries.begin(), entries.end(), g);
size_t pos = 0;
while (pos < entries.size() && entries[pos]->addCard(myPool, to))
pos++;