Feature #1124 » 0083-Create-anims-hash-table-to-store-animations-to-free-.patch
client/tilespec.c | ||
---|---|---|
hash, tag_name, sprite)
|
||
#define sprite_hash_iterate_end HASH_ITERATE_END
|
||
/* 'struct anim_hash' and related functions. */
|
||
#define SPECHASH_TAG anim
|
||
#define SPECHASH_ASTR_KEY_TYPE
|
||
#define SPECHASH_IDATA_TYPE struct anim *
|
||
#include "spechash.h"
|
||
#define anim_hash_iterate(hash, tag_name, sprite) \
|
||
TYPED_HASH_ITERATE(const char *, struct anim *, \
|
||
hash, tag_name, anim)
|
||
#define anim_hash_iterate_end HASH_ITERATE_END
|
||
/* 'struct drawing_hash' and related functions. */
|
||
static void drawing_data_destroy(struct drawing_data *draw);
|
||
... | ... | |
struct estyle_hash *estyle_hash;
|
||
struct anim_hash *anim_hash;
|
||
struct named_sprites sprites;
|
||
struct color_system *color_system;
|
||
... | ... | |
goto ON_ERROR;
|
||
}
|
||
fc_assert(t->sprite_hash == NULL);
|
||
fc_assert(t->sprite_hash == nullptr);
|
||
t->sprite_hash = sprite_hash_new();
|
||
fc_assert(t->anim_hash == nullptr);
|
||
t->anim_hash = anim_hash_new();
|
||
if (!tileset_scan_single_list(t, spec_filenames[SFILE_COMMON],
|
||
num_spec_files[SFILE_COMMON],
|
||
verbose, duplicates_ok)) {
|
||
... | ... | |
}
|
||
}
|
||
anim_hash_insert(t->anim_hash, tag, ret);
|
||
return ret;
|
||
}
|
||
... | ... | |
****************************************************************************/
|
||
static void unload_all_sprites(struct tileset *t)
|
||
{
|
||
if (t->sprite_hash) {
|
||
if (t->sprite_hash != nullptr) {
|
||
sprite_hash_iterate(t->sprite_hash, tag_name, ss) {
|
||
while (ss->ref_count > 0) {
|
||
unload_sprite(t, tag_name);
|
||
... | ... | |
}
|
||
}
|
||
/************************************************************************//**
|
||
Free resources allocated for all animations.
|
||
****************************************************************************/
|
||
static void free_all_anims(struct tileset *t)
|
||
{
|
||
if (t->anim_hash != nullptr) {
|
||
anim_hash_iterate(t->anim_hash, tag, anim) {
|
||
(void)tag;
|
||
anim_free(anim);
|
||
} anim_hash_iterate_end;
|
||
}
|
||
}
|
||
/************************************************************************//**
|
||
Free all sprites from tileset.
|
||
****************************************************************************/
|
||
... | ... | |
t->sprites.unit.stack = NULL;
|
||
}
|
||
anim_free(t->sprites.unit.select);
|
||
free_all_anims(t);
|
||
t->sprites.unit.select = nullptr;
|
||
anim_free(t->sprites.unit.action_decision_want);
|
||
t->sprites.unit.action_decision_want = nullptr;
|
||
if (t->anim_hash) {
|
||
anim_hash_destroy(t->anim_hash);
|
||
t->anim_hash = nullptr;
|
||
}
|
||
tileset_background_free(t);
|
||
}
|
||
- « Previous
- 1
- 2
- Next »