mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
SAGA2: Use Common::HashMap for active items hash
This commit is contained in:
parent
f9ecdb80ae
commit
f930e14188
@ -2457,8 +2457,7 @@ void WorldMapData::buildInstanceHash(void) {
|
||||
+ ai->instance.v + (ai->instance.groupID << 2))
|
||||
% elementsof(instHash);
|
||||
|
||||
ai->nextHash = instHash[hashVal];
|
||||
instHash[hashVal] = ai;
|
||||
itemHash.setVal(hashVal, ai);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2472,17 +2471,9 @@ ActiveItem *WorldMapData::findHashedInstance(
|
||||
int16 group) {
|
||||
int16 hashVal = (((tp.u + tp.z) << 4) + tp.v + (group << 2))
|
||||
% elementsof(instHash);
|
||||
ActiveItem *ai;
|
||||
if (itemHash.contains(hashVal))
|
||||
return itemHash.getVal(hashVal);
|
||||
|
||||
for (ai = instHash[hashVal];
|
||||
ai;
|
||||
ai = ai->nextHash) {
|
||||
if (ai->instance.u == tp.u
|
||||
&& ai->instance.v == tp.v
|
||||
&& ai->instance.h == tp.z
|
||||
&& ai->instance.groupID == group)
|
||||
return ai;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -867,6 +867,7 @@ struct WorldMapData {
|
||||
RipTableIDPtr ripTableIDList; // MetaTile object ripping
|
||||
|
||||
ActiveItem *instHash[513]; // ActiveItem hash table
|
||||
Common::HashMap<int16, ActiveItem*> itemHash;
|
||||
|
||||
int16 metaCount, // Number of MetaTiles
|
||||
activeCount; // Number of ActiveItems
|
||||
|
Loading…
Reference in New Issue
Block a user