Fixed broken GetProto() function (again)

This commit is contained in:
NovaRain
2021-02-10 23:52:56 +08:00
parent 6d7ef3c76b
commit 7ce7f4db27
3 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -534,16 +534,16 @@ Queue* QueueFind(TGameObj* object, long type) {
long AnimCodeByWeapon(TGameObj* weapon) {
if (weapon != nullptr) {
sProto* proto = nullptr;
if (GetProto(weapon->protoId, proto) && proto->item.type == item_type_weapon) {
sProto* proto;
if (GetProto(weapon->protoId, &proto) && proto->item.type == item_type_weapon) {
return proto->item.weapon.animationCode;
}
}
return 0;
}
bool GetProto(long pid, sProto* outProto) {
return (fo_proto_ptr(pid, &outProto) != -1);
bool GetProto(long pid, sProto** outProto) {
return (fo_proto_ptr(pid, outProto) != -1);
}
void SkillGetTags(long* result, long num) {
+1 -1
View File
@@ -508,7 +508,7 @@ Queue* QueueFind(TGameObj* object, long type);
long AnimCodeByWeapon(TGameObj* weapon);
// returns False if the prototype does not exist, or pointer to prototype by PID in the outProto argument
bool GetProto(long pid, sProto* outProto);
bool GetProto(long pid, sProto** outProto);
// returns pointer to prototype by PID, or nullptr on get failure
// NOTE: not an efficient construction
+3 -3
View File
@@ -101,12 +101,12 @@ DWORD __stdcall sfgame_adjust_fid() {
// vanilla logic:
indexNum = *ptr_art_vault_guy_num;
sProto* critterPro;
if (GetProto(*ptr_inven_pid, critterPro)) {
if (GetProto(*ptr_inven_pid, &critterPro)) {
indexNum = critterPro->fid & 0xFFF;
}
if (*ptr_i_worn != nullptr) {
sProto* armorPro;
GetProto((*ptr_i_worn)->protoId, armorPro);
GetProto((*ptr_i_worn)->protoId, &armorPro);
DWORD armorFid = fo_stat_level(*ptr_inven_dude, STAT_gender) == GENDER_FEMALE
? armorPro->item.armor.femaleFID
: armorPro->item.armor.maleFID;
@@ -122,7 +122,7 @@ DWORD __stdcall sfgame_adjust_fid() {
if (itemInHand != nullptr) {
sProto* itemPro;
if (GetProto(itemInHand->protoId, itemPro) && itemPro->item.type == item_type_weapon) {
if (GetProto(itemInHand->protoId, &itemPro) && itemPro->item.type == item_type_weapon) {
weaponAnimCode = itemPro->item.weapon.animationCode;
}
}