Browse Source

mpqapi_add_file cleanup

pull/256/head
qndel 7 years ago committed by Anders Jenbo
parent
commit
f473ffbe7f
  1. 9
      Source/mpqapi.cpp

9
Source/mpqapi.cpp

@ -266,17 +266,12 @@ _BLOCKENTRY *mpqapi_add_file(const char *pszName, _BLOCKENTRY *pBlk, int block_i
h3 = Hash(pszName, 2);
if (mpqapi_get_hash_index(h1, h2, h3, 0) != -1)
app_fatal("Hash collision between \"%s\" and existing file\n", pszName);
i = 2048;
hIdx = h1 & 0x7FF;
while (1) {
i--;
i = 2048;
while (i--) {
if (sgpHashTbl[hIdx].block == -1 || sgpHashTbl[hIdx].block == -2)
break;
hIdx = (hIdx + 1) & 0x7FF;
if (!i) {
i = -1;
break;
}
}
if (i < 0)
app_fatal("Out of hash space");

Loading…
Cancel
Save