* fixed endless loop in TypeStorage
* misc stuff
This commit is contained in:
parent
24fbafdd51
commit
f11a1112be
12
bin/data/packet/info.txt
Normal file
12
bin/data/packet/info.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
This directory contains packets or packet parts.
|
||||||
|
You can change them with a hex editor or similar,
|
||||||
|
but BE SURE YOU KNOW WHAT YOU ARE DOING!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Information about the files:
|
||||||
|
|
||||||
|
addon_info.bin - contains the addon data sent to the server in the CMSG_AUTH_SESSION
|
||||||
|
packet. (Appended to the normal packet)
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ template<class T> void TypeStorage<T>::Clear(bool keep)
|
|||||||
_storage.clear();
|
_storage.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(_TypeIter it = _storage.begin(); it != _storage.end();)
|
for(_TypeIter it = _storage.begin(); it != _storage.end(); )
|
||||||
{
|
{
|
||||||
delete it->second;
|
delete it->second;
|
||||||
_storage.erase(it++);
|
_storage.erase(it++);
|
||||||
@ -123,7 +123,7 @@ template<class T> void TypeStorage<T>::Unlink(std::string s)
|
|||||||
// removes the pointer from the storage without deleting it, if name is unknown
|
// removes the pointer from the storage without deleting it, if name is unknown
|
||||||
template<class T> void TypeStorage<T>::UnlinkByPtr(T *ptr)
|
template<class T> void TypeStorage<T>::UnlinkByPtr(T *ptr)
|
||||||
{
|
{
|
||||||
for(_TypeIter it = _storage.begin(); it != _storage.end();)
|
for(_TypeIter it = _storage.begin(); it != _storage.end(); it++)
|
||||||
{
|
{
|
||||||
if(it->second == ptr)
|
if(it->second == ptr)
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ template<class T> void TypeStorage<T>::UnlinkByPtr(T *ptr)
|
|||||||
|
|
||||||
template<class T> std::string TypeStorage<T>::GetNameByPtr(T *ptr)
|
template<class T> std::string TypeStorage<T>::GetNameByPtr(T *ptr)
|
||||||
{
|
{
|
||||||
for(_TypeIter it = _storage.begin(); it != _storage.end();)
|
for(_TypeIter it = _storage.begin(); it != _storage.end(); it++)
|
||||||
{
|
{
|
||||||
if(it->second == ptr)
|
if(it->second == ptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -248,4 +248,24 @@ std::string NormalizeFilename(std::string s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FilesizeFormat(uint32 b)
|
||||||
|
{
|
||||||
|
char buf[15];
|
||||||
|
if (b < 1024)
|
||||||
|
{
|
||||||
|
sprintf(buf,"%u B",b);
|
||||||
|
}
|
||||||
|
else if(b < 1024*1024)
|
||||||
|
{
|
||||||
|
sprintf(buf,"%.2f kB",(b / 1024.0f));
|
||||||
|
}
|
||||||
|
else if(b < 1024*1024*1024)
|
||||||
|
{
|
||||||
|
sprintf(buf,"%.2f MB",(b / double(1024*1024)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf,"%.2f GB",(b / double(1024*1024*1024)));
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|||||||
@ -23,5 +23,6 @@ uint32 GetFileSize(const char*);
|
|||||||
void _FixFileName(std::string&);
|
void _FixFileName(std::string&);
|
||||||
std::string _PathToFileName(std::string);
|
std::string _PathToFileName(std::string);
|
||||||
std::string NormalizeFilename(std::string);
|
std::string NormalizeFilename(std::string);
|
||||||
|
std::string FilesizeFormat(uint32);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user