Forráskód Böngészése

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

Conflicts:
	client/CPlayerInterface.cpp
Fay 10 éve
szülő
commit
cbd3a19987

+ 4 - 4
client/mapHandler.cpp

@@ -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;

+ 2 - 2
client/widgets/AdventureMapClasses.cpp

@@ -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

+ 4 - 1
config/spells/offensive.json

@@ -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
 		}
 	},

+ 2 - 2
config/spells/other.json

@@ -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" : {

+ 26 - 5
config/spells/timed.json

@@ -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,

+ 3 - 1
lib/SpellMechanics.cpp

@@ -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)
 	{

+ 1 - 1
lib/filesystem/CCompressedStream.cpp

@@ -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)

+ 11 - 3
lib/filesystem/ResourceID.cpp

@@ -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);

+ 2 - 1
lib/filesystem/ResourceID.h

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

+ 15 - 0
scripting/erm/ERMParser.cpp

@@ -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
  *

+ 3 - 16
scripting/erm/ERMParser.h

@@ -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
 {