mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Merged changes from upstream and fixed compilation caused by API changes
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
/*
|
||||
* mapHandler.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdInc.h"
|
||||
#include "mapHandler.h"
|
||||
|
||||
@@ -17,19 +27,7 @@
|
||||
#include "../lib/GameConstants.h"
|
||||
#include "../lib/CStopWatch.h"
|
||||
#include "CMT.h"
|
||||
|
||||
/*
|
||||
* mapHandler.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
const bool MARK_BLOCKED_POSITIONS = false;
|
||||
const bool MARK_VISITABLE_POSITIONS = false;
|
||||
#include "../lib/CRandomGenerator.h"
|
||||
|
||||
#define ADVOPT (conf.go()->ac)
|
||||
|
||||
@@ -129,7 +127,7 @@ void CMapHandler::prepareFOWDefs()
|
||||
elem[j].resize(sizes.z);
|
||||
for(int k = 0; k < sizes.z; ++k)
|
||||
{
|
||||
elem[j][k] = rand()%graphics->FoWfullHide->ourImages.size();
|
||||
elem[j][k] = CRandomGenerator::getDefault().nextInt(graphics->FoWfullHide->ourImages.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,6 +197,8 @@ void CMapHandler::borderAndTerrainBitmapInit()
|
||||
{
|
||||
int terBitmapNum = -1;
|
||||
|
||||
auto & rand = CRandomGenerator::getDefault();
|
||||
|
||||
if(i==-1 && j==-1)
|
||||
terBitmapNum = 16;
|
||||
else if(i==-1 && j==(sizes.y))
|
||||
@@ -208,15 +208,15 @@ void CMapHandler::borderAndTerrainBitmapInit()
|
||||
else if(i==(sizes.x) && j==(sizes.y))
|
||||
terBitmapNum = 18;
|
||||
else if(j == -1 && i > -1 && i < sizes.y)
|
||||
terBitmapNum = 22+rand()%2;
|
||||
terBitmapNum = rand.nextInt(22, 23);
|
||||
else if(i == -1 && j > -1 && j < sizes.y)
|
||||
terBitmapNum = 33+rand()%2;
|
||||
terBitmapNum = rand.nextInt(33, 34);
|
||||
else if(j == sizes.y && i >-1 && i < sizes.x)
|
||||
terBitmapNum = 29+rand()%2;
|
||||
terBitmapNum = rand.nextInt(29, 30);
|
||||
else if(i == sizes.x && j > -1 && j < sizes.y)
|
||||
terBitmapNum = 25+rand()%2;
|
||||
terBitmapNum = rand.nextInt(25, 26);
|
||||
else
|
||||
terBitmapNum = rand()%16;
|
||||
terBitmapNum = rand.nextInt(15);
|
||||
|
||||
if(terBitmapNum != -1)
|
||||
{
|
||||
@@ -1083,7 +1083,7 @@ ui8 CMapHandler::getPhaseShift(const CGObjectInstance *object) const
|
||||
auto i = animationPhase.find(object);
|
||||
if(i == animationPhase.end())
|
||||
{
|
||||
ui8 ret = rand() % 255;
|
||||
ui8 ret = CRandomGenerator::getDefault().nextInt(254);
|
||||
animationPhase[object] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user