From c2b119e721e6ca83687767f5ff8de1d2b7e49fcb Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sun, 25 Feb 2007 21:11:57 +0000 Subject: [PATCH] # Linux fixes. Disabled CONFIG_USE_MMGR by default, since it seems unnecessary and it makes debug builds slow (extremely slow under Valgrind) due to symbol lookups when allocating memory. Fixed minor warnings and errors. This was SVN commit r4927. --- build/premake/premake.lua | 3 ++- source/graphics/Model.cpp | 2 +- source/graphics/ObjectEntry.cpp | 2 ++ source/lib/precompiled.h | 8 ++++---- source/ps/Profile.cpp | 4 ++-- source/simulation/Simulation.cpp | 2 +- .../tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp | 1 + 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/build/premake/premake.lua b/build/premake/premake.lua index de9eb7693f..02a47aa696 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -100,6 +100,7 @@ function package_set_build_flags() "-Wno-switch", -- enumeration value not handled in switch "-Wno-reorder", -- order of initialization list in constructors "-Wno-non-virtual-dtor", + "-Wno-invalid-offsetof", -- offsetof on non-POD types -- do something (?) so that ccache can handle compilation with PCH enabled "-fpch-preprocess", @@ -127,7 +128,7 @@ function package_set_build_flags() } package.defines = { "__STDC_VERSION__=199901L", - "CONFIG_USE_MMGR", + -- "CONFIG_USE_MMGR", } end end diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp index 54f98e600f..2e10820f94 100644 --- a/source/graphics/Model.cpp +++ b/source/graphics/Model.cpp @@ -248,7 +248,7 @@ void CModel::Update(float time) // Make sure the last displayed frame is the final frame // of the animation. float nearlyEnd = duration - 1.f; // 1 msec - if (abs(oldAnimTime - nearlyEnd) < 1.f) + if (fabs(oldAnimTime - nearlyEnd) < 1.f) SetAnimation(NULL); else m_AnimTime = nearlyEnd; diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 38e3f88ced..f4b08c4978 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -67,8 +67,10 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections // Build the model: +/* // remember the old model so we can replace any models using it later on CModelDefPtr oldmodeldef = m_Model ? m_Model->GetModelDef() : CModelDefPtr(); +*/ // try and create a model CModelDefPtr modeldef (objectManager.GetMeshManager().GetMesh(m_ModelName)); diff --git a/source/lib/precompiled.h b/source/lib/precompiled.h index afbaec1f8f..1278021ef7 100644 --- a/source/lib/precompiled.h +++ b/source/lib/precompiled.h @@ -162,10 +162,6 @@ # include #endif -// Boost -#include // noncopyable - - // (further headers to be precompiled go here) #endif // #if HAVE_PCH @@ -188,3 +184,7 @@ // note: mmgr.h activates mmgr or the VC debug heap or nothing depending // on CONFIG_USE_MMGR and HAVE_VC_DEBUG_ALLOC settings. # include "mmgr.h" + + +// Boost +#include // noncopyable diff --git a/source/ps/Profile.cpp b/source/ps/Profile.cpp index c46c61ed45..b5af672c98 100644 --- a/source/ps/Profile.cpp +++ b/source/ps/Profile.cpp @@ -154,7 +154,7 @@ CStr CProfileNodeTable::GetCellText(size_t row, size_t col) else if (col == 4) snprintf(buf, sizeof(buf), "%.1f", unlogged * 100.0f / g_Profiler.GetRoot()->GetFrameTime()); else if (col == 5) - snprintf(buf, sizeof(buf), "%d", unlogged_mallocs); + snprintf(buf, sizeof(buf), "%ld", unlogged_mallocs); buf[sizeof(buf)-1] = '\0'; return CStr(buf); @@ -183,7 +183,7 @@ CStr CProfileNodeTable::GetCellText(size_t row, size_t col) snprintf(buf, sizeof(buf), "%.1f", child->GetFrameTime() * 100.0 / node->GetFrameTime()); break; case 5: - snprintf(buf, sizeof(buf), "%d", child->GetFrameMallocs()); + snprintf(buf, sizeof(buf), "%ld", child->GetFrameMallocs()); break; } buf[sizeof(buf)-1] = '\0'; diff --git a/source/simulation/Simulation.cpp b/source/simulation/Simulation.cpp index 9403a67938..8b9bf8861b 100644 --- a/source/simulation/Simulation.cpp +++ b/source/simulation/Simulation.cpp @@ -136,7 +136,7 @@ void CSimulation::Interpolate(double frameTime, double offset) void CSimulation::Simulate() { - float time = m_pTurnManager->GetTurnLength(); + uint time = m_pTurnManager->GetTurnLength(); PROFILE_START( "scheduler tick" ); g_Scheduler.update(time); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp index 98284c585a..b23cefaab4 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -2,6 +2,7 @@ #include "ScenarioEditor.h" +#include "wx/config.h" #include "wx/evtloop.h" #include "wx/tooltip.h" #include "wx/image.h"