1
0

Merge remote-tracking branch 'origin/master' into VillageGen

This commit is contained in:
madmaxoft 2014-05-29 09:14:47 +02:00
commit b56033d541
4 changed files with 44 additions and 1 deletions

View File

@ -20,6 +20,12 @@ endif()
# Lua needs to be linked dynamically on Windows and statically on *nix, so that LuaRocks work # Lua needs to be linked dynamically on Windows and statically on *nix, so that LuaRocks work
if (WIN32) if (WIN32)
#for compiliers other than msvc we need to tell lua that its building as a dll
if (NOT MSVC)
add_flags_cxx(-DLUA_BUILD_AS_DLL=1)
endif()
add_library(lua SHARED ${SOURCE}) add_library(lua SHARED ${SOURCE})
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer) set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)

View File

@ -17,6 +17,10 @@ if (WIN32)
source_group("Sources" FILES ${SOURCE}) source_group("Sources" FILES ${SOURCE})
endif() endif()
# FreeBSD requires us to define this to get POSIX 2001 standard
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
add_flags_cxx(-D__POSIX_VISIBLE=200112)
endif()
add_library(sqlite ${SOURCE}) add_library(sqlite ${SOURCE})

View File

@ -26,6 +26,34 @@ cPrefabPiecePool::cPrefabPiecePool(
cPrefabPiecePool::~cPrefabPiecePool()
{
Clear();
}
void cPrefabPiecePool::Clear(void)
{
m_PiecesByConnector.clear();
for (cPieces::iterator itr = m_AllPieces.begin(), end = m_AllPieces.end(); itr != end; ++itr)
{
delete *itr;
}
m_AllPieces.clear();
for (cPieces::iterator itr = m_StartingPieces.begin(), end = m_StartingPieces.end(); itr != end; ++itr)
{
delete *itr;
}
m_StartingPieces.clear();
}
void cPrefabPiecePool::AddPieceDefs(const cPrefab::sDef * a_PieceDefs, size_t a_NumPieceDefs) void cPrefabPiecePool::AddPieceDefs(const cPrefab::sDef * a_PieceDefs, size_t a_NumPieceDefs)
{ {
ASSERT(a_PieceDefs != NULL); ASSERT(a_PieceDefs != NULL);

View File

@ -34,6 +34,12 @@ public:
const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs
); );
/** Destroys the pool, freeing all pieces. */
~cPrefabPiecePool();
/** Removes and frees all pieces from this pool. */
void Clear(void);
/** Adds pieces from the specified definitions into m_AllPieces. Also adds the pieces into /** Adds pieces from the specified definitions into m_AllPieces. Also adds the pieces into
the m_PiecesByConnector map. the m_PiecesByConnector map.
May be called multiple times with different PieceDefs, will add all such pieces. */ May be called multiple times with different PieceDefs, will add all such pieces. */
@ -44,7 +50,6 @@ public:
May be called multiple times with different PieceDefs, will add all such pieces. */ May be called multiple times with different PieceDefs, will add all such pieces. */
void AddStartingPieceDefs(const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs); void AddStartingPieceDefs(const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs);
protected: protected:
/** The type used to map a connector type to the list of pieces with that connector */ /** The type used to map a connector type to the list of pieces with that connector */