201 Commits

Author SHA1 Message Date
Jens Ayton
98a4baf994 Tweaked SpiderMonkey build setup warning message. Fixed a cosmetic problem with -[AI dumpState].
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1372 127b21dd-08f5-0310-b4b7-95ae10353056
2008-02-13 11:55:19 +00:00
Jens Ayton
65574daac5 Fix for ReferenceErrors when more than one JavaScript context active. Added various logs and script messages to debug escort issues.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1355 127b21dd-08f5-0310-b4b7-95ae10353056
2008-02-09 16:37:34 +00:00
Jens Ayton
f11b6fae14 Implemented JS sound interface. Moved some more generic JS ObjC wrapper stuff into OOJavaScriptEngine.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1340 127b21dd-08f5-0310-b4b7-95ae10353056
2008-02-03 02:16:23 +00:00
Jens Ayton
a97c9fd093 Fixed a few leaks, notably one that became serious on the short-range chart screen. Fixed some warnings when building for Windows.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1282 127b21dd-08f5-0310-b4b7-95ae10353056
2007-12-24 13:59:30 +00:00
Jens Ayton
3fbc24887d * All ships now have a JavaScript script attached, allowing JS scripts to
add behaviours to any ship.
* Legacy script_actions, setup_actions, launch_actions and death_actions
  handled through default JavaScript script.
* In order to implement the above, JS Ship now has a runLegacyScriptActions
  method. This is not to be exposed as an "official" method, though, since
  we might want to change the mechanism -- for instance, to "compile"
  legacy scripts into JS. Handling dynamically-generated legacy scripts in
  that case would be a significant complication.
* Updates for Mac OS X 10.5 "Leopard".
  - Errors on reading/writing plist will not cause a crash if building
    against the Leopard SDK. (I have no intention of requiring Leopard any
    time soon, but future-proofing is good.)
  - OOWeakReference is now more efficient when running under Leopard, by
    implementing the new "fast forwarding" mechanism.
  - Threads now have names set under Leopard, which may provide debugging
    advantages.
  - Fixed some new build warnings for new version of apple-gcc.
  - Updated type declarations to identify Oolite saved games as property
    lists.
* Cleaned up PlayerEntityControls.m somewhat. Moved method declarations
  into files, fixed indentation, broke up monster giant method of doom.
* Script-generated asteroids now behave like system populator-generated
  asteroids (As Seen on BB[TM]).
* Minor optimizations and simplifications of legacy script engine.
* JS System.filteredEntities() now has sensible behaviour if predicate
  throws an exception: the predicate is not called again, and null is
  returned. The exception is reported and not rethrown.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1240 127b21dd-08f5-0310-b4b7-95ae10353056
2007-11-23 15:04:14 +00:00
Jens Ayton
8dac1d08cd Split JS Planet into Planet and Sun in anticipation of splitting PlanetEntity in same way.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1214 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-15 13:20:27 +00:00
Jens Ayton
6a8c7976dd Added scriptInfo dictionary to ships, and global JS objects worldScripts and worldScriptNames. Fiddled with messages on both sides of debug console. Fiddled with flags on JavaScript classes, hopefully for the better.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1211 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-13 15:10:16 +00:00
Jens Ayton
c69733ac93 Changed to using a pool of JavaScript contexts instead of a single one, so that JS -> ObjC -> JS call chains work. I'm not sure I fully trust this, but it appears to work. Need to think up some serious stress tests.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1207 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-09 18:02:18 +00:00
Jens Ayton
d675db1622 JS entity-searching functions now return results sorted by proximity to reference entity, if specified. Cleaned up implementation, too.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1200 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-08 12:06:39 +00:00
Jens Ayton
160cd8b94d Implemented JS class Planet. Added JS System attributes mainPlanet, sun, planets and allShips, and methods shipsWithPrimaryRole(), shipsWithRole(), entitiesWithScanClass() and filteredEntities() (the latter disabled due to an architectural flaw -- we need more than one JSContext). In support of this, added/exposed generic predicate-based entity counters and getters to Universe.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1198 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-07 21:41:18 +00:00
Jens Ayton
9994475a5a Fixed Mac debug console. Added auto-generated stripped-down debug.oxp to trigger TCP console support.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1192 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-06 13:25:59 +00:00
Jens Ayton
8904c39401 Oolite should now build with external debug console support on all platforms. Mac debug OXP is broken.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1191 127b21dd-08f5-0310-b4b7-95ae10353056
2007-10-06 11:03:01 +00:00
Jens Ayton
3c16a7cdaf Added clearMissionScreen scripting method (legacy and JS). Scripting tweaks. Ported trumble mission to JavaScript. Attempted to address JS Ship.escorts bug but couldn't reproduce it.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1187 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-29 12:27:31 +00:00
Jens Ayton
ff941ad9ff More explicit message about the need to set JS_C_STRINGS_ARE_UTF8. Explicitly set scanClass of 'barrel' to CLASS_CARGO for scripted creation.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1186 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-29 09:08:31 +00:00
Jens Ayton
7d99e403a5 Experimental support for caching of compiled JavaScript (can be disabled with -DOO_CACHE_JS_SCRIPTS=0). Implemented JS Vector.rotateBy(quaternionExpression).
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1181 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-22 15:16:40 +00:00
Jens Ayton
fca7042527 More consistent use of JS-friendly description mechanism. Cleaned out redundant and unused particle types, and improved encapsulation of ParticleEntity.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1178 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-16 11:58:13 +00:00
Nikos Barkas
9051c61d31 Fixed a compile error when ALLOW_PROCEDURAL_PLANETS was defined. Eliminated some build warnings.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1177 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-16 11:01:16 +00:00
Jens Ayton
7e4b1b0880 Implemented JS clock global object, unbroke makefile.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1175 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-15 15:09:19 +00:00
Jens Ayton
0da77044e5 Implemented JS Timer object. Updated priority queue test case.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1173 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-15 13:53:30 +00:00
Jens Ayton
77df587d1a Split out remaining JS classes from OOJavaScriptEngine.* into new files. Added expandable pirate-victim recognition via pirate-victim-roles.plist. Added a number of AI methods for searching for entities by role and scan class.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1169 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-12 17:00:59 +00:00
Jens Ayton
51afdc0a40 Fixes for minor build problems.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1159 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-05 14:43:53 +00:00
Jens Ayton
a265c06344 * Work on generic-ish JavaScript object bridging.
* Fixed potential crashing bug in JS memory management (OOJSScript was not releasing its JS GC root).
* Fixed bug with several shipdata.plist settings being ignored in StationEntitys (bug #11684).
* Added JS Oolite object for app and JS version number checking; may add other facilities.
* Require latest version of SpiderMonkey (Gecko 1.8/FireFox 2 version) with JavaScript 1.7 support, built with JS_C_STRINGS_ARE_UTF8. 
*Made SpiderMonkey build as a subproject in Xcode for ease of debugging.
* Further fiddling with Mac debug console.
* Added has_npc_traffic attribute to StationEntity.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1157 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-04 23:04:09 +00:00
Jens Ayton
2df17375b1 Missing files from r1153.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1154 127b21dd-08f5-0310-b4b7-95ae10353056
2007-09-01 12:07:02 +00:00
Jens Ayton
6980e1d9d6 Various JS scripting fixes. Threw out all Convert ops and replaced them with toString methods, which is simpler and actually works.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1148 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-28 00:22:12 +00:00
Jens Ayton
699e5f5ff6 Fixed bug where player's dockedStation was nil at startup (due to circular dependencies). Added Build All target to Xcode project to avoid circular dependency between Oolite and Debug.oxp. (The Oolite target now no longer builds Debug.oxp. Build All builds Oolite, then builds Debug.oxp, then copies Debug.oxp into AddOns.)
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1147 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-27 13:17:43 +00:00
Jens Ayton
b455b2b8fd Interactive JS console working, with some bugs (failure to convert certain types to string, bugs in Oolite NSArray <-> JS array bridge). Basic macro system (implemented in JavaScript) works. A few debugging functions.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1146 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-25 18:15:41 +00:00
Jens Ayton
a1451d4a3e Dicking around with Mac-specific debug stuff instead of doing real work. Added JavaScript console window (intended to be interactive, but isn't yet; shows errors, warnings and JS-generated log messages a bit more prettily than the standard log). Added F-Script support (F-Script is not yet another OXP scripting language, it's an interactive language integrated with the ObjC runtime, making a useful debug tool for poking around).
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1141 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-25 01:15:40 +00:00
Jens Ayton
f5e3b4894e Made Mac debug OXP a loadable module instead of including code in Oolite itself.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1139 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-23 20:18:22 +00:00
Jens Ayton
0ffb248771 For the past two weeks I've been procrastinating from fixing a double-free bug in the JS accessor for Ship.escorts (or, more precisely, in the code constructing a JS array). The bug was in r1129, so not checking stuff in doesn't really make much sense.
Fixes in that time:
* Clean, integrated model for JS ship scripts and world scripts.
* Player ships support JS ship scripts (but not ones synthesized from legacy actions).
* Subentity shader uniform bindings bind to owning ship as intended.
* Fixed like_ship recursion limiter in -[Universe getDictionaryForShip:].
* Fixed a bug in material configuration parsing.
* Fixed a material bug where a shader material with textures, followed by a shader material with no textures, followed by a basic material with no textures would leave a texture bound.
* Cleaned up NSArray -> JS array conversion, without fixing aforementioned bug.
* Made JS Ship property "target" read/write, and made property setting work.
* Added JS Quaternion.random() static method.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1136 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-19 23:05:48 +00:00
Jens Ayton
892c271501 Split JS system into separate file. Started on support for ship scripts (incomplete).
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1129 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-05 11:47:09 +00:00
Nikos Barkas
2a81d2caa1 Added jsarray.h and jsprvtd.h to Windows include dependencies. Fixed commander's name input on save screen overwriting the saved game timestamp. Fixed an unsigned comparison against 0 in Universe.m, getContainersOfGoods, that was leading to a crash within a few minutes of game time. Replaced js_NewArrayObject call with JS_NewArrayObject to avoid linking error.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1126 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-05 08:54:24 +00:00
Jens Ayton
30b800a829 JavaScript: new Entity properties isValid, isShip, isStation, isPlayer, isPlanet. Deprecated Entity.valid() in favour of Entity.isValid. Added Ship.subEntities. Player.dockedStation is now null rather than undefined when not docked. Fixed bugs including crash when attempting to compare JS Entity subclass instances.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1123 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-03 16:31:17 +00:00
Jens Ayton
6fe5f8347f Register JS Station class at set-up time.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1120 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-02 16:52:56 +00:00
Jens Ayton
5c6e674fa2 Made OOJavaScriptConversion an informal protocol with a default implementation (returning JSVAL_NULL) for NSObject. Work on rewriting JS player proxy, moving properties up into Ship and Entity as appropriate. Reimplemented player.call(), allowing it to return values, and applying to entities in general. Ensured correct and consistent type conversion in JavaScript property getters/setters. Fixed bug where script-awarded missiles/mines would use two slots. Made blowUpStation actually blow up the station.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1119 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-02 16:41:55 +00:00
Jens Ayton
15255d19c0 JavaScript: entity class hierarchy now reflected in JS object prototype relationships (player is a Player is a Ship is an Entity). Fix for enery units being unbuyable; moved some hardcoded equipment requirements into equipment.plist; made -[PlayerEntity hasExtraEquipment:] accept arrays and sets of strings as well as individual strings.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1118 127b21dd-08f5-0310-b4b7-95ae10353056
2007-08-02 00:31:44 +00:00
Jens Ayton
b3b04859ab Enabled more warning flags (-Wextra -Wno-unused-parameter -Wno-missing-field-initializers) in OS X build, and fixed several hundred resulting warnings (mostly by using more appropriate types). Bumped version number to 1.69.1. Fixed unable-to-buy-in-shipyard bug. Attempt to fix dockEscorts crash bugs (needs testing). Sundry cleanup, especially of AI and GuiDisplayGen; all exception throws now in standard form. Removed some dead code. Use correct key for Advanced Nav Array if no keyconfig.plist found. Changed OOCollectionExtractors to always clamp integer values to the requested type's range rather than truncating like NSNumber. Removed inconsistently-used and apparently-unneeded NSLock from AI.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1063 127b21dd-08f5-0310-b4b7-95ae10353056
2007-07-07 15:44:50 +00:00
Jens Ayton
f0b1addbeb Fixed legacy script method awardCredits: always setting the player's balance to 0. Fixed JS script method system.legacyAddShipsWithinRadius() ignoring radius parameter. Made JS methods that use legacy script methods always set the legacy script system script target to ensure consistent behaviour.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1059 127b21dd-08f5-0310-b4b7-95ae10353056
2007-07-04 12:12:58 +00:00
Jens Ayton
9137ef4581 Clean-up of various methods in connection with documenting uniform binding mechanism. Tweak to syntax for said mechanism. Bumped version number to 1.69.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1011 127b21dd-08f5-0310-b4b7-95ae10353056
2007-06-08 12:59:08 +00:00
Jens Ayton
7192a86ec6 Removed entity recycling (and associated bugs) from demo screen code. Work on unifying damage-taking code. World scripts now get notifications of cause of death; set up for similar effect for NPC scripts.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@921 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-09 17:55:19 +00:00
Jens Ayton
c611e69a33 Implemented JavaScript quaternion. Much cleanup. Made various enumerations actual enum types. Made some other integer types dedicated types. Slightly reduced size of entity instances. Relatively high chance of breakage.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@912 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-07 18:03:50 +00:00
Jens Ayton
ca593a0a1e Error reporting for JS Vector and Entity methods.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@911 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-06 17:35:42 +00:00
Jens Ayton
67138687af implemented JS Entity class (but not tested - there's no way to get an entity yet). Simplified JS Vector by removing the reference-to-object-property stuff.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@910 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-06 15:09:19 +00:00
Jens Ayton
935e8be1bd Implemented Vector JavaScript class.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@909 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-05 23:53:48 +00:00
Jens Ayton
cc175c75b9 Changed references to PlayerEntityScripting to PlayerEntityLegacyScriptEngine. Cleanup of Entity.h led to making universe a global (UNIVERSE) because having lots of references to it and passing it around is silly, and it's used many thousand times per frame.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@906 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-05 16:46:46 +00:00
Jens Ayton
0a828d664f Removed JS universe global, accidentally left in as a duplicate of system.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@904 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-04 21:30:28 +00:00
Jens Ayton
0f356d5154 OOLogging now merges logcontrol.plist from the root search paths. This is hopefully the last touch on 1.68-mac.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@896 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-03 00:14:21 +00:00
Jens Ayton
d327cb7b38 Fiddled with JavaScript loading and error reporting: unicode savvy, should load on all platforms.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@891 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-02 19:59:43 +00:00
dajt
98bbda198b Fixing compilation errors for GNUstep build.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@889 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-01 23:44:13 +00:00
Jens Ayton
1a18ca735e More scripting tweaks. Moved all of universe into system, and removed universe.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@888 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-01 18:41:47 +00:00
Jens Ayton
7db1aebda6 Added some missingg JS methods; added systemEconomy_string; implemented willLaunch() event.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@887 127b21dd-08f5-0310-b4b7-95ae10353056
2007-04-01 16:56:17 +00:00