summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2023-12-31 14:28:09 +0100
committerAetias <aetias@outlook.com>2023-12-31 14:28:09 +0100
commit61dea7280f942e156dbc111584fb05c8eb47d246 (patch)
tree8825125676483d6f1a0c1bcc8b7f96bf4ad99fba /src
parent0ab53a2adf0c5b97acb742f9ee4bec00c207ada8 (diff)
96% match `Inventory::Save`
Diffstat (limited to 'src')
-rw-r--r--src/Inventory.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index ad6622af..4ab8ec08 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -39,13 +39,23 @@ NONMATCH void Inventory::Save(SaveInventory *save) {
for (s32 i = 0; i < Gem_COUNT; ++i) {
save->numGems[i] = this->mNumGems[i];
}
- for (s32 i = 0, j = 0; i < ShipPart_COUNT; ++i, j = 0) {
+ u8 *saveEquippedParts = save->equippedShipParts;
+ const u32 *equippedParts = this->mEquippedShipParts;
+
+ s32 i = 0;
+ SaveInventory *save2 = save;
+ Inventory *this2 = this;
+ ShipParts (Inventory::*shipParts)[ShipPart_COUNT] = &Inventory::mShipParts;
+ for (; i < ShipPart_COUNT; ++i) {
save->equippedShipParts[i] = this->mEquippedShipParts[i];
- do {
- save->shipParts[i].parts[j] = this->mShipParts[i].parts[j];
- ++j;
- } while (j < ShipType_COUNT);
+ for (s32 j = 0; j < ShipType_COUNT; ++j) {
+ u8 shipPartCount = ((Inventory*) ((u32)this2 + j)->*shipParts)[0].parts[0];
+ ((SaveInventory*) ((u32)save2 + j))->shipParts[0].parts[0] = shipPartCount;
+ }
+ this2 = (Inventory*) ((u32)this2 + sizeof(this2->mShipParts[0]));
+ save2 = (SaveInventory*) ((u32)save2 + sizeof(save2->shipParts[0]));
}
+
save->shipPartPricesShown = this->mShipPartPricesShown;
for (s32 i = 0; i < Treasure_COUNT; ++i) {
save->treasure[i] = this->mTreasure[i];