diff --git a/src/Database.cpp b/src/Database.cpp index 9b20bdf..02b8dfc 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -612,22 +612,22 @@ void Database::getInventory(Player* player) { void Database::removeExpiredVehicles(Player* player) { int32_t currentTime = getTimestamp(); - //remove from bank immediately + // remove from bank immediately for (int i = 0; i < ABANK_COUNT; i++) { if (player->Bank[i].iType == 10 && player->Bank[i].iTimeLimit < currentTime) player->Bank[i] = {}; } - //for the rest, we want to leave only 1 expired vehicle on player to delete it with the client packet + // for the rest, we want to leave only 1 expired vehicle on player to delete it with the client packet std::vector toRemove; - //equiped vehicle + // equiped vehicle if (player->Equip[8].iOpt > 0 && player->Equip[8].iTimeLimit < currentTime) { toRemove.push_back(&player->Equip[8]); player->toRemoveVehicle.eIL = 0; player->toRemoveVehicle.iSlotNum = 8; } - //inventory + // inventory for (int i = 0; i < AINVEN_COUNT; i++) { if (player->Inven[i].iType == 10 && player->Inven[i].iTimeLimit < currentTime) { toRemove.push_back(&player->Inven[i]); @@ -636,7 +636,7 @@ void Database::removeExpiredVehicles(Player* player) { } } - //delete all but one vehicles, leave last one for ceremonial deletion + // delete all but one vehicles, leave last one for ceremonial deletion for (int i = 0; i < (int)toRemove.size()-1; i++) { memset(toRemove[i], 0, sizeof(sItemBase)); } diff --git a/src/ItemManager.cpp b/src/ItemManager.cpp index 60e9f8b..45a5376 100644 --- a/src/ItemManager.cpp +++ b/src/ItemManager.cpp @@ -793,9 +793,12 @@ void ItemManager::checkItemExpire(CNSocket* sock, Player* player) { itemData->iSlotNum = player->toRemoveVehicle.iSlotNum; sock->sendPacket((void*)&respbuf, P_FE2CL_PC_DELETE_TIME_LIMIT_ITEM, resplen); - //delete serverside + // delete serverside if (player->toRemoveVehicle.eIL == 0) memset(&player->Equip[8], 0, sizeof(sItemBase)); else memset(&player->Inven[player->toRemoveVehicle.iSlotNum], 0, sizeof(sItemBase)); + + player->toRemoveVehicle.eIL = 0; + player->toRemoveVehicle.iSlotNum = 0; } diff --git a/src/MissionManager.cpp b/src/MissionManager.cpp index aeff93f..94844aa 100644 --- a/src/MissionManager.cpp +++ b/src/MissionManager.cpp @@ -328,7 +328,7 @@ void MissionManager::mobKilled(CNSocket *sock, int mobid) { if (task["m_iCSUNumToKill"][j] != 0) { missionmob = true; - //sanity check + // sanity check if (plr->RemainingNPCCount[i][j] == 0) { std::cout << "[WARN] RemainingNPCCount tries to go below 0?!" << std::endl; } diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index 4ef26a0..33f31be 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -326,7 +326,7 @@ void PlayerManager::movePlayer(CNSocket* sock, CNPacketData* data) { sP_CL2FE_REQ_PC_MOVE* moveData = (sP_CL2FE_REQ_PC_MOVE*)data->buf; updatePlayerPosition(sock, moveData->iX, moveData->iY, moveData->iZ, moveData->iAngle); - + players[sock].plr->angle = moveData->iAngle; uint64_t tm = getTime(); @@ -710,7 +710,7 @@ void PlayerManager::enterPlayerVehicle(CNSocket* sock, CNPacketData* data) { INITSTRUCT(sP_FE2CL_PC_VEHICLE_ON_FAIL, response); sock->sendPacket((void*)&response, P_FE2CL_PC_VEHICLE_ON_FAIL, sizeof(sP_FE2CL_PC_VEHICLE_ON_FAIL)); - //check if vehicle didn't expire + // check if vehicle didn't expire if (plr.plr->Equip[8].iTimeLimit < getTimestamp()) { plr.plr->toRemoveVehicle.eIL = 0; diff --git a/src/main.cpp b/src/main.cpp index fe1ab25..66d8dba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -150,7 +150,7 @@ time_t getTime() { return (time_t)value.count(); } -//returns system time in seconds +// returns system time in seconds time_t getTimestamp() { using namespace std::chrono;