Tagged 1.8.0

This commit is contained in:
David Anderson 2007-10-26 02:25:13 +00:00
commit 1a6c457000
39 changed files with 691 additions and 416 deletions

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -2,7 +2,7 @@
# Makefile written by David "BAILOPAN" Anderson # Makefile written by David "BAILOPAN" Anderson
HLSDK = ../../hlsdk HLSDK = ../../hlsdk
MM_ROOT = ../metamod/metamod MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###

View File

@ -39,7 +39,7 @@ void amx_command()
{ {
print_srvconsole("Currently loaded plugins:\n"); 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 plugins = 0;
int running = 0; int running = 0;
@ -52,7 +52,7 @@ void amx_command()
if ((*a).isValid() && !(*a).isPaused()) if ((*a).isValid() && !(*a).isPaused())
++running; ++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; ++a;
} }
@ -215,7 +215,7 @@ void amx_command()
else if (!strcmp(cmd, "modules")) else if (!strcmp(cmd, "modules"))
{ {
print_srvconsole("Currently loaded modules:\n"); 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 running = 0;
int modules = 0; int modules = 0;
@ -228,7 +228,7 @@ void amx_command()
++running; ++running;
++modules; ++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; ++a;
} }

View File

@ -1,8 +1,8 @@
#ifndef _INCLUDE_SVN_VERSION_H_ #ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_ #define _INCLUDE_SVN_VERSION_H_
#define SVN_VERSION_STRING "1.8.0.3648" #define SVN_VERSION_STRING "1.8.0.3660"
#define SVN_VERSION_DWORD 1,8,0,3648 #define SVN_VERSION_DWORD 1,8,0,3660
#define SVN_VERSION_PRODUCT "1.8.0" #define SVN_VERSION_PRODUCT "1.8.0"
#endif //_INCLUDE_SVN_VERSION_H_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -70,32 +82,58 @@ template <class T> class CVector
// change size // change size
if (size == m_Size) if (size == m_Size)
return true; return true;
if (!size)
{
if (m_Data)
{
delete [] m_Data;
m_Data = NULL;
m_Size = 0;
}
return true;
}
T *newData = new T[size]; T *newData = new T[size];
if (!newData) if (!newData)
return false; return false;
if (m_Data) 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++) for (size_t i=0; i<end; i++)
newData[i] = m_Data[i]; newData[i] = m_Data[i];
delete [] m_Data; delete [] m_Data;
} }
if (m_Size < size)
m_CurrentSize = size;
m_Data = newData; m_Data = newData;
m_Size = size; m_Size = size;
if (m_CurrentUsedSize > m_Size)
m_CurrentUsedSize = m_Size;
return true; return true;
} }
void FreeMemIfPossible() 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: protected:
T *m_Data; T *m_Data;
size_t m_Size; size_t m_Size;
size_t m_CurrentUsedSize; size_t m_CurrentUsedSize;
size_t m_CurrentSize;
public: public:
class iterator class iterator
{ {
@ -189,7 +227,7 @@ public:
iterator & operator-=(size_t offset) iterator & operator-=(size_t offset)
{ {
m_Ptr += offset; m_Ptr -= offset;
return (*this); return (*this);
} }
@ -203,10 +241,10 @@ public:
iterator operator-(size_t offset) const iterator operator-(size_t offset) const
{ {
iterator tmp(*this); iterator tmp(*this);
tmp.m_Ptr += offset; tmp.m_Ptr -= offset;
return tmp; return tmp;
} }
T & operator[](size_t offset) T & operator[](size_t offset)
{ {
return (*(*this + offset)); return (*(*this + offset));
@ -277,12 +315,12 @@ public:
return m_Size; return m_Size;
} }
iterator begin() iterator begin() const
{ {
return iterator(m_Data); return iterator(m_Data);
} }
iterator end() iterator end() const
{ {
return iterator(m_Data + m_CurrentUsedSize); return iterator(m_Data + m_CurrentUsedSize);
} }
@ -296,19 +334,20 @@ public:
bool reserve(size_t newSize) bool reserve(size_t newSize)
{ {
return ChangeSize(newSize); if (newSize > m_Size)
return ChangeSize(newSize);
return true;
} }
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -317,14 +356,15 @@ public:
--m_CurrentUsedSize; --m_CurrentUsedSize;
if (m_CurrentUsedSize < 0) if (m_CurrentUsedSize < 0)
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
// :TODO: free memory sometimes
FreeMemIfPossible();
} }
bool resize(size_t newSize) bool resize(size_t newSize)
{ {
if (!ChangeSize(newSize)) if (!ChangeSize(newSize))
return false; return false;
FreeMemIfPossible(); m_CurrentUsedSize = newSize;
return true; return true;
} }
@ -397,50 +437,64 @@ public:
return m_Data[m_CurrentUsedSize - 1]; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
++m_CurrentUsedSize; size_t ofs = where - begin();
if (!GrowIfNeeded())
if (!GrowIfNeeded(1))
{ {
--m_CurrentUsedSize;
return false; return false;
} }
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data)); ++m_CurrentUsedSize;
memcpy(where.base(), &value, sizeof(T));
return true; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
size_t ofs = where - begin();
if (m_CurrentUsedSize > 1) if (m_CurrentUsedSize > 1)
{ {
// move // 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; --m_CurrentUsedSize;
// :TODO: free memory sometimes
FreeMemIfPossible();
return begin() + ofs;
} }
void clear() void clear()
{ {
m_Size = 0; m_Size = 0;
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
delete [] m_Data; if (m_Data)
m_Data = NULL; {
delete [] m_Data;
m_Data = NULL;
}
} }
}; };

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -1,7 +1,7 @@
#(C)2004-2005 AMX Mod X Development Team #(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson # Makefile written by David "BAILOPAN" Anderson
HLSDK = ../../../../hlsdk HLSDK = ../../../hlsdk
MM_ROOT = ../../../metamod/metamod MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###

