Skip to content

Commit

Permalink
-Fix (#236): translation errors in Tile_GetTileInDirectionOf
Browse files Browse the repository at this point in the history
Translation errors in commit 032da23:
1. dir should be incremented by 31 (0x1F) instead of 29.
2. i should not incremented, making it loop until a valid tile is found.
  • Loading branch information
wangds committed Sep 19, 2013
1 parent cd093a2 commit e3050a0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/tile.c
Expand Up @@ -291,7 +291,6 @@ uint16 Tile_GetTileInDirectionOf(uint16 packed_from, uint16 packed_to)
{
int16 distance;
uint8 direction;
uint8 i;

if (packed_from == 0 || packed_to == 0) return 0;

Expand All @@ -300,12 +299,12 @@ uint16 Tile_GetTileInDirectionOf(uint16 packed_from, uint16 packed_to)

if (distance <= 10) return 0;

for (i = 0; i < 4; i++) {
while (true) {
int16 dir;
tile32 position;
uint16 packed;

dir = 29 + (Tools_Random_256() & 0x3F);
dir = 31 + (Tools_Random_256() & 0x3F);

if ((Tools_Random_256() & 1) != 0) dir = -dir;

Expand Down

0 comments on commit e3050a0

Please sign in to comment.