CObjectHandler.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "stdafx.h"
  2. #include "CObjectHandler.h"
  3. #include "CGameInfo.h"
  4. #include "CGeneralTextHandler.h"
  5. void CObjectHandler::loadObjects()
  6. {
  7. int ID=0;
  8. std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("OBJNAMES.TXT");
  9. int it=0;
  10. while (it<buf.length()-1)
  11. {
  12. CObject nobj;
  13. CGeneralTextHandler::loadToIt(nobj.name,buf,it,3);
  14. objects.push_back(nobj);
  15. }
  16. }
  17. bool CObjectInstance::operator <(const CObjectInstance &cmp) const
  18. {
  19. if(CGI->ac->map.defy[this->defNumber].printPriority==1 && CGI->ac->map.defy[cmp.defNumber].printPriority==0)
  20. return true;
  21. if(CGI->ac->map.defy[cmp.defNumber].printPriority==1 && CGI->ac->map.defy[this->defNumber].printPriority==0)
  22. return false;
  23. if(this->pos.y<cmp.pos.y)
  24. return true;
  25. if(this->pos.y>cmp.pos.y)
  26. return false;
  27. if(CGI->ac->map.defy[this->defNumber].isOnDefList && !(CGI->ac->map.defy[cmp.defNumber].isOnDefList))
  28. return true;
  29. if(CGI->ac->map.defy[cmp.defNumber].isOnDefList && !(CGI->ac->map.defy[this->defNumber].isOnDefList))
  30. return false;
  31. if(!CGI->ac->map.defy[this->defNumber].isVisitable() && CGI->ac->map.defy[cmp.defNumber].isVisitable())
  32. return true;
  33. if(!CGI->ac->map.defy[cmp.defNumber].isVisitable() && CGI->ac->map.defy[this->defNumber].isVisitable())
  34. return false;
  35. if(this->pos.x<cmp.pos.x)
  36. return true;
  37. return false;
  38. }