Browse Source

Change infostr from char[128] to std::string

pull/4207/head
Anders Jenbo 4 years ago
parent
commit
6d28810dc7
  1. 33
      Source/control.cpp
  2. 2
      Source/control.h
  3. 2
      Source/controls/plrctrls.cpp
  4. 4
      Source/cursor.cpp
  5. 6
      Source/inv.cpp
  6. 6
      Source/items.cpp
  7. 86
      Source/objects.cpp
  8. 10
      Source/panels/spell_list.cpp
  9. 4
      Source/qol/stash.cpp
  10. 2
      Source/quests.cpp
  11. 58
      Source/trigs.cpp

33
Source/control.cpp

@ -8,6 +8,7 @@
#include <algorithm>
#include <array>
#include <cstddef>
#include <string>
#include <fmt/format.h>
@ -73,7 +74,7 @@ bool talkflag;
bool sbookflag;
bool chrflag;
bool drawbtnflag;
char infostr[128];
std::string InfoString;
bool panelflag;
int initialDropGoldValue;
bool panbtndown;
@ -253,8 +254,8 @@ void PrintInfo(const Surface &out)
Rectangle line { { PANEL_X + 177, PANEL_Y + LineStart[pnumlines] }, { 288, 12 } };
if (infostr[0] != '\0') {
DrawString(out, infostr, line, InfoColor | UiFlags::AlignCenter | UiFlags::KerningFitSpacing, 2);
if (!InfoString.empty()) {
DrawString(out, InfoString, line, InfoColor | UiFlags::AlignCenter | UiFlags::KerningFitSpacing, 2);
line.position.y += LineHeights[pnumlines];
}
@ -567,7 +568,7 @@ void InitControlPan()
buttonEnabled = false;
chrbtnactive = false;
pDurIcons = LoadCel("Items\\DurIcons.CEL", 32);
strcpy(infostr, "");
InfoString.clear();
ClearPanel();
drawhpflag = true;
drawmanaflag = true;
@ -694,12 +695,12 @@ void CheckPanelInfo()
int yend = PanBtnPos[i].y + mainPanelPosition.y + PanBtnPos[i].h;
if (MousePosition.x >= PanBtnPos[i].x + mainPanelPosition.x && MousePosition.x <= xend && MousePosition.y >= PanBtnPos[i].y + mainPanelPosition.y && MousePosition.y <= yend) {
if (i != 7) {
CopyUtf8(infostr, _(PanBtnStr[i]), sizeof(infostr));
InfoString = _(PanBtnStr[i]);
} else {
if (gbFriendlyMode)
CopyUtf8(infostr, _("Player friendly"), sizeof(infostr));
InfoString = _("Player friendly");
else
CopyUtf8(infostr, _("Player attack"), sizeof(infostr));
InfoString = _("Player attack");
}
if (PanBtnHotKey[i] != nullptr) {
AddPanelString(fmt::format(_("Hotkey: {:s}"), _(PanBtnHotKey[i])));
@ -709,7 +710,7 @@ void CheckPanelInfo()
}
}
if (!spselflag && MousePosition.x >= 565 + mainPanelPosition.x && MousePosition.x < 621 + mainPanelPosition.x && MousePosition.y >= 64 + mainPanelPosition.y && MousePosition.y < 120 + mainPanelPosition.y) {
CopyUtf8(infostr, _("Select current spell button"), sizeof(infostr));
InfoString = _("Select current spell button");
InfoColor = UiFlags::ColorWhite;
panelflag = true;
AddPanelString(_("Hotkey: 's'"));
@ -850,7 +851,7 @@ void DrawInfoBox(const Surface &out)
{
DrawPanelBox(out, { 177, 62, 288, 60 }, { PANEL_X + 177, PANEL_Y + 46 });
if (!panelflag && !trigflag && pcursinvitem == -1 && pcursstashitem == uint16_t(-1) && !spselflag) {
infostr[0] = '\0';
InfoString.clear();
InfoColor = UiFlags::ColorWhite;
ClearPanel();
}
@ -860,15 +861,15 @@ void DrawInfoBox(const Surface &out)
auto &myPlayer = Players[MyPlayerId];
if (myPlayer.HoldItem._itype == ItemType::Gold) {
int nGold = myPlayer.HoldItem._ivalue;
CopyUtf8(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold), sizeof(infostr));
InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold);
} else if (!myPlayer.CanUseItem(myPlayer.HoldItem)) {
ClearPanel();
AddPanelString(_("Requirements not met"));
} else {
if (myPlayer.HoldItem._iIdentified)
strcpy(infostr, myPlayer.HoldItem._iIName);
InfoString = myPlayer.HoldItem._iIName;
else
strcpy(infostr, myPlayer.HoldItem._iName);
InfoString = myPlayer.HoldItem._iName;
InfoColor = myPlayer.HoldItem.getTextColor();
}
} else {
@ -880,7 +881,7 @@ void DrawInfoBox(const Surface &out)
if (leveltype != DTYPE_TOWN) {
const auto &monster = Monsters[pcursmonst];
InfoColor = UiFlags::ColorWhite;
CopyUtf8(infostr, monster.mName, sizeof(infostr));
InfoString = monster.mName;
ClearPanel();
if (monster._uniqtype != 0) {
InfoColor = UiFlags::ColorWhitegold;
@ -889,19 +890,19 @@ void DrawInfoBox(const Surface &out)
PrintMonstHistory(monster.MType->mtype);
}
} else if (pcursitem == -1) {
CopyUtf8(infostr, Towners[pcursmonst].name, sizeof(infostr));
InfoString = std::string(Towners[pcursmonst].name);
}
}
if (pcursplr != -1) {
InfoColor = UiFlags::ColorWhitegold;
auto &target = Players[pcursplr];
strcpy(infostr, target._pName);
InfoString = target._pName;
ClearPanel();
AddPanelString(fmt::format(_("{:s}, Level: {:d}"), _(ClassStrTbl[static_cast<std::size_t>(target._pClass)]), target._pLevel));
AddPanelString(fmt::format(_("Hit Points {:d} of {:d}"), target._pHitPoints >> 6, target._pMaxHP >> 6));
}
}
if (infostr[0] != '\0' || pnumlines != 0)
if (!InfoString.empty() || pnumlines != 0)
PrintInfo(out);
}