View File

@ -1,9 +1,26 @@
 
Microsoft Visual Studio Solution File, Format Version 8.00 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}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns", "ns.vcproj", "{5B5DEFD0-28ED-4D0E-A1B0-50F9304A65DF}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject EndProject
Global 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 GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -70,32 +82,58 @@ template <class T> class CVector
// change size // change size
if (size == m_Size) if (size == m_Size)
return true; return true;
if (!size)
{
if (m_Data)
{
delete [] m_Data;
m_Data = NULL;
m_Size = 0;
}
return true;
}
T *newData = new T[size]; T *newData = new T[size];
if (!newData) if (!newData)
return false; return false;
if (m_Data) 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++) for (size_t i=0; i<end; i++)
newData[i] = m_Data[i]; newData[i] = m_Data[i];
delete [] m_Data; delete [] m_Data;
} }
if (m_Size < size)
m_CurrentSize = size;
m_Data = newData; m_Data = newData;
m_Size = size; m_Size = size;
if (m_CurrentUsedSize > m_Size)
m_CurrentUsedSize = m_Size;
return true; return true;
} }
void FreeMemIfPossible() 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: protected:
T *m_Data; T *m_Data;
size_t m_Size; size_t m_Size;
size_t m_CurrentUsedSize; size_t m_CurrentUsedSize;
size_t m_CurrentSize;
public: public:
class iterator class iterator
{ {
@ -189,7 +227,7 @@ public:
iterator & operator-=(size_t offset) iterator & operator-=(size_t offset)
{ {
m_Ptr += offset; m_Ptr -= offset;
return (*this); return (*this);
} }
@ -203,10 +241,10 @@ public:
iterator operator-(size_t offset) const iterator operator-(size_t offset) const
{ {
iterator tmp(*this); iterator tmp(*this);
tmp.m_Ptr += offset; tmp.m_Ptr -= offset;
return tmp; return tmp;
} }
T & operator[](size_t offset) T & operator[](size_t offset)
{ {
return (*(*this + offset)); return (*(*this + offset));
@ -277,12 +315,12 @@ public:
return m_Size; return m_Size;
} }
iterator begin() iterator begin() const
{ {
return iterator(m_Data); return iterator(m_Data);
} }
iterator end() iterator end() const
{ {
return iterator(m_Data + m_CurrentUsedSize); return iterator(m_Data + m_CurrentUsedSize);
} }
@ -296,19 +334,20 @@ public:
bool reserve(size_t newSize) bool reserve(size_t newSize)
{ {
return ChangeSize(newSize); if (newSize > m_Size)
return ChangeSize(newSize);
return true;
} }
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -317,14 +356,15 @@ public:
--m_CurrentUsedSize; --m_CurrentUsedSize;
if (m_CurrentUsedSize < 0) if (m_CurrentUsedSize < 0)
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
// :TODO: free memory sometimes
FreeMemIfPossible();
} }
bool resize(size_t newSize) bool resize(size_t newSize)
{ {
if (!ChangeSize(newSize)) if (!ChangeSize(newSize))
return false; return false;
FreeMemIfPossible(); m_CurrentUsedSize = newSize;
return true; return true;
} }
@ -397,50 +437,64 @@ public:
return m_Data[m_CurrentUsedSize - 1]; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
++m_CurrentUsedSize; size_t ofs = where - begin();
if (!GrowIfNeeded())
if (!GrowIfNeeded(1))
{ {
--m_CurrentUsedSize;
return false; return false;
} }
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data)); ++m_CurrentUsedSize;
memcpy(where.base(), &value, sizeof(T));
return true; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
size_t ofs = where - begin();
if (m_CurrentUsedSize > 1) if (m_CurrentUsedSize > 1)
{ {
// move // 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; --m_CurrentUsedSize;
// :TODO: free memory sometimes
FreeMemIfPossible();
return begin() + ofs;
} }
void clear() void clear()
{ {
m_Size = 0; m_Size = 0;
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
delete [] m_Data; if (m_Data)
m_Data = NULL; {
delete [] m_Data;
m_Data = NULL;
}
} }
}; };

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -70,32 +82,58 @@ template <class T> class CVector
// change size // change size
if (size == m_Size) if (size == m_Size)
return true; return true;
if (!size)
{
if (m_Data)
{
delete [] m_Data;
m_Data = NULL;
m_Size = 0;
}
return true;
}
T *newData = new T[size]; T *newData = new T[size];
if (!newData) if (!newData)
return false; return false;
if (m_Data) 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++) for (size_t i=0; i<end; i++)
newData[i] = m_Data[i]; newData[i] = m_Data[i];
delete [] m_Data; delete [] m_Data;
} }
if (m_Size < size)
m_CurrentSize = size;
m_Data = newData; m_Data = newData;
m_Size = size; m_Size = size;
if (m_CurrentUsedSize > m_Size)
m_CurrentUsedSize = m_Size;
return true; return true;
} }
void FreeMemIfPossible() 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: protected:
T *m_Data; T *m_Data;
size_t m_Size; size_t m_Size;
size_t m_CurrentUsedSize; size_t m_CurrentUsedSize;
size_t m_CurrentSize;
public: public:
class iterator class iterator
{ {
@ -189,7 +227,7 @@ public:
iterator & operator-=(size_t offset) iterator & operator-=(size_t offset)
{ {
m_Ptr += offset; m_Ptr -= offset;
return (*this); return (*this);
} }
@ -203,10 +241,10 @@ public:
iterator operator-(size_t offset) const iterator operator-(size_t offset) const
{ {
iterator tmp(*this); iterator tmp(*this);
tmp.m_Ptr += offset; tmp.m_Ptr -= offset;
return tmp; return tmp;
} }
T & operator[](size_t offset) T & operator[](size_t offset)
{ {
return (*(*this + offset)); return (*(*this + offset));
@ -277,12 +315,12 @@ public:
return m_Size; return m_Size;
} }
iterator begin() iterator begin() const
{ {
return iterator(m_Data); return iterator(m_Data);
} }
iterator end() iterator end() const
{ {
return iterator(m_Data + m_CurrentUsedSize); return iterator(m_Data + m_CurrentUsedSize);
} }
@ -296,19 +334,20 @@ public:
bool reserve(size_t newSize) bool reserve(size_t newSize)
{ {
return ChangeSize(newSize); if (newSize > m_Size)
return ChangeSize(newSize);
return true;
} }
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -317,14 +356,15 @@ public:
--m_CurrentUsedSize; --m_CurrentUsedSize;
if (m_CurrentUsedSize < 0) if (m_CurrentUsedSize < 0)
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
// :TODO: free memory sometimes
FreeMemIfPossible();
} }
bool resize(size_t newSize) bool resize(size_t newSize)
{ {
if (!ChangeSize(newSize)) if (!ChangeSize(newSize))
return false; return false;
FreeMemIfPossible(); m_CurrentUsedSize = newSize;
return true; return true;
} }
@ -397,50 +437,64 @@ public:
return m_Data[m_CurrentUsedSize - 1]; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
++m_CurrentUsedSize; size_t ofs = where - begin();
if (!GrowIfNeeded())
if (!GrowIfNeeded(1))
{ {
--m_CurrentUsedSize;
return false; return false;
} }
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data)); ++m_CurrentUsedSize;
memcpy(where.base(), &value, sizeof(T));
return true; 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 // validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize)) if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
return false; return iterator(0);
size_t ofs = where - begin();
if (m_CurrentUsedSize > 1) if (m_CurrentUsedSize > 1)
{ {
// move // 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; --m_CurrentUsedSize;
// :TODO: free memory sometimes
FreeMemIfPossible();
return begin() + ofs;
} }
void clear() void clear()
{ {
m_Size = 0; m_Size = 0;
m_CurrentUsedSize = 0; m_CurrentUsedSize = 0;
delete [] m_Data; if (m_Data)
m_Data = NULL; {
delete [] m_Data;
m_Data = NULL;
}
} }
}; };

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -37,12 +37,20 @@
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
bool Grow() bool Grow(size_t amount)
{ {
// automatic grow // automatic grow
size_t newSize = m_Size * 2; size_t newSize = m_Size * 2;
if (newSize == 0) if (newSize == 0)
newSize = 8; // a good init value {
newSize = 8;
}
while (m_CurrentUsedSize + amount > newSize)
{
newSize *= 2;
}
T *newData = new T[newSize]; T *newData = new T[newSize];
if (!newData) if (!newData)
return false; return false;
@ -57,12 +65,16 @@ template <class T> class CVector
return true; return true;
} }
bool GrowIfNeeded() bool GrowIfNeeded(size_t amount)
{ {
if (m_CurrentUsedSize >= m_Size) if (m_CurrentUsedSize + amount >= m_Size)
return Grow(); {
return Grow(amount);
}
else else
{
return true; return true;
}
} }
bool ChangeSize(size_t size) bool ChangeSize(size_t size)
@ -329,14 +341,13 @@ public:
bool push_back(const T & elem) bool push_back(const T & elem)
{ {
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
m_Data[m_CurrentUsedSize - 1] = elem; m_Data[m_CurrentUsedSize++] = elem;
return true; return true;
} }
@ -434,13 +445,13 @@ public:
size_t ofs = where - begin(); size_t ofs = where - begin();
++m_CurrentUsedSize; if (!GrowIfNeeded(1))
if (!GrowIfNeeded())
{ {
--m_CurrentUsedSize;
return false; return false;
} }
++m_CurrentUsedSize;
where = begin() + ofs; where = begin() + ofs;
// Move subsequent entries // Move subsequent entries

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -4,6 +4,6 @@
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */ /** 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. */ /** 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_ #endif //_INCLUDE_SVN_VERSION_H_

View File

@ -123,6 +123,7 @@ namespace AMXXRelease
AddPlugin("telemenu"); AddPlugin("telemenu");
AddPlugin("timeleft"); AddPlugin("timeleft");
AddPlugin("cmdmenu"); AddPlugin("cmdmenu");
AddPlugin("pluginmenu");
} }
private void AddModules() private void AddModules()

View File

@ -1,6 +1,6 @@
compress = C:\WINDOWS\zip.exe compress = C:\WINDOWS\zip.exe
source = R:\amxmodx source = c:\temp\amxmodx
makeopts = makeopts =
output = c:\real\done output = c:\temp\done
devenv = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com devenv = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com
release = amxmodx-1.76d release = amxmodx-1.8.0

View File

@ -2,7 +2,7 @@
; Licensed under the GNU General Public License ; Licensed under the GNU General Public License
; Originally written by -=HaXoMaTiC=- ; Originally written by -=HaXoMaTiC=-
!define PRODUCT_NAME "AMX Mod X Installer" !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_PUBLISHER "AMX Mod X Dev Team"
!define PRODUCT_WEB_SITE "http://www.amxmodx.org/" !define PRODUCT_WEB_SITE "http://www.amxmodx.org/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Installer.exe" !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\clcmds.ini"
File "installer\files\base\addons\amxmodx\configs\cmds.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\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\core.ini"
File "installer\files\base\addons\amxmodx\configs\custommenuitems.cfg" 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\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\maps.ini"
File "installer\files\base\addons\amxmodx\configs\modules.ini" File "installer\files\base\addons\amxmodx\configs\modules.ini"
File "installer\files\base\addons\amxmodx\configs\plugins.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\regex_amxx_i386.so"
File "installer\files\base\addons\amxmodx\modules\sockets_amxx.dll" 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\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" SetOutPath "$INSTDIR\files\base\plugins"
File "installer\files\base\addons\amxmodx\plugins\admin.amxx" File "installer\files\base\addons\amxmodx\plugins\admin.amxx"
File "installer\files\base\addons\amxmodx\plugins\adminchat.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\nextmap.amxx"
File "installer\files\base\addons\amxmodx\plugins\pausecfg.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\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\scrollmsg.amxx"
File "installer\files\base\addons\amxmodx\plugins\statscfg.amxx" File "installer\files\base\addons\amxmodx\plugins\statscfg.amxx"
File "installer\files\base\addons\amxmodx\plugins\telemenu.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\amxconst.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmisc.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\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\core.inc"
File "installer\files\base\addons\amxmodx\scripting\include\csstats.inc" File "installer\files\base\addons\amxmodx\scripting\include\csstats.inc"
File "installer\files\base\addons\amxmodx\scripting\include\cstrike.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\float.inc"
File "installer\files\base\addons\amxmodx\scripting\include\fun.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\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\hlsdk_const.inc"
File "installer\files\base\addons\amxmodx\scripting\include\lang.inc" File "installer\files\base\addons\amxmodx\scripting\include\lang.inc"
File "installer\files\base\addons\amxmodx\scripting\include\messages.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\ns2amx.inc"
File "installer\files\base\addons\amxmodx\scripting\include\ns_const.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\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\nvault.inc"
File "installer\files\base\addons\amxmodx\scripting\include\sockets.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\sorting.inc"
File "installer\files\base\addons\amxmodx\scripting\include\sqlx.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\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\tfcconst.inc"
File "installer\files\base\addons\amxmodx\scripting\include\tfcstats.inc" File "installer\files\base\addons\amxmodx\scripting\include\tfcstats.inc"
File "installer\files\base\addons\amxmodx\scripting\include\tfcx.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\nextmap.sma"
File "installer\files\base\addons\amxmodx\scripting\pausecfg.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\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\scrollmsg.sma"
File "installer\files\base\addons\amxmodx\scripting\statscfg.sma" File "installer\files\base\addons\amxmodx\scripting\statscfg.sma"
File "installer\files\base\addons\amxmodx\scripting\telemenu.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\telemenu.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\statscfg.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\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\plmenu.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\pausecfg.sma" Delete "$INSTDIR\files\base\addons\amxmodx\scripting\pausecfg.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\nextmap.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\tfcstats.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\tfcconst.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\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\string.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\sqlx.inc" Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\sqlx.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\sorting.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\ns2amx.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\ns.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\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_stocks.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\message_const.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\messages.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\lang.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\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\geoip.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\fun.inc" Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\fun.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\float.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\cstrike.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\csstats.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\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\amxmodx.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod.inc" Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmisc.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\telemenu.amxx"
Delete "$INSTDIR\files\base\plugins\statscfg.amxx" Delete "$INSTDIR\files\base\plugins\statscfg.amxx"
Delete "$INSTDIR\files\base\plugins\scrollmsg.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\plmenu.amxx"
Delete "$INSTDIR\files\base\plugins\pausecfg.amxx" Delete "$INSTDIR\files\base\plugins\pausecfg.amxx"
Delete "$INSTDIR\files\base\plugins\nextmap.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\fakemeta_amxx.dll"
Delete "$INSTDIR\files\base\modules\engine_amxx_i386.so" Delete "$INSTDIR\files\base\modules\engine_amxx_i386.so"
Delete "$INSTDIR\files\base\modules\engine_amxx.dll" 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_i386.so"
Delete "$INSTDIR\files\base\dlls\metamod.dll" Delete "$INSTDIR\files\base\dlls\metamod.dll"
Delete "$INSTDIR\files\base\dlls\amxmodx_mm_i386.so" 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\plugins.ini"
Delete "$INSTDIR\files\base\configs\modules.ini" Delete "$INSTDIR\files\base\configs\modules.ini"
Delete "$INSTDIR\files\base\configs\maps.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\cvars.ini"
Delete "$INSTDIR\files\base\configs\custommenuitems.cfg" Delete "$INSTDIR\files\base\configs\custommenuitems.cfg"
Delete "$INSTDIR\files\base\configs\core.ini" 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\configs.ini"
Delete "$INSTDIR\files\base\configs\cmds.ini" Delete "$INSTDIR\files\base\configs\cmds.ini"
Delete "$INSTDIR\files\base\configs\clcmds.ini" Delete "$INSTDIR\files\base\configs\clcmds.ini"

View File

@ -796,13 +796,13 @@ public cmdPlugins(id, level, cid)
new running = 0 new running = 0
console_print(id, "----- %L -----", id, "LOADED_PLUGINS") 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; new i=StartPLID;
while (i <EndPLID) while (i <EndPLID)
{ {
get_plugin(i++, filename, 31, name, 31, version, 31, author, 31, status, 31) 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" if (status[0]=='d' || status[0]=='r') // "debug" or "running"
running++ running++
@ -842,7 +842,7 @@ public cmdModules(id, level, cid)
new num = get_modulesnum() new num = get_modulesnum()
console_print(id, "%L:", id, "LOADED_MODULES") 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++) 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) 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); console_print(id, "%d old connections saved.", g_Size);
return PLUGIN_HANDLED; return PLUGIN_HANDLED;
} }

View File

@ -13,4 +13,4 @@
#define AMXX_VERSION 1.80 #define AMXX_VERSION 1.80
#define AMXX_VERSION_NUM 180 #define AMXX_VERSION_NUM 180
stock const AMXX_VERSION_STR[] = "1.8.0.3648"; stock const AMXX_VERSION_STR[] = "1.8.0.3660";

View File

@ -1,185 +1,195 @@
#!/usr/bin/perl #!/usr/bin/perl
our %arguments = our %arguments =
( (
'config' => 'modules.versions', 'config' => 'modules.versions',
'major' => '1', 'major' => '1',
'minor' => '0', 'minor' => '0',
'revision' => '0', 'revision' => '0',
'build' => undef, 'build' => undef,
'svnrev' => 'global', 'svnrev' => 'global',
'path' => '', 'path' => '',
'modules' => '', 'modules' => '',
); );
my $arg; my $arg;
foreach $arg (@ARGV) foreach $arg (@ARGV)
{ {
$arg =~ s/--//; $arg =~ s/--//;
@arg = split(/=/, $arg); @arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1]; $arguments{$arg[0]} = $arg[1];
} }
our (%allowed); our (%allowed);
if ($arguments{'modules'} ne "") if ($arguments{'modules'} ne "")
{ {
my @l = split(/,/, $arguments{'modules'}); my @l = split(/,/, $arguments{'modules'});
my $i; my $i;
for ($i=0; $i<=$#l; $i++) for ($i=0; $i<=$#l; $i++)
{ {
$allowed{$l[$i]} = 1; $allowed{$l[$i]} = 1;
} }
} else { } else {
$allowed{'*'} = 1; $allowed{'*'} = 1;
} }
#Set up path info #Set up path info
if ($arguments{'path'} ne "") if ($arguments{'path'} ne "")
{ {
if (!(-d $arguments{'path'})) if (!(-d $arguments{'path'}))
{ {
die "Unable to find path: " . $arguments{'path'} ."\n"; die "Unable to find path: " . $arguments{'path'} ."\n";
} }
chdir($arguments{'path'}); chdir($arguments{'path'});
} }
if (!open(CONFIG, $arguments{'config'})) if (!open(CONFIG, $arguments{'config'}))
{ {
die "Unable to open config file for reading: " . $arguments{'config'} . "\n"; die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
} }
our %modules; our %modules;
my $cur_module = undef; my $cur_module = undef;
my $line; my $line;
while (<CONFIG>) while (<CONFIG>)
{ {
chomp; chomp;
$line = $_; $line = $_;
if ($line =~ /^\[([^\]]+)\]$/) if ($line =~ /^\[([^\]]+)\]$/)
{ {
$cur_module = $1; $cur_module = $1;
next; next;
} }
if (!$cur_module) if (!$cur_module)
{ {
next; next;
} }
if ($line =~ /^([^=]+) = (.+)$/) if ($line =~ /^([^=]+) = (.+)$/)
{ {
$modules{$cur_module}{$1} = $2; $modules{$cur_module}{$1} = $2;
} }
} }
close(CONFIG); close(CONFIG);
#Copy global configuration options... #Copy global configuration options...
if (exists($modules{'PRODUCT'})) if (exists($modules{'PRODUCT'}))
{ {
if (exists($modules{'PRODUCT'}{'major'})) if (exists($modules{'PRODUCT'}{'major'}))
{ {
$arguments{'major'} = $modules{'PRODUCT'}{'major'}; $arguments{'major'} = $modules{'PRODUCT'}{'major'};
} }
if (exists($modules{'PRODUCT'}{'minor'})) if (exists($modules{'PRODUCT'}{'minor'}))
{ {
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'}; $arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
} }
if (exists($modules{'PRODUCT'}{'revision'})) if (exists($modules{'PRODUCT'}{'revision'}))
{ {
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'}; $arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
} }
if (exists($modules{'PRODUCT'}{'svnrev'})) if (exists($modules{'PRODUCT'}{'svnrev'}))
{ {
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'}; $arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
} }
} }
#Get the global SVN revision if we have none #Get the global SVN revision if we have none
my $rev; my $rev;
if ($arguments{'build'} == undef) if ($arguments{'build'} == undef)
{ {
$rev = GetRevision(undef); $rev = GetRevision(undef);
} else { } else {
$rev = int($arguments{'build'}); $rev = int($arguments{'build'});
} }
my $major = $arguments{'major'}; my $major = $arguments{'major'};
my $minor = $arguments{'minor'}; my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'}; my $revision = $arguments{'revision'};
my $svnrev = $arguments{'svnrev'}; my $svnrev = $arguments{'svnrev'};
#Go through everything now #Go through everything now
my $mod_i; my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) ) while ( ($cur_module, $mod_i) = each(%modules) )
{ {
#Skip the magic one #Skip the magic one
if ($cur_module eq "PRODUCT") if ($cur_module eq "PRODUCT")
{ {
next; next;
} }
if (!$allowed{'*'} && !$allowed{$cur_module}) if (!$allowed{'*'} && !$allowed{$cur_module})
{ {
next; next;
} }
#Prepare path #Prepare path
my %mod = %{$mod_i}; my %mod = %{$mod_i};
my $infile = $mod{'in'}; my $infile = $mod{'in'};
my $outfile = $mod{'out'}; my $outfile = $mod{'out'};
if ($mod{'folder'}) if ($mod{'folder'})
{ {
if (!(-d $mod{'folder'})) if (!(-d $mod{'folder'}))
{ {
die "Folder " . $mod{'folder'} . " not found.\n"; die "Folder " . $mod{'folder'} . " not found.\n";
} }
$infile = $mod{'folder'} . '/' . $infile; $infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile; $outfile = $mod{'folder'} . '/' . $outfile;
} }
if (!(-f $infile)) if (!(-f $infile))
{ {
die "File $infile is not a file.\n"; die "File $infile is not a file.\n";
} }
my $global_rev = $rev; my $global_rev = $rev;
my $local_rev = GetRevision($mod{'folder'}); my $local_rev;
if ($arguments{'svnrev'} eq 'local')
{ if ($arguments{'build'} == undef)
$global_rev = $local_rev; {
} $local_rev = GetRevision($mod{'folder'});
#Start rewriting }
open(INFILE, $infile) or die "Could not open file for reading: $infile\n"; else
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n"; {
while (<INFILE>) $local_rev = $rev;
{ }
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g; if ($arguments{'svnrev'} eq 'local')
s/\$PREVISION\$/$revision/g; {
s/\$GLOBAL_BUILD\$/$rev/g; $global_rev = $local_rev;
s/\$LOCAL_BUILD\$/$local_rev/g; }
print OUTFILE $_; #Start rewriting
} open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
close(OUTFILE); open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
close(INFILE); while (<INFILE>)
} {
s/\$PMAJOR\$/$major/g;
sub GetRevision s/\$PMINOR\$/$minor/g;
{ s/\$PREVISION\$/$revision/g;
my ($path)=(@_); s/\$GLOBAL_BUILD\$/$rev/g;
my $rev; s/\$LOCAL_BUILD\$/$local_rev/g;
if (!$path) print OUTFILE $_;
{ }
$rev = `svnversion --committed`; close(OUTFILE);
} else { close(INFILE);
$rev = `svnversion --committed $path`; }
}
if ($rev =~ /exported/) sub GetRevision
{ {
die "Path specified is not a working copy\n"; my ($path)=(@_);
} elsif ($rev =~ /(\d+):(\d+)/) { my $rev;
$rev = int($2); if (!$path)
} elsif ($rev =~ /(\d+)/) { {
$rev = int($1); $rev = `svnversion --committed`;
} else { } else {
die "Unknown svnversion response: $rev\n"; $rev = `svnversion --committed $path`;
} }
return $rev; 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;
}