diff --git a/build/premake/premake.lua b/build/premake/premake.lua index f0bde56b84..1fbac1041a 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -80,6 +80,9 @@ function package_set_build_flags() "-Wno-reorder", -- order of initialization list in constructors "-Wno-non-virtual-dtor", + -- do something (?) so that ccache can handle compilation with PCH enabled + "-fpch-preprocess", + -- speed up math functions by inlining. warning: this may result in -- non-IEEE-conformant results, but haven't noticed any trouble so far. "-ffast-math", @@ -530,6 +533,7 @@ function setup_atlas_packages() "ScenarioEditor/Sections/Map", "ScenarioEditor/Sections/Object", "ScenarioEditor/Sections/Terrain", + "ScenarioEditor/Sections/Trigger", "ScenarioEditor/Tools", "ScenarioEditor/Tools/Common" },{ -- include diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 0740636af3..9d4afbdbd3 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -749,7 +749,7 @@ void CXMLReader::ReadTriggerGroup(XMBElement parent, MapTriggerGroup& group) CStr notAtt(condition.getAttributes().getNamedItem(at_not)); if ( notAtt == CStr("true") ) - mapCondition.not = true; + mapCondition.negated = true; //Read in each condition child XERO_ITER_EL(condition, conditionChild) diff --git a/source/graphics/MapWriter.cpp b/source/graphics/MapWriter.cpp index 5ecb65feef..fdc0688a85 100644 --- a/source/graphics/MapWriter.cpp +++ b/source/graphics/MapWriter.cpp @@ -481,7 +481,7 @@ void CMapWriter::WriteTrigger(XMLWriter_File& xml_file_, const MapTrigger& trigg != trigger.logicBlocks.end() ) { XML_Element("LogicBlock"); - if ( logicIter->not ) + if ( logicIter->negated ) XML_Attribute("not", "true"); else XML_Attribute("not", "false"); @@ -493,7 +493,7 @@ void CMapWriter::WriteTrigger(XMLWriter_File& xml_file_, const MapTrigger& trigg XML_Attribute("function", it2->functionName); XML_Attribute("display", it2->displayName); - if ( it2->not ) + if ( it2->negated ) XML_Attribute("not", "true"); else XML_Attribute("not", "false"); @@ -566,4 +566,4 @@ void CMapWriter::RewriteAllMaps(CTerrain* pTerrain, CUnitManager* pUnitMan, } } - \ No newline at end of file + diff --git a/source/graphics/TerrainProperties.h b/source/graphics/TerrainProperties.h index 0e9a715b64..b2c37dbc56 100644 --- a/source/graphics/TerrainProperties.h +++ b/source/graphics/TerrainProperties.h @@ -10,7 +10,6 @@ #ifndef graphics_TerrainProperties_H #define graphics_TerrainProperties_H -#include "simulation/EntityHandles.h" #include "ps/CStr.h" #include @@ -18,7 +17,7 @@ class CTerrainGroup; class XMBElement; class CXeromyces; class CTerrainProperties; -class CEntity; +class HEntity; typedef boost::shared_ptr CTerrainPropertiesPtr; diff --git a/source/ps/Interact.h b/source/ps/Interact.h index b645781e3e..d740485ddc 100644 --- a/source/ps/Interact.h +++ b/source/ps/Interact.h @@ -15,7 +15,6 @@ #include "ps/Vector2D.h" #include "lib/input.h" #include "lib/res/handle.h" -#include "ps/CStr.h" class CVector3D; class CUnit; diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index ab9f645f12..e902a4e5b1 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -1287,7 +1287,7 @@ JSBool getTrigger( JSContext* cx, JSObject* UNUSED(globalObject), uint argc, *rval = ToJSVal( g_TriggerManager.m_TriggerMap[name] ); else { - debug_printf("Invalid trigger name %ws", name); + debug_printf("Invalid trigger name %ws", name.c_str()); *rval = JSVAL_NULL; } return JS_TRUE; diff --git a/source/simulation/TriggerManager.cpp b/source/simulation/TriggerManager.cpp index b1e2103712..935d5a3633 100644 --- a/source/simulation/TriggerManager.cpp +++ b/source/simulation/TriggerManager.cpp @@ -208,12 +208,12 @@ void CTriggerManager::AddTrigger(MapTriggerGroup& group, const MapTrigger& trigg std::set::const_iterator blockIt; if ( ( blockIt = trigger.logicBlocks.find(MapTriggerLogicBlock(i)) ) != trigger.logicBlocks.end() ) { - if ( blockIt->not ) + if ( blockIt->negated ) conditionBody += CStrW(L"!"); conditionBody += CStrW(L" ("); } - if ( it->not ) + if ( it->negated ) conditionBody += CStrW(L"!"); conditionBody += it->functionName; conditionBody += CStrW(L"("); @@ -291,7 +291,7 @@ bool CTriggerManager::LoadXML( const CStr& filename ) { if ( !loadTriggerSpec(rootChild, XeroFile, true) ) { - LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename); + LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); return false; } } @@ -299,13 +299,13 @@ bool CTriggerManager::LoadXML( const CStr& filename ) { if ( !loadTriggerSpec(rootChild, XeroFile, false) ) { - LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename); + LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML tag. File: %s", filename.c_str()); return false; } } else { - LOG(ERROR, LOG_CATEGORY, "Invalid tag in trigger XML. File: ws", filename); + LOG(ERROR, LOG_CATEGORY, "Invalid tag in trigger XML. File: %s", filename.c_str()); return false; } } diff --git a/source/simulation/TriggerManager.h b/source/simulation/TriggerManager.h index 5d5a55e135..c5b7ac1bdd 100644 --- a/source/simulation/TriggerManager.h +++ b/source/simulation/TriggerManager.h @@ -11,6 +11,9 @@ #include "scripting/ScriptableObject.h" #include "simulation/ScriptObject.h" +#include +#include + class CXeromyces; class XMBElement; @@ -18,11 +21,11 @@ class XMBElement; struct MapTriggerCondition { - MapTriggerCondition() : linkLogic(0), not(false) { } + MapTriggerCondition() : linkLogic(0), negated(false) { } CStrW name, functionName, displayName; std::list parameters; int linkLogic; //0 = NONE, 1 = AND, 2 = OR - bool not; + bool negated; }; struct MapTriggerEffect @@ -33,9 +36,9 @@ struct MapTriggerEffect struct MapTriggerLogicBlock { - MapTriggerLogicBlock(size_t i, bool _not=false) : index(i), not(_not) { } + MapTriggerLogicBlock(size_t i, bool _not=false) : index(i), negated(_not) { } size_t index; - bool not; + bool negated; bool operator< (const MapTriggerLogicBlock& block) const { return (index < block.index); } bool operator== (const MapTriggerLogicBlock& block) const { return (index == block.index); } @@ -54,7 +57,7 @@ struct MapTrigger std::list conditions; std::list effects; - void AddLogicBlock(bool not) { logicBlocks.insert( MapTriggerLogicBlock(conditions.size(), not) ); } + void AddLogicBlock(bool negated) { logicBlocks.insert( MapTriggerLogicBlock(conditions.size(), negated) ); } void AddLogicBlockEnd() { logicBlockEnds.insert( effects.size() ); } }; diff --git a/source/tools/atlas/AtlasUI/CustomControls/Buttons/ActionButton.cpp b/source/tools/atlas/AtlasUI/CustomControls/Buttons/ActionButton.cpp index 671e5d34e9..07dc41d130 100644 --- a/source/tools/atlas/AtlasUI/CustomControls/Buttons/ActionButton.cpp +++ b/source/tools/atlas/AtlasUI/CustomControls/Buttons/ActionButton.cpp @@ -4,4 +4,5 @@ BEGIN_EVENT_TABLE(ActionButton, wxButton) EVT_BUTTON(wxID_ANY, ActionButton::OnClick) -END_EVENT_TABLE() \ No newline at end of file +END_EVENT_TABLE() + diff --git a/source/tools/atlas/AtlasUI/FileConverter/FileConverter.cpp b/source/tools/atlas/AtlasUI/FileConverter/FileConverter.cpp index 6b06551730..5f5705094b 100644 --- a/source/tools/atlas/AtlasUI/FileConverter/FileConverter.cpp +++ b/source/tools/atlas/AtlasUI/FileConverter/FileConverter.cpp @@ -44,7 +44,7 @@ bool ConvertFile(const wxString& sourceFilename, FileType sourceType, XMLReader* io); FileConverter::FileConverter(wxWindow* parent) -: wxFrame(parent, wxID_ANY, wxString::Format(_("%s - File Converter"), g_ProgramNameVersion)) +: wxFrame(parent, wxID_ANY, wxString::Format(_("%s - File Converter"), g_ProgramNameVersion.c_str())) { SetIcon(wxIcon(_T("ICON_FileConverter"))); @@ -294,7 +294,7 @@ bool ConvertFile(const wxString& sourceFilename, FileType sourceType, DDTFile ddt(inStream); if (! ddt.Read(DDTFile::TGA)) { - wxLogError(_("Failed to read TGA file %s"), sourceFilename); + wxLogError(_("Failed to read TGA file %s"), sourceFilename.c_str()); return false; } // Extract the format-identifying data from just before the extension diff --git a/source/tools/atlas/AtlasUI/General/AtlasClipboard.h b/source/tools/atlas/AtlasUI/General/AtlasClipboard.h index 2aa9b672af..8c79bad9f9 100644 --- a/source/tools/atlas/AtlasUI/General/AtlasClipboard.h +++ b/source/tools/atlas/AtlasUI/General/AtlasClipboard.h @@ -6,4 +6,4 @@ public: // Return true on success static bool SetClipboard(AtObj& in); static bool GetClipboard(AtObj& out); -}; \ No newline at end of file +}; diff --git a/source/tools/atlas/AtlasUI/General/AtlasWindowCommand.cpp b/source/tools/atlas/AtlasUI/General/AtlasWindowCommand.cpp index f6f803f041..10484a3899 100644 --- a/source/tools/atlas/AtlasUI/General/AtlasWindowCommand.cpp +++ b/source/tools/atlas/AtlasUI/General/AtlasWindowCommand.cpp @@ -43,4 +43,4 @@ bool AtlasCommand_End::Merge(AtlasWindowCommand* command) previousCommand->m_PostData = previousCommand->m_Object->FreezeData(); return true; -} \ No newline at end of file +} diff --git a/source/tools/atlas/AtlasUI/Misc/stdafx.h b/source/tools/atlas/AtlasUI/Misc/stdafx.h index 58a94a7cec..e813008990 100644 --- a/source/tools/atlas/AtlasUI/Misc/stdafx.h +++ b/source/tools/atlas/AtlasUI/Misc/stdafx.h @@ -68,7 +68,13 @@ #endif #ifdef _WIN32 -#define ATLASDLLIMPEXP extern "C" __declspec(dllexport) +# define ATLASDLLIMPEXP extern "C" __declspec(dllexport) #else -#define ATLASDLLIMPEXP extern "C" +# define ATLASDLLIMPEXP extern "C" +#endif + +// Abort with an obvious message if wx isn't Unicode, instead of complaining +// mysteriously when it first discovers wxChar != wchar_t +#ifndef UNICODE +# error This needs to be compiled with a Unicode version of wxWidgets. #endif diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp index 3d762f05ae..c04bc693d4 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -210,6 +210,7 @@ END_EVENT_TABLE() ////////////////////////////////////////////////////////////////////////// +#if wxUSE_MEDIACTRL class MediaPlayer : public wxFrame { public: @@ -238,6 +239,7 @@ private: BEGIN_EVENT_TABLE(MediaPlayer, wxFrame) EVT_MEDIA_LOADED(wxID_ANY, MediaPlayer::OnLoad) END_EVENT_TABLE() +#endif // wxUSE_MEDIACTRL ////////////////////////////////////////////////////////////////////////// @@ -592,8 +594,12 @@ void ScenarioEditor::OnScreenshot(wxCommandEvent& WXUNUSED(event)) void ScenarioEditor::OnMediaPlayer(wxCommandEvent& WXUNUSED(event)) { +#if wxUSE_MEDIACTRL wxWindow* mediaPlayer = new MediaPlayer(this); mediaPlayer->Show(); +#else + wxLogError(_("Sorry, media playback is not supported in this build.")); +#endif } ////////////////////////////////////////////////////////////////////////// diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.h b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.h index 8e8500d4c8..ddabc97916 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.h +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.h @@ -15,6 +15,7 @@ class CinemaSliderBox; class CinemaSpinnerBox; class CinemaInfoBox; class CinematicBottomBar; +class CinemaButtonBox; class wxImage; class CinematicSidebar : public Sidebar diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/LightControl.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/LightControl.cpp index e8ddf58ca5..9686fc3a17 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/LightControl.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/LightControl.cpp @@ -55,7 +55,7 @@ public: float rdotl = rx*lx + ry*ly + rz*lz; int diffuse = (int)std::max(0.f, ndotl*128.f); - int specular = (int)std::min(255.f, 64.f*pow(std::max(0.f, rdotl), 16.f)); + int specular = (int)std::min(255.f, 64.f*powf(std::max(0.f, rdotl), 16.f)); imgData[0] = std::min(64+diffuse+specular, 255); imgData[1] = std::min(48+diffuse+specular, 255); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.cpp index 6f1726d99e..8543c133f7 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.cpp @@ -4,7 +4,11 @@ #include "GameInterface/Messages.h" #include "CustomControls/Buttons/ActionButton.h" #include "ScenarioEditor/Tools/Common/Tools.h" + +#include "wx/treectrl.h" + #include +#include using namespace AtlasMessage; @@ -412,7 +416,7 @@ public: std::vector conditions = *m_Sidebar->GetSelectedItemData()->conditions; int condition = m_Sidebar->GetConditionCount(m_Sidebar->m_SelectedCond); bool value = (evt.GetInt() == 1); - conditions[condition-1].not = value; + conditions[condition-1].negated = value; m_Sidebar->GetSelectedItemData()->conditions = conditions; m_Sidebar->UpdateLists(); @@ -565,7 +569,7 @@ public: else m_LogicRadio->SetSelection(1); - m_NotCheck->SetValue(condition.not); + m_NotCheck->SetValue(condition.negated); } void FillEffectData() diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.h b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.h index e49b5e4c78..b08037df58 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.h +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Trigger/Trigger.h @@ -12,6 +12,7 @@ class TriggerTreeCtrl; class TriggerBottomBar; class TriggerPage; class wxTreeItemId; +class wxTreeItemData; class TriggerSidebar : public Sidebar { diff --git a/source/tools/atlas/GameInterface/CommandProc.cpp b/source/tools/atlas/GameInterface/CommandProc.cpp index 248e48d3dc..015868882a 100644 --- a/source/tools/atlas/GameInterface/CommandProc.cpp +++ b/source/tools/atlas/GameInterface/CommandProc.cpp @@ -4,7 +4,6 @@ #include #include -#include ////////////////////////////////////////////////////////////////////////// diff --git a/source/tools/atlas/GameInterface/Handlers/TriggerHandler.cpp b/source/tools/atlas/GameInterface/Handlers/TriggerHandler.cpp index 8f654f90c1..0fa677299e 100644 --- a/source/tools/atlas/GameInterface/Handlers/TriggerHandler.cpp +++ b/source/tools/atlas/GameInterface/Handlers/TriggerHandler.cpp @@ -55,7 +55,7 @@ sTrigger TriggerToAtlas(const MapTrigger& trigger) it != trigger.logicBlocks.end(); ++it ) { atlasBlocks.push_back( (int)it->index ); - atlasNots.push_back( it->not ); + atlasNots.push_back( it->negated ); } for ( std::set::const_iterator it = trigger.logicBlockEnds.begin(); it != trigger.logicBlockEnds.end(); ++it ) @@ -77,7 +77,7 @@ sTrigger TriggerToAtlas(const MapTrigger& trigger) atlasCondition.name = it->name; atlasCondition.functionName = it->functionName; atlasCondition.displayName = it->displayName; - atlasCondition.not = it->not; + atlasCondition.negated = it->negated; std::vector parameters; for ( std::list::const_iterator it2=it->parameters.begin(); @@ -145,8 +145,8 @@ MapTrigger AtlasToTrigger(const sTrigger& trigger) engineTrigger.groupName = *trigger.group; std::vector blockEnds = *trigger.logicBlockEnds, blocks = *trigger.logicBlocks; - std::copy( blockEnds.begin(), blockEnds.end(), engineTrigger.logicBlockEnds.begin() ); - std::copy( blocks.begin(), blocks.end(), engineTrigger.logicBlocks.begin() ); + std::copy( blockEnds.begin(), blockEnds.end(), inserter(engineTrigger.logicBlockEnds, engineTrigger.logicBlockEnds.begin()) ); + std::copy( blocks.begin(), blocks.end(), inserter(engineTrigger.logicBlocks, engineTrigger.logicBlocks.begin()) ); engineTrigger.maxRunCount = trigger.maxRuns; engineTrigger.name = *trigger.name; @@ -164,7 +164,7 @@ MapTrigger AtlasToTrigger(const sTrigger& trigger) cond->displayName = *it->displayName; cond->linkLogic = it->linkLogic; cond->name = *it->name; - cond->not = it->not; + cond->negated = it->negated; std::vector parameters = *it->parameters; for ( std::vector::const_iterator it2 = parameters.begin(); it2 != parameters.end(); ++it2 ) @@ -318,4 +318,4 @@ BEGIN_COMMAND(SetAllTriggers) }; END_COMMAND(SetAllTriggers); -} \ No newline at end of file +} diff --git a/source/tools/atlas/GameInterface/SharedTypes.h b/source/tools/atlas/GameInterface/SharedTypes.h index 73fd4e7719..7540c8e2f5 100644 --- a/source/tools/atlas/GameInterface/SharedTypes.h +++ b/source/tools/atlas/GameInterface/SharedTypes.h @@ -146,8 +146,8 @@ SHAREABLE_STRUCT(sTriggerSpec); struct sTriggerCondition { - sTriggerCondition() : linkLogic(1), not(false) {} - sTriggerCondition(const std::wstring& _name) : linkLogic(1), not(false), name(_name) {} + sTriggerCondition() : linkLogic(1), negated(false) {} + sTriggerCondition(const std::wstring& _name) : linkLogic(1), negated(false), name(_name) {} //displayName is used for selecting choice items in Atlas Shareable name, functionName, displayName; @@ -155,7 +155,7 @@ struct sTriggerCondition //0 = none, 1 = and, 2 = or Shareable linkLogic; - Shareable not; + Shareable negated; bool operator== ( const std::wstring& _name ) const {