2
Source/control.h

@ -47,7 +47,7 @@ extern bool talkflag;
extern bool sbookflag;
extern bool chrflag;
extern bool drawbtnflag;
extern char infostr[128];
extern std::string InfoString;
extern bool panelflag;
extern int initialDropGoldValue;
extern bool panbtndown;

2
Source/controls/plrctrls.cpp

@ -1486,7 +1486,7 @@ void plrctrls_after_check_curs_move()
return;
}
if (!invflag) {
*infostr = '\0';
InfoString.clear();
ClearPanel();
FindActor();
FindItemOrObject();

4
Source/cursor.cpp

@ -217,7 +217,7 @@ void CheckTown()
if (EntranceBoundaryContains(missile.position.tile, cursPosition)) {
trigflag = true;
ClearPanel();
CopyUtf8(infostr, _("Town Portal"), sizeof(infostr));
InfoString = _("Town Portal");
AddPanelString(fmt::format(_("from {:s}"), Players[missile._misource]._pName));
cursPosition = missile.position.tile;
}
@ -232,7 +232,7 @@ void CheckRportal()
if (EntranceBoundaryContains(missile.position.tile, cursPosition)) {
trigflag = true;
ClearPanel();
CopyUtf8(infostr, _("Portal to"), sizeof(infostr));
InfoString = _("Portal to");
AddPanelString(!setlevel ? _("The Unholy Altar") : _("level 15"));
cursPosition = missile.position.tile;
}

6
Source/inv.cpp

@ -1951,14 +1951,14 @@ int8_t CheckInvHLight()
if (pi->_itype == ItemType::Gold) {
int nGold = pi->_ivalue;
CopyUtf8(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold), sizeof(infostr));
InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold);
} else {
InfoColor = pi->getTextColor();
if (pi->_iIdentified) {
strcpy(infostr, pi->_iIName);
InfoString = pi->_iIName;
PrintItemDetails(*pi);
} else {
strcpy(infostr, pi->_iName);
InfoString = pi->_iName;
PrintItemDur(*pi);
}
}

6
Source/items.cpp

