src/animated_tile.cpp
author rubidium
Fri, 18 Jul 2008 12:20:31 +0000
changeset 11171 04fc8e49df1b
parent 10751 ebd94f2d6385
permissions -rw-r--r--
(svn r13729) -Fix: assumption that non-north tiles of a house do not have the 1x1 building bit set was flawed with some NewGRFs. This caused the amount of houses to differ, which causes the town radii to differ, which causes desyncs when towns are expanded.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
10268
434c8d706e7e (svn r12800) -Codechange: move the animated tile related functions out of texteff.cpp (it isn't a text effect after all). Also remove a few more functions from functions.
rubidium
parents: 8766
diff changeset
     3
/** @file animated_tile.cpp Everything related to animated tiles. */
6918
5589c415e28f (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6700
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1881
diff changeset
     6
#include "openttd.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#include "saveload.h"
10268
434c8d706e7e (svn r12800) -Codechange: move the animated tile related functions out of texteff.cpp (it isn't a text effect after all). Also remove a few more functions from functions.
rubidium
parents: 8766
diff changeset
     8
#include "landscape.h"
8626
440dfcd14c4a (svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
rubidium
parents: 8617
diff changeset
     9
#include "core/alloc_func.hpp"
8627
448ebf3a8291 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8626
diff changeset
    10
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    12
/** The table/list with animated tiles. */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    13
TileIndex *_animated_tile_list = NULL;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    14
/** The number of animated tiles in the current state. */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    15
uint _animated_tile_count = 0;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    16
/** The number of slots for animated tiles allocated currently. */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    17
static uint _animated_tile_allocated = 0;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    18
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    19
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    20
 * Removes the given tile from the animated tile table.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    21
 * @param tile the tile to remove
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    22
 */
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1891
diff changeset
    23
void DeleteAnimatedTile(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
{
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    25
	for (TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1891
diff changeset
    26
		if (tile == *ti) {
8245
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    27
			/* Remove the hole
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    28
			 * The order of the remaining elements must stay the same, otherwise the animation loop
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    29
			 * may miss a tile; that's why we must use memmove instead of just moving the last element.
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    30
			 */
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    31
			memmove(ti, ti + 1, (_animated_tile_list + _animated_tile_count - (ti + 1)) * sizeof(*ti));
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    32
			_animated_tile_count--;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
			MarkTileDirtyByTile(tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
			return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 0
diff changeset
    35
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    39
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    40
 * Add the given tile to the animated tile table (if it does not exist
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    41
 * on that table yet). Also increases the size of the table if necessary.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    42
 * @param tile the tile to make animated
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    43
 */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    44
void AddAnimatedTile(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
{
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    46
	MarkTileDirtyByTile(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    48
	for (const TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    49
		if (tile == *ti) return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 0
diff changeset
    50
	}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    52
	/* Table not large enough, so make it larger */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    53
	if (_animated_tile_count == _animated_tile_allocated) {
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    54
		_animated_tile_allocated *= 2;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    55
		_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    56
	}
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    57
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    58
	_animated_tile_list[_animated_tile_count] = tile;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    59
	_animated_tile_count++;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    62
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    63
 * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    64
 */
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6541
diff changeset
    65
void AnimateAnimatedTiles()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
{
8245
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    67
	const TileIndex *ti = _animated_tile_list;
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    68
	while (ti < _animated_tile_list + _animated_tile_count) {
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    69
		const TileIndex curr = *ti;
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    70
		AnimateTile(curr);
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    71
		/* During the AnimateTile call, DeleteAnimatedTile could have been called,
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    72
		 * deleting an element we've already processed and pushing the rest one
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    73
		 * slot to the left. We can detect this by checking whether the index
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    74
		 * in the current slot has changed - if it has, an element has been deleted,
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    75
		 * and we should process the current slot again instead of going forward.
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    76
		 * NOTE: this will still break if more than one animated tile is being
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    77
		 *       deleted during the same AnimateTile call, but no code seems to
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    78
		 *       be doing this anyway.
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    79
		 */
dc1637bc2c56 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 8190
diff changeset
    80
		if (*ti == curr) ++ti;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    84
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    85
 * Initialize all animated tile variables to some known begin point
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    86
 */
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6541
diff changeset
    87
void InitializeAnimatedTiles()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
{
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    89
	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, 256);
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    90
	_animated_tile_count = 0;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    91
	_animated_tile_allocated = 256;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    94
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    95
 * Save the ANIT chunk.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    96
 */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    97
static void Save_ANIT()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
{
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
    99
	SlSetLength(_animated_tile_count * sizeof(*_animated_tile_list));
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   100
	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   102
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   103
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   104
 * Load the ANIT chunk; the chunk containing the animated tiles.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   105
 */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   106
static void Load_ANIT()
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   107
{
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   108
	/* Before version 80 we did NOT have a variable length animated tile table */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   109
	if (CheckSavegameVersion(80)) {
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   110
		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   111
		SlArray(_animated_tile_list, 256, CheckSavegameVersion(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   113
		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   114
			if (_animated_tile_list[_animated_tile_count] == 0) break;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   115
		}
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   116
		return;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   117
	}
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   118
10751
ebd94f2d6385 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 10268
diff changeset
   119
	_animated_tile_count = (uint)SlGetFieldLength() / sizeof(*_animated_tile_list);
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   120
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   121
	/* Determine a nice rounded size for the amount of allocated tiles */
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   122
	_animated_tile_allocated = 256;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   123
	while (_animated_tile_allocated < _animated_tile_count) _animated_tile_allocated *= 2;
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   124
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   125
	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   126
	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   127
}
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   128
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   129
/**
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   130
 * "Definition" imported by the saveload code to be able to load and save
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   131
 * the animated tile table.
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   132
 */
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
   133
extern const ChunkHandler _animated_tile_chunk_handlers[] = {
8190
efd1f3b110a2 (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 8041
diff changeset
   134
	{ 'ANIT', Save_ANIT, Load_ANIT, CH_RIFF | CH_LAST},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
};