diff --git a/Source/items.cpp b/Source/items.cpp index f6e69462e..e3fc1b743 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -4078,7 +4078,7 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) if (p == myplr) NewCursor(CURSOR_TELEPORT); } else { - ClrPlrPath(p); + ClrPlrPath(&plr[p]); plr[p]._pSpell = spl; plr[p]._pSplType = RSPLTYPE_INVALID; plr[p]._pSplFrom = 3; @@ -4096,7 +4096,7 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) if (p == myplr) NewCursor(CURSOR_TELEPORT); } else { - ClrPlrPath(p); + ClrPlrPath(&plr[p]); plr[p]._pSpell = spl; plr[p]._pSplType = RSPLTYPE_INVALID; plr[p]._pSplFrom = 3; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 2d6b5de0e..4bd522fc5 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -4220,7 +4220,7 @@ void MI_Town(int i) for (p = 0; p < MAX_PLRS; p++) { if (plr[p].plractive && currlevel == plr[p].plrlevel && !plr[p]._pLvlChanging && plr[p]._pmode == PM_STAND && plr[p].position.tile == missile[i].position.tile) { - ClrPlrPath(p); + ClrPlrPath(&plr[p]); if (p == myplr) { NetSendCmdParam1(true, CMD_WARP, missile[i]._misource); plr[p]._pmode = PM_NEWLVL; diff --git a/Source/msg.cpp b/Source/msg.cpp index e0cc3ebd3..134349728 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1317,7 +1317,7 @@ static DWORD On_WALKXY(TCmd *pCmd, int pnum) auto *p = (TCmdLoc *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); MakePlrPath(pnum, p->x, p->y, true); plr[pnum].destAction = ACTION_NONE; } @@ -1616,7 +1616,7 @@ static DWORD On_SATTACKXY(TCmd *pCmd, int pnum) auto *p = (TCmdLoc *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_ATTACK; plr[pnum].destParam1 = p->x; plr[pnum].destParam2 = p->y; @@ -1630,7 +1630,7 @@ static DWORD On_RATTACKXY(TCmd *pCmd, int pnum) auto *p = (TCmdLoc *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_RATTACK; plr[pnum].destParam1 = p->x; plr[pnum].destParam2 = p->y; @@ -1646,7 +1646,7 @@ static DWORD On_SPELLXYD(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam1); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELLWALL; plr[pnum].destParam1 = p->x; plr[pnum].destParam2 = p->y; @@ -1669,7 +1669,7 @@ static DWORD On_SPELLXY(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam1); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELL; plr[pnum].destParam1 = p->x; plr[pnum].destParam2 = p->y; @@ -1691,7 +1691,7 @@ static DWORD On_TSPELLXY(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam1); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELL; plr[pnum].destParam1 = p->x; plr[pnum].destParam2 = p->y; @@ -1784,7 +1784,7 @@ static DWORD On_RATTACKID(TCmd *pCmd, int pnum) auto *p = (TCmdParam1 *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_RATTACKMON; plr[pnum].destParam1 = p->wParam1; } @@ -1797,7 +1797,7 @@ static DWORD On_RATTACKPID(TCmd *pCmd, int pnum) auto *p = (TCmdParam1 *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_RATTACKPLR; plr[pnum].destParam1 = p->wParam1; } @@ -1812,7 +1812,7 @@ static DWORD On_SPELLID(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam2); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELLMON; plr[pnum].destParam1 = p->wParam1; plr[pnum].destParam2 = p->wParam3; @@ -1833,7 +1833,7 @@ static DWORD On_SPELLPID(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam2); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELLPLR; plr[pnum].destParam1 = p->wParam1; plr[pnum].destParam2 = p->wParam3; @@ -1854,7 +1854,7 @@ static DWORD On_TSPELLID(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam2); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELLMON; plr[pnum].destParam1 = p->wParam1; plr[pnum].destParam2 = p->wParam3; @@ -1875,7 +1875,7 @@ static DWORD On_TSPELLPID(TCmd *pCmd, int pnum) if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { auto spell = static_cast(p->wParam2); if (currlevel != 0 || spelldata[spell].sTownSpell) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_SPELLPLR; plr[pnum].destParam1 = p->wParam1; plr[pnum].destParam2 = p->wParam3; @@ -2430,7 +2430,7 @@ static DWORD On_NOVA(TCmd *pCmd, int pnum) auto *p = (TCmdLoc *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel && pnum != myplr) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum]._pSpell = SPL_NOVA; plr[pnum]._pSplType = RSPLTYPE_INVALID; plr[pnum]._pSplFrom = 3; diff --git a/Source/objects.cpp b/Source/objects.cpp index 4981ab29f..60ac0687f 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1956,7 +1956,7 @@ void Obj_Circle(int i) AddMissile(plr[myplr].position.tile.x, plr[myplr].position.tile.y, 35, 46, plr[myplr]._pdir, MIS_RNDTELEPORT, TARGET_MONSTERS, myplr, 0, 0); track_repeat_walk(false); sgbMouseDown = CLICK_NONE; - ClrPlrPath(myplr); + ClrPlrPath(&plr[myplr]); StartStand(myplr, DIR_S); } } else { diff --git a/Source/pack.cpp b/Source/pack.cpp index 95ffe5327..15385dff6 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -216,7 +216,7 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, bool netSync) pPlayer->position.tile = { pPack->px, pPack->py }; pPlayer->position.future = { pPack->px, pPack->py }; pPlayer->plrlevel = pPack->plrlevel; - ClrPlrPath(pnum); + ClrPlrPath(pPlayer); pPlayer->destAction = ACTION_NONE; strcpy(pPlayer->_pName, pPack->pName); pPlayer->_pClass = (HeroClass)pPack->pClass; diff --git a/Source/player.cpp b/Source/player.cpp index df68b964d..8e6406d82 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2106,7 +2106,7 @@ void InitLevelChange(int pnum) plr[pnum]._pLvlVisited[plr[pnum].plrlevel] = true; } - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); plr[pnum].destAction = ACTION_NONE; plr[pnum]._pLvlChanging = true; @@ -3167,7 +3167,7 @@ void CheckNewPath(int pnum) } if (x < 2 && y < 2) { - ClrPlrPath(pnum); + ClrPlrPath(&plr[pnum]); if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { @@ -3651,13 +3651,9 @@ void ProcessPlayers() } } -void ClrPlrPath(int pnum) +void ClrPlrPath(PlayerStruct *player) { - if ((DWORD)pnum >= MAX_PLRS) { - app_fatal("ClrPlrPath: illegal player %d", pnum); - } - - memset(plr[pnum].walkpath, WALK_NONE, sizeof(plr[pnum].walkpath)); + memset(player->walkpath, WALK_NONE, sizeof(player->walkpath)); } bool PosOkPlayer(int pnum, int x, int y) diff --git a/Source/player.h b/Source/player.h index e8678c4f6..0562117a4 100644 --- a/Source/player.h +++ b/Source/player.h @@ -428,7 +428,7 @@ void StartNewLvl(int pnum, interface_mode fom, int lvl); void RestartTownLvl(int pnum); void StartWarpLvl(int pnum, int pidx); void ProcessPlayers(); -void ClrPlrPath(int pnum); +void ClrPlrPath(PlayerStruct *player); bool PosOkPlayer(int pnum, int x, int y); void MakePlrPath(int pnum, int xx, int yy, bool endspace); void CheckPlrSpell(); diff --git a/Source/spells.cpp b/Source/spells.cpp index ac4edc48b..d7b726be3 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -279,7 +279,7 @@ void DoResurrect(int pnum, int rid) drawmanaflag = true; } - ClrPlrPath(rid); + ClrPlrPath(&plr[rid]); plr[rid].destAction = ACTION_NONE; plr[rid]._pInvincible = false; PlacePlayer(rid);