fixed travel
This commit is contained in:
parent
9c44781fd3
commit
98c3ff193d
@ -142,10 +142,13 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
|
|||||||
{
|
{
|
||||||
if(dir.compare("north") == 0 || dir.compare("n") == 0)
|
if(dir.compare("north") == 0 || dir.compare("n") == 0)
|
||||||
{
|
{
|
||||||
if(c->y == 0 || (repeat && terrainType != WORLDMAP[c->x][c->y-1]))
|
bool isDiff = repeat && terrainType != WORLDMAP[c->x][c->y-1];
|
||||||
|
if(c->y == 0 || (isDiff && dist != 0))
|
||||||
blocked = true;
|
blocked = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(isDiff)
|
||||||
|
blocked = true;
|
||||||
c->y -= 1;
|
c->y -= 1;
|
||||||
++dist;
|
++dist;
|
||||||
}
|
}
|
||||||
@ -153,10 +156,13 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
|
|||||||
}
|
}
|
||||||
else if(dir.compare("south") == 0 || dir.compare("s") == 0)
|
else if(dir.compare("south") == 0 || dir.compare("s") == 0)
|
||||||
{
|
{
|
||||||
if(c->y == 24 || (repeat && terrainType != WORLDMAP[c->x][c->y+1]))
|
bool isDiff = repeat && terrainType != WORLDMAP[c->x][c->y+1];
|
||||||
|
if(c->y == 24 || (isDiff && dist != 0))
|
||||||
blocked = true;
|
blocked = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(isDiff)
|
||||||
|
blocked = true;
|
||||||
c->y += 1;
|
c->y += 1;
|
||||||
++dist;
|
++dist;
|
||||||
}
|
}
|
||||||
@ -164,10 +170,13 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
|
|||||||
}
|
}
|
||||||
else if(dir.compare("west") == 0 || dir.compare("w") == 0)
|
else if(dir.compare("west") == 0 || dir.compare("w") == 0)
|
||||||
{
|
{
|
||||||
if(c->x == 0 || (repeat && terrainType != WORLDMAP[c->x-1][c->y]))
|
bool isDiff = repeat && terrainType != WORLDMAP[c->x-1][c->y];
|
||||||
|
if(c->x == 0 || (isDiff && dist != 0))
|
||||||
blocked = true;
|
blocked = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(isDiff)
|
||||||
|
blocked = true;
|
||||||
c->x -= 1;
|
c->x -= 1;
|
||||||
++dist;
|
++dist;
|
||||||
}
|
}
|
||||||
@ -175,10 +184,13 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
|
|||||||
}
|
}
|
||||||
else if(dir.compare("east") == 0 || dir.compare("e") == 0)
|
else if(dir.compare("east") == 0 || dir.compare("e") == 0)
|
||||||
{
|
{
|
||||||
if(c->x == 24 || (repeat && terrainType != WORLDMAP[c->x+1][c->y]))
|
bool isDiff = repeat && terrainType != WORLDMAP[c->x+1][c->y];
|
||||||
|
if(c->x == 24 || (isDiff && dist != 0))
|
||||||
blocked = true;
|
blocked = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(isDiff)
|
||||||
|
blocked = true;
|
||||||
c->x += 1;
|
c->x += 1;
|
||||||
++dist;
|
++dist;
|
||||||
}
|
}
|
||||||
@ -191,10 +203,12 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
|
|||||||
|
|
||||||
if(blocked)
|
if(blocked)
|
||||||
{
|
{
|
||||||
if(repeat && dist > 0)
|
if(repeat)
|
||||||
{
|
{
|
||||||
QString("%1 travels %2 during %3 hours through %4")
|
if(dist > 0)
|
||||||
.arg(c->pseudo).arg(direction).arg(dist).arg(currentArea);
|
return QString("%1 travels %2 during %3 hours through %4")
|
||||||
|
.arg(c->pseudo).arg(direction).arg(dist).arg(currentArea);
|
||||||
|
else {}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return QString("%1 cannot go %2, a hill is blocking his way").arg(c->pseudo).arg(direction);
|
return QString("%1 cannot go %2, a hill is blocking his way").arg(c->pseudo).arg(direction);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user