generated from sigonasr2/CPlusPlusProjectTemplate
Add casts for comparisons with vector class
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
5d8575dcc5
commit
8226b056e2
Binary file not shown.
25
main.cpp
25
main.cpp
@ -317,20 +317,7 @@ enum class ItemName{
|
|||||||
KEY_TO_THE_PALACE,
|
KEY_TO_THE_PALACE,
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, typename F>
|
template<typename T, typename F> inline T transform_to( F str ) noexcept{if (str.empty()) return {}; return { std::begin(str), std::end(str) };};
|
||||||
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.
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Battle{
|
namespace Battle{
|
||||||
class Move{
|
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) {
|
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(0).bPressed) {
|
||||||
for (int i=0;i<CURRENT_MAP->encounters.size();i++) {
|
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];
|
EDITING_ENCOUNTER=CURRENT_MAP->encounters[i];
|
||||||
TextEntryEnable(true);
|
TextEntryEnable(true);
|
||||||
break;
|
break;
|
||||||
@ -1453,7 +1440,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
} else
|
} else
|
||||||
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(1).bPressed) {
|
if (EDITING_LAYER==layer::ENCOUNTER&&GetMouse(1).bPressed) {
|
||||||
for (int i=0;i<CURRENT_MAP->encounters.size();i++) {
|
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++) {
|
for (int j=0;j<CURRENT_MAP->encounters[i]->objs.size();j++) {
|
||||||
int index=CURRENT_MAP->encounters[i]->objs[j]->obj->objArrElement;
|
int index=CURRENT_MAP->encounters[i]->objs[j]->obj->objArrElement;
|
||||||
delete OBJECTS[index];
|
delete OBJECTS[index];
|
||||||
@ -1473,7 +1460,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
} else
|
} else
|
||||||
if (EDITING_LAYER==layer::OBJECT&&GetMouse(1).bReleased) {
|
if (EDITING_LAYER==layer::OBJECT&&GetMouse(1).bReleased) {
|
||||||
for (int i=0;i<OBJECTS.size();i++) {
|
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];
|
delete OBJECTS[i];
|
||||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||||
} else {
|
} 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.
|
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++) {
|
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;
|
nonSolid=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!nonSolid) {
|
if (!nonSolid) {
|
||||||
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
|
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;
|
nonSolid=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user