@ -3460,14 +3460,14 @@ void GetItemStr(Item &item)
{
if (item._itype != ItemType::Gold) {
if (item._iIdentified)
strcpy(infostr, item._iIName);
InfoString = item._iIName;
else
strcpy(infostr, item._iName);
InfoString = item._iName;
InfoColor = item.getTextColor();
} else {
int nGold = item._ivalue;
CopyUtf8(infostr, fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold), sizeof(infostr));
InfoString = fmt::format(ngettext("{:d} gold piece", "{:d} gold pieces", nGold), nGold);
}
}

86
Source/objects.cpp

@ -5389,11 +5389,11 @@ void GetObjectStr(const Object &object)
case OBJ_CRUX1:
case OBJ_CRUX2:
case OBJ_CRUX3:
CopyUtf8(infostr, _("Crucified Skeleton"), sizeof(infostr));
InfoString = _("Crucified Skeleton");
break;
case OBJ_LEVER:
case OBJ_FLAMELVR:
CopyUtf8(infostr, _("Lever"), sizeof(infostr));
InfoString = _("Lever");
break;
case OBJ_L1LDOOR:
case OBJ_L1RDOOR:
@ -5402,135 +5402,135 @@ void GetObjectStr(const Object &object)
case OBJ_L3LDOOR:
case OBJ_L3RDOOR:
if (object._oVar4 == 1)
CopyUtf8(infostr, _("Open Door"), sizeof(infostr));
InfoString = _("Open Door");
if (object._oVar4 == 0)
CopyUtf8(infostr, _("Closed Door"), sizeof(infostr));
InfoString = _("Closed Door");
if (object._oVar4 == 2)
CopyUtf8(infostr, _("Blocked Door"), sizeof(infostr));
InfoString = _("Blocked Door");
break;
case OBJ_BOOK2L:
if (setlevel) {
if (setlvlnum == SL_BONECHAMB) {
CopyUtf8(infostr, _("Ancient Tome"), sizeof(infostr));
InfoString = _("Ancient Tome");
} else if (setlvlnum == SL_VILEBETRAYER) {
CopyUtf8(infostr, _("Book of Vileness"), sizeof(infostr));
InfoString = _("Book of Vileness");
}
}
break;
case OBJ_SWITCHSKL:
CopyUtf8(infostr, _("Skull Lever"), sizeof(infostr));
InfoString = _("Skull Lever");
break;
case OBJ_BOOK2R:
CopyUtf8(infostr, _("Mythical Book"), sizeof(infostr));
InfoString = _("Mythical Book");
break;
case OBJ_CHEST1:
case OBJ_TCHEST1:
CopyUtf8(infostr, _("Small Chest"), sizeof(infostr));
InfoString = _("Small Chest");
break;
case OBJ_CHEST2:
case OBJ_TCHEST2:
CopyUtf8(infostr, _("Chest"), sizeof(infostr));
InfoString = _("Chest");
break;
case OBJ_CHEST3:
case OBJ_TCHEST3:
case OBJ_SIGNCHEST:
CopyUtf8(infostr, _("Large Chest"), sizeof(infostr));
InfoString = _("Large Chest");
break;
case OBJ_SARC:
CopyUtf8(infostr, _("Sarcophagus"), sizeof(infostr));
InfoString = _("Sarcophagus");
break;
case OBJ_BOOKSHELF:
CopyUtf8(infostr, _("Bookshelf"), sizeof(infostr));
InfoString = _("Bookshelf");
break;
case OBJ_BOOKCASEL:
case OBJ_BOOKCASER:
CopyUtf8(infostr, _("Bookcase"), sizeof(infostr));
InfoString = _("Bookcase");
break;
case OBJ_BARREL:
case OBJ_BARRELEX:
if (currlevel >= 17 && currlevel <= 20) // for hive levels
CopyUtf8(infostr, _("Pod"), sizeof(infostr)); // Then a barrel is called a pod
else if (currlevel >= 21 && currlevel <= 24) // for crypt levels
CopyUtf8(infostr, _("Urn"), sizeof(infostr)); // Then a barrel is called an urn
if (currlevel >= 17 && currlevel <= 20) // for hive levels
InfoString = _("Pod"); // Then a barrel is called a pod
else if (currlevel >= 21 && currlevel <= 24) // for crypt levels
InfoString = _("Urn"); // Then a barrel is called an urn
else
CopyUtf8(infostr, _("Barrel"), sizeof(infostr));
InfoString = _("Barrel");
break;
case OBJ_SHRINEL:
case OBJ_SHRINER:
CopyUtf8(infostr, fmt::format(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine"), _(ShrineNames[object._oVar1])), sizeof(infostr));
InfoString = fmt::format(_(/* TRANSLATORS: {:s} will be a name from the Shrine block above */ "{:s} Shrine"), _(ShrineNames[object._oVar1]));
break;
case OBJ_SKELBOOK:
CopyUtf8(infostr, _("Skeleton Tome"), sizeof(infostr));
InfoString = _("Skeleton Tome");
break;
case OBJ_BOOKSTAND:
CopyUtf8(infostr, _("Library Book"), sizeof(infostr));
InfoString = _("Library Book");
break;
case OBJ_BLOODFTN:
CopyUtf8(infostr, _("Blood Fountain"), sizeof(infostr));
InfoString = _("Blood Fountain");
break;
case OBJ_DECAP:
CopyUtf8(infostr, _("Decapitated Body"), sizeof(infostr));
InfoString = _("Decapitated Body");
break;
case OBJ_BLINDBOOK:
CopyUtf8(infostr, _("Book of the Blind"), sizeof(infostr));
InfoString = _("Book of the Blind");
break;
case OBJ_BLOODBOOK:
CopyUtf8(infostr, _("Book of Blood"), sizeof(infostr));
InfoString = _("Book of Blood");
break;
case OBJ_PURIFYINGFTN:
CopyUtf8(infostr, _("Purifying Spring"), sizeof(infostr));
InfoString = _("Purifying Spring");
break;
case OBJ_ARMORSTAND:
case OBJ_WARARMOR:
CopyUtf8(infostr, _("Armor"), sizeof(infostr));
InfoString = _("Armor");
break;
case OBJ_WARWEAP:
CopyUtf8(infostr, _("Weapon Rack"), sizeof(infostr));
InfoString = _("Weapon Rack");
break;
case OBJ_GOATSHRINE:
CopyUtf8(infostr, _("Goat Shrine"), sizeof(infostr));
InfoString = _("Goat Shrine");
break;
case OBJ_CAULDRON:
CopyUtf8(infostr, _("Cauldron"), sizeof(infostr));
InfoString = _("Cauldron");
break;
case OBJ_MURKYFTN:
CopyUtf8(infostr, _("Murky Pool"), sizeof(infostr));
InfoString = _("Murky Pool");
break;
case OBJ_TEARFTN:
CopyUtf8(infostr, _("Fountain of Tears"), sizeof(infostr));
InfoString = _("Fountain of Tears");
break;
case OBJ_STEELTOME:
CopyUtf8(infostr, _("Steel Tome"), sizeof(infostr));
InfoString = _("Steel Tome");
break;
case OBJ_PEDISTAL:
CopyUtf8(infostr, _("Pedestal of Blood"), sizeof(infostr));
InfoString = _("Pedestal of Blood");
break;
case OBJ_STORYBOOK:
CopyUtf8(infostr, _(StoryBookName[object._oVar3]), sizeof(infostr));
InfoString = _(StoryBookName[object._oVar3]);
break;
case OBJ_WEAPONRACK:
CopyUtf8(infostr, _("Weapon Rack"), sizeof(infostr));
InfoString = _("Weapon Rack");
break;
case OBJ_MUSHPATCH:
CopyUtf8(infostr, _("Mushroom Patch"), sizeof(infostr));
InfoString = _("Mushroom Patch");
break;
case OBJ_LAZSTAND:
CopyUtf8(infostr, _("Vile Stand"), sizeof(infostr));
InfoString = _("Vile Stand");
break;
case OBJ_SLAINHERO:
CopyUtf8(infostr, _("Slain Hero"), sizeof(infostr));
InfoString = _("Slain Hero");
break;
default:
break;
}
if (Players[MyPlayerId]._pClass == HeroClass::Rogue) {
if (object._oTrapFlag) {
CopyUtf8(infostr, fmt::format(_(/* TRANSLATORS: {:s} will either be a chest or a door */ "Trapped {:s}"), infostr), sizeof(infostr));
InfoString = fmt::format(_(/* TRANSLATORS: {:s} will either be a chest or a door */ "Trapped {:s}"), InfoString);
InfoColor = UiFlags::ColorRed;
}
}
if (object.IsDisabled()) {
CopyUtf8(infostr, 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), sizeof(infostr));
InfoString = fmt::format(_(/* TRANSLATORS: If user enabled diablo.ini setting "Disable Crippling Shrines" is set to 1; also used for Na-Kruls leaver */ "{:s} (disabled)"), InfoString);
InfoColor = UiFlags::ColorRed;
}
}

