FindObj.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * FindObj.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "FindObj.h"
  12. #include "../VCAI.h"
  13. #include "../AIUtility.h"
  14. extern boost::thread_specific_ptr<CCallback> cb;
  15. extern boost::thread_specific_ptr<VCAI> ai;
  16. extern FuzzyHelper * fh;
  17. using namespace Goals;
  18. bool FindObj::operator==(const FindObj & other) const
  19. {
  20. return other.hero.h == hero.h && other.objid == objid;
  21. }
  22. //
  23. //TSubgoal FindObj::whatToDoToAchieve()
  24. //{
  25. // const CGObjectInstance * o = nullptr;
  26. // if(resID > -1) //specified
  27. // {
  28. // for(const CGObjectInstance * obj : ai->visitableObjs)
  29. // {
  30. // if(obj->ID == objid && obj->subID == resID)
  31. // {
  32. // o = obj;
  33. // break; //TODO: consider multiple objects and choose best
  34. // }
  35. // }
  36. // }
  37. // else
  38. // {
  39. // for(const CGObjectInstance * obj : ai->visitableObjs)
  40. // {
  41. // if(obj->ID == objid)
  42. // {
  43. // o = obj;
  44. // break; //TODO: consider multiple objects and choose best
  45. // }
  46. // }
  47. // }
  48. // if(o && ai->isAccessible(o->pos)) //we don't use isAccessibleForHero as we don't know which hero it is
  49. // return sptr(VisitObj(o->id.getNum()));
  50. //}