Returns a hash table entry in the following order: 1) A hash table entry with the preferred locale and platform 2) A hash table entry with the neutral|matching locale and neutral|matching platform 3) NULL Storm_2016.dll: 15020940
| 618 | // 3) NULL |
| 619 | // Storm_2016.dll: 15020940 |
| 620 | static TMPQHash * GetHashEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale, BYTE Platform) |
| 621 | { |
| 622 | TMPQHash * pFirstHash = GetFirstHashEntry(ha, szFileName); |
| 623 | TMPQHash * pBestEntry = NULL; |
| 624 | TMPQHash * pHash = pFirstHash; |
| 625 | |
| 626 | // Parse the found hashes |
| 627 | while(pHash != NULL) |
| 628 | { |
| 629 | // Storm_2016.dll: 150209CB |
| 630 | // If the hash entry matches both locale and platform, return it immediately |
| 631 | // Note: We only succeed this check if the locale is non-neutral, because |
| 632 | // some Warcraft III maps have several items with neutral locale&platform, which leads |
| 633 | // to wrong item being returned |
| 634 | if((lcLocale || Platform) && pHash->lcLocale == lcLocale && pHash->Platform == Platform) |
| 635 | return pHash; |
| 636 | |
| 637 | // Storm_2016.dll: 150209D9 |
| 638 | // If (locale matches or is neutral) OR (platform matches or is neutral) |
| 639 | // remember this as the best entry |
| 640 | if(pHash->lcLocale == 0 || pHash->lcLocale == lcLocale) |
| 641 | { |
| 642 | if(pHash->Platform == 0 || pHash->Platform == Platform) |
| 643 | pBestEntry = pHash; |
| 644 | } |
| 645 | |
| 646 | // Get the next hash entry for that file |
| 647 | pHash = GetNextHashEntry(ha, pFirstHash, pHash); |
| 648 | } |
| 649 | |
| 650 | // At the end, return neutral hash (if found), otherwise NULL |
| 651 | return pBestEntry; |
| 652 | } |
| 653 | |
| 654 | // Returns a hash table entry in the following order: |
| 655 | // 1) A hash table entry with the preferred locale |
no test coverage detected