Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Micropolis.Core/Micropolis.Random.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,12 @@ public int GetRandom16()
/// <returns></returns>
public int GetRandom16Signed()
{
var i = GetRandom16();

if (i > 0x7fff) i = 0x7fff - i;

return i;
// GetRandom16() returns an int value from 0 to 65535.
// Casting this to a short correctly performs the two's complement conversion,
// mapping the upper half of the range (32768-65535) to the negative
// short values (-32768 to -1). The result is implicitly cast back to an
// int for the return type, which is what the call sites expect.
return (short)GetRandom16();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Micropolis.Core/Micropolis.Zone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public void DoResidential(Position pos, bool zonePower)
}

value = GetLandPollutionValue(pos);

DoResIn(pos, tpop, value);
return;
}
Expand Down