fixed coordinates bug
This commit is contained in:
		
							parent
							
								
									806efbcba0
								
							
						
					
					
						commit
						aa8e420af5
					
				@ -191,7 +191,7 @@ QString RPGModule::lookAt(RPGCharacter *c, QString target)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if(target.compare("around") == 0)
 | 
					    if(target.compare("around") == 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        int terrain = WORLDMAP[c->x][c->y];
 | 
					        int terrain = WORLDMAP[c->y][c->x];
 | 
				
			||||||
        if(terrain == VILLAGE)
 | 
					        if(terrain == VILLAGE)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Village *v = getVillage(c);
 | 
					            Village *v = getVillage(c);
 | 
				
			||||||
@ -216,13 +216,13 @@ QString RPGModule::lookAt(RPGCharacter *c, QString target)
 | 
				
			|||||||
            return QString("%1 is in %2").arg(c->pseudo).arg(getTerrainName(terrain));
 | 
					            return QString("%1 is in %2").arg(c->pseudo).arg(getTerrainName(terrain));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if(target.compare("north") == 0 || target.compare("n") == 0)
 | 
					    else if(target.compare("north") == 0 || target.compare("n") == 0)
 | 
				
			||||||
        return QString("%1 looks north and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->x-1][c->y]));
 | 
					        return QString("%1 looks north and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->y-1][c->x]));
 | 
				
			||||||
    else if(target.compare("south") == 0 || target.compare("s") == 0)
 | 
					    else if(target.compare("south") == 0 || target.compare("s") == 0)
 | 
				
			||||||
        return QString("%1 looks south and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->x+1][c->y]));
 | 
					        return QString("%1 looks south and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->y+1][c->x]));
 | 
				
			||||||
    else if(target.compare("west") == 0 || target.compare("w") == 0)
 | 
					    else if(target.compare("west") == 0 || target.compare("w") == 0)
 | 
				
			||||||
        return QString("%1 looks west and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->x][c->y-1]));
 | 
					        return QString("%1 looks west and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->y][c->x-1]));
 | 
				
			||||||
    else if(target.compare("east") == 0 || target.compare("e") == 0)
 | 
					    else if(target.compare("east") == 0 || target.compare("e") == 0)
 | 
				
			||||||
        return QString("%1 looks east and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->x][c->y+1]));
 | 
					        return QString("%1 looks east and sees %2").arg(c->pseudo).arg(getTerrainName(WORLDMAP[c->y][c->x+1]));
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return QString("%1 is not a valid target").arg(target);
 | 
					        return QString("%1 is not a valid target").arg(target);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -245,7 +245,7 @@ QString RPGModule::eventInteract(RPGCharacter *c, QString target)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
 | 
					QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char terrainType = WORLDMAP[c->x][c->y];
 | 
					    char terrainType = WORLDMAP[c->y][c->x];
 | 
				
			||||||
    QString direction;
 | 
					    QString direction;
 | 
				
			||||||
    QString currentArea = getTerrainName(terrainType);
 | 
					    QString currentArea = getTerrainName(terrainType);
 | 
				
			||||||
    bool blocked = false;
 | 
					    bool blocked = false;
 | 
				
			||||||
@ -255,7 +255,7 @@ 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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool isDiff = repeat && terrainType != WORLDMAP[c->x-1][c->y];
 | 
					            bool isDiff = repeat && terrainType != WORLDMAP[c->y-1][c->x];
 | 
				
			||||||
            if(c->y == 0 || (isDiff && dist != 0))
 | 
					            if(c->y == 0 || (isDiff && dist != 0))
 | 
				
			||||||
                blocked = true;
 | 
					                blocked = true;
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -269,7 +269,7 @@ 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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool isDiff = repeat && terrainType != WORLDMAP[c->x+1][c->y];
 | 
					            bool isDiff = repeat && terrainType != WORLDMAP[c->y+1][c->x];
 | 
				
			||||||
            if(c->y == 24 || (isDiff && dist != 0))
 | 
					            if(c->y == 24 || (isDiff && dist != 0))
 | 
				
			||||||
                blocked = true;
 | 
					                blocked = true;
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -283,7 +283,7 @@ 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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool isDiff = repeat && terrainType != WORLDMAP[c->x][c->y-1];
 | 
					            bool isDiff = repeat && terrainType != WORLDMAP[c->y][c->x-1];
 | 
				
			||||||
            if(c->x == 0 || (isDiff && dist != 0))
 | 
					            if(c->x == 0 || (isDiff && dist != 0))
 | 
				
			||||||
                blocked = true;
 | 
					                blocked = true;
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -297,7 +297,7 @@ 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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool isDiff = repeat && terrainType != WORLDMAP[c->x][c->y+1];
 | 
					            bool isDiff = repeat && terrainType != WORLDMAP[c->y][c->x+1];
 | 
				
			||||||
            if(c->x == 24 || (isDiff && dist != 0))
 | 
					            if(c->x == 24 || (isDiff && dist != 0))
 | 
				
			||||||
                blocked = true;
 | 
					                blocked = true;
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -327,12 +327,12 @@ QString RPGModule::playerTravel(RPGCharacter *c, QString dir, bool repeat)
 | 
				
			|||||||
            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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    char newTerrainType = WORLDMAP[c->x][c->y];
 | 
					    char newTerrainType = WORLDMAP[c->y][c->x];
 | 
				
			||||||
    if(terrainType == newTerrainType)
 | 
					    if(terrainType == newTerrainType)
 | 
				
			||||||
        return QString("%1 is traveling %2 and is still in %3").arg(c->pseudo).arg(direction).arg(currentArea);
 | 
					        return QString("%1 is traveling %2 and is still in %3").arg(c->pseudo).arg(direction).arg(currentArea);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        return QString("%1 is traveling %2, leaving %3 and entering %4")
 | 
					        return QString("%1 is traveling %2, leaving %3 and entering %4")
 | 
				
			||||||
            .arg(c->pseudo).arg(direction).arg(currentArea).arg(getTerrainName(WORLDMAP[c->x][c->y]));
 | 
					            .arg(c->pseudo).arg(direction).arg(currentArea).arg(getTerrainName(WORLDMAP[c->y][c->x]));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool RPGModule::messageHandler(Message msg)
 | 
					bool RPGModule::messageHandler(Message msg)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user