Browse Source

Bugfix - it should work now.

Michał W. Urbańczyk 18 years ago
parent
commit
ae0be1f79e
4 changed files with 19 additions and 1 deletions
  1. 6 0
      CAdvmapInterface.cpp
  2. 1 0
      CAdvmapInterface.h
  3. 9 0
      CCallback.cpp
  4. 3 1
      CCallback.h

+ 6 - 0
CAdvmapInterface.cpp

@@ -314,6 +314,12 @@ void CHeroList::hover (bool on)
 void CHeroList::keyPressed (SDL_KeyboardEvent & key)
 {
 }
+void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar
+{
+	int ser = LOCPLINT->cb->getHeroSerial(which);
+	int pom = (which->movement)/100;
+	blitAtWR(mobile->ourImages[pom].bitmap,posmobx,posmoby+ser*32); //move point
+}
 void CHeroList::draw()
 {	
 	for (int iT=0+from;iT<5+from;iT++)

+ 1 - 0
CAdvmapInterface.h

@@ -71,6 +71,7 @@ public:
 	void hover (bool on);
 	void keyPressed (SDL_KeyboardEvent & key);
 	void updateHList();
+	void updateMove(const CGHeroInstance* which); //draws move points bar
 	void redrawAllOne(int which);
 	void draw();
 	void init();

+ 9 - 0
CCallback.cpp

@@ -350,6 +350,15 @@ int CCallback::getMyColor()
 {
 	return player;
 }
+int CCallback::getHeroSerial(const CGHeroInstance * hero)
+{
+	for (int i=0; i<gs->players[player].heroes.size();i++)
+	{
+		if (gs->players[player].heroes[i]==hero)
+			return i;
+	}
+	return -1;
+}
 int CCallback::getMySerial()
 {	
 	return gs->players[player].serial;

+ 3 - 1
CCallback.h

@@ -27,10 +27,11 @@ public:
 	virtual const CGTownInstance * getTownInfo(int val, bool mode)=0; //mode = 0 -> val = serial; mode = 1 -> val = ID
 	virtual int howManyTowns()=0;
 	virtual std::vector < std::string > getObjDescriptions(int3 pos)=0; //returns descriptions of objects at pos in order from the lowest to the highest
-	virtual std::vector < const CGHeroInstance *> * getHeroesInfo(bool onlyOur=true)=0;
+	virtual std::vector < const CGHeroInstance *> getHeroesInfo(bool onlyOur=true)=0;
 	virtual bool isVisible(int3 pos)=0;
 	virtual int getMyColor()=0;
 	virtual int getMySerial()=0;
+	virtual int getHeroSerial(const CGHeroInstance * hero)=0;
 };
 
 struct HeroMoveDetails
@@ -72,6 +73,7 @@ public:
 	std::vector < const CGHeroInstance *> getHeroesInfo(bool onlyOur=true);
 	bool isVisible(int3 pos);
 	int getMyColor();
+	int getHeroSerial(const CGHeroInstance * hero);
 	int getMySerial();
 
 //friends