From: Rudolf Polzer Date: Fri, 11 Oct 2013 05:43:14 +0000 (+0200) Subject: Fix bug in begin handling. X-Git-Tag: xonotic-v0.8.0~256^2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9dc0ef36500d63d54b7e6810c7c0bcc5691db13b;p=xonotic%2Fxonotic-data.pk3dir.git Fix bug in begin handling. --- diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index 8b6139cff..9b943b16d 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -702,6 +702,11 @@ void XonoticServerList_draw(entity me) // invariant in the binary search and thus has // to be handled separately. print(sprintf("hit: x='%d', dc='%d', first='%d', last='%d', catf='%d', catl='%d'.\n", x, category_draw_count, first, last, catf, catl)); + if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != x) + error("Category mismatch I"); + if(first > 0) + if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == x) + error("Category mismatch II"); category_name[category_draw_count] = x; category_item[category_draw_count] = first; ++category_draw_count; @@ -730,12 +735,19 @@ void XonoticServerList_draw(entity me) } if (catl == x) { print(sprintf("hit: x='%d', dc='%d', first='%d', last='%d', catf='%d', catl='%d'.\n", x, category_draw_count, first, last, catf, catl)); + if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != x) + error("Category mismatch III"); + if(last > 0) + if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == x) + error("Category mismatch IV"); category_name[category_draw_count] = x; category_item[category_draw_count] = last; ++category_draw_count; ++me.nItems; + begin = last + 1; // already scanned through these, skip 'em } - begin = last + 1; // already scanned through these, skip 'em + else + begin = last; // already scanned through these, skip 'em } }