Ver Fonte

It should be quite stable now.

Michał W. Urbańczyk há 18 anos atrás
pai
commit
cc01243da5
6 ficheiros alterados com 21 adições e 9 exclusões
  1. 2 2
      CCallback.cpp
  2. 2 0
      CGameState.h
  3. 1 0
      CMT.cpp
  4. 1 1
      CPathfinder.cpp
  5. 1 1
      CPathfinder.h
  6. 14 5
      mapHandler.cpp

+ 2 - 2
CCallback.cpp

@@ -98,7 +98,7 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
 		HeroMoveDetails curd;
 		curd.src = stpos;
 		curd.dst = endpos;
-		//curd.ho = hero->ourObject;
+		curd.ho = hero;
 		curd.owner = hero->state->owner;
 		/*if(player!=-1)
 		{
@@ -152,7 +152,7 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
 
 			std::vector< CGObjectInstance * > vis = CGI->mh->getVisitableObjs(hero->getPosition(false));
 			for (int iii=0; iii<vis.size(); iii++)
-				std::cout<< CGI->objh->objects[5].name<<std::endl;
+				std::cout<< CGI->objh->objects[vis[iii]->ID].name<<std::endl;
 
 		}
 		else

+ 2 - 0
CGameState.h

@@ -30,6 +30,8 @@ public:
 	friend int _tmain(int argc, _TCHAR* argv[]);
 	friend void initGameState(CGameInfo * cgi);
 	//CCallback * cb; //for communication between PlayerInterface/AI and GameState
+
+	//friend SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, unsigned char anim, PseudoV< PseudoV< PseudoV<unsigned char> > > & visibilityMap); //todo: wywalic koniecznie, tylko do flag obecnie!!!!
 };
 
 #endif //CGAMESTATE_H

+ 1 - 0
CMT.cpp

@@ -66,6 +66,7 @@ void initGameState(CGameInfo * cgi)
 	for (int i=0; i<cgi->scenarioOps.playerInfos.size();i++)
 	{
 		std::pair<int,PlayerState> ins(cgi->scenarioOps.playerInfos[i].color,PlayerState());
+		ins.second.color=ins.first;
 		cgi->state->players.insert(ins);
 	}
 	/******************RESOURCES****************************************************/

+ 1 - 1
CPathfinder.cpp

@@ -197,7 +197,7 @@ void CPathfinder::convertPath(CPath * path, unsigned int mode) //mode=0 -> from
 	{
 		for (int i=0;i<path->nodes.size();i++)
 		{
-			path->nodes[i].coord = CHeroInstance::convertPosition(path->nodes[i].coord,true);
+			path->nodes[i].coord = CGHeroInstance::convertPosition(path->nodes[i].coord,true);
 		}
 	}
 }

+ 1 - 1
CPathfinder.h

@@ -31,7 +31,7 @@ private:
 	std::vector< std::vector<CPathNode *> > graph;
 public:
 	CPath * getPath(int3 src, int3 dest, const CGHeroInstance * hero, unsigned char type=0); //calculates path between src and dest; returns pointer to CPath or NULL if path does not exists; type - type of calculation: 0 - positions are normal positions of hero; 1 - given places are tiles blocked by hero
-	CPath * getPath(const int3 & src, const int3 & dest, const CHeroInstance * hero, int (*getDist)(int3 & a, int3 & b), unsigned char type=0); //calculates path between src and dest; returns pointer to CPath or NULL if path does not exists; uses getDist to calculate distance; type - type of calculation: 0 - positions are normal positions of hero; 1 - given places are tiles blocked by hero
+	CPath * getPath(const int3 & src, const int3 & dest, const CGHeroInstance * hero, int (*getDist)(int3 & a, int3 & b), unsigned char type=0); //calculates path between src and dest; returns pointer to CPath or NULL if path does not exists; uses getDist to calculate distance; type - type of calculation: 0 - positions are normal positions of hero; 1 - given places are tiles blocked by hero
 
 	static void convertPath(CPath * path, unsigned int mode); //mode=0 -> from 'manifest' to 'object'
 };

+ 14 - 5
mapHandler.cpp

@@ -8,7 +8,7 @@
 #include "hch\CLodHandler.h"
 #include "hch\CDefObjInfoHandler.h"
 #include <algorithm>
-
+#include "CGameState.h"
 extern SDL_Surface * ekran;
 
 class OCM_HLP
@@ -970,10 +970,19 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
 
 	///enabling flags
 
-	for(int qq=0; qq<CGI->heroh->heroInstances.size(); ++qq)
-	{
-		//CGI->heroh->heroInstances[qq]->ourObject->flagPrinted = false;
-	}
+
+
+	//nie zauwazylem aby ustawianie tego cokolwiek zmienialo w wyswietlaniu, wiec komentuje (do dzialania wymaga jeszcze odkomentowania przyjazni w statcie)
+
+	//for(std::map<int, PlayerState>::iterator k=CGI->state->players.begin(); k!=CGI->state->players.end(); ++k)
+	//{
+	//	for (int l = 0; l<k->second.heroes.size(); l++)
+	//		k->second.heroes[l]->flagPrinted = false;
+	//}
+	//for(int qq=0; qq<CGI->heroh->heroInstances.size(); ++qq)
+	//{
+	//	CGI->heroh->heroInstances[qq]->flagPrinted = false;
+	//}
 
 	///flags enabled