Skip to content

Commit

Permalink
Splitting CheckInvPaste() into smaller functions (#6984)
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgomes28 authored Apr 20, 2024
1 parent a4d8aea commit 7848ab7
Show file tree
Hide file tree
Showing 12 changed files with 294 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ void DrawInfoBox(const Surface &out)
GetObjectStr(*ObjectUnderCursor);
if (pcursmonst != -1) {
if (leveltype != DTYPE_TOWN) {
const auto &monster = Monsters[pcursmonst];
const Monster &monster = Monsters[pcursmonst];
InfoColor = UiFlags::ColorWhite;
InfoString = monster.name();
if (monster.isUnique()) {
Expand Down
6 changes: 3 additions & 3 deletions Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void FindItemOrObject()

continue;
}
auto &item = Items[itemId];
Item &item = Items[itemId];
if (item.isEmpty() || item._iSelFlag == 0) {
continue;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ void FindRangedTarget()

for (size_t i = 0; i < ActiveMonsterCount; i++) {
int mi = ActiveMonsters[i];
const auto &monster = Monsters[mi];
const Monster &monster = Monsters[mi];

if (!CanTargetMonster(monster))
continue;
Expand Down Expand Up @@ -332,7 +332,7 @@ void FindMeleeTarget()

if (dMonster[dx][dy] != 0) {
const int mi = std::abs(dMonster[dx][dy]) - 1;
const auto &monster = Monsters[mi];
const Monster &monster = Monsters[mi];
if (CanTargetMonster(monster)) {
const bool newCanTalk = CanTalkToMonst(monster);
if (pcursmonst != -1 && !canTalk && newCanTalk)
Expand Down
2 changes: 1 addition & 1 deletion Source/controls/touch/renderers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ VirtualGamepadButtonType PrimaryActionButtonRenderer::GetTownButtonType()
VirtualGamepadButtonType PrimaryActionButtonRenderer::GetDungeonButtonType()
{
if (pcursmonst != -1) {
const auto &monster = Monsters[pcursmonst];
const Monster &monster = Monsters[pcursmonst];
if (M_Talker(monster) || monster.talkMsg != TEXT_NONE)
return GetTalkButtonType(virtualPadButton->isHeld);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/diablo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ void UnstuckChargers()
}
}
for (size_t i = 0; i < ActiveMonsterCount; i++) {
auto &monster = Monsters[ActiveMonsters[i]];
Monster &monster = Monsters[ActiveMonsters[i]];
if (monster.mode == MonsterMode::Charge)
monster.mode = MonsterMode::Stand;
}
Expand All @@ -1400,7 +1400,7 @@ void UnstuckChargers()
void UpdateMonsterLights()
{
for (size_t i = 0; i < ActiveMonsterCount; i++) {
auto &monster = Monsters[ActiveMonsters[i]];
Monster &monster = Monsters[ActiveMonsters[i]];

if ((monster.flags & MFLAG_BERSERK) != 0) {
int lightRadius = leveltype == DTYPE_NEST ? 9 : 3;
Expand Down
Loading

0 comments on commit 7848ab7

Please sign in to comment.