mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07:57 +03:00
Archive the weapon clip amount in persistent data
This commit is contained in:
parent
6675a491be
commit
98c61529b9
1 changed files with 14 additions and 0 deletions
|
@ -2214,11 +2214,25 @@ void Sentient::ArchivePersistantData(Archiver& arc)
|
||||||
error("ArchivePersistantData", "Non Item in inventory\n");
|
error("ArchivePersistantData", "Non Item in inventory\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arc.ArchiveString(&name);
|
arc.ArchiveString(&name);
|
||||||
arc.ArchiveInteger(&amount);
|
arc.ArchiveInteger(&amount);
|
||||||
if (arc.Loading()) {
|
if (arc.Loading()) {
|
||||||
item = giveItem(name, amount);
|
item = giveItem(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item && item->IsSubclassOfWeapon()) {
|
||||||
|
Weapon* pWeap = static_cast<Weapon*>(item);
|
||||||
|
|
||||||
item->CancelEventsOfType(EV_Weapon_GiveStartingAmmo);
|
item->CancelEventsOfType(EV_Weapon_GiveStartingAmmo);
|
||||||
|
if (arc.Saving()) {
|
||||||
|
amount = pWeap->ClipAmmo(FIRE_PRIMARY);
|
||||||
|
}
|
||||||
|
arc.ArchiveInteger(&amount);
|
||||||
|
|
||||||
|
if (arc.Loading()) {
|
||||||
|
pWeap->SetAmmoAmount(amount, FIRE_PRIMARY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue