mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7918] Improve portability in work with uint64 string format specifiers and in code literals.
* Replace platform seelction MaNGOS code for select format descriptor for uint64 by using ACE define. I64FMTD renamed to UI64FMTD for more clear name. * Add new define UI64LIT (base at ACE seelction) for build portables uint64 literals. Please always use UI64LIT(0x00001) instead less portable 0x00001LL
This commit is contained in:
parent
e8cd008005
commit
2a27a44e2a
36 changed files with 372 additions and 362 deletions
|
|
@ -130,7 +130,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
|
|||
{
|
||||
// save the resettime for normal instances only when they get unloaded
|
||||
if(time_t resettime = itr->second->GetResetTimeForDB())
|
||||
CharacterDatabase.PExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
|
||||
CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
|
||||
delete itr->second;
|
||||
m_instanceSaveById.erase(itr);
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ void InstanceSave::SaveToDB()
|
|||
}
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"I64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str());
|
||||
CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str());
|
||||
}
|
||||
|
||||
time_t InstanceSave::GetResetTimeForDB()
|
||||
|
|
@ -395,7 +395,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
ResetTimeMapType::iterator itr = InstResetTime.find(instance);
|
||||
if(itr != InstResetTime.end() && itr->second.second != resettime)
|
||||
{
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
|
||||
itr->second.second = resettime;
|
||||
}
|
||||
}
|
||||
|
|
@ -430,7 +430,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
uint64 oldresettime = fields[1].GetUInt64();
|
||||
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
||||
if(oldresettime != newresettime)
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", newresettime, mapid);
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", newresettime, mapid);
|
||||
|
||||
m_resetTimeByMapId[mapid] = newresettime;
|
||||
} while(result->NextRow());
|
||||
|
|
@ -439,7 +439,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
|
||||
// clean expired instances, references to them will be deleted in CleanupInstances
|
||||
// must be done before calculating new reset times
|
||||
_DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"I64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"I64FMTD"')", (uint64)now, (uint64)now);
|
||||
_DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)now, (uint64)now);
|
||||
|
||||
// calculate new global reset times for expired instances and those that have never been reset yet
|
||||
// add the global reset times to the priority queue
|
||||
|
|
@ -459,7 +459,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
{
|
||||
// initialize the reset time
|
||||
t = today + period + diff;
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"I64FMTD"')", i, (uint64)t);
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"UI64FMTD"')", i, (uint64)t);
|
||||
}
|
||||
|
||||
if(t < now)
|
||||
|
|
@ -468,7 +468,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
// calculate the next reset time
|
||||
t = (t / DAY) * DAY;
|
||||
t += ((today - t) / period + 1) * period + diff;
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", (uint64)t, i);
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", (uint64)t, i);
|
||||
}
|
||||
|
||||
m_resetTimeByMapId[temp->map] = t;
|
||||
|
|
@ -611,7 +611,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
|
|||
uint32 period = temp->reset_delay * DAY;
|
||||
uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
|
||||
// update it in the DB
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%d'", next_reset, mapid);
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d'", next_reset, mapid);
|
||||
}
|
||||
|
||||
MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue