Browse Source

DebugCmdLoadMap: Fix transition from level to map

pull/2789/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
2e07a59582
  1. 27
      Source/debug.cpp

27
Source/debug.cpp

@ -80,6 +80,20 @@ void PrintDebugMonster(int m)
NetSendCmdString(1 << MyPlayerId, dstr);
}
void ProcessMessages()
{
tagMSG msg;
while (FetchMessage(&msg)) {
if (msg.message == DVL_WM_QUIT) {
gbRunGameResult = false;
gbRunGame = false;
break;
}
TranslateMessage(&msg);
PushMessage(&msg);
}
}
struct DebugCmdItem {
const string_view text;
const string_view description;
@ -183,22 +197,23 @@ std::string DebugCmdLoadMap(const string_view parameter)
auto level = atoi(parameter.data());
if (level < 1)
return fmt::format("Map id must be 1 or higher", level);
if (setlevel && myPlayer.plrlevel == level)
return fmt::format("I did nothing but fulfilled your wish. You are already at level {}.", level);
if (setlevel && setlvlnum == level)
return fmt::format("I did nothing but fulfilled your wish. You are already at mapid {}.", level);
for (auto &quest : Quests) {
if (level != quest._qslvl)
continue;
setlevel = false;
StartNewLvl(MyPlayerId, (quest._qlevel != 21) ? interface_mode::WM_DIABNEXTLVL : interface_mode::WM_DIABTWARPUP, quest._qlevel);
ProcessMessages();
setlvltype = quest._qlvltype;
currlevel = quest._qlevel;
myPlayer.plrlevel = quest._qlevel;
StartNewLvl(MyPlayerId, WM_DIABSETLVL, level);
return fmt::format("Welcome to {}.", QuestLevelNames[level]);
}
return fmt::format("Level {} is not known. Do you want to write a mod?", level);
return fmt::format("Mapid {} is not known. Do you want to write a mod?", level);
}
std::unordered_map<string_view, _talker_id> TownerShortNameToTownerId = {

Loading…
Cancel
Save