Revision: 8003
http://armagetronad.svn.sourceforge.net/armagetronad/?rev=8003&view=rev
Author: wrtlprnft
Date: 2008-02-19 04:49:32 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
got rid of the warnings that appeared when loading the default cockpit
Modified Paths:
--------------
armagetronad/trunk/armagetronad/src/tron/cockpit/cCockpit.cpp
armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.cpp
armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.h
Modified: armagetronad/trunk/armagetronad/src/tron/cockpit/cCockpit.cpp
===================================================================
--- armagetronad/trunk/armagetronad/src/tron/cockpit/cCockpit.cpp 2008-02-19 12:47:18 UTC (rev 8002)
+++ armagetronad/trunk/armagetronad/src/tron/cockpit/cCockpit.cpp 2008-02-19 12:49:32 UTC (rev 8003)
@@ -470,6 +470,7 @@
cWidget::Base &widget = *widget_ptr;
widget.SetCockpit(this);
+ widget.ParseTemplate(true);
//Process all templates first
tString use(cur.GetProp("usetemplate"));
@@ -487,6 +488,7 @@
pos = next+1;
}
+ widget.ParseTemplate(false);
ProcessWidget(cur, widget);
m_Widgets.push_back(widget_ptr.release());
}
Modified: armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.cpp
===================================================================
--- armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.cpp 2008-02-19 12:47:18 UTC (rev 8002)
+++ armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.cpp 2008-02-19 12:49:32 UTC (rev 8003)
@@ -45,7 +45,9 @@
//! This should be called by derived classes if parsing a setting fails.
//! @param cur the node that's being attempted to parse
void Base::DisplayError(tXmlParser::node cur) {
- tERR_WARN("Element of type '" + cur.GetName() + "' not processable in this context: '" + typeid(*this).name() + "'");
+ if(!m_ParsingTemplate) {
+ tERR_WARN("Element of type '" + cur.GetName() + "' not processable in this context: '" + typeid(*this).name() + "'");
+ }
}
//! This needs to be overwritten if the derived class has anyting to parse or can be derived from.
Modified: armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.h
===================================================================
--- armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.h 2008-02-19 12:47:18 UTC (rev 8002)
+++ armagetronad/trunk/armagetronad/src/tron/cockpit/cWidgetBase.h 2008-02-19 12:49:32 UTC (rev 8003)
@@ -58,6 +58,7 @@
//! Offers basic functions and keeps the camera settings
class Base : public tReferencable<Base> {
int m_Cam; //!< The camera(s) the widget will be rendered for
+ bool m_ParsingTemplate;
protected:
void DisplayError(tXmlParser::node cur); //!< Displays a parsing error message
bool m_Render; //!< Should this Widget be rendered?
@@ -65,7 +66,7 @@
bool m_Sticky; //!< Should this Widget be sticky?
cCockpit *m_Cockpit; //!< the cockpit this widget belongs to
public:
- Base() : m_Render(true), m_RenderDefault(true), m_Sticky(true) {}
+ Base() : m_ParsingTemplate(false), m_Render(true), m_RenderDefault(true), m_Sticky(true) {}
virtual ~Base() { }
virtual void Render() = 0; //!< Needs to be owerwritten for all widgets that can be rendered (and therefore created)
void SetCam(int Cam); //!< Set the camera(s) this widget will be rendered for
@@ -90,6 +91,9 @@
//! @param state true if the key was pressed, false if it was released
//! @param id key id of the event that was received
virtual void HandleEvent(bool state, int id) { Toggle(state); }
+ //! Call this to surpress warnings about unknown tags
+ //! @param state whether to surpress warnings
+ void ParseTemplate(bool state) {m_ParsingTemplate = state;}
};
typedef std::auto_ptr<Base> Base_ptr; //!< simple shortcut; used in the derived classes
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|