(svn r7676) -Backport from trunk (r7630, r7631):

- cur/old economy memmove magic (r7630).
 - wrong pointer arithmetic that totally corrupted animated_tiles table, desyncing
   between different endiannes-machines in multiplayer (r7631).
This commit is contained in:
Darkvater 2006-12-30 23:25:57 +00:00
parent 0e7701fbe6
commit b5715acaf8
2 changed files with 5 additions and 6 deletions

View File

@ -589,17 +589,16 @@ static void PlayersGenStatistics(void)
FOR_ALL_PLAYERS(p) {
if (p->is_active) {
memmove(&p->old_economy, &p->cur_economy, sizeof(p->old_economy));
memmove(&p->old_economy[1], &p->old_economy[0], sizeof(p->old_economy) - sizeof(p->old_economy[0]));
p->old_economy[0] = p->cur_economy;
memset(&p->cur_economy, 0, sizeof(p->cur_economy));
if (p->num_valid_stat_ent != 24)
p->num_valid_stat_ent++;
if (p->num_valid_stat_ent != 24) p->num_valid_stat_ent++;
UpdateCompanyRatingAndValue(p, true);
PlayersCheckBankrupt(p);
if (p->block_preview != 0)
p->block_preview--;
if (p->block_preview != 0) p->block_preview--;
}
}

View File

@ -324,7 +324,7 @@ void DeleteAnimatedTile(TileIndex tile)
for (ti = _animated_tile_list; ti != endof(_animated_tile_list); ti++) {
if (tile == *ti) {
/* remove the hole */
memmove(ti, ti + 1, endof(_animated_tile_list) - 1 - ti);
memmove(ti, ti + 1, (lastof(_animated_tile_list) - ti) * sizeof(_animated_tile_list[0]));
/* and clear last item */
endof(_animated_tile_list)[-1] = 0;
MarkTileDirtyByTile(tile);