diff --git a/src/gamedata.cpp b/src/gamedata.cpp index 116c7f41e6..592974ae8f 100644 --- a/src/gamedata.cpp +++ b/src/gamedata.cpp @@ -143,13 +143,13 @@ void gamedata::set_counter(word change, byte c) if(c>=MAX_COUNTERS) // Sanity check return; - flushItemCache(true); - if(game!=NULL) { int32_t ringID=current_item_id(itype_ring, true); _counter[c]=zc_max(change, 0); + flushItemCache(true); + // ringcolor is very slow, so make sure the ring has actually changed if(ringID!=current_item_id(itype_ring, true)) ringcolor(false); @@ -168,14 +168,14 @@ void gamedata::change_counter(int16_t change, byte c) if(c>=MAX_COUNTERS) // Sanity check return; - - flushItemCache(true); if(game!=NULL) { int32_t ringID=current_item_id(itype_ring, true); _counter[c]=vbound(_counter[c]+change, 0, _maxcounter[c]); + flushItemCache(true); + if(ringID!=current_item_id(itype_ring, true)) ringcolor(false); } diff --git a/src/new_subscr.cpp b/src/new_subscr.cpp index 579b6021b3..68a9fabb6e 100644 --- a/src/new_subscr.cpp +++ b/src/new_subscr.cpp @@ -67,6 +67,21 @@ void refresh_subscr_items() { subscr_item_clk = 0; subscr_itemless = false; + if(replay_version_check(0,19)) + { + //This needs to be here for the item cache to be correct... + for(int i = 0; i < itype_max; ++i) + { + switch(i) + { + case itype_map: + case itype_compass: + case itype_bosskey: + continue; + } + current_item_id(i,false); + } + } } void kill_subscr_items() diff --git a/src/zc/zc_sys.cpp b/src/zc/zc_sys.cpp index bf4619993e..64249ec504 100644 --- a/src/zc/zc_sys.cpp +++ b/src/zc/zc_sys.cpp @@ -2287,7 +2287,7 @@ int32_t _c_item_id_internal(int32_t itemtype, bool checkmagic, bool jinx_check) jinx_check = false; //not jinxed } if(itemtype == itype_ring) checkmagic = true; - if (!jinx_check) + if (!jinx_check && (use_cost_cache || itemtype != itype_ring)) { auto& cache = checkmagic && use_cost_cache ? itemcache_cost : itemcache; auto res = cache.find(itemtype); @@ -2305,8 +2305,7 @@ int32_t _c_item_id_internal(int32_t itemtype, bool checkmagic, bool jinx_check) { if(checkmagic && itemtype != itype_magicring) if(!checkmagiccost(i)) - if ( !get_qr(qr_NEVERDISABLEAMMOONSUBSCREEN) ) - continue; //don't make items with a magic cost vanish!! -Z + continue; if(jinx_check && (usesSwordJinx(i) ? HeroSwordClk() : HeroItemClk())) if(!(itemsbuf[i].flags & ITEM_JINX_IMMUNE)) continue;