From: <gi...@cr...> - 2011-12-29 01:18:25
|
via d74c999e13a044fd7774bee8f9cc69887217bd91 (commit) from 765af0c3a705afef9bb23b8170a9e0e5713cd23c (commit) ----------------------------------------------------------------------- commit d74c999e13a044fd7774bee8f9cc69887217bd91 Author: Adam Borowski <kil...@an...> Date: Thu Dec 29 02:07:18 2011 +0100 Don't read the mcache in any case; drop unmarshalling code. It was read only to be immediately dropped, this would be important if there'd be any valuable data in the chunk after it but it happens that there is nothing relevant. ----------------------------------------------------------------------- Summary of changes: crawl-ref/source/stairs.cc | 3 - crawl-ref/source/tags.cc | 17 +----- crawl-ref/source/tilemcache.cc | 107 ---------------------------------------- crawl-ref/source/tilemcache.h | 6 -- 4 files changed, 3 insertions(+), 130 deletions(-) diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index 3e9b2f0..e9c6f1f 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -1312,9 +1312,6 @@ static void _update_level_state() void new_level(bool restore) { -#ifdef USE_TILE - mcache.clear_all(); -#endif print_stats_level(); #ifdef DGL_WHEREIS whereis_record(); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 737b6c9..c0b0a8c 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -3893,22 +3893,11 @@ void tag_read_level_tiles(reader &th) _debug_count_tiles(); #if TAG_MAJOR_VERSION == 32 -# ifdef USE_TILE if (th.getMinorVersion() < TAG_MINOR_LESS_TILE_DATA) { - mcache.read(th); - if (th.getMinorVersion() >= TAG_MINOR_MONSTER_TILES) - unmarshallInt(th); // TILEP_PLAYER_MAX - } -# else - // there wasn't a minor tag there, being overinclusive doesn't hurt - if (th.getMinorVersion() < TAG_MINOR_CONSTRICTION) - { // Snarf all remaining data, throwing it out. - // Console builds don't know of old mcache formats, it'd be too much work - // to properly skip it. Instead, we snarf the remaining data and throw it - // out. The only thing after mcache is TILE_WALL_MAX, and it's guaranteed - // it won't match anyway. + // There's no need to read the mcache just to discard it, the only thing + // after mcache is TILE_WALL_MAX which is guaranteed to not match anyway. try { while (1) @@ -3919,9 +3908,9 @@ void tag_read_level_tiles(reader &th) } dprf("An ancient save, can't check DNGN tilecount; recreating tile data."); tag_missing_level_tiles(); + tag_init_tile_bk(); return; } -# endif #endif if (unmarshallInt(th) != TILE_WALL_MAX) diff --git a/crawl-ref/source/tilemcache.cc b/crawl-ref/source/tilemcache.cc index c0dcbb7..119638d 100644 --- a/crawl-ref/source/tilemcache.cc +++ b/crawl-ref/source/tilemcache.cc @@ -34,22 +34,6 @@ struct demon_data tileidx_t wings; }; -#if TAG_MAJOR_VERSION == 32 -// Custom unmarshall functions. -static void unmarshallDoll(reader &th, dolls_data &doll) -{ - for (unsigned int i = 0; i < TILEP_PART_MAX; i++) - doll.parts[i] = unmarshallInt(th); -} - -static void unmarshallDemon(reader &th, demon_data &demon) -{ - demon.head = unmarshallInt(th); - demon.body = unmarshallInt(th); - demon.wings = unmarshallInt(th); -} -#endif - // Internal mcache classes. The mcache_manager creates these internally. // The only access external clients need is through the virtual // info function. @@ -58,9 +42,6 @@ class mcache_monster : public mcache_entry { public: mcache_monster(const monster_info& mon); -#if TAG_MAJOR_VERSION == 32 - mcache_monster(reader &th); -#endif virtual int info(tile_draw_info *dinfo) const; @@ -77,9 +58,6 @@ class mcache_draco : public mcache_entry { public: mcache_draco(const monster_info& mon); -#if TAG_MAJOR_VERSION == 32 - mcache_draco(reader &th); -#endif virtual int info(tile_draw_info *dinfo) const; @@ -95,9 +73,6 @@ class mcache_ghost : public mcache_entry { public: mcache_ghost(const monster_info& mon); -#if TAG_MAJOR_VERSION == 32 - mcache_ghost(reader &th); -#endif virtual const dolls_data *doll() const; @@ -113,9 +88,6 @@ class mcache_demon : public mcache_entry { public: mcache_demon(const monster_info& minf); -#if TAG_MAJOR_VERSION == 32 - mcache_demon(reader &th); -#endif virtual int info(tile_draw_info *dinfo) const; @@ -231,54 +203,6 @@ mcache_entry *mcache_manager::get(tileidx_t tile) return (entry); } -#if TAG_MAJOR_VERSION == 32 -void mcache_manager::read(reader &th) -{ - unsigned int size = unmarshallInt(th); - m_entries.reserve(size); - m_entries.clear(); - - for (unsigned int i = 0; i < size; i++) - { - char type = unmarshallByte(th); - - mcache_entry *entry; - switch (type) - { - case MCACHE_MONSTER: - entry = new mcache_monster(th); - break; - case MCACHE_DRACO: - entry = new mcache_draco(th); - break; - case MCACHE_GHOST: - entry = new mcache_ghost(th); - break; - case MCACHE_DEMON: - entry = new mcache_demon(th); - break; - default: - die("Invalid streamed mcache type."); - case MCACHE_NULL: - entry = NULL; - break; - } - - m_entries.push_back(entry); - } -} -#endif - -///////////////////////////////////////////////////////////////////////////// -// mcache_entry - -#if TAG_MAJOR_VERSION == 32 -mcache_entry::mcache_entry(reader &th) -{ - m_ref_count = unmarshallInt(th); -} -#endif - ///////////////////////////////////////////////////////////////////////////// // mcache_monster @@ -578,14 +502,6 @@ bool mcache_monster::valid(const monster_info& mon) return get_weapon_offset(mon_tile, &ox, &oy); } -#if TAG_MAJOR_VERSION == 32 -mcache_monster::mcache_monster(reader &th) : mcache_entry(th) -{ - m_mon_tile = unmarshallInt(th); - m_equ_tile = unmarshallInt(th); -} -#endif - ///////////////////////////////////////////////////////////////////////////// // mcache_draco @@ -617,15 +533,6 @@ bool mcache_draco::valid(const monster_info& mon) return (mons_is_draconian(mon.type)); } -#if TAG_MAJOR_VERSION == 32 -mcache_draco::mcache_draco(reader &th) : mcache_entry(th) -{ - m_mon_tile = unmarshallInt(th); - m_job_tile = unmarshallInt(th); - m_equ_tile = unmarshallInt(th); -} -#endif - ///////////////////////////////////////////////////////////////////////////// // mcache_ghost @@ -769,13 +676,6 @@ bool mcache_ghost::valid(const monster_info& mon) return (mons_is_pghost(mon.type)); } -#if TAG_MAJOR_VERSION == 32 -mcache_ghost::mcache_ghost(reader &th) : mcache_entry(th) -{ - unmarshallDoll(th, m_doll); -} -#endif - bool mcache_ghost::transparent() const { return (true); @@ -826,11 +726,4 @@ bool mcache_demon::valid(const monster_info& mon) return (mon.type == MONS_PANDEMONIUM_LORD); } -#if TAG_MAJOR_VERSION == 32 -mcache_demon::mcache_demon(reader &th) : mcache_entry(th) -{ - unmarshallDemon(th, m_demon); -} -#endif - #endif diff --git a/crawl-ref/source/tilemcache.h b/crawl-ref/source/tilemcache.h index 3ea091e..9807f4d 100644 --- a/crawl-ref/source/tilemcache.h +++ b/crawl-ref/source/tilemcache.h @@ -55,9 +55,6 @@ public: virtual bool transparent() const { return false; } protected: -#if TAG_MAJOR_VERSION == 32 - mcache_entry(reader &th); -#endif // ref count in backstore int m_ref_count; @@ -74,9 +71,6 @@ public: void clear_nonref(); void clear_all(); -#if TAG_MAJOR_VERSION == 32 - void read(reader &th); -#endif bool empty() { return m_entries.empty(); } protected: -- Dungeon Crawl Stone Soup |