Browse Source

Update GetObjectStr to take a const Object&

Brings it in line with GetItemStr
pull/3355/head
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
d2940e8f7f
  1. 2
      Source/control.cpp
  2. 18
      Source/objects.cpp
  3. 6
      Source/objects.h

2
Source/control.cpp

@ -1386,7 +1386,7 @@ void DrawInfoBox(const Surface &out)
if (pcursitem != -1)
GetItemStr(Items[pcursitem]);
else if (pcursobj != -1)
GetObjectStr(pcursobj);
GetObjectStr(Objects[pcursobj]);
if (pcursmonst != -1) {
if (leveltype != DTYPE_TOWN) {
const auto &monster = Monsters[pcursmonst];

18
Source/objects.cpp

@ -5332,9 +5332,9 @@ void SyncObjectAnim(Object &object)
}
}
void GetObjectStr(int i)
void GetObjectStr(const Object &object)
{
switch (Objects[i]._otype) {
switch (object._otype) {
case OBJ_CRUX1:
case OBJ_CRUX2:
case OBJ_CRUX3:
@ -5350,11 +5350,11 @@ void GetObjectStr(int i)
case OBJ_L2RDOOR:
case OBJ_L3LDOOR:
case OBJ_L3RDOOR:
if (Objects[i]._oVar4 == 1)
if (object._oVar4 == 1)
strcpy(infostr, _("Open Door"));
if (Objects[i]._oVar4 == 0)
if (object._oVar4 == 0)
strcpy(infostr, _("Closed Door"));
if (Objects[i]._oVar4 == 2)
if (object._oVar4 == 2)
strcpy(infostr, _("Blocked Door"));
break;
case OBJ_BOOK2L:
@ -5406,7 +5406,7 @@ void GetObjectStr(int i)
break;
case OBJ_SHRINEL:
case OBJ_SHRINER:
strcpy(tempstr, fmt::format(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine"), _(ShrineNames[Objects[i]._oVar1])).c_str());
strcpy(tempstr, fmt::format(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine"), _(ShrineNames[object._oVar1])).c_str());
strcpy(infostr, tempstr);
break;
case OBJ_SKELBOOK:
@ -5456,7 +5456,7 @@ void GetObjectStr(int i)
strcpy(infostr, _("Pedestal of Blood"));
break;
case OBJ_STORYBOOK:
strcpy(infostr, _(StoryBookName[Objects[i]._oVar3]));
strcpy(infostr, _(StoryBookName[object._oVar3]));
break;
case OBJ_WEAPONRACK:
strcpy(infostr, _("Weapon Rack"));
@ -5474,13 +5474,13 @@ void GetObjectStr(int i)
break;
}
if (Players[MyPlayerId]._pClass == HeroClass::Rogue) {
if (Objects[i]._oTrapFlag) {
if (object._oTrapFlag) {
strcpy(tempstr, fmt::format(_(/* TRANSLATORS: {:s} will either be a chest or a door */ "Trapped {:s}"), infostr).c_str());
strcpy(infostr, tempstr);
InfoColor = UiFlags::ColorRed;
}
}
if (Objects[i].IsDisabled()) {
if (object.IsDisabled()) {
strcpy(tempstr, fmt::format(_(/* TRANSLATORS: If user enabled diablo.ini setting "Disable Crippling Shrines" is set to 1; also used for Na-Kruls leaver */ "{:s} (disabled)"), infostr).c_str());
strcpy(infostr, tempstr);
InfoColor = UiFlags::ColorRed;

6
Source/objects.h

@ -169,7 +169,11 @@ void SyncOpObject(int pnum, int cmd, int i);
void BreakObject(int pnum, int oi);
void SyncBreakObj(int pnum, int oi);
void SyncObjectAnim(Object &object);
void GetObjectStr(int i);
/**
* @brief Updates the text drawn in the info box to describe the given object
* @param object The currently highlighted object
*/
void GetObjectStr(const Object &object);
void OperateNakrulLever();
void SyncNakrulRoom();
void AddNakrulLeaver();

Loading…
Cancel
Save