Browse Source

mpqapi_get_hash_index bin exact

pull/959/head
qndel 5 years ago committed by Anders Jenbo
parent
commit
bb54ed00e4
  1. 18
      Source/mpqapi.cpp

18
Source/mpqapi.cpp

@ -251,16 +251,24 @@ static int mpqapi_find_free_block(int size, int *block_size)
return result; return result;
} }
static int mpqapi_get_hash_index(short index, int hash_a, int hash_b, int locale) static int mpqapi_get_hash_index(int index, int hash_a, int hash_b, int locale)
{ {
int idx, i; DWORD idx, i;
i = 2048; i = 2048;
for (idx = index & 0x7FF; sgpHashTbl[idx].block != -1; idx = (idx + 1) & 0x7FF) { for (idx = index & 0x7FF; sgpHashTbl[idx].block != -1; idx = (idx + 1) & 0x7FF) {
if (!i--) if (i-- == 0)
break; break;
if (sgpHashTbl[idx].hashcheck[0] == hash_a && sgpHashTbl[idx].hashcheck[1] == hash_b && sgpHashTbl[idx].lcid == locale && sgpHashTbl[idx].block != -2) if (sgpHashTbl[idx].hashcheck[0] != hash_a)
return idx; continue;
if (sgpHashTbl[idx].hashcheck[1] != hash_b)
continue;
if (sgpHashTbl[idx].lcid != locale)
continue;
if (sgpHashTbl[idx].block != -2)
continue;
return idx;
} }
return -1; return -1;

Loading…
Cancel
Save