mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Tweaks for obstacles.
This commit is contained in:
parent
2ad89a29c4
commit
482051eb17
@ -907,7 +907,7 @@ void CBattleInterface::showObstacles(std::multimap<BattleHex, int> *hexToObstacl
|
||||
std::vector<Cimage> &images = idToObstacle[curOb.ID]->ourImages; //reference to animation of obstacle
|
||||
Rect r = hexPosition(hex);
|
||||
int offset = images.front().bitmap->h % 42;
|
||||
if(offset > 15) //experimental value, may need tweaking if some obstacles are shown too low/high
|
||||
if(offset > 7) //experimental value, may need tweaking if some obstacles are shown too low/high
|
||||
offset -= 42;
|
||||
|
||||
r.y += 42 - images.front().bitmap->h + offset;
|
||||
|
@ -1543,16 +1543,22 @@ struct RangeGenerator
|
||||
remaining.resize(remainingCount, true);
|
||||
}
|
||||
|
||||
int generateNumber()
|
||||
{
|
||||
if(!remainingCount)
|
||||
throw ExhaustedPossibilities();
|
||||
if(remainingCount == 1)
|
||||
return 0;
|
||||
return myRand() % remainingCount;
|
||||
}
|
||||
|
||||
//get number fulfilling predicate. Never gives the same number twice.
|
||||
int getSuchNumber(boost::function<bool(int)> goodNumberPred = 0)
|
||||
{
|
||||
int ret = -1;
|
||||
do
|
||||
{
|
||||
if(!remainingCount)
|
||||
throw ExhaustedPossibilities();
|
||||
|
||||
int n = myRand() % remainingCount;
|
||||
int n = generateNumber();
|
||||
int i = 0;
|
||||
for(;;i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user