Removed redundant mapping of tab to space (done in code and in font generator). Exposed commodity display names to JavaScript as global DisplayNameForCommodity(). Made commodity symbolic name -> display name mapping case insensitive. NOTE: this changes keys in descriptions.plist.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1362 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
5b7047074e
commit
a6e6dbb6cc
@ -1313,39 +1313,39 @@
|
||||
<string>For capturing %@, %@, you’re paid a bounty of %.1f credits.</string>
|
||||
|
||||
<!-- Commodity names -->
|
||||
<key>commodity-name Food</key>
|
||||
<key>commodity-name food</key>
|
||||
<string>Food</string>
|
||||
<key>commodity-name Textiles</key>
|
||||
<key>commodity-name textiles</key>
|
||||
<string>Textiles</string>
|
||||
<key>commodity-name Radioactives</key>
|
||||
<key>commodity-name radioactives</key>
|
||||
<string>Radioactives</string>
|
||||
<key>commodity-name Slaves</key>
|
||||
<key>commodity-name slaves</key>
|
||||
<string>Slaves</string>
|
||||
<key>commodity-name Liquor/Wines</key>
|
||||
<key>commodity-name liquor/wines</key>
|
||||
<string>Liquor/Wines</string>
|
||||
<key>commodity-name Luxuries</key>
|
||||
<key>commodity-name luxuries</key>
|
||||
<string>Luxuries</string>
|
||||
<key>commodity-name Narcotics</key>
|
||||
<key>commodity-name narcotics</key>
|
||||
<string>Narcotics</string>
|
||||
<key>commodity-name Computers</key>
|
||||
<key>commodity-name computers</key>
|
||||
<string>Computers</string>
|
||||
<key>commodity-name Machinery</key>
|
||||
<key>commodity-name machinery</key>
|
||||
<string>Machinery</string>
|
||||
<key>commodity-name Alloys</key>
|
||||
<key>commodity-name alloys</key>
|
||||
<string>Alloys</string>
|
||||
<key>commodity-name Firearms</key>
|
||||
<key>commodity-name firearms</key>
|
||||
<string>Firearms</string>
|
||||
<key>commodity-name Furs</key>
|
||||
<key>commodity-name furs</key>
|
||||
<string>Furs</string>
|
||||
<key>commodity-name Minerals</key>
|
||||
<key>commodity-name minerals</key>
|
||||
<string>Minerals</string>
|
||||
<key>commodity-name Gold</key>
|
||||
<key>commodity-name gold</key>
|
||||
<string>Gold</string>
|
||||
<key>commodity-name Platinum</key>
|
||||
<key>commodity-name platinum</key>
|
||||
<string>Platinum</string>
|
||||
<key>commodity-name Gem-Stones</key>
|
||||
<key>commodity-name gem-stones</key>
|
||||
<string>Gem-Stones</string>
|
||||
<key>commodity-name Alien Items</key>
|
||||
<key>commodity-name alien items</key>
|
||||
<string>Alien Items</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -2065,7 +2065,7 @@ void drawString(NSString *text, double x, double y, double z, NSSize siz)
|
||||
{
|
||||
unsigned i;
|
||||
double cx = x;
|
||||
unsigned ch, length;
|
||||
unsigned length;
|
||||
NSData *data = nil;
|
||||
const uint8_t *bytes = NULL;
|
||||
|
||||
@ -2080,13 +2080,7 @@ void drawString(NSString *text, double x, double y, double z, NSSize siz)
|
||||
glBegin(GL_QUADS);
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
ch = bytes[i];
|
||||
if (ch == '\t') ch = ' ';
|
||||
//if (ch > 190)
|
||||
//{
|
||||
// OOLog(@"temp", @"Fancy!");
|
||||
//}
|
||||
cx += drawCharacterQuad(ch, cx, y, z, siz);
|
||||
cx += drawCharacterQuad(bytes[i], cx, y, z, siz);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
|
@ -526,7 +526,7 @@ NSString *CommodityDisplayNameForSymbolicName(NSString *symbolicName)
|
||||
// If no entry is found in descriptions.plist, the symbolic name is used.
|
||||
if (result == nil)
|
||||
{
|
||||
key = [@"commodity-name " stringByAppendingString:symbolicName];
|
||||
key = [@"commodity-name " stringByAppendingString:[symbolicName lowercaseString]];
|
||||
result = [UNIVERSE descriptionForKey:key];
|
||||
if (result == nil) result = symbolicName;
|
||||
[cache setObject:result forKey:symbolicName];
|
||||
|
@ -29,6 +29,7 @@ MA 02110-1301, USA.
|
||||
#import "OOJSPlayer.h"
|
||||
#import "PlayerEntityScriptMethods.h"
|
||||
#import "OOStringParsing.h"
|
||||
#import "OOConstToString.h"
|
||||
|
||||
|
||||
#if OOJSENGINE_MONITOR_SUPPORT
|
||||
@ -52,6 +53,7 @@ static JSBool GlobalGetProperty(JSContext *context, JSObject *this, jsval name,
|
||||
static JSBool GlobalLog(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool GlobalLogWithClass(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool GlobalExpandDescription(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool GlobalDisplayNameForCommodity(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool GlobalRandomName(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
|
||||
|
||||
@ -96,6 +98,7 @@ static JSFunctionSpec sGlobalMethods[] =
|
||||
{ "Log", GlobalLog, 1 },
|
||||
{ "LogWithClass", GlobalLogWithClass, 2 },
|
||||
{ "ExpandDescription", GlobalExpandDescription, 1 },
|
||||
{ "DisplayNameForCommodity", GlobalDisplayNameForCommodity, 1 },
|
||||
{ "RandomName", GlobalRandomName, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
@ -195,6 +198,19 @@ static JSBool GlobalExpandDescription(JSContext *context, JSObject *this, uintN
|
||||
}
|
||||
|
||||
|
||||
// DisplayNameForCommodity(commodityName : String) : String
|
||||
static JSBool GlobalDisplayNameForCommodity(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
NSString *string = nil;
|
||||
|
||||
string = [NSString stringWithJavaScriptValue:argv[0] inContext:context];
|
||||
string = CommodityDisplayNameForSymbolicName(string);
|
||||
*outResult = [string javaScriptValueInContext:context];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
static JSBool GlobalRandomName(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
NSString *string = nil;
|
||||
|
Loading…
x
Reference in New Issue
Block a user