MCPcopy Create free account
hub / github.com/diasurgical/devilution / PlrDeadItem

Function PlrDeadItem

Source/player.cpp:1806–1841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1804}
1805
1806void PlrDeadItem(int pnum, ItemStruct *itm, int xx, int yy)
1807{
1808 int x, y;
1809 int i, j, k;
1810
1811 if (itm->_itype == ITYPE_NONE)
1812 return;
1813
1814 if ((DWORD)pnum >= MAX_PLRS) {
1815 app_fatal("PlrDeadItem: illegal player %d", pnum);
1816 }
1817
1818 x = xx + plr[pnum].WorldX;
1819 y = yy + plr[pnum].WorldY;
1820 if ((xx || yy) && ItemSpaceOk(x, y)) {
1821 RespawnDeadItem(itm, x, y);
1822 plr[pnum].HoldItem = *itm;
1823 NetSendCmdPItem(FALSE, CMD_RESPAWNITEM, x, y);
1824 return;
1825 }
1826
1827 for (k = 1; k < 50; k++) {
1828 for (j = -k; j <= k; j++) {
1829 y = j + plr[pnum].WorldY;
1830 for (i = -k; i <= k; i++) {
1831 x = i + plr[pnum].WorldX;
1832 if (ItemSpaceOk(x, y)) {
1833 RespawnDeadItem(itm, x, y);
1834 plr[pnum].HoldItem = *itm;
1835 NetSendCmdPItem(FALSE, CMD_RESPAWNITEM, x, y);
1836 return;
1837 }
1838 }
1839 }
1840 }
1841}
1842
1843void DropHalfPlayersGold(int pnum)
1844{

Callers 2

StartPlayerKillFunction · 0.85
DropHalfPlayersGoldFunction · 0.85

Calls 4

app_fatalFunction · 0.85
ItemSpaceOkFunction · 0.85
RespawnDeadItemFunction · 0.85
NetSendCmdPItemFunction · 0.85

Tested by

no test coverage detected