mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-04-16 22:42:32 +03:00
Tagged 1.8.0
This commit is contained in:
commit
1a6c457000
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../hlsdk
|
||||
MM_ROOT = ../metamod/metamod
|
||||
MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
|
@ -39,7 +39,7 @@ void amx_command()
|
||||
{
|
||||
|
||||
print_srvconsole("Currently loaded plugins:\n");
|
||||
print_srvconsole(" %-23.22s %-8.7s %-17.16s %-16.15s %-9.8s\n", "name", "version", "author", "file", "status");
|
||||
print_srvconsole(" %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", "name", "version", "author", "file", "status");
|
||||
|
||||
int plugins = 0;
|
||||
int running = 0;
|
||||
@ -52,7 +52,7 @@ void amx_command()
|
||||
if ((*a).isValid() && !(*a).isPaused())
|
||||
++running;
|
||||
|
||||
print_srvconsole(" [%3d] %-23.22s %-8.7s %-17.16s %-16.15s %-9.8s\n", plugins, (*a).getTitle(), (*a).getVersion(), (*a).getAuthor(), (*a).getName(), (*a).getStatus());
|
||||
print_srvconsole(" [%3d] %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", plugins, (*a).getTitle(), (*a).getVersion(), (*a).getAuthor(), (*a).getName(), (*a).getStatus());
|
||||
++a;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ void amx_command()
|
||||
else if (!strcmp(cmd, "modules"))
|
||||
{
|
||||
print_srvconsole("Currently loaded modules:\n");
|
||||
print_srvconsole(" %-23.22s %-8.7s %-20.19s %-11.10s\n", "name", "version", "author", "status");
|
||||
print_srvconsole(" %-23.22s %-11.10s %-20.19s %-11.10s\n", "name", "version", "author", "status");
|
||||
|
||||
int running = 0;
|
||||
int modules = 0;
|
||||
@ -228,7 +228,7 @@ void amx_command()
|
||||
++running;
|
||||
++modules;
|
||||
|
||||
print_srvconsole(" [%2d] %-23.22s %-8.7s %-20.19s %-11.10s\n", modules, (*a).getName(), (*a).getVersion(), (*a).getAuthor(), (*a).getStatus());
|
||||
print_srvconsole(" [%2d] %-23.22s %-11.10s %-20.19s %-11.10s\n", modules, (*a).getName(), (*a).getVersion(), (*a).getAuthor(), (*a).getStatus());
|
||||
++a;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef _INCLUDE_SVN_VERSION_H_
|
||||
#define _INCLUDE_SVN_VERSION_H_
|
||||
|
||||
#define SVN_VERSION_STRING "1.8.0.3648"
|
||||
#define SVN_VERSION_DWORD 1,8,0,3648
|
||||
#define SVN_VERSION_STRING "1.8.0.3660"
|
||||
#define SVN_VERSION_DWORD 1,8,0,3660
|
||||
#define SVN_VERSION_PRODUCT "1.8.0"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3635"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3550"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3587"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3538"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -70,32 +82,58 @@ template <class T> class CVector
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_Size < size) ? (m_Size) : size;
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
if (m_Size < size)
|
||||
m_CurrentSize = size;
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
size_t m_CurrentSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
@ -189,7 +227,7 @@ public:
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -203,10 +241,10 @@ public:
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
@ -277,12 +315,12 @@ public:
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end()
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
@ -296,19 +334,20 @@ public:
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
return ChangeSize(newSize);
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,14 +356,15 @@ public:
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
FreeMemIfPossible();
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -397,50 +437,64 @@ public:
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
bool insert(iterator where, const T & value)
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// we have to insert before
|
||||
// if it is begin, don't decrement
|
||||
if (where != m_Data)
|
||||
--where;
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data));
|
||||
memcpy(where.base(), &value, sizeof(T));
|
||||
return true;
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
void erase(iterator where)
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1);
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3486"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3641"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3466"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3552"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3582"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3645"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -1,7 +1,7 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
@ -1,9 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns", "ns.vcproj", "{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}.Debug.ActiveCfg = Debug|Win32
|
||||
{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}.Debug.Build.0 = Debug|Win32
|
||||
{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}.Release.ActiveCfg = Release|Win32
|
||||
{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3591"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -70,32 +82,58 @@ template <class T> class CVector
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_Size < size) ? (m_Size) : size;
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
if (m_Size < size)
|
||||
m_CurrentSize = size;
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
size_t m_CurrentSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
@ -189,7 +227,7 @@ public:
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -203,10 +241,10 @@ public:
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
@ -277,12 +315,12 @@ public:
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end()
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
@ -296,19 +334,20 @@ public:
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
return ChangeSize(newSize);
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,14 +356,15 @@ public:
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
FreeMemIfPossible();
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -397,50 +437,64 @@ public:
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
bool insert(iterator where, const T & value)
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// we have to insert before
|
||||
// if it is begin, don't decrement
|
||||
if (where != m_Data)
|
||||
--where;
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data));
|
||||
memcpy(where.base(), &value, sizeof(T));
|
||||
return true;
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
void erase(iterator where)
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1);
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3466"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -70,32 +82,58 @@ template <class T> class CVector
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_Size < size) ? (m_Size) : size;
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
if (m_Size < size)
|
||||
m_CurrentSize = size;
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
size_t m_CurrentSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
@ -189,7 +227,7 @@ public:
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
@ -203,10 +241,10 @@ public:
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
@ -277,12 +315,12 @@ public:
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end()
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
@ -296,19 +334,20 @@ public:
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
return ChangeSize(newSize);
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -317,14 +356,15 @@ public:
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
FreeMemIfPossible();
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -397,50 +437,64 @@ public:
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
bool insert(iterator where, const T & value)
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// we have to insert before
|
||||
// if it is begin, don't decrement
|
||||
if (where != m_Data)
|
||||
--where;
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data));
|
||||
memcpy(where.base(), &value, sizeof(T));
|
||||
return true;
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
void erase(iterator where)
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return false;
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1);
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
// :TODO: free memory sometimes
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3564"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3467"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -37,12 +37,20 @@
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow()
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 8; // a good init value
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
@ -57,12 +65,16 @@ template <class T> class CVector
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded()
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize >= m_Size)
|
||||
return Grow();
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
@ -329,14 +341,13 @@ public:
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,13 +445,13 @@ public:
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
if (!GrowIfNeeded())
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3647"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3551"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3466"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
@ -4,6 +4,6 @@
|
||||
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
|
||||
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
|
||||
|
||||
#define SVN_VERSION "1.8.0.3538"
|
||||
#define SVN_VERSION "1.8.0.3660"
|
||||
|
||||
#endif //_INCLUDE_SVN_VERSION_H_
|
||||
|
Binary file not shown.
@ -123,6 +123,7 @@ namespace AMXXRelease
|
||||
AddPlugin("telemenu");
|
||||
AddPlugin("timeleft");
|
||||
AddPlugin("cmdmenu");
|
||||
AddPlugin("pluginmenu");
|
||||
}
|
||||
|
||||
private void AddModules()
|
||||
|
@ -1,6 +1,6 @@
|
||||
compress = C:\WINDOWS\zip.exe
|
||||
source = R:\amxmodx
|
||||
source = c:\temp\amxmodx
|
||||
makeopts =
|
||||
output = c:\real\done
|
||||
output = c:\temp\done
|
||||
devenv = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com
|
||||
release = amxmodx-1.76d
|
||||
release = amxmodx-1.8.0
|
||||
|
@ -2,7 +2,7 @@
|
||||
; Licensed under the GNU General Public License
|
||||
; Originally written by -=HaXoMaTiC=-
|
||||
!define PRODUCT_NAME "AMX Mod X Installer"
|
||||
!define PRODUCT_VERSION "1.76d"
|
||||
!define PRODUCT_VERSION "1.8.0"
|
||||
!define PRODUCT_PUBLISHER "AMX Mod X Dev Team"
|
||||
!define PRODUCT_WEB_SITE "http://www.amxmodx.org/"
|
||||
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Installer.exe"
|
||||
@ -107,10 +107,10 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\configs\clcmds.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\cmds.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\configs.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\conmotd.txt"
|
||||
File "installer\files\base\addons\amxmodx\configs\core.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\custommenuitems.cfg"
|
||||
File "installer\files\base\addons\amxmodx\configs\cvars.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\hamdata.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\maps.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\modules.ini"
|
||||
File "installer\files\base\addons\amxmodx\configs\plugins.ini"
|
||||
@ -171,6 +171,8 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\modules\regex_amxx_i386.so"
|
||||
File "installer\files\base\addons\amxmodx\modules\sockets_amxx.dll"
|
||||
File "installer\files\base\addons\amxmodx\modules\sockets_amxx_i386.so"
|
||||
File "installer\files\base\addons\amxmodx\modules\hamsandwich_amxx.dll"
|
||||
File "installer\files\base\addons\amxmodx\modules\hamsandwich_amxx_i386.so"
|
||||
SetOutPath "$INSTDIR\files\base\plugins"
|
||||
File "installer\files\base\addons\amxmodx\plugins\admin.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\adminchat.amxx"
|
||||
@ -190,6 +192,7 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\plugins\nextmap.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\pausecfg.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\plmenu.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\pluginmenu.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\scrollmsg.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\statscfg.amxx"
|
||||
File "installer\files\base\addons\amxmodx\plugins\telemenu.amxx"
|
||||
@ -218,6 +221,7 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\amxconst.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\amxmisc.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\amxmodx.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\cellarray.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\core.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\csstats.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\cstrike.inc"
|
||||
@ -239,6 +243,9 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\float.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\fun.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\geoip.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\ham_const.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\hamsandwich.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\hlsdk_const.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\hlsdk_const.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\lang.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\messages.inc"
|
||||
@ -248,11 +255,13 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\ns2amx.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\ns_const.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\regex.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\newmenus.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\nvault.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\sockets.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\sorting.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\sqlx.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\string.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\svn_version.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\tfcconst.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\tfcstats.inc"
|
||||
File "installer\files\base\addons\amxmodx\scripting\include\tfcx.inc"
|
||||
@ -282,6 +291,7 @@ Section "MainSection" SEC01
|
||||
File "installer\files\base\addons\amxmodx\scripting\nextmap.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\pausecfg.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\plmenu.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\pluginmenu.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\scrollmsg.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\statscfg.sma"
|
||||
File "installer\files\base\addons\amxmodx\scripting\telemenu.sma"
|
||||
@ -589,6 +599,7 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\telemenu.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\statscfg.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\scrollmsg.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\pluginmenu.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\plmenu.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\pausecfg.sma"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\nextmap.sma"
|
||||
@ -618,6 +629,7 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\tfcstats.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\tfcconst.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\time.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\svn_version.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\string.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\sqlx.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\sorting.inc"
|
||||
@ -627,11 +639,14 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\ns2amx.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\ns.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\nvault.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\newmenus.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\message_stocks.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\message_const.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\messages.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\lang.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\hlsdk_const.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\ham_const.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\hamsandwich.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\geoip.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\fun.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\float.inc"
|
||||
@ -653,6 +668,7 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\cstrike.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\csstats.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\core.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\cellarray.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmodx.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod.inc"
|
||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmisc.inc"
|
||||
@ -696,6 +712,7 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\plugins\telemenu.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\statscfg.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\scrollmsg.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\pluginmenu.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\plmenu.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\pausecfg.amxx"
|
||||
Delete "$INSTDIR\files\base\plugins\nextmap.amxx"
|
||||
@ -731,6 +748,8 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\modules\fakemeta_amxx.dll"
|
||||
Delete "$INSTDIR\files\base\modules\engine_amxx_i386.so"
|
||||
Delete "$INSTDIR\files\base\modules\engine_amxx.dll"
|
||||
Delete "$INSTDIR\files\base\modules\hamsandwich_amxx_i386.so"
|
||||
Delete "$INSTDIR\files\base\modules\hamsandwich_amxx.dll"
|
||||
Delete "$INSTDIR\files\base\dlls\metamod_i386.so"
|
||||
Delete "$INSTDIR\files\base\dlls\metamod.dll"
|
||||
Delete "$INSTDIR\files\base\dlls\amxmodx_mm_i386.so"
|
||||
@ -769,10 +788,10 @@ Section Uninstall
|
||||
Delete "$INSTDIR\files\base\configs\plugins.ini"
|
||||
Delete "$INSTDIR\files\base\configs\modules.ini"
|
||||
Delete "$INSTDIR\files\base\configs\maps.ini"
|
||||
Delete "$INSTDIR\files\base\configs\hamdata.ini"
|
||||
Delete "$INSTDIR\files\base\configs\cvars.ini"
|
||||
Delete "$INSTDIR\files\base\configs\custommenuitems.cfg"
|
||||
Delete "$INSTDIR\files\base\configs\core.ini"
|
||||
Delete "$INSTDIR\files\base\configs\conmotd.txt"
|
||||
Delete "$INSTDIR\files\base\configs\configs.ini"
|
||||
Delete "$INSTDIR\files\base\configs\cmds.ini"
|
||||
Delete "$INSTDIR\files\base\configs\clcmds.ini"
|
||||
|
@ -796,13 +796,13 @@ public cmdPlugins(id, level, cid)
|
||||
new running = 0
|
||||
|
||||
console_print(id, "----- %L -----", id, "LOADED_PLUGINS")
|
||||
console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
|
||||
console_print(id, "%-18.17s %-11.10s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
|
||||
|
||||
new i=StartPLID;
|
||||
while (i <EndPLID)
|
||||
{
|
||||
get_plugin(i++, filename, 31, name, 31, version, 31, author, 31, status, 31)
|
||||
console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", name, version, author, filename, status)
|
||||
console_print(id, "%-18.17s %-11.10s %-17.16s %-16.15s %-9.8s", name, version, author, filename, status)
|
||||
|
||||
if (status[0]=='d' || status[0]=='r') // "debug" or "running"
|
||||
running++
|
||||
@ -842,7 +842,7 @@ public cmdModules(id, level, cid)
|
||||
new num = get_modulesnum()
|
||||
|
||||
console_print(id, "%L:", id, "LOADED_MODULES")
|
||||
console_print(id, "%-23.22s %-8.7s %-20.19s %-11.10s", lName, lVersion, lAuthor, lStatus)
|
||||
console_print(id, "%-23.22s %-11.10s %-20.19s %-11.10s", lName, lVersion, lAuthor, lStatus)
|
||||
|
||||
for (new i = 0; i < num; i++)
|
||||
{
|
||||
@ -860,7 +860,7 @@ public cmdModules(id, level, cid)
|
||||
}
|
||||
}
|
||||
|
||||
console_print(id, "%-23.22s %-8.7s %-20.19s %-11.10s", name, version, author, sStatus)
|
||||
console_print(id, "%-23.22s %-11.10s %-20.19s %-11.10s", name, version, author, sStatus)
|
||||
}
|
||||
console_print(id, "%L", id, "NUM_MODULES", num)
|
||||
|
||||
@ -1174,4 +1174,4 @@ public cmdLast(id, level, cid)
|
||||
console_print(id, "%d old connections saved.", g_Size);
|
||||
|
||||
return PLUGIN_HANDLED;
|
||||
}
|
||||
}
|
||||
|
@ -13,4 +13,4 @@
|
||||
|
||||
#define AMXX_VERSION 1.80
|
||||
#define AMXX_VERSION_NUM 180
|
||||
stock const AMXX_VERSION_STR[] = "1.8.0.3648";
|
||||
stock const AMXX_VERSION_STR[] = "1.8.0.3660";
|
||||
|
@ -1,185 +1,195 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
our %arguments =
|
||||
(
|
||||
'config' => 'modules.versions',
|
||||
'major' => '1',
|
||||
'minor' => '0',
|
||||
'revision' => '0',
|
||||
'build' => undef,
|
||||
'svnrev' => 'global',
|
||||
'path' => '',
|
||||
'modules' => '',
|
||||
);
|
||||
|
||||
my $arg;
|
||||
foreach $arg (@ARGV)
|
||||
{
|
||||
$arg =~ s/--//;
|
||||
@arg = split(/=/, $arg);
|
||||
$arguments{$arg[0]} = $arg[1];
|
||||
}
|
||||
|
||||
our (%allowed);
|
||||
if ($arguments{'modules'} ne "")
|
||||
{
|
||||
my @l = split(/,/, $arguments{'modules'});
|
||||
my $i;
|
||||
|
||||
for ($i=0; $i<=$#l; $i++)
|
||||
{
|
||||
$allowed{$l[$i]} = 1;
|
||||
}
|
||||
} else {
|
||||
$allowed{'*'} = 1;
|
||||
}
|
||||
|
||||
#Set up path info
|
||||
if ($arguments{'path'} ne "")
|
||||
{
|
||||
if (!(-d $arguments{'path'}))
|
||||
{
|
||||
die "Unable to find path: " . $arguments{'path'} ."\n";
|
||||
}
|
||||
chdir($arguments{'path'});
|
||||
}
|
||||
|
||||
if (!open(CONFIG, $arguments{'config'}))
|
||||
{
|
||||
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
|
||||
}
|
||||
|
||||
our %modules;
|
||||
my $cur_module = undef;
|
||||
my $line;
|
||||
while (<CONFIG>)
|
||||
{
|
||||
chomp;
|
||||
$line = $_;
|
||||
if ($line =~ /^\[([^\]]+)\]$/)
|
||||
{
|
||||
$cur_module = $1;
|
||||
next;
|
||||
}
|
||||
if (!$cur_module)
|
||||
{
|
||||
next;
|
||||
}
|
||||
if ($line =~ /^([^=]+) = (.+)$/)
|
||||
{
|
||||
$modules{$cur_module}{$1} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
close(CONFIG);
|
||||
|
||||
#Copy global configuration options...
|
||||
if (exists($modules{'PRODUCT'}))
|
||||
{
|
||||
if (exists($modules{'PRODUCT'}{'major'}))
|
||||
{
|
||||
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'minor'}))
|
||||
{
|
||||
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'revision'}))
|
||||
{
|
||||
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'svnrev'}))
|
||||
{
|
||||
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
|
||||
}
|
||||
}
|
||||
|
||||
#Get the global SVN revision if we have none
|
||||
my $rev;
|
||||
if ($arguments{'build'} == undef)
|
||||
{
|
||||
$rev = GetRevision(undef);
|
||||
} else {
|
||||
$rev = int($arguments{'build'});
|
||||
}
|
||||
|
||||
my $major = $arguments{'major'};
|
||||
my $minor = $arguments{'minor'};
|
||||
my $revision = $arguments{'revision'};
|
||||
my $svnrev = $arguments{'svnrev'};
|
||||
|
||||
#Go through everything now
|
||||
my $mod_i;
|
||||
while ( ($cur_module, $mod_i) = each(%modules) )
|
||||
{
|
||||
#Skip the magic one
|
||||
if ($cur_module eq "PRODUCT")
|
||||
{
|
||||
next;
|
||||
}
|
||||
if (!$allowed{'*'} && !$allowed{$cur_module})
|
||||
{
|
||||
next;
|
||||
}
|
||||
#Prepare path
|
||||
my %mod = %{$mod_i};
|
||||
my $infile = $mod{'in'};
|
||||
my $outfile = $mod{'out'};
|
||||
if ($mod{'folder'})
|
||||
{
|
||||
if (!(-d $mod{'folder'}))
|
||||
{
|
||||
die "Folder " . $mod{'folder'} . " not found.\n";
|
||||
}
|
||||
$infile = $mod{'folder'} . '/' . $infile;
|
||||
$outfile = $mod{'folder'} . '/' . $outfile;
|
||||
}
|
||||
if (!(-f $infile))
|
||||
{
|
||||
die "File $infile is not a file.\n";
|
||||
}
|
||||
my $global_rev = $rev;
|
||||
my $local_rev = GetRevision($mod{'folder'});
|
||||
if ($arguments{'svnrev'} eq 'local')
|
||||
{
|
||||
$global_rev = $local_rev;
|
||||
}
|
||||
#Start rewriting
|
||||
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
|
||||
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
|
||||
while (<INFILE>)
|
||||
{
|
||||
s/\$PMAJOR\$/$major/g;
|
||||
s/\$PMINOR\$/$minor/g;
|
||||
s/\$PREVISION\$/$revision/g;
|
||||
s/\$GLOBAL_BUILD\$/$rev/g;
|
||||
s/\$LOCAL_BUILD\$/$local_rev/g;
|
||||
print OUTFILE $_;
|
||||
}
|
||||
close(OUTFILE);
|
||||
close(INFILE);
|
||||
}
|
||||
|
||||
sub GetRevision
|
||||
{
|
||||
my ($path)=(@_);
|
||||
my $rev;
|
||||
if (!$path)
|
||||
{
|
||||
$rev = `svnversion --committed`;
|
||||
} else {
|
||||
$rev = `svnversion --committed $path`;
|
||||
}
|
||||
if ($rev =~ /exported/)
|
||||
{
|
||||
die "Path specified is not a working copy\n";
|
||||
} elsif ($rev =~ /(\d+):(\d+)/) {
|
||||
$rev = int($2);
|
||||
} elsif ($rev =~ /(\d+)/) {
|
||||
$rev = int($1);
|
||||
} else {
|
||||
die "Unknown svnversion response: $rev\n";
|
||||
}
|
||||
return $rev;
|
||||
}
|
||||
|
||||
#!/usr/bin/perl
|
||||
|
||||
our %arguments =
|
||||
(
|
||||
'config' => 'modules.versions',
|
||||
'major' => '1',
|
||||
'minor' => '0',
|
||||
'revision' => '0',
|
||||
'build' => undef,
|
||||
'svnrev' => 'global',
|
||||
'path' => '',
|
||||
'modules' => '',
|
||||
);
|
||||
|
||||
my $arg;
|
||||
foreach $arg (@ARGV)
|
||||
{
|
||||
$arg =~ s/--//;
|
||||
@arg = split(/=/, $arg);
|
||||
$arguments{$arg[0]} = $arg[1];
|
||||
}
|
||||
|
||||
our (%allowed);
|
||||
if ($arguments{'modules'} ne "")
|
||||
{
|
||||
my @l = split(/,/, $arguments{'modules'});
|
||||
my $i;
|
||||
|
||||
for ($i=0; $i<=$#l; $i++)
|
||||
{
|
||||
$allowed{$l[$i]} = 1;
|
||||
}
|
||||
} else {
|
||||
$allowed{'*'} = 1;
|
||||
}
|
||||
|
||||
#Set up path info
|
||||
if ($arguments{'path'} ne "")
|
||||
{
|
||||
if (!(-d $arguments{'path'}))
|
||||
{
|
||||
die "Unable to find path: " . $arguments{'path'} ."\n";
|
||||
}
|
||||
chdir($arguments{'path'});
|
||||
}
|
||||
|
||||
if (!open(CONFIG, $arguments{'config'}))
|
||||
{
|
||||
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
|
||||
}
|
||||
|
||||
our %modules;
|
||||
my $cur_module = undef;
|
||||
my $line;
|
||||
while (<CONFIG>)
|
||||
{
|
||||
chomp;
|
||||
$line = $_;
|
||||
if ($line =~ /^\[([^\]]+)\]$/)
|
||||
{
|
||||
$cur_module = $1;
|
||||
next;
|
||||
}
|
||||
if (!$cur_module)
|
||||
{
|
||||
next;
|
||||
}
|
||||
if ($line =~ /^([^=]+) = (.+)$/)
|
||||
{
|
||||
$modules{$cur_module}{$1} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
close(CONFIG);
|
||||
|
||||
#Copy global configuration options...
|
||||
if (exists($modules{'PRODUCT'}))
|
||||
{
|
||||
if (exists($modules{'PRODUCT'}{'major'}))
|
||||
{
|
||||
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'minor'}))
|
||||
{
|
||||
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'revision'}))
|
||||
{
|
||||
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'svnrev'}))
|
||||
{
|
||||
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
|
||||
}
|
||||
}
|
||||
|
||||
#Get the global SVN revision if we have none
|
||||
my $rev;
|
||||
if ($arguments{'build'} == undef)
|
||||
{
|
||||
$rev = GetRevision(undef);
|
||||
} else {
|
||||
$rev = int($arguments{'build'});
|
||||
}
|
||||
|
||||
my $major = $arguments{'major'};
|
||||
my $minor = $arguments{'minor'};
|
||||
my $revision = $arguments{'revision'};
|
||||
my $svnrev = $arguments{'svnrev'};
|
||||
|
||||
#Go through everything now
|
||||
my $mod_i;
|
||||
while ( ($cur_module, $mod_i) = each(%modules) )
|
||||
{
|
||||
#Skip the magic one
|
||||
if ($cur_module eq "PRODUCT")
|
||||
{
|
||||
next;
|
||||
}
|
||||
if (!$allowed{'*'} && !$allowed{$cur_module})
|
||||
{
|
||||
next;
|
||||
}
|
||||
#Prepare path
|
||||
my %mod = %{$mod_i};
|
||||
my $infile = $mod{'in'};
|
||||
my $outfile = $mod{'out'};
|
||||
if ($mod{'folder'})
|
||||
{
|
||||
if (!(-d $mod{'folder'}))
|
||||
{
|
||||
die "Folder " . $mod{'folder'} . " not found.\n";
|
||||
}
|
||||
$infile = $mod{'folder'} . '/' . $infile;
|
||||
$outfile = $mod{'folder'} . '/' . $outfile;
|
||||
}
|
||||
if (!(-f $infile))
|
||||
{
|
||||
die "File $infile is not a file.\n";
|
||||
}
|
||||
my $global_rev = $rev;
|
||||
my $local_rev;
|
||||
|
||||
if ($arguments{'build'} == undef)
|
||||
{
|
||||
$local_rev = GetRevision($mod{'folder'});
|
||||
}
|
||||
else
|
||||
{
|
||||
$local_rev = $rev;
|
||||
}
|
||||
|
||||
if ($arguments{'svnrev'} eq 'local')
|
||||
{
|
||||
$global_rev = $local_rev;
|
||||
}
|
||||
#Start rewriting
|
||||
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
|
||||
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
|
||||
while (<INFILE>)
|
||||
{
|
||||
s/\$PMAJOR\$/$major/g;
|
||||
s/\$PMINOR\$/$minor/g;
|
||||
s/\$PREVISION\$/$revision/g;
|
||||
s/\$GLOBAL_BUILD\$/$rev/g;
|
||||
s/\$LOCAL_BUILD\$/$local_rev/g;
|
||||
print OUTFILE $_;
|
||||
}
|
||||
close(OUTFILE);
|
||||
close(INFILE);
|
||||
}
|
||||
|
||||
sub GetRevision
|
||||
{
|
||||
my ($path)=(@_);
|
||||
my $rev;
|
||||
if (!$path)
|
||||
{
|
||||
$rev = `svnversion --committed`;
|
||||
} else {
|
||||
$rev = `svnversion --committed $path`;
|
||||
}
|
||||
if ($rev =~ /exported/)
|
||||
{
|
||||
die "Path specified is not a working copy\n";
|
||||
} elsif ($rev =~ /(\d+):(\d+)/) {
|
||||
$rev = int($2);
|
||||
} elsif ($rev =~ /(\d+)/) {
|
||||
$rev = int($1);
|
||||
} else {
|
||||
die "Unknown svnversion response: $rev\n";
|
||||
}
|
||||
return $rev;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user