mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20:05 +00:00
fixed comments formating, added zeroing out player->toRemoveVehicle after removing vehicle
This commit is contained in:
parent
016c48645e
commit
7bcdc111da
@ -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<sItemBase*> 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));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user