Add casts for comparisons with vector class

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 5d8575dcc5
commit 8226b056e2
  1. BIN
      C++ProjectTemplate
  2. 25
      main.cpp

Binary file not shown.

@ -317,20 +317,7 @@ enum class ItemName{
KEY_TO_THE_PALACE,
};
template<typename T, typename F>
inline T
transform_to ( F str ) noexcept
{
// note: F has to have
// the empty()method
if (str.empty())
return {};
// note: F must be able to work
// with std begin and end
return { std::begin(str), std::end(str) };
// also the above line requires, T has a constructor
// that will take begin and end values of type F.
};
template<typename T, typename F> inline T transform_to( F str ) noexcept{if (str.empty()) return {}; return { std::begin(str), std::end(str) };};
namespace Battle{
class Move{
@ -1441,7 +1428,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(0).bPressed) {
for (int i=0;i<CURRENT_MAP->encounters.size();i++) {
if(CURRENT_MAP->encounters[i]->pos==HIGHLIGHTED_TILE*32) {
if(CURRENT_MAP->encounters[i]->pos==(vd2d)HIGHLIGHTED_TILE*32) {
EDITING_ENCOUNTER=CURRENT_MAP->encounters[i];
TextEntryEnable(true);
break;
@ -1453,7 +1440,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} else
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(1).bPressed) {
for (int i=0;i<CURRENT_MAP->encounters.size();i++) {
if(CURRENT_MAP->encounters[i]->pos==HIGHLIGHTED_TILE*32) {
if(CURRENT_MAP->encounters[i]->pos==(vd2d)HIGHLIGHTED_TILE*32) {
for (int j=0;j<CURRENT_MAP->encounters[i]->objs.size();j++) {
int index=CURRENT_MAP->encounters[i]->objs[j]->obj->objArrElement;
delete OBJECTS[index];
@ -1473,7 +1460,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
} else
if (EDITING_LAYER==layer::OBJECT&&GetMouse(1).bReleased) {
for (int i=0;i<OBJECTS.size();i++) {
if (OBJECTS[i]->GetPos()==HIGHLIGHTED_TILE*32) {
if (OBJECTS[i]->GetPos()==(vd2d)HIGHLIGHTED_TILE*32) {
delete OBJECTS[i];
OBJECTS.erase(OBJECTS.begin()+i--);
} else {
@ -3535,14 +3522,14 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
bool nonSolid=false; //Ran into a non-solid instance, which means we can't mark the tile, but we can continue moving through.
for (int i=0;i<PARTY_MEMBER_COUNT;i++) {
if (CURRENT_TURN!=-i-1&&pos==(vi2d)(PARTY_MEMBER_OBJ[i]->GetPosWithOrigin()-cameraPos)/32*32) {
if (CURRENT_TURN!=-i-1&&pos==(vd2d)(vi2d)(PARTY_MEMBER_OBJ[i]->GetPosWithOrigin()-cameraPos)/32*32) {
nonSolid=true;
break;
}
}
if (!nonSolid) {
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
if (pos==(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) {
if (pos==(vd2d)(vi2d)(BATTLE_ENCOUNTER->objs[i]->obj->GetPosWithOrigin()-cameraPos)/32*32) {
nonSolid=true;
break;
}

Loading…
Cancel
Save