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>
|
<string>For capturing %@, %@, you’re paid a bounty of %.1f credits.</string>
|
||||||
|
|
||||||
<!-- Commodity names -->
|
<!-- Commodity names -->
|
||||||
<key>commodity-name Food</key>
|
<key>commodity-name food</key>
|
||||||
<string>Food</string>
|
<string>Food</string>
|
||||||
<key>commodity-name Textiles</key>
|
<key>commodity-name textiles</key>
|
||||||
<string>Textiles</string>
|
<string>Textiles</string>
|
||||||
<key>commodity-name Radioactives</key>
|
<key>commodity-name radioactives</key>
|
||||||
<string>Radioactives</string>
|
<string>Radioactives</string>
|
||||||
<key>commodity-name Slaves</key>
|
<key>commodity-name slaves</key>
|
||||||
<string>Slaves</string>
|
<string>Slaves</string>
|
||||||
<key>commodity-name Liquor/Wines</key>
|
<key>commodity-name liquor/wines</key>
|
||||||
<string>Liquor/Wines</string>
|
<string>Liquor/Wines</string>
|
||||||
<key>commodity-name Luxuries</key>
|
<key>commodity-name luxuries</key>
|
||||||
<string>Luxuries</string>
|
<string>Luxuries</string>
|
||||||
<key>commodity-name Narcotics</key>
|
<key>commodity-name narcotics</key>
|
||||||
<string>Narcotics</string>
|
<string>Narcotics</string>
|
||||||
<key>commodity-name Computers</key>
|
<key>commodity-name computers</key>
|
||||||
<string>Computers</string>
|
<string>Computers</string>
|
||||||
<key>commodity-name Machinery</key>
|
<key>commodity-name machinery</key>
|
||||||
<string>Machinery</string>
|
<string>Machinery</string>
|
||||||
<key>commodity-name Alloys</key>
|
<key>commodity-name alloys</key>
|
||||||
<string>Alloys</string>
|
<string>Alloys</string>
|
||||||
<key>commodity-name Firearms</key>
|
<key>commodity-name firearms</key>
|
||||||
<string>Firearms</string>
|
<string>Firearms</string>
|
||||||
<key>commodity-name Furs</key>
|
<key>commodity-name furs</key>
|
||||||
<string>Furs</string>
|
<string>Furs</string>
|
||||||
<key>commodity-name Minerals</key>
|
<key>commodity-name minerals</key>
|
||||||
<string>Minerals</string>
|
<string>Minerals</string>
|
||||||
<key>commodity-name Gold</key>
|
<key>commodity-name gold</key>
|
||||||
<string>Gold</string>
|
<string>Gold</string>
|
||||||
<key>commodity-name Platinum</key>
|
<key>commodity-name platinum</key>
|
||||||
<string>Platinum</string>
|
<string>Platinum</string>
|
||||||
<key>commodity-name Gem-Stones</key>
|
<key>commodity-name gem-stones</key>
|
||||||
<string>Gem-Stones</string>
|
<string>Gem-Stones</string>
|
||||||
<key>commodity-name Alien Items</key>
|
<key>commodity-name alien items</key>
|
||||||
<string>Alien Items</string>
|
<string>Alien Items</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -2065,7 +2065,7 @@ void drawString(NSString *text, double x, double y, double z, NSSize siz)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
double cx = x;
|
double cx = x;
|
||||||
unsigned ch, length;
|
unsigned length;
|
||||||
NSData *data = nil;
|
NSData *data = nil;
|
||||||
const uint8_t *bytes = NULL;
|
const uint8_t *bytes = NULL;
|
||||||
|
|
||||||
@ -2080,13 +2080,7 @@ void drawString(NSString *text, double x, double y, double z, NSSize siz)
|
|||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
ch = bytes[i];
|
cx += drawCharacterQuad(bytes[i], cx, y, z, siz);
|
||||||
if (ch == '\t') ch = ' ';
|
|
||||||
//if (ch > 190)
|
|
||||||
//{
|
|
||||||
// OOLog(@"temp", @"Fancy!");
|
|
||||||
//}
|
|
||||||
cx += drawCharacterQuad(ch, cx, y, z, siz);
|
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ NSString *CommodityDisplayNameForSymbolicName(NSString *symbolicName)
|
|||||||
// If no entry is found in descriptions.plist, the symbolic name is used.
|
// If no entry is found in descriptions.plist, the symbolic name is used.
|
||||||
if (result == nil)
|
if (result == nil)
|
||||||
{
|
{
|
||||||
key = [@"commodity-name " stringByAppendingString:symbolicName];
|
key = [@"commodity-name " stringByAppendingString:[symbolicName lowercaseString]];
|
||||||
result = [UNIVERSE descriptionForKey:key];
|
result = [UNIVERSE descriptionForKey:key];
|
||||||
if (result == nil) result = symbolicName;
|
if (result == nil) result = symbolicName;
|
||||||
[cache setObject:result forKey:symbolicName];
|
[cache setObject:result forKey:symbolicName];
|
||||||
|
@ -29,6 +29,7 @@ MA 02110-1301, USA.
|
|||||||
#import "OOJSPlayer.h"
|
#import "OOJSPlayer.h"
|
||||||
#import "PlayerEntityScriptMethods.h"
|
#import "PlayerEntityScriptMethods.h"
|
||||||
#import "OOStringParsing.h"
|
#import "OOStringParsing.h"
|
||||||
|
#import "OOConstToString.h"
|
||||||
|
|
||||||
|
|
||||||
#if OOJSENGINE_MONITOR_SUPPORT
|
#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 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 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 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);
|
static JSBool GlobalRandomName(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||||
|
|
||||||
|
|
||||||
@ -96,6 +98,7 @@ static JSFunctionSpec sGlobalMethods[] =
|
|||||||
{ "Log", GlobalLog, 1 },
|
{ "Log", GlobalLog, 1 },
|
||||||
{ "LogWithClass", GlobalLogWithClass, 2 },
|
{ "LogWithClass", GlobalLogWithClass, 2 },
|
||||||
{ "ExpandDescription", GlobalExpandDescription, 1 },
|
{ "ExpandDescription", GlobalExpandDescription, 1 },
|
||||||
|
{ "DisplayNameForCommodity", GlobalDisplayNameForCommodity, 1 },
|
||||||
{ "RandomName", GlobalRandomName, 0 },
|
{ "RandomName", GlobalRandomName, 0 },
|
||||||
{ 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)
|
static JSBool GlobalRandomName(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||||
{
|
{
|
||||||
NSString *string = nil;
|
NSString *string = nil;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user