AlexVinS 9 ani în urmă
părinte
comite
c9a3d92ff3

+ 1 - 1
client/NetPacksClient.cpp

@@ -369,7 +369,7 @@ void TryMoveHero::applyFirstCl(CClient *cl)
 	}
 
 	if(result == TELEPORTATION  ||  result == EMBARK  ||  result == DISEMBARK  ||  !humanKnows)
-		CGI->mh->removeObject(h, result == EMBARK && humanKnows);
+		CGI->mh->hideObject(h, result == EMBARK && humanKnows);
 
 
 	if(result == DISEMBARK)

+ 1 - 15
client/mapHandler.cpp

@@ -598,6 +598,7 @@ void CMapHandler::CMapWorldViewBlitter::drawScaledRotatedElement(EMapCacheType t
 
 		CSDL_Ext::blitSurface(scaledSurf2, srcRect, targetSurf, dstRect);
 		parent->cache.cacheWorldViewEntry(type, key, scaledSurf2);
+		SDL_FreeSurface(baseSurfRotated);
 	}
 }
 
@@ -1373,11 +1374,6 @@ bool CMapHandler::hideObject(const CGObjectInstance *obj, bool fadeout /* = fals
 
 	return true;
 }
-bool CMapHandler::removeObject(CGObjectInstance *obj, bool fadeout /* = false */)
-{
-	hideObject(obj, fadeout);
-	return true;
-}
 
 bool CMapHandler::canStartHeroMovement()
 {
@@ -1516,16 +1512,6 @@ void CMapHandler::CMapCache::updateWorldViewScale(float scale)
 	worldViewCachedScale = scale;
 }
 
-void CMapHandler::CMapCache::removeFromWorldViewCache(CMapHandler::EMapCacheType type, intptr_t key)
-{
-	auto iter = data[(ui8)type].find(key);
-	if (iter != data[(ui8)type].end())
-	{
-		SDL_FreeSurface((*iter).second);
-		data[(ui8)type].erase(iter);
-	}
-}
-
 SDL_Surface * CMapHandler::CMapCache::requestWorldViewCache(CMapHandler::EMapCacheType type, intptr_t key)
 {
 	auto iter = data[(ui8)type].find(key);

+ 5 - 8
client/mapHandler.h

@@ -169,7 +169,6 @@ class CMapHandler
 		void discardWorldViewCache();
 		/// updates scale and determines if currently cached data is still valid
 		void updateWorldViewScale(float scale);
-		void removeFromWorldViewCache(EMapCacheType type, intptr_t key);
 		/// asks for cached data; @returns cached surface or nullptr if data is not in cache
 		SDL_Surface * requestWorldViewCache(EMapCacheType type, intptr_t key);
 		/// asks for cached data; @returns cached data if found, new scaled surface otherwise
@@ -343,6 +342,11 @@ class CMapHandler
 	CMapBlitter * resolveBlitter(const MapDrawingInfo * info) const;
 	bool updateObjectsFade();
 	bool startObjectFade(TerrainTileObject & obj, bool in, int3 pos);
+
+	void initObjectRects();
+	void borderAndTerrainBitmapInit();
+	void roadsRiverTerrainInit();
+	void prepareFOWDefs();
 public:
 	PseudoV< PseudoV< PseudoV<TerrainTile2> > > ttiles; //informations about map tiles
 	int3 sizes; //map size (x = width, y = height, z = number of levels)
@@ -384,16 +388,9 @@ public:
 	~CMapHandler(); //d-tor
 
 	void getTerrainDescr(const int3 &pos, std::string & out, bool terName); //if tername == false => empty string when tile is clear
-	CGObjectInstance * createObject(int id, int subid, int3 pos, int owner=254); //creates a new object with a certain id and subid
 	bool printObject(const CGObjectInstance * obj, bool fadein = false); //puts appropriate things to tiles, so obj will be visible on map
 	bool hideObject(const CGObjectInstance * obj, bool fadeout = false); //removes appropriate things from ttiles, so obj will be no longer visible on map (but still will exist)
-	bool removeObject(CGObjectInstance * obj, bool fadeout = false); //removes object from each place in VCMI (I hope)
 	void init();
-	void calculateBlockedPos();
-	void initObjectRects();
-	void borderAndTerrainBitmapInit();
-	void roadsRiverTerrainInit();
-	void prepareFOWDefs();
 
 	EMapAnimRedrawStatus drawTerrainRectNew(SDL_Surface * targetSurface, const MapDrawingInfo * info, bool redrawOnlyAnim = false);
 	void updateWater();

+ 0 - 1
client/widgets/AdventureMapClasses.cpp

@@ -8,7 +8,6 @@
 
 #include "../CGameInfo.h"
 #include "../CMusicHandler.h"
-#include "../CDefHandler.h"
 #include "../CPlayerInterface.h"
 #include "../CPreGame.h"
 #include "../Graphics.h"

+ 0 - 1
client/windows/CAdvmapInterface.cpp

@@ -9,7 +9,6 @@
 #include "CTradeWindow.h"
 
 #include "../CBitmapHandler.h"
-#include "../CDefHandler.h"
 #include "../CGameInfo.h"
 #include "../CMessage.h"
 #include "../CMusicHandler.h"