src/animated_tile.cpp
author smatz
Wed, 24 Sep 2008 16:40:06 +0000
changeset 10184 bf4e3ff4cf16
parent 9390 88d36f907e96
permissions -rw-r--r--
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
-Fix: close any dropdown and child windows in the Order and Timetable windows when selected order is deselected, deleted, ...
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
9005
d6b0e0a54ef2 (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: 8270
diff changeset
     3
/** @file animated_tile.cpp Everything related to animated tiles. */
6422
6679df1c05ba (svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents: 6374
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (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"
9005
d6b0e0a54ef2 (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: 8270
diff changeset
     8
#include "landscape.h"
8130
d2eb7d04f6e1 (svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
rubidium
parents: 8121
diff changeset
     9
#include "core/alloc_func.hpp"
8131
160939e24ed3 (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: 8130
diff changeset
    10
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    12
/** The table/list with animated tiles. */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    13
TileIndex *_animated_tile_list = NULL;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    14
/** The number of animated tiles in the current state. */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    15
uint _animated_tile_count = 0;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    16
/** The number of slots for animated tiles allocated currently. */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    17
static uint _animated_tile_allocated = 0;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    18
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    19
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    20
 * Removes the given tile from the animated tile table.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    21
 * @param tile the tile to remove
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    22
 */
1977
37bbebf94434 (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
{
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    25
	for (TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1891
diff changeset
    26
		if (tile == *ti) {
7749
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    27
			/* Remove the hole
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    28
			 * The order of the remaining elements must stay the same, otherwise the animation loop
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    29
			 * may miss a tile; that's why we must use memmove instead of just moving the last element.
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    30
			 */
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    31
			memmove(ti, ti + 1, (_animated_tile_list + _animated_tile_count - (ti + 1)) * sizeof(*ti));
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    39
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    40
 * Add the given tile to the animated tile table (if it does not exist
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    41
 * on that table yet). Also increases the size of the table if necessary.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    42
 * @param tile the tile to make animated
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    43
 */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    44
void AddAnimatedTile(TileIndex tile)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
{
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    46
	MarkTileDirtyByTile(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    48
	for (const TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    52
	/* Table not large enough, so make it larger */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    53
	if (_animated_tile_count == _animated_tile_allocated) {
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    54
		_animated_tile_allocated *= 2;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    55
		_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    56
	}
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    57
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    58
	_animated_tile_list[_animated_tile_count] = tile;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    62
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    63
 * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    64
 */
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6215
diff changeset
    65
void AnimateAnimatedTiles()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
{
7749
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    67
	const TileIndex *ti = _animated_tile_list;
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    68
	while (ti < _animated_tile_list + _animated_tile_count) {
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    69
		const TileIndex curr = *ti;
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    70
		AnimateTile(curr);
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    71
		/* During the AnimateTile call, DeleteAnimatedTile could have been called,
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    72
		 * deleting an element we've already processed and pushing the rest one
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    73
		 * slot to the left. We can detect this by checking whether the index
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    74
		 * in the current slot has changed - if it has, an element has been deleted,
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    75
		 * and we should process the current slot again instead of going forward.
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    76
		 * NOTE: this will still break if more than one animated tile is being
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    77
		 *       deleted during the same AnimateTile call, but no code seems to
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    78
		 *       be doing this anyway.
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
diff changeset
    79
		 */
3ed7d92bd966 (svn r11286) -Fix (r11228): NewGRF industries assume that the order of animation always stays the same. Patch by Csaboka.
rubidium
parents: 7694
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    84
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    85
 * Initialize all animated tile variables to some known begin point
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    86
 */
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6215
diff changeset
    87
void InitializeAnimatedTiles()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
{
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    89
	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, 256);
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    90
	_animated_tile_count = 0;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    94
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    95
 * Save the ANIT chunk.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    96
 */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    97
static void Save_ANIT()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
{
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
    99
	SlSetLength(_animated_tile_count * sizeof(*_animated_tile_list));
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   103
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   104
 * Load the ANIT chunk; the chunk containing the animated tiles.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   105
 */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   106
static void Load_ANIT()
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   107
{
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   108
	/* Before version 80 we did NOT have a variable length animated tile table */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   109
	if (CheckSavegameVersion(80)) {
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   110
		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   113
		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   114
			if (_animated_tile_list[_animated_tile_count] == 0) break;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   115
		}
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   116
		return;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   117
	}
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   118
9390
88d36f907e96 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents: 9005
diff changeset
   119
	_animated_tile_count = (uint)SlGetFieldLength() / sizeof(*_animated_tile_list);
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   120
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   121
	/* Determine a nice rounded size for the amount of allocated tiles */
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   122
	_animated_tile_allocated = 256;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   123
	while (_animated_tile_allocated < _animated_tile_count) _animated_tile_allocated *= 2;
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   124
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   125
	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   126
	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   127
}
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   128
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   129
/**
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   130
 * "Definition" imported by the saveload code to be able to load and save
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   131
 * the animated tile table.
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
diff changeset
   132
 */
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5584
diff changeset
   133
extern const ChunkHandler _animated_tile_chunk_handlers[] = {
7694
3c4a0b7894cd (svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents: 7545
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
};