1
0
forked from 0ad/0ad

# Fixes for GCC

Renamed 'not' to 'negated', since 'not' is special in C++. Added some
includes, etc.

This was SVN commit r4665.
This commit is contained in:
Ykkrosh 2006-11-29 23:37:10 +00:00
parent 828c8581ac
commit 835003d525
21 changed files with 61 additions and 38 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,
}
}

View File

@ -10,7 +10,6 @@
#ifndef graphics_TerrainProperties_H
#define graphics_TerrainProperties_H
#include "simulation/EntityHandles.h"
#include "ps/CStr.h"
#include <boost/shared_ptr.hpp>
@ -18,7 +17,7 @@ class CTerrainGroup;
class XMBElement;
class CXeromyces;
class CTerrainProperties;
class CEntity;
class HEntity;
typedef boost::shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;

View File

@ -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;

View File

@ -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;

View File

@ -208,12 +208,12 @@ void CTriggerManager::AddTrigger(MapTriggerGroup& group, const MapTrigger& trigg
std::set<MapTriggerLogicBlock>::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 <condition> tag. File: %s", filename);
LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML <condition> 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 <effect> tag. File: %s", filename);
LOG(ERROR, LOG_CATEGORY, "Error detected in Trigger XML <effect> 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;
}
}

View File

@ -11,6 +11,9 @@
#include "scripting/ScriptableObject.h"
#include "simulation/ScriptObject.h"
#include <list>
#include <set>
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<CStrW> 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<MapTriggerCondition> conditions;
std::list<MapTriggerEffect> 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() ); }
};

View File

@ -4,4 +4,5 @@
BEGIN_EVENT_TABLE(ActionButton, wxButton)
EVT_BUTTON(wxID_ANY, ActionButton::OnClick)
END_EVENT_TABLE()
END_EVENT_TABLE()

View File

@ -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

View File

@ -6,4 +6,4 @@ public:
// Return true on success
static bool SetClipboard(AtObj& in);
static bool GetClipboard(AtObj& out);
};
};

View File

@ -43,4 +43,4 @@ bool AtlasCommand_End::Merge(AtlasWindowCommand* command)
previousCommand->m_PostData = previousCommand->m_Object->FreezeData();
return true;
}
}

View File

@ -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

View File

@ -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
}
//////////////////////////////////////////////////////////////////////////

View File

@ -15,6 +15,7 @@ class CinemaSliderBox;
class CinemaSpinnerBox;
class CinemaInfoBox;
class CinematicBottomBar;
class CinemaButtonBox;
class wxImage;
class CinematicSidebar : public Sidebar

View File

@ -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);

View File

@ -4,7 +4,11 @@
#include "GameInterface/Messages.h"
#include "CustomControls/Buttons/ActionButton.h"
#include "ScenarioEditor/Tools/Common/Tools.h"
#include "wx/treectrl.h"
#include <sstream>
#include <list>
using namespace AtlasMessage;
@ -412,7 +416,7 @@ public:
std::vector<sTriggerCondition> 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()

View File

@ -12,6 +12,7 @@ class TriggerTreeCtrl;
class TriggerBottomBar;
class TriggerPage;
class wxTreeItemId;
class wxTreeItemData;
class TriggerSidebar : public Sidebar
{

View File

@ -4,7 +4,6 @@
#include <cassert>
#include <algorithm>
#include <cassert>
//////////////////////////////////////////////////////////////////////////

View File

@ -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<size_t>::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<std::wstring> parameters;
for ( std::list<CStrW>::const_iterator it2=it->parameters.begin();
@ -145,8 +145,8 @@ MapTrigger AtlasToTrigger(const sTrigger& trigger)
engineTrigger.groupName = *trigger.group;
std::vector<int> 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<std::wstring> parameters = *it->parameters;
for ( std::vector<std::wstring>::const_iterator it2 = parameters.begin(); it2 != parameters.end(); ++it2 )
@ -318,4 +318,4 @@ BEGIN_COMMAND(SetAllTriggers)
};
END_COMMAND(SetAllTriggers);
}
}

View File

@ -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<std::wstring> name, functionName, displayName;
@ -155,7 +155,7 @@ struct sTriggerCondition
//0 = none, 1 = and, 2 = or
Shareable<int> linkLogic;
Shareable<bool> not;
Shareable<bool> negated;
bool operator== ( const std::wstring& _name ) const
{