[7918] Improve portability in work with uint64 string format specifiers and in code literals. Author: VladimirMangos
* 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
--HG--
branch : trunk
This commit is contained in:
1 parent
a36d4fc7ae
commit
f92e8315cf
34 files changed
+130
-125
No files matched your search
@@ -135,7 +135,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);
|
||||
}
|
||||
@@ -173,7 +173,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()
|
||||
@@ -403,7 +403,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;
|
||||
}
|
||||
}
|
||||
@@ -438,7 +438,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());
|
||||
@@ -447,7 +447,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
|
||||
@@ -467,7 +467,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)
|
||||
@@ -476,7 +476,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;
|
||||
@@ -619,7 +619,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();
|
||||
|
||||
Reference in new issue
Block a user