10
Source/panels/spell_list.cpp

@ -124,7 +124,7 @@ void DrawSpell(const Surface &out)
void DrawSpellList(const Surface &out)
{
infostr[0] = '\0';
InfoString.clear();
ClearPanel();
auto &myPlayer = Players[MyPlayerId];
@ -160,14 +160,14 @@ void DrawSpellList(const Surface &out)
case RSPLTYPE_SKILL:
spellColor = PAL16_YELLOW - 46;
PrintSBookSpellType(out, spellListItem.location, _("Skill"), spellColor);
CopyUtf8(infostr, fmt::format(_("{:s} Skill"), pgettext("spell", spellDataItem.sSkillText)), sizeof(infostr));
InfoString = fmt::format(_("{:s} Skill"), pgettext("spell", spellDataItem.sSkillText));
break;
case RSPLTYPE_SPELL:
if (myPlayer.plrlevel != 0) {
spellColor = PAL16_BLUE + 5;
}
PrintSBookSpellType(out, spellListItem.location, _("Spell"), spellColor);
CopyUtf8(infostr, fmt::format(_("{:s} Spell"), pgettext("spell", spellDataItem.sNameText)), sizeof(infostr));
InfoString = fmt::format(_("{:s} Spell"), pgettext("spell", spellDataItem.sNameText));
if (spellId == SPL_HBOLT) {
AddPanelString(_("Damages undead only"));
}
@ -181,7 +181,7 @@ void DrawSpellList(const Surface &out)
spellColor = PAL16_RED - 59;
}
PrintSBookSpellType(out, spellListItem.location, _("Scroll"), spellColor);
CopyUtf8(infostr, fmt::format(_("Scroll of {:s}"), pgettext("spell", spellDataItem.sNameText)), sizeof(infostr));
InfoString = fmt::format(_("Scroll of {:s}"), pgettext("spell", spellDataItem.sNameText));
const InventoryAndBeltPlayerItemsRange items { myPlayer };
const int scrollCount = std::count_if(items.begin(), items.end(), [spellId](const Item &item) {
return item.IsScrollOf(spellId);
@ -193,7 +193,7 @@ void DrawSpellList(const Surface &out)
spellColor = PAL16_ORANGE + 5;
}
PrintSBookSpellType(out, spellListItem.location, _("Staff"), spellColor);
CopyUtf8(infostr, fmt::format(_("Staff of {:s}"), pgettext("spell", spellDataItem.sNameText)), sizeof(infostr));
InfoString = fmt::format(_("Staff of {:s}"), pgettext("spell", spellDataItem.sNameText));
int charges = myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges;
AddPanelString(fmt::format(ngettext("{:d} Charge", "{:d} Charges", charges), charges));
} break;

4
Source/qol/stash.cpp

@ -435,10 +435,10 @@ uint16_t CheckStashHLight(Point mousePosition)
InfoColor = item.getTextColor();
if (item._iIdentified) {
strcpy(infostr, item._iIName);
InfoString = item._iIName;
PrintItemDetails(item);
} else {
strcpy(infostr, item._iName);
InfoString = item._iName;
PrintItemDur(item);
}

2
Source/quests.cpp

@ -448,7 +448,7 @@ bool ForceQuests()
int ql = quest._qslvl - 1;
if (EntranceBoundaryContains(quest.position, cursPosition)) {
CopyUtf8(infostr, fmt::format(_(/* TRANSLATORS: Used for Quest Portals. {:s} is a Map Name */ "To {:s}"), _(QuestTriggerNames[ql])), sizeof(infostr));
InfoString = fmt::format(_(/* TRANSLATORS: Used for Quest Portals. {:s} is a Map Name */ "To {:s}"), _(QuestTriggerNames[ql]));
cursPosition = quest.position;
return true;
}

58
Source/trigs.cpp

@ -340,7 +340,7 @@ bool ForceTownTrig()
if (tileId == -1)
break;
if (dPiece[cursPosition.x][cursPosition.y] == tileId) {
CopyUtf8(infostr, _("Down to dungeon"), sizeof(infostr));
InfoString = _("Down to dungeon");
cursPosition = { 25, 29 };
return true;
}
@ -351,7 +351,7 @@ bool ForceTownTrig()
if (tileId == -1)
break;
if (dPiece[cursPosition.x][cursPosition.y] == tileId) {
CopyUtf8(infostr, _("Down to catacombs"), sizeof(infostr));
InfoString = _("Down to catacombs");
cursPosition = { 49, 21 };
return true;
}
@ -361,7 +361,7 @@ bool ForceTownTrig()
if (IsWarpOpen(DTYPE_CAVES)) {
for (int i = 1199; i <= 1220; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == i) {
CopyUtf8(infostr, _("Down to caves"), sizeof(infostr));
InfoString = _("Down to caves");
cursPosition = { 17, 69 };
return true;
}
@ -371,7 +371,7 @@ bool ForceTownTrig()
if (IsWarpOpen(DTYPE_HELL)) {
for (int i = 1240; i <= 1255; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == i) {
CopyUtf8(infostr, _("Down to hell"), sizeof(infostr));
InfoString = _("Down to hell");
cursPosition = { 41, 80 };
return true;
}
@ -383,7 +383,7 @@ bool ForceTownTrig()
if (tileId == -1)
break;
if (dPiece[cursPosition.x][cursPosition.y] == tileId) {
CopyUtf8(infostr, _("Down to Hive"), sizeof(infostr));
InfoString = _("Down to Hive");
cursPosition = { 80, 62 };
return true;
}
@ -395,7 +395,7 @@ bool ForceTownTrig()
if (tileId == -1)
break;
if (dPiece[cursPosition.x][cursPosition.y] == tileId) {
CopyUtf8(infostr, _("Down to Crypt"), sizeof(infostr));
InfoString = _("Down to Crypt");
cursPosition = { 36, 24 };
return true;
}
@ -411,9 +411,9 @@ bool ForceL1Trig()
for (int i = 0; L1UpList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L1UpList[i]) {
if (currlevel > 1)
CopyUtf8(infostr, fmt::format(_("Up to level {:d}"), currlevel - 1), sizeof(infostr));
InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1);
else
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursPosition = trigs[j].position;
@ -424,7 +424,7 @@ bool ForceL1Trig()
}
for (int i = 0; L1DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L1DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to level {:d}"), currlevel + 1), sizeof(infostr));
InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -436,7 +436,7 @@ bool ForceL1Trig()
} else {
for (int i = 0; L5UpList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L5UpList[i]) {
CopyUtf8(infostr, fmt::format(_("Up to Crypt level {:d}"), currlevel - 21), sizeof(infostr));
InfoString = fmt::format(_("Up to Crypt level {:d}"), currlevel - 21);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursPosition = trigs[j].position;
@ -446,12 +446,12 @@ bool ForceL1Trig()
}
}
if (dPiece[cursPosition.x][cursPosition.y] == 317) {
CopyUtf8(infostr, _("Cornerstone of the World"), sizeof(infostr));
InfoString = _("Cornerstone of the World");
return true;
}
for (int i = 0; L5DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L5DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to Crypt level {:d}"), currlevel - 19), sizeof(infostr));
InfoString = fmt::format(_("Down to Crypt level {:d}"), currlevel - 19);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -468,7 +468,7 @@ bool ForceL1Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
cursPosition = trigs[j].position;
return true;
}
@ -491,7 +491,7 @@ bool ForceL2Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, fmt::format(_("Up to level {:d}"), currlevel - 1), sizeof(infostr));
InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1);
cursPosition = trigs[j].position;
return true;
}
@ -502,7 +502,7 @@ bool ForceL2Trig()
for (int i = 0; L2DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L2DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to level {:d}"), currlevel + 1), sizeof(infostr));
InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -520,7 +520,7 @@ bool ForceL2Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
cursPosition = trigs[j].position;
return true;
}
@ -538,7 +538,7 @@ bool ForceL3Trig()
if (currlevel < 17) {
for (int i = 0; L3UpList[i] != -1; ++i) {
if (dPiece[cursPosition.x][cursPosition.y] == L3UpList[i]) {
CopyUtf8(infostr, fmt::format(_("Up to level {:d}"), currlevel - 1), sizeof(infostr));
InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) {
int dx = abs(trigs[j].position.x - cursPosition.x);
@ -555,7 +555,7 @@ bool ForceL3Trig()
if (dPiece[cursPosition.x][cursPosition.y] == L3DownList[i]
|| dPiece[cursPosition.x + 1][cursPosition.y] == L3DownList[i]
|| dPiece[cursPosition.x + 2][cursPosition.y] == L3DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to level {:d}"), currlevel + 1), sizeof(infostr));
InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -567,7 +567,7 @@ bool ForceL3Trig()
} else {
for (int i = 0; L6UpList[i] != -1; ++i) {
if (dPiece[cursPosition.x][cursPosition.y] == L6UpList[i]) {
CopyUtf8(infostr, fmt::format(_("Up to Nest level {:d}"), currlevel - 17), sizeof(infostr));
InfoString = fmt::format(_("Up to Nest level {:d}"), currlevel - 17);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursPosition = trigs[j].position;
@ -580,7 +580,7 @@ bool ForceL3Trig()
if (dPiece[cursPosition.x][cursPosition.y] == L6DownList[i]
|| dPiece[cursPosition.x + 1][cursPosition.y] == L6DownList[i]
|| dPiece[cursPosition.x + 2][cursPosition.y] == L6DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to level {:d}"), currlevel - 15), sizeof(infostr));
InfoString = fmt::format(_("Down to level {:d}"), currlevel - 15);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -599,7 +599,7 @@ bool ForceL3Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
cursPosition = trigs[j].position;
return true;
}
@ -616,7 +616,7 @@ bool ForceL3Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
cursPosition = trigs[j].position;
return true;
}
@ -633,7 +633,7 @@ bool ForceL4Trig()
{
for (int i = 0; L4UpList[i] != -1; ++i) {
if (dPiece[cursPosition.x][cursPosition.y] == L4UpList[i]) {
CopyUtf8(infostr, fmt::format(_("Up to level {:d}"), currlevel - 1), sizeof(infostr));
InfoString = fmt::format(_("Up to level {:d}"), currlevel - 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABPREVLVL) {
cursPosition = trigs[j].position;
@ -645,7 +645,7 @@ bool ForceL4Trig()
for (int i = 0; L4DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L4DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Down to level {:d}"), currlevel + 1), sizeof(infostr));
InfoString = fmt::format(_("Down to level {:d}"), currlevel + 1);
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -663,7 +663,7 @@ bool ForceL4Trig()
int dx = abs(trigs[j].position.x - cursPosition.x);
int dy = abs(trigs[j].position.y - cursPosition.y);
if (dx < 4 && dy < 4) {
CopyUtf8(infostr, _("Up to town"), sizeof(infostr));
InfoString = _("Up to town");
cursPosition = trigs[j].position;
return true;
}
@ -676,7 +676,7 @@ bool ForceL4Trig()
if (currlevel == 15) {
for (int i = 0; L4PentaList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L4PentaList[i]) {
CopyUtf8(infostr, _("Down to Diablo"), sizeof(infostr));
InfoString = _("Down to Diablo");
for (int j = 0; j < numtrigs; j++) {
if (trigs[j]._tmsg == WM_DIABNEXTLVL) {
cursPosition = trigs[j].position;
@ -709,7 +709,7 @@ bool ForceSKingTrig()
{
for (int i = 0; L1UpList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L1UpList[i]) {
CopyUtf8(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_SKELKING]._qlevel), sizeof(infostr));
InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_SKELKING]._qlevel);
cursPosition = trigs[0].position;
return true;
@ -723,7 +723,7 @@ bool ForceSChambTrig()
{
for (int i = 0; L2DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L2DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_SCHAMB]._qlevel), sizeof(infostr));
InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_SCHAMB]._qlevel);
cursPosition = trigs[0].position;
return true;
@ -737,7 +737,7 @@ bool ForcePWaterTrig()
{
for (int i = 0; L3DownList[i] != -1; i++) {
if (dPiece[cursPosition.x][cursPosition.y] == L3DownList[i]) {
CopyUtf8(infostr, fmt::format(_("Back to Level {:d}"), Quests[Q_PWATER]._qlevel), sizeof(infostr));
InfoString = fmt::format(_("Back to Level {:d}"), Quests[Q_PWATER]._qlevel);
cursPosition = trigs[0].position;
return true;

Loading…
Cancel
Save