mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/vcmi/vcmi into test/advMapFading
Conflicts: client/CPlayerInterface.cpp
This commit is contained in:
		| @@ -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)); | 	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 | 	// 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) | 	// (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), | 	Rect clipRect(std::max<int>(info->drawBounds->x, info->drawBounds->x - topTile.x * tileSize), | ||||||
| 				  std::max(info->drawBounds->y, info->drawBounds->y - topTile.y * tileSize), | 				  std::max<int>(info->drawBounds->y, info->drawBounds->y - topTile.y * tileSize), | ||||||
| 				  std::min(info->drawBounds->w, parent->sizes.x * tileSize), | 				  std::min<int>(info->drawBounds->w, parent->sizes.x * tileSize), | ||||||
| 				  std::min(info->drawBounds->h, parent->sizes.y * tileSize)); | 				  std::min<int>(info->drawBounds->h, parent->sizes.y * tileSize)); | ||||||
| 	SDL_GetClipRect(targetSurf, &prevClip); | 	SDL_GetClipRect(targetSurf, &prevClip); | ||||||
| 	SDL_SetClipRect(targetSurf, &clipRect); //preventing blitting outside of that rect | 	SDL_SetClipRect(targetSurf, &clipRect); //preventing blitting outside of that rect | ||||||
| 	return prevClip; | 	return prevClip; | ||||||
|   | |||||||
| @@ -612,8 +612,8 @@ void CMinimap::showAll(SDL_Surface * to) | |||||||
| 		if (adventureInt->mode == EAdvMapMode::WORLD_VIEW) | 		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) | 			// 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.x = std::min<int>(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.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) | 			if (radar.x < pos.x && radar.y < pos.y) | ||||||
| 				return; // whole map is visible at once, no point in redrawing border | 				return; // whole map is visible at once, no point in redrawing border | ||||||
|   | |||||||
| @@ -110,6 +110,9 @@ | |||||||
| 			"offensive": true, | 			"offensive": true, | ||||||
| 			"negative": true | 			"negative": true | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"DIRECT_DAMAGE_IMMUNITY": true | 			"DIRECT_DAMAGE_IMMUNITY": true | ||||||
| 		} | 		} | ||||||
| @@ -258,10 +261,10 @@ | |||||||
| 			"negative": true | 			"negative": true | ||||||
| 		}, | 		}, | ||||||
| 		"absoluteImmunity":{ | 		"absoluteImmunity":{ | ||||||
|  | 			"SIEGE_WEAPON": true, | ||||||
| 			"UNDEAD": true, | 			"UNDEAD": true, | ||||||
| 		},		 | 		},		 | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"SIEGE_WEAPON": true,			 |  | ||||||
| 			"DIRECT_DAMAGE_IMMUNITY": true | 			"DIRECT_DAMAGE_IMMUNITY": true | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
| @@ -226,7 +226,7 @@ | |||||||
| 				"targetModifier":{"smart":true} | 				"targetModifier":{"smart":true} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"absoluteImmunity" : { | ||||||
| 			"SIEGE_WEAPON": true | 			"SIEGE_WEAPON": true | ||||||
| 		}, | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| @@ -262,7 +262,7 @@ | |||||||
| 				"targetModifier":{"smart":true} | 				"targetModifier":{"smart":true} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"absoluteImmunity" : { | ||||||
| 			"SIEGE_WEAPON": true | 			"SIEGE_WEAPON": true | ||||||
| 		}, | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
|   | |||||||
| @@ -352,6 +352,7 @@ | |||||||
| 			"spell.bless": true | 			"spell.bless": true | ||||||
| 		}, | 		}, | ||||||
| 		"absoluteImmunity" : { | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true, | ||||||
| 			"UNDEAD": true | 			"UNDEAD": true | ||||||
| 		}, | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| @@ -401,6 +402,9 @@ | |||||||
| 		"counters" : { | 		"counters" : { | ||||||
| 			"spell.weakness": true | 			"spell.weakness": true | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| 			"positive": true | 			"positive": true | ||||||
| 		} | 		} | ||||||
| @@ -695,6 +699,7 @@ | |||||||
| 			"spell.sorrow":true | 			"spell.sorrow":true | ||||||
| 		}, | 		}, | ||||||
| 		"absoluteImmunity":{ | 		"absoluteImmunity":{ | ||||||
|  | 			"SIEGE_WEAPON": true, | ||||||
| 			"UNDEAD": true,		 | 			"UNDEAD": true,		 | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| @@ -747,6 +752,7 @@ | |||||||
| 			"spell.mirth":true | 			"spell.mirth":true | ||||||
| 		}, | 		}, | ||||||
| 		"absoluteImmunity":{ | 		"absoluteImmunity":{ | ||||||
|  | 			"SIEGE_WEAPON": true, | ||||||
| 			"UNDEAD": true,		 | 			"UNDEAD": true,		 | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| @@ -889,7 +895,7 @@ | |||||||
| 		"counters" : { | 		"counters" : { | ||||||
| 			"spell.slow": true | 			"spell.slow": true | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"absoluteImmunity" : { | ||||||
| 			"SIEGE_WEAPON": true | 			"SIEGE_WEAPON": true | ||||||
| 		}, | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| @@ -940,7 +946,7 @@ | |||||||
| 		"counters" : { | 		"counters" : { | ||||||
| 			"spell.haste":true | 			"spell.haste":true | ||||||
| 		}, | 		}, | ||||||
| 		"immunity" : { | 		"absoluteImmunity" : { | ||||||
| 			"SIEGE_WEAPON": true | 			"SIEGE_WEAPON": true | ||||||
| 		}, | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| @@ -1038,6 +1044,9 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| 			"positive": true | 			"positive": true | ||||||
| 		} | 		} | ||||||
| @@ -1081,6 +1090,9 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"flags" : { | 		"flags" : { | ||||||
| 			"positive": true | 			"positive": true | ||||||
| 		} | 		} | ||||||
| @@ -1137,7 +1149,9 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"MIND_IMMUNITY": true, | 			"MIND_IMMUNITY": true, | ||||||
| 			"UNDEAD": true, | 			"UNDEAD": true, | ||||||
| @@ -1197,7 +1211,9 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"MIND_IMMUNITY": true, | 			"MIND_IMMUNITY": true, | ||||||
| 			"UNDEAD": true, | 			"UNDEAD": true, | ||||||
| @@ -1261,6 +1277,9 @@ | |||||||
| 		"absoluteLimit" : { | 		"absoluteLimit" : { | ||||||
| 			"SHOOTER": true | 			"SHOOTER": true | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"MIND_IMMUNITY": true, | 			"MIND_IMMUNITY": true, | ||||||
| 			"UNDEAD": true, | 			"UNDEAD": true, | ||||||
| @@ -1309,7 +1328,9 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"absoluteImmunity" : { | ||||||
|  | 			"SIEGE_WEAPON": true | ||||||
|  | 		}, | ||||||
| 		"immunity" : { | 		"immunity" : { | ||||||
| 			"MIND_IMMUNITY": true, | 			"MIND_IMMUNITY": true, | ||||||
| 			"UNDEAD": true, | 			"UNDEAD": true, | ||||||
|   | |||||||
| @@ -992,7 +992,9 @@ void DeathStareMechnics::applyBattleEffects(const SpellCastEnvironment * env, Ba | |||||||
| { | { | ||||||
| 	//calculating dmg to display | 	//calculating dmg to display | ||||||
| 	ctx.sc.dmgToDisplay = parameters.usedSpellPower; | 	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) | 	for(auto & attackedCre : ctx.attackedCres) | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -103,7 +103,7 @@ CCompressedStream::CCompressedStream(std::unique_ptr<CInputStream> stream, bool | |||||||
| CCompressedStream::~CCompressedStream() | CCompressedStream::~CCompressedStream() | ||||||
| { | { | ||||||
| 	inflateEnd(inflateState); | 	inflateEnd(inflateState); | ||||||
| 	//delete inflateState; | 	delete inflateState; | ||||||
| } | } | ||||||
|  |  | ||||||
| si64 CCompressedStream::readMore(ui8 *data, si64 size) | si64 CCompressedStream::readMore(ui8 *data, si64 size) | ||||||
|   | |||||||
| @@ -33,16 +33,18 @@ ResourceID::ResourceID() | |||||||
| } | } | ||||||
|  |  | ||||||
| ResourceID::ResourceID(std::string name) | ResourceID::ResourceID(std::string name) | ||||||
|  | 	:type(EResType::UNDEFINED) | ||||||
| { | { | ||||||
| 	CFileInfo info(std::move(name)); | 	CFileInfo info(std::move(name)); | ||||||
| 	setName(info.getStem()); |  | ||||||
| 	setType(info.getType()); | 	setType(info.getType()); | ||||||
|  | 	setName(info.getStem()); | ||||||
| } | } | ||||||
|  |  | ||||||
| ResourceID::ResourceID(std::string name, EResType::Type type) | ResourceID::ResourceID(std::string name, EResType::Type type) | ||||||
|  | 	:type(EResType::UNDEFINED) | ||||||
| { | { | ||||||
| 	setName(std::move(name)); |  | ||||||
| 	setType(type); | 	setType(type); | ||||||
|  | 	setName(std::move(name)); | ||||||
| } | } | ||||||
|  |  | ||||||
| std::string ResourceID::getName() const | std::string ResourceID::getName() const | ||||||
| @@ -57,12 +59,18 @@ EResType::Type ResourceID::getType() const | |||||||
|  |  | ||||||
| void ResourceID::setName(std::string name) | void ResourceID::setName(std::string name) | ||||||
| { | { | ||||||
|  | 	// setName shouldn't be used if type is UNDEFINED | ||||||
|  | 	assert(type != EResType::UNDEFINED); | ||||||
|  |  | ||||||
| 	this->name = std::move(name); | 	this->name = std::move(name); | ||||||
|  |  | ||||||
| 	size_t dotPos = this->name.find_last_of("/."); | 	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); | 		this->name.erase(dotPos); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| #ifdef ENABLE_TRIVIAL_TOUPPER | #ifdef ENABLE_TRIVIAL_TOUPPER | ||||||
| 	toUpper(this->name); | 	toUpper(this->name); | ||||||
|   | |||||||
| @@ -56,7 +56,8 @@ namespace EResType | |||||||
| 		ERM, | 		ERM, | ||||||
| 		ERT, | 		ERT, | ||||||
| 		ERS, | 		ERS, | ||||||
| 		OTHER | 		OTHER, | ||||||
|  | 		UNDEFINED | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,21 @@ | |||||||
| #include "StdInc.h" | #include "StdInc.h" | ||||||
| #include "ERMParser.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 |  * ERMParser.cpp, part of VCMI engine | ||||||
|  * |  * | ||||||
|   | |||||||
| @@ -1,20 +1,4 @@ | |||||||
| #pragma once | #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 |  * ERMParser.h, part of VCMI engine | ||||||
|  * |  * | ||||||
| @@ -25,6 +9,9 @@ namespace phoenix = boost::phoenix; | |||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
|   |   | ||||||
|  | #include <boost/spirit/home/support/unused.hpp> | ||||||
|  |  | ||||||
|  | namespace spirit = boost::spirit; | ||||||
|  |  | ||||||
| class CERMPreprocessor | class CERMPreprocessor | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user