1
0
forked from 0ad/0ad

Uses CStr now, no ICE in VC6

This was SVN commit r49.
This commit is contained in:
Gee 2003-11-07 01:55:29 +00:00
parent db2157d1b1
commit 24d48f2308
6 changed files with 29 additions and 24 deletions

View File

@ -302,7 +302,7 @@ bool CGUI::ObjectExists(const CStr &Name) const
//-------------------------------------------------------------------
// Report XML Reading Error, should be called from within the
// Xerces_* functions. These will not
// Xerces_* functions.
// Input:
// str String explaining error
//-------------------------------------------------------------------
@ -316,7 +316,7 @@ void CGUI::ReportParseError(const CStr &str, ...)
// Important, set ParseError to true
++m_Errors;
/* MEGA TODO Gee
char buffer[512];
va_list args;
@ -324,7 +324,7 @@ void CGUI::ReportParseError(const CStr &str, ...)
va_start(args, str);
vsprintf(buffer, str.c_str(), args);
va_end(args);
*/
/// g_nemLog(" %s", buffer);
}
@ -333,7 +333,7 @@ void CGUI::ReportParseError(const CStr &str, ...)
// Input:
// Filename XML filename
//-------------------------------------------------------------------
void CGUI::LoadXMLFile(const CStr &Filename)
void CGUI::LoadXMLFile(const string &Filename)
{
// Reset parse error
// we can later check if this has increased
@ -365,7 +365,7 @@ void CGUI::LoadXMLFile(const CStr &Filename)
/// g_nemLog("*** Xerces XML Parsing Errors");
// Get main node
LocalFileInputSource source( XMLString::transcode(Filename.c_str()) );
LocalFileInputSource source( XMLString::transcode( Filename.c_str() ) );
// parse
parser->parse(source);

View File

@ -83,7 +83,7 @@ public:
bool HandleEvent(const SDL_Event& ev);
// Load a GUI XML file
void LoadXMLFile(const CStr &Filename);
void LoadXMLFile(const std::string &Filename);
// Checks if object exists and return true or false accordingly
bool ObjectExists(const CStr &Name) const;

View File

@ -278,12 +278,12 @@ void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
// Get setting
SGUISetting set = GetSettingsInfo()[Setting];
if (set.m_Type == "string")
if (set.m_Type == CStr(_T("string")))
{
GUI<string>::SetSetting(this, Setting, Value);
GUI<CStr>::SetSetting(this, Setting, Value);
}
else
if (set.m_Type == "float")
if (set.m_Type == CStr(_T("float")))
{
// Use the parser to parse the values
/* CParser parser;
@ -307,18 +307,21 @@ void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
// Finally the rectangle values
GUI<float>::SetSetting(this, Setting, value);
*/
GUI<float>::SetSetting(this, Setting, (float)atof(Value.c_str()) );
GUI<float>::SetSetting(this, Setting, Value.ToFloat() );
}
else
if (set.m_Type == "rect")
if (set.m_Type == CStr(_T("rect")))
{
// TEMP
// GUI<CRect>::SetSetting(this, Setting, CRect(100,100,200,200));
GUI<CRect>::SetSetting(this, Setting, CRect(100,100,200,200));
// Use the parser to parse the values
CParser parser;
/* CParser parser;
parser.InputTaskType("", "_$value_$value_$value_$value_");
// TODO Gee string really?
string str = Value;
CParserLine line;
line.ParseString(parser, Value);
if (!line.m_ParseOK)
@ -339,7 +342,7 @@ void CGUIObject::SetSetting(const CStr &Setting, const CStr &Value)
// Finally the rectangle values
CRect rect(values[0], values[1], values[2], values[3]);
GUI<CRect>::SetSetting(this, Setting, rect);
}
*/}
else
{
throw PS_FAIL;

View File

@ -147,8 +147,8 @@ public:
// Get/Set
// Name
std::string GetName() const { return m_Name; }
void SetName(const std::string &Name) { m_Name = Name; }
CStr GetName() const { return m_Name; }
void SetName(const CStr &Name) { m_Name = Name; }
// Fill a map_pObjects with this object (does not include recursion)
void AddToPointersMap(map_pObjects &ObjectMap);

View File

@ -16,6 +16,14 @@ gee@pyro.nu
#ifndef GUI_H
#define GUI_H
//--------------------------------------------------------
// Compiler specific
//--------------------------------------------------------
// Important that we do this before <map> is included
#ifdef _MSC_VER
# pragma warning(disable:4786)
#endif
//--------------------------------------------------------
// Includes
//--------------------------------------------------------
@ -25,6 +33,7 @@ gee@pyro.nu
//// janwas: these are very sloppy added, I don't know the etiquette
#include "../ps/Prometheus.h"
#include "../ps/CStr.h"
#include "types.h"
#include "ogl.h"
//// This is what I need from these includes

View File

@ -18,13 +18,6 @@ gee@pyro.nu
#define GUIbase_H
//--------------------------------------------------------
// Compiler specific
//--------------------------------------------------------
#ifdef _MSC_VER
# pragma warning(disable:4786)
#endif
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
@ -44,7 +37,7 @@ class CGUIObject;
// Temp
#define CInput nemInput
#define CStr std::string
//#define CStr std::string
// Example
// GUI_ADD_OFFSET(CButton, SButtonSettings, m_Settings, "frozen", m_Frozen);