Przeglądaj źródła

Fixed #1181. Do not change that setProperty to setPropertyDer, it has to be as it is.
Sketchy fix for BattleAIs colliding ith their callbacks.

Michał W. Urbańczyk 12 lat temu
rodzic
commit
6232a1b369
3 zmienionych plików z 3 dodań i 2 usunięć
  1. 1 0
      AI/BattleAI/BattleAI.cpp
  2. 1 1
      lib/CObjectHandler.cpp
  3. 1 1
      lib/CObjectHandler.h

+ 1 - 0
AI/BattleAI/BattleAI.cpp

@@ -346,6 +346,7 @@ struct PotentialTargets
 
 
 BattleAction CBattleAI::activeStack( const CStack * stack )
 BattleAction CBattleAI::activeStack( const CStack * stack )
 {
 {
+	cbc = cb; //TODO: make solid sure that AIs always use their callbacks (need to take care of event handlers too)
 	try
 	try
 	{
 	{
 		print("activeStack called for " + stack->nodeName());
 		print("activeStack called for " + stack->nodeName());

+ 1 - 1
lib/CObjectHandler.cpp

@@ -1639,7 +1639,7 @@ void CGDwelling::initObj()
 	}
 	}
 }
 }
 
 
-void CGDwelling::setPropertyDer(ui8 what, ui32 val)
+void CGDwelling::setProperty(ui8 what, ui32 val)
 {
 {
 	switch (what)
 	switch (what)
 	{
 	{

+ 1 - 1
lib/CObjectHandler.h

@@ -478,7 +478,7 @@ public:
 	void onHeroVisit(const CGHeroInstance * h) const override;
 	void onHeroVisit(const CGHeroInstance * h) const override;
 	void newTurn() const override;
 	void newTurn() const override;
 protected:
 protected:
-	void setPropertyDer(ui8 what, ui32 val) override;
+	void setProperty(ui8 what, ui32 val) override;
 private:
 private:
 	void heroAcceptsCreatures(const CGHeroInstance *h, ui32 answer) const;
 	void heroAcceptsCreatures(const CGHeroInstance *h, ui32 answer) const;
 	void fightOver(const CGHeroInstance *h, BattleResult *result) const;
 	void fightOver(const CGHeroInstance *h, BattleResult *result) const;