mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 22:52:18 +00:00
Corrected mesh manager's use of hashmap. Added CStrW support to JS/GUI interface. Added error checking to CStr::Left/Right to make bugs more obvious.
This was SVN commit r1456.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// $Id: JSInterface_IGUIObject.cpp,v 1.15 2004/09/06 11:28:30 philip Exp $
|
||||
// $Id$
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
@@ -173,11 +173,20 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval
|
||||
{
|
||||
CStr value;
|
||||
GUI<CStr>::GetSetting(e, propName, value);
|
||||
// Create a garbage-collectable copy of the string
|
||||
// Create a garbage-collectible copy of the string
|
||||
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, value.c_str() ));
|
||||
break;
|
||||
}
|
||||
|
||||
case GUIST_CStrW:
|
||||
{
|
||||
CStrW value;
|
||||
GUI<CStrW>::GetSetting(e, propName, value);
|
||||
// Create a garbage-collectible copy of the string
|
||||
*vp = STRING_TO_JSVAL(JS_NewUCStringCopyZ(cx, value.utf16().c_str() ));
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO Gee: (2004-09-01) EAlign and EVAlign too.
|
||||
|
||||
default:
|
||||
@@ -220,6 +229,13 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval
|
||||
break;
|
||||
}
|
||||
|
||||
case GUIST_CStrW:
|
||||
{
|
||||
utf16string value (JS_GetStringChars(JS_ValueToString(cx, *vp)));
|
||||
GUI<CStrW>::SetSetting(e, propName, value);
|
||||
break;
|
||||
}
|
||||
|
||||
case GUIST_CGUIString:
|
||||
{
|
||||
std::wstring value;
|
||||
|
||||
Reference in New Issue
Block a user