Adding "setShipInfoForKey" (#380) plus useful information to README for compiling on Linux
parent
a5b7d716e1
commit
e00be336fb
24
README.md
24
README.md
|
@ -47,15 +47,19 @@ For end-user documentation, see [oolite.org](http://www.oolite.org/) and
|
|||
- **tools**: Various tools for preparing files, builds, releases etc.
|
||||
|
||||
## Building
|
||||
On Mac OS X, you will need the latest version of Xcode from the App Store.
|
||||
### Mac OS X
|
||||
You will need the latest version of Xcode from the App Store.
|
||||
Then double click on the Xcode project in the Finder, select one of the Oolite
|
||||
targets from the Scheme pop-up, and hit Build and Run (the play button in the
|
||||
toolbar).
|
||||
|
||||
For Windows, see the Oolite wiki:
|
||||
### Windows
|
||||
See the Oolite wiki:
|
||||
http://wiki.alioth.net/index.php/Running_Oolite-Windows
|
||||
|
||||
On Linux, if you have the Debian package tools (installed by default with
|
||||
### Linux
|
||||
|
||||
If you have the Debian package tools (installed by default with
|
||||
Debian and Ubuntu), use dpkg-buildpackage.
|
||||
|
||||
On Linux, BSD and other Unix platforms without dpkg tools, you will need to
|
||||
|
@ -66,14 +70,20 @@ distros, GNUstep and SDL development libraries come prepackaged - just
|
|||
apt-get/yum install the relevant files. You may also need to install Mozilla
|
||||
Spidermonkey (libmozjs). On others you may need to build them from source. In
|
||||
particular, you need the SDL_Mixer library, which doesn't always come with the
|
||||
base SDL development kit. Then just type `make`, or, if you're using GNU make,
|
||||
base SDL development kit.
|
||||
|
||||
Then just type `make`, or, if you're using GNU make,
|
||||
`make -f Makefile`. On some systems, such as Gentoo, you may need to run
|
||||
`make -f Makefile OBJCFLAGS=-fobjc-exceptions`.
|
||||
`make -f Makefile OBJCFLAGS=-fobjc-exceptions`.
|
||||
If you get errors like `make[1]: *** No rule to make target '/objc.make'. Stop.` it might help if you run `source /usr/share/GNUstep/Makefiles/GNUstep.sh` (the exact path to `GNUstep.sh` might differ).
|
||||
If you have problems with missing textures you can try to delete `deps/Linux-deps/include/png.h` and `deps/Linux-deps/include/pngconf.h` before compiling.
|
||||
|
||||
Also remember to first fetch the various submodules, see [Git](#Git).
|
||||
|
||||
## Running
|
||||
On OS X, you can run from Xcode by clicking on the appropriate icon
|
||||
(or choosing 'Run' from the 'Product' menu).
|
||||
On Linux/BSD/Unix, in a terminal, type `openapp oolite`
|
||||
(or choosing 'Run' from the 'Product' menu).
|
||||
On Linux/BSD/Unix, in a terminal, type `openapp oolite`, or if you compiled it yourself you can run it with `./oolite.app/oolite`.
|
||||
|
||||
## Git
|
||||
The Oolite source is available from github.
|
||||
|
|
|
@ -47,6 +47,7 @@ SOFTWARE.
|
|||
+ (void) reload;
|
||||
|
||||
- (NSDictionary *) shipInfoForKey:(NSString *)key;
|
||||
- (void) setShipInfoForKey:(NSString *)key with:(NSDictionary *)newShipData;
|
||||
- (NSDictionary *) effectInfoForKey:(NSString *)key;
|
||||
- (NSDictionary *) shipyardInfoForKey:(NSString *)key;
|
||||
- (OOProbabilitySet *) probabilitySetForRole:(NSString *)role;
|
||||
|
|
|
@ -209,6 +209,13 @@ static NSString * const kVisualEffectDataCacheKey = @"visual effect data";
|
|||
return [_shipData objectForKey:key];
|
||||
}
|
||||
|
||||
- (void) setShipInfoForKey:(NSString *)key with:(NSDictionary *)newShipData
|
||||
{
|
||||
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionaryWithDictionary:_shipData];
|
||||
[mutableDict setObject:OODeepCopy(newShipData) forKey:key];
|
||||
DESTROY(_shipData);
|
||||
_shipData = [[NSDictionary dictionaryWithDictionary:mutableDict] retain];
|
||||
}
|
||||
|
||||
- (NSDictionary *) effectInfoForKey:(NSString *)key
|
||||
{
|
||||
|
|
|
@ -151,6 +151,7 @@ static JSBool ShipStaticKeys(JSContext *context, uintN argc, jsval *vp);
|
|||
static JSBool ShipStaticRoles(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipStaticRoleIsInCategory(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipStaticShipDataForKey(JSContext *context, uintN argc, jsval *vp);
|
||||
static JSBool ShipStaticSetShipDataForKey(JSContext *context, uintN argc, jsval *vp);
|
||||
|
||||
static JSClass sShipClass =
|
||||
{
|
||||
|
@ -575,6 +576,7 @@ static JSFunctionSpec sShipStaticMethods[] =
|
|||
{ "roleIsInCategory", ShipStaticRoleIsInCategory, 2 },
|
||||
{ "roles", ShipStaticRoles, 0 },
|
||||
{ "shipDataForKey", ShipStaticShipDataForKey, 1 },
|
||||
{ "setShipDataForKey", ShipStaticSetShipDataForKey, 2 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -4352,8 +4354,28 @@ static JSBool ShipStaticShipDataForKey(JSContext *context, uintN argc, jsval *vp
|
|||
}
|
||||
else
|
||||
{
|
||||
OOJSReportBadArguments(context, @"Ship", @"shipDataForKey", MIN(argc, 1U), OOJS_ARGV, nil, @"ship role");
|
||||
OOJSReportBadArguments(context, @"Ship", @"shipDataForKey", MIN(argc, 1U), OOJS_ARGV, nil, @"key");
|
||||
return NO;
|
||||
}
|
||||
OOJS_NATIVE_EXIT
|
||||
}
|
||||
|
||||
static JSBool ShipStaticSetShipDataForKey(JSContext *context, uintN argc, jsval *vp)
|
||||
{
|
||||
OOJS_NATIVE_ENTER(context);
|
||||
OOShipRegistry *registry = [OOShipRegistry sharedRegistry];
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
NSString *key = OOStringFromJSValue(context, OOJS_ARGV[0]);
|
||||
NSDictionary *newShipData = OOJSNativeObjectFromJSObject(context, JSVAL_TO_OBJECT(OOJS_ARGV[1]));
|
||||
[registry setShipInfoForKey:key with:newShipData];
|
||||
OOJS_RETURN_BOOL(YES);
|
||||
}
|
||||
else
|
||||
{
|
||||
OOJSReportBadArguments(context, @"Ship", @"setShipInfoForKey", MIN(argc, 2U), OOJS_ARGV, nil, @"key shipdata");
|
||||
return NO;
|
||||
}
|
||||
OOJS_NATIVE_EXIT
|
||||
}
|
Loading…
Reference in New Issue