CObjectHandler.cpp 1.6 KB

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