mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
**********************************************************
** Big Maps Projects code (incl. Multiplayer v1.5 ** ********************************************************** - Merged Big Maps Project code from BMP+MP trunk (Revision: 3340) o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP - Before THIS merge, I made a branch of the existing 1.13 source o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src - Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago - I will add VS 2010 projects and solution file in the next few days git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+19
-19
@@ -16,41 +16,41 @@ public:
|
||||
/**
|
||||
* Interface
|
||||
*/
|
||||
static void OnStartCallback(void *userData, const XML_Char* name, const XML_Char** atts)
|
||||
static void onStartCallback(void *userData, const XML_Char* name, const XML_Char** atts)
|
||||
{
|
||||
((IXMLParser*)userData)->OnStartElement(name,atts);
|
||||
((IXMLParser*)userData)->onStartElement(name,atts);
|
||||
}
|
||||
static void OnEndCallback(void *userData, const XML_Char* name)
|
||||
static void onEndCallback(void *userData, const XML_Char* name)
|
||||
{
|
||||
((IXMLParser*)userData)->OnEndElement(name);
|
||||
((IXMLParser*)userData)->onEndElement(name);
|
||||
// test if we are done here
|
||||
if( ((IXMLParser*)userData)->_caller && (strcmp(name, ((IXMLParser*)userData)->ElementName) == 0) )
|
||||
{
|
||||
((IXMLParser*)userData)->_caller->GrabParser();
|
||||
((IXMLParser*)userData)->_caller->grabParser();
|
||||
}
|
||||
}
|
||||
static void OnTextCallback(void *userData, const XML_Char *str, int len)
|
||||
static void onTextCallback(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
((IXMLParser*)userData)->OnTextElement(str,len);
|
||||
((IXMLParser*)userData)->onTextElement(str,len);
|
||||
}
|
||||
void GrabParser()
|
||||
void grabParser()
|
||||
{
|
||||
XML_SetUserData(_parser,this);
|
||||
XML_SetElementHandler(_parser, IXMLParser::OnStartCallback, IXMLParser::OnEndCallback);
|
||||
XML_SetCharacterDataHandler(_parser, IXMLParser::OnTextCallback);
|
||||
XML_SetElementHandler(_parser, IXMLParser::onStartCallback, IXMLParser::onEndCallback);
|
||||
XML_SetCharacterDataHandler(_parser, IXMLParser::onTextCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override these methods in your parser
|
||||
*/
|
||||
virtual void OnStartElement(const XML_Char* name, const XML_Char** atts)
|
||||
virtual void onStartElement(const XML_Char* name, const XML_Char** atts)
|
||||
{};
|
||||
virtual void OnEndElement(const XML_Char* name)
|
||||
virtual void onEndElement(const XML_Char* name)
|
||||
{};
|
||||
virtual void OnTextElement(const XML_Char *str, int len)
|
||||
virtual void onTextElement(const XML_Char *str, int len)
|
||||
{};
|
||||
protected:
|
||||
XML_Char const* GetAttribute(const XML_Char* attr_name, const XML_Char** atts)
|
||||
XML_Char const* getAttribute(const XML_Char* attr_name, const XML_Char** atts)
|
||||
{
|
||||
while(*atts)
|
||||
{
|
||||
@@ -62,9 +62,9 @@ protected:
|
||||
}
|
||||
return "";
|
||||
}
|
||||
bool GetAttributeAsInt(const XML_Char* attr_name, const XML_Char** attr, int &value)
|
||||
bool getAttributeAsInt(const XML_Char* attr_name, const XML_Char** attr, int &value)
|
||||
{
|
||||
XML_Char const* result = GetAttribute(attr_name,attr);
|
||||
XML_Char const* result = getAttribute(attr_name,attr);
|
||||
if( strcmp(result,"") != 0)
|
||||
{
|
||||
value = (int)atol(result);
|
||||
@@ -72,9 +72,9 @@ protected:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool GetAttributeAsFloat(const XML_Char* attr_name, const XML_Char** attr, float &value)
|
||||
bool getAttributeAsFloat(const XML_Char* attr_name, const XML_Char** attr, float &value)
|
||||
{
|
||||
XML_Char const* result = GetAttribute(attr_name,attr);
|
||||
XML_Char const* result = getAttribute(attr_name,attr);
|
||||
if( strcmp(result,"") != 0)
|
||||
{
|
||||
value = (float)atof(result);
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
int GetCurrentLineNumber()
|
||||
int getCurrentLineNumber()
|
||||
{
|
||||
return XML_GetCurrentLineNumber(this->_parser);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user