1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge branch 'develop' of https://github.com/vcmi/vcmi into test/advMapFading

Conflicts:
	client/CPlayerInterface.cpp
This commit is contained in:
Fay 2015-02-09 16:09:27 +01:00
commit cbd3a19987
11 changed files with 73 additions and 36 deletions

View File

@ -727,10 +727,10 @@ SDL_Rect CMapHandler::CMapWorldViewBlitter::clip(SDL_Surface * targetSurf) const
SDL_FillRect(targetSurf, info->drawBounds, SDL_MapRGB(targetSurf->format, 0, 0, 0));
// makes the clip area smaller if the map is smaller than the screen frame
// (actually, it could be made 1 tile bigger so that overlay icons on edge tiles could be drawn partly outside)
Rect clipRect(std::max(info->drawBounds->x, info->drawBounds->x - topTile.x * tileSize),
std::max(info->drawBounds->y, info->drawBounds->y - topTile.y * tileSize),
std::min(info->drawBounds->w, parent->sizes.x * tileSize),
std::min(info->drawBounds->h, parent->sizes.y * tileSize));
Rect clipRect(std::max<int>(info->drawBounds->x, info->drawBounds->x - topTile.x * tileSize),
std::max<int>(info->drawBounds->y, info->drawBounds->y - topTile.y * tileSize),
std::min<int>(info->drawBounds->w, parent->sizes.x * tileSize),
std::min<int>(info->drawBounds->h, parent->sizes.y * tileSize));
SDL_GetClipRect(targetSurf, &prevClip);
SDL_SetClipRect(targetSurf, &clipRect); //preventing blitting outside of that rect
return prevClip;

View File

@ -612,8 +612,8 @@ void CMinimap::showAll(SDL_Surface * to)
if (adventureInt->mode == EAdvMapMode::WORLD_VIEW)
{
// adjusts radar so that it doesn't go out of map in world view mode (since there's no frame)
radar.x = std::min(std::max(pos.x, radar.x), pos.x + pos.w - radar.w);
radar.y = std::min(std::max(pos.y, radar.y), pos.y + pos.h - radar.h);
radar.x = std::min<int>(std::max(pos.x, radar.x), pos.x + pos.w - radar.w);
radar.y = std::min<int>(std::max(pos.y, radar.y), pos.y + pos.h - radar.h);
if (radar.x < pos.x && radar.y < pos.y)
return; // whole map is visible at once, no point in redrawing border

View File

@ -110,6 +110,9 @@
"offensive": true,
"negative": true
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"immunity" : {
"DIRECT_DAMAGE_IMMUNITY": true
}
@ -258,10 +261,10 @@
"negative": true
},
"absoluteImmunity":{
"SIEGE_WEAPON": true,
"UNDEAD": true,
},
"immunity" : {
"SIEGE_WEAPON": true,
"DIRECT_DAMAGE_IMMUNITY": true
}
},

View File

@ -226,7 +226,7 @@
"targetModifier":{"smart":true}
}
},
"immunity" : {
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
@ -262,7 +262,7 @@
"targetModifier":{"smart":true}
}
},
"immunity" : {
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {

View File

@ -352,6 +352,7 @@
"spell.bless": true
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true,
"UNDEAD": true
},
"flags" : {
@ -401,6 +402,9 @@
"counters" : {
"spell.weakness": true
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
"positive": true
}
@ -695,6 +699,7 @@
"spell.sorrow":true
},
"absoluteImmunity":{
"SIEGE_WEAPON": true,
"UNDEAD": true,
},
"immunity" : {
@ -747,6 +752,7 @@
"spell.mirth":true
},
"absoluteImmunity":{
"SIEGE_WEAPON": true,
"UNDEAD": true,
},
"immunity" : {
@ -889,7 +895,7 @@
"counters" : {
"spell.slow": true
},
"immunity" : {
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
@ -940,7 +946,7 @@
"counters" : {
"spell.haste":true
},
"immunity" : {
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
@ -1038,6 +1044,9 @@
}
}
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
"positive": true
}
@ -1081,6 +1090,9 @@
}
}
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"flags" : {
"positive": true
}
@ -1137,7 +1149,9 @@
}
}
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"immunity" : {
"MIND_IMMUNITY": true,
"UNDEAD": true,
@ -1197,7 +1211,9 @@
}
}
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"immunity" : {
"MIND_IMMUNITY": true,
"UNDEAD": true,
@ -1261,6 +1277,9 @@
"absoluteLimit" : {
"SHOOTER": true
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"immunity" : {
"MIND_IMMUNITY": true,
"UNDEAD": true,
@ -1309,7 +1328,9 @@
}
}
},
"absoluteImmunity" : {
"SIEGE_WEAPON": true
},
"immunity" : {
"MIND_IMMUNITY": true,
"UNDEAD": true,

View File

@ -992,7 +992,9 @@ void DeathStareMechnics::applyBattleEffects(const SpellCastEnvironment * env, Ba
{
//calculating dmg to display
ctx.sc.dmgToDisplay = parameters.usedSpellPower;
vstd::amin(ctx.sc.dmgToDisplay, (*ctx.attackedCres.begin())->count); //stack is already reduced after attack
if(!ctx.attackedCres.empty())
vstd::amin(ctx.sc.dmgToDisplay, (*ctx.attackedCres.begin())->count); //stack is already reduced after attack
for(auto & attackedCre : ctx.attackedCres)
{

View File

@ -103,7 +103,7 @@ CCompressedStream::CCompressedStream(std::unique_ptr<CInputStream> stream, bool
CCompressedStream::~CCompressedStream()
{
inflateEnd(inflateState);
//delete inflateState;
delete inflateState;
}
si64 CCompressedStream::readMore(ui8 *data, si64 size)

View File

@ -33,16 +33,18 @@ ResourceID::ResourceID()
}
ResourceID::ResourceID(std::string name)
:type(EResType::UNDEFINED)
{
CFileInfo info(std::move(name));
setName(info.getStem());
setType(info.getType());
setName(info.getStem());
}
ResourceID::ResourceID(std::string name, EResType::Type type)
:type(EResType::UNDEFINED)
{
setName(std::move(name));
setType(type);
setName(std::move(name));
}
std::string ResourceID::getName() const
@ -57,12 +59,18 @@ EResType::Type ResourceID::getType() const
void ResourceID::setName(std::string name)
{
// setName shouldn't be used if type is UNDEFINED
assert(type != EResType::UNDEFINED);
this->name = std::move(name);
size_t dotPos = this->name.find_last_of("/.");
if(dotPos != std::string::npos && this->name[dotPos] == '.')
if(dotPos != std::string::npos && this->name[dotPos] == '.'
&& this->type == EResTypeHelper::getTypeFromExtension(this->name.substr(dotPos)))
{
this->name.erase(dotPos);
}
#ifdef ENABLE_TRIVIAL_TOUPPER
toUpper(this->name);

View File

@ -56,7 +56,8 @@ namespace EResType
ERM,
ERT,
ERS,
OTHER
OTHER,
UNDEFINED
};
}

View File

@ -1,6 +1,21 @@
#include "StdInc.h"
#include "ERMParser.h"
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
namespace qi = boost::spirit::qi;
namespace ascii = spirit::ascii;
namespace phoenix = boost::phoenix;
/*
* ERMParser.cpp, part of VCMI engine
*

View File

@ -1,20 +1,4 @@
#pragma once
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
namespace spirit = boost::spirit;
namespace qi = boost::spirit::qi;
namespace ascii = spirit::ascii;
namespace phoenix = boost::phoenix;
/*
* ERMParser.h, part of VCMI engine
*
@ -24,7 +8,10 @@ namespace phoenix = boost::phoenix;
* Full text of license available in license.txt file, in main folder
*
*/
#include <boost/spirit/home/support/unused.hpp>
namespace spirit = boost::spirit;
class CERMPreprocessor
{