Skip to content

Commit

Permalink
rename numPremiumItems
Browse files Browse the repository at this point in the history
numPremiumsItems remains a non-class variable in the store refactor PR.
  • Loading branch information
kphoenix137 committed Sep 20, 2024
1 parent 321e738 commit a86a366
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4397,14 +4397,14 @@ void SpawnPremium(const Player &player)
{
int lvl = player.getCharacterLevel();
int maxItems = gbIsHellfire ? SMITH_PREMIUM_ITEMS : 6;
if (numPremiumItems < maxItems) {
if (NumPremiumItems < maxItems) {
for (int i = 0; i < maxItems; i++) {
if (premiumItem[i].isEmpty()) {
int plvl = premiumItemLevel + (gbIsHellfire ? premiumLvlAddHellfire[i] : premiumlvladd[i]);
SpawnOnePremium(premiumItem[i], plvl, player);
}
}
numPremiumItems = maxItems;
NumPremiumItems = maxItems;
}
while (premiumItemLevel < lvl) {
premiumItemLevel++;
Expand Down
4 changes: 2 additions & 2 deletions Source/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@ void LoadGame(bool firstflag)
memset(dLight, 0, sizeof(dLight));
}

numPremiumItems = file.NextBE<int32_t>();
NumPremiumItems = file.NextBE<int32_t>();
premiumItemLevel = file.NextBE<int32_t>();

for (int i = 0; i < giNumberOfSmithPremiumItems; i++)
Expand Down Expand Up @@ -2786,7 +2786,7 @@ void SaveGameData(SaveWriter &saveWriter)
}
}

file.WriteBE<int32_t>(numPremiumItems);
file.WriteBE<int32_t>(NumPremiumItems);
file.WriteBE<int32_t>(premiumItemLevel);

for (int i = 0; i < giNumberOfSmithPremiumItems; i++)
Expand Down
6 changes: 3 additions & 3 deletions Source/stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int8_t playerItemIndexes[48];
Item playerItem[48];

Item smithItem[SMITH_ITEMS];
int numPremiumItems;
int NumPremiumItems;
int premiumItemLevel;
Item premiumItem[SMITH_PREMIUM_ITEMS];

Expand Down Expand Up @@ -1374,7 +1374,7 @@ void SmithBuyPItem(Item &item)
}

premiumItem[xx].clear();
numPremiumItems--;
NumPremiumItems--;
SpawnPremium(*MyPlayer);
}

Expand Down Expand Up @@ -2112,7 +2112,7 @@ void InitStores()
activeStore = TalkID::None;
isTextFullSize = false;
hasScrollbar = false;
numPremiumItems = 0;
NumPremiumItems = 0;
premiumItemLevel = 1;

for (auto &premiumitem : premiumItem)
Expand Down
2 changes: 1 addition & 1 deletion Source/stores.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern DVL_API_FOR_TEST Item playerItem[48];
/** Items sold by Griswold */
extern Item smithItem[SMITH_ITEMS];
/** Number of premium items for sale by Griswold */
extern int numPremiumItems;
extern int NumPremiumItems;
/** Base level of current premium items sold by Griswold */
extern int premiumItemLevel;
/** Premium items sold by Griswold */
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/memory_map/game.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ M_DL 12544 8 dLight
M_DL 12544 8 dPreLight
M_DL 1600 8 AutomapView
M_DL 12544 8 dMissile
R 32 numPremiumItems
R 32 NumPremiumItems
R 32 premiumItemLevel
C_DA 6 item PremiumItems
C_HF 15 item PremiumItems
Expand Down

0 comments on commit a86a366

Please sign in to comment.