Commit Graph

363 Commits

Author SHA1 Message Date
523d220ac5 Add engine support to load mods from config and restart into mods.
Restructure mod mounting code a bit to make it reusable, and use it for
replays. Fixes #2703.

This was SVN commit r15676.
2014-08-25 16:02:40 +00:00
8593825eee Modifies 23c708f72a to use the NONCOPYABLE macro as suggested by leper.
This was SVN commit r15626.
2014-08-09 21:16:25 +00:00
23c708f72a Prevent copying of ScriptInterface objects.
Copying a ScriptInterface is not allowed. The destructor destroys the
JSContext and if there's a copy around that still uses it, that causes
crashes which can be quite hard to debug. This change prevents copying
by of ScriptInterface objects by making the copy constructor private,
which will reveal such errors at compile time.

This was SVN commit r15625.
2014-08-09 20:20:32 +00:00
9872f5741f Exact stack rooting for ScriptInterface::FreezeObject.
Refs #2415

This was SVN commit r15622.
2014-08-08 11:59:49 +00:00
efb889b79a Exact stack rooting for WriteStructuredClone and functions that use it.
Refs #2415

This was SVN commit r15607.
2014-08-03 19:32:39 +00:00
f4d62152e7 Exact stack rooting for GetClass and GetPrivate.
Refs #2415

This was SVN commit r15606.
2014-08-03 17:53:21 +00:00
169174824f Exact stack rooting for ScriptInterface::ToString.
I had to change a few other functions to take JS::MutableHandleValue
because JS::Stringify takes a JS::MutableHandleValue as input parameter.
That seems a bit strange because it should not change that value.
I assume it has historical reasons.

Refs #2415
Refs #2462

This was SVN commit r15605.
2014-08-03 17:29:49 +00:00
a2bd44b23a Exact stack rooting for JSON related ScriptInterface functions.
Refs #2415
Refs #2462

This was SVN commit r15603.
2014-08-02 22:21:50 +00:00
c818b8e475 Exact rooting for CallConstructor.
Refs #2415
Refs #2462

This was SVN commit r15601.
2014-08-02 16:30:15 +00:00
736d934107 Removes an unused codepath for AI deserialization and related ScriptInterface code.
It might actually be needed again in the future, but I think even then
it would be easier to rewrite it than having to update the code in the
meantime.

Refs #2462

This was SVN commit r15600.
2014-08-02 13:22:02 +00:00
608c27fe10 Exact stack rooting for structured cloning functions.
Refs #2415
Refs #2462

This was SVN commit r15597.
2014-08-01 20:55:16 +00:00
5c07a25ddc More exact stack rooting (CallFunction object).
Changes CallFunction and CallFunctionVoid to use a HandleValue as object
parameter. Also changes some JS serialization/deserialization functions
to only support the JSAPI rooted types (drop support for CScriptVal and
CScriptValRooted there). Some other functions got changed too because
they were closely related.

Refs #2415
Refs #2462

This was SVN commit r15592.
2014-07-31 19:18:40 +00:00
d677a30c39 Adds support for passing JS::HandleValue and JS::RootedValue& to CallFunction.
Also adds tests for these cases.

Refs #2415

This was SVN commit r15591.
2014-07-31 16:34:15 +00:00
28bdd8540f Quite a lot of stack rooting related changes.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.

Refs #2415
Refs #2462

This was SVN commit r15568.
2014-07-26 22:33:16 +00:00
e818b08344 Better support for SpiderMonkey rooted types in the ScriptInterface.
* Adds additional overloads/specializations which are required when
passing JS::Handle<T>/JS::MutableHandle<T> types to different functions.
* Replaces GetPropertyJS with a GetProperty specialization.
* Allows us to avoid the implementation of ToJSVal specializations for
JS::Value and JS::HandleValue. Such conversions should only happen if
there's no way around it and if you are aware of it.
* Adds test to make sure that all potentially required specializations
with custom implementations are instantiated. This should help prevent
introducing bugs in temporarily unused code.

Refs #2415

This was SVN commit r15567.
2014-07-26 20:31:29 +00:00
e3888448c4 Removes rooting test.
Rooting works different now and the CScriptVal types are going to be
removed. We will need rooting tests again, but they will have to work
completely different than this test implementation.

Refs #2415

This was SVN commit r15562.
2014-07-26 14:07:56 +00:00
a9048fa43d Adds support for passing JS::HandleValue to SetProperty and CallFunctionVoid without using ugly casing.
Also includes one little "demo-usecase", but additional code will be
changed to use that in future commits.

Refs #2415
Refs #2462

This was SVN commit r15542.
2014-07-20 19:45:18 +00:00
31f9ca9ebf Implements CallFunction with JS::MutableHandle<T> return type.
Changes the CallFunction implementation to use macros because otherwise
we'd have to write twice as many functions manually.
Adapts GetSavedGameData to use the new function template. Additional
callers will be changed in future commits.

Refs #2415
Refs #2462

This was SVN commit r15541.
2014-07-20 15:08:28 +00:00
52f4cda439 Changes ToJSVal to take JS::MutableHandleValue instead of JS::Value&.
JS::MutableHandleValue is similar to JS::HandleValue, but the whole
JS::Value it points to can be replaced.
This change is needed for support of exact stack rooting and moving GC.
Contains a few other trivial API adjustments and style improvements too.

Refs #2462
Refs #2415

This was SVN commit r15534.
2014-07-14 19:52:35 +00:00
09e04cb741 Adds missing request (fixes tests in debug mode).
This was SVN commit r15530.
2014-07-13 22:08:29 +00:00
1b5ab8142e Makes custom JS objects compatible with SpiderMonkey ESR31.
In v24 you called JS_InitClass and passed in a definition of JSNative
functions. Later you could call JS_NewObject with this class and the
object would get a prototype with the specified JSNative functions.
In ESR31 you now have to explicitly store the prototype object returned
by JS_InitClass and pass it as prototype argument to JS_NewObject to
achieve the same.
This change modifies our existing ScriptInterface implementation for
custom object types a bit and uses it at places where the JSAPI was used
directly before.

Refs #2462

This was SVN commit r15524.
2014-07-13 15:31:48 +00:00
5a3f07b3d9 Forgot to use excnObj in db9c20e0a9. Also roots an additional jsval.
This was SVN commit r15518.
2014-07-12 19:46:12 +00:00
db9c20e0a9 Changes FromJSVal to take a JS::HandleValue instead of JS::Value.
JS::HandleValue is basically a wrapper around a JS::Value that is safe
for exact stack rooting and moving GC.
I've tried to keep this changeset rather small and isolated and
therefore create additional JS::Rooted<T> values at some places where
the function should eventually directly take a JS::Handle<T>.
The functions "CallFunction" and "CallFunctionVoid" put their arguments
inside a JS::AutoValueVector because this will be passed directly to
"CallFunction_" with ESR31.

Refs #2462
Refs #2415

This was SVN commit r15517.
2014-07-12 19:08:39 +00:00
cfa59fc4e1 Changes our JSNative functions to use JS::CallReceiver/JS::CallArgs.
This is the new way for working with arguments in JSNative functions.
JS_THIS_VALUE, JS_ARGV, JS_SET_RVAL and direct access to vp or argc are
deprecated and will probably be removed in future versions of
SpiderMonkey.
CallArgs also takes care of proper rooting and you can get the values as
Handles or MutableHandles. The interface changes a little bit for ESR
31, but commiting this now still makes it easier and the changes shout
be straigtforward (search and replace more or less).

Refs #2462
Refs #2415

This was SVN commit r15516.
2014-07-12 16:55:09 +00:00
ae93c02ba8 Fixes a bug that caused script filenames to be defined as properties of the global object.
This was SVN commit r15450.
2014-06-26 17:08:46 +00:00
2b05a8d233 Reenable JS warnings that were disabled in db0376fdc2.
This was SVN commit r15156.
2014-05-18 13:25:08 +00:00
8cec641156 Replace strictness test by a different one, as the old test wasn't considered non-strict anymore.
This was SVN commit r15134.
2014-05-08 13:26:21 +00:00
db0376fdc2 Temporarily disable the Spidermonkey warnings for release
This was SVN commit r15127.
2014-05-07 19:42:12 +00:00
7acdde5c86 Changes tests to use global g_ScriptRuntime instead of creating a new JSRuntime for each test.
The tests crashed on my Debian systems but not on my Ubuntu system.
The crash happened in line 142 of SpiderMonkey's ThreadLocal.h.

I know that I had to use a workarounnd for contexts to avoid destroying
the context that was created first. I also had in mind that in newer
versions a JS_Init function got introduced which presumably solves this
kind of issues.
Based on this experience I assumed runtimes could have a similar problem
and this patch indeed fixes the issues.
Unfortunately the correct usage of JSRuntimes in that regard is not
documented.
There's only a rater misterious comment in JSAPI.h which hasn't been
cleared up so far and is most likely completely outdated
(https://bugzilla.mozilla.org/show_bug.cgi?id=992641).

This was SVN commit r14995.
2014-04-25 21:19:51 +00:00
92f2a16a88 Suppresses MSVC warning C4005 'macro redefinition' from SpiderMonkey upgrade
This was SVN commit r14975.
2014-04-23 21:12:28 +00:00
e9e05f4efc Second (main) commit for the SpiderMonkey upgrade.
This commit contains all the required changes to our source files and
build scripts (hopefully).
A next commit will remove the old stuff of SpiderMonkey 1.8.5.

Spcial thanks to:
 - H4writer who helped a lot mainly with the performance issues we
had/have, but also with other problems or questions.
 - Leper for the review.
 - Historic_bruno for implementing the build scripts on Mac OS X and
testing on the Mac.
 - The people from the #jsapi channel and from
mozilla.dev.tech.js-engine who answered a lot of questions and helped
solving problems.
 - All the other people who helped

Refs #1886
Fixes #2442
Fixes #2416

This was SVN commit r14877.
2014-03-28 20:26:32 +00:00
31e98e5c03 Reverts f25edfd8f1. Structured clones don't support cyclic references in SpiderMonkey v1.8.5.
SpiderMonkey v24 supports it and I'll add this change to #1886 instead.

Refs #2416
Refs #2415
Refs #1886

This was SVN commit r14733.
2014-02-06 13:32:09 +00:00
f25edfd8f1 Removes ValueCloner.
Fixes #2416
Refs #2415
Refs #1886

This was SVN commit r14724.
2014-02-01 20:37:33 +00:00
bab3a08643 Fixes a crash introduced in fd187f466f by ensuring that the CScriptValRooted values are destroyed before calling JS_DestroyContext.
I've tested the performance on Combat Demo (Huge) again with the code
from #2394.
It's very close but probably a little bit lower (hard to tell because
it's so close).

Closes #2408
Refs #2394

This was SVN commit r14705.
2014-01-30 13:21:36 +00:00
fd187f466f Add vector prototype to vector-like return values from C++ to JS. Fixes #2394.
This was SVN commit r14645.
2014-01-23 11:32:08 +00:00
cbc0650a79 Removes some unused files
This was SVN commit r14561.
2014-01-10 19:38:34 +00:00
7193e29961 Adds precompiled.h include because Visual Studio checks for that even though the file only contains comments.
Thanks to boeseRaupe for reporting.

Refs #2348

This was SVN commit r14512.
2014-01-05 13:58:38 +00:00
b20955436b I completely missed the header files when disabling the JS debugger.
Refs #2348

This was SVN commit r14511.
2014-01-05 10:26:27 +00:00
7d516e7e7a Disables the JS debugger.
It's completely broken since 4b1297b328 and will have to be updated for
the new SpiderMonkey API.
I only uncomment it at the moment because I plan to fix/reimplement it
soon after the upgrade.

Closes #2348
Refs #2241
Refs #1886

This was SVN commit r14506.
2014-01-04 20:47:56 +00:00
4b1297b328 Removes g_ScriptingHost and implements global to compartment 1 to 1 relation.
Each GUI Page gets its own compartment and all ScriptInterfaces in the
same thread should now use the same JS Runtime.
This is required for the SpiderMonkey upgrade.
Check the ticket for details.

Closes #2241
Refs #1886
Refs #1966

This was SVN commit r14496.
2014-01-04 10:14:53 +00:00
5ce8de1f0a Removes unused var from JS debugger, from patch by Markus. Fixes #1852
This was SVN commit r14211.
2013-11-17 23:41:19 +00:00
d178f32698 Fix Unicode in JS print() on Linux
This was SVN commit r14129.
2013-11-10 16:13:40 +00:00
d7ec8c47a6 Fix Unicode support in lobby.
Fix EncryptPassword being called with the wrong argument order, and
encrypting username instead of password. (This will break all existing
lobby accounts.)

Fix EncryptPassword not using all of salt_base.

This was SVN commit r14123.
2013-11-09 23:26:17 +00:00
72e11a2dea Fix VS2013 build errors, warnings
This was SVN commit r14073.
2013-11-03 12:46:07 +00:00
20ed5b118c Unify script conversions and remove JSInterface_Vector3D.
Because it was historically grown, we have some duplicated code for
converting script types to native types.
This patch removes the file JSConversions.cpp and moves some code to
ScriptConversions.cpp.
The places using JSConversions.cpp are changed to use the
ScriptInterface's conversion functions in ScriptConversions.cpp.
I also removed JSInterface_Vector3D because it had additional
requirements to the conversion code that no other code has and because
it's currently not used. I think it doesn't make sense to maintain code
just because it could possibly be used again later.

Closes #2213
Refs #1886

This was SVN commit r14036.
2013-10-20 17:13:53 +00:00
f3d088dd5c Fixes JS debugger, fixes VS 2013 build error, re-fixes #2127, #2175
This was SVN commit r13973.
2013-10-07 22:55:30 +00:00
5d9b2b95b0 Ticket #2127 - Performance and style improvements in scriptinterface.
No real behavior changes, only code maintenance.

Fixed signed/unsigned mismatch in EntityMap.h

This was SVN commit r13865.
2013-09-16 19:10:06 +00:00
b1bd61938e add file notification to Mac ticket 514, also change name of class FileInfo to CFileInfo to ease Mac development
This was SVN commit r13821.
2013-09-10 14:17:04 +00:00
0ca841b92b Suppress unused local typedef warnings when including SpiderMonkey headers.
This was SVN commit r13713.
2013-08-19 18:26:44 +00:00
8c74df2acd Give an elevation advantage to ranged units. Patch by sanderd17. Fix #1960.
This was SVN commit r13626.
2013-08-03 19:20:20 +00:00
94c57085e9 Makes some classes NONCOPYABLE, based on patch by Markus, refs #1852
This was SVN commit r13419.
2013-05-22 21:40:56 +00:00
d7dcd3b26c Use prefix increment operator for iterators (for consistency), refs #1852, #1064
This was SVN commit r13418.
2013-05-22 18:41:13 +00:00
3f00d4d997 Change some size() > 0 to Based on patches by kuranes and Markus. Refs #1852, #1923.
This was SVN commit r13413.
2013-05-21 22:11:47 +00:00
74df28f952 Fix --without-pch build
This was SVN commit r13333.
2013-04-02 15:44:42 +00:00
0d7e6b7880 Use pimpl idiom for ThreadDebugger.
This was SVN commit r13253.
2013-03-10 23:08:01 +00:00
8c756b507a Fix non-pch build. Maybe use pimpl idiom instead.
This was SVN commit r13245.
2013-03-08 23:46:32 +00:00
73951b75fc Adds the server-side part of the javascript debugger. Refs #410
This was SVN commit r13238.
2013-03-07 13:49:49 +00:00
1fdaca5cec Attempts to fix StringifyJSON by clearing pending exceptions from JS API
This was SVN commit r13125.
2013-01-27 01:38:43 +00:00
75a23856cf Fix some static analysis warnings
This was SVN commit r13101.
2013-01-21 20:33:25 +00:00
99d04e93bb Implements global tech modification function. Fixes #1358, refs #1520.
Applies tech modifications to template data returned by GuiInterface.
Extends engine to load arbitrary global scripts, separates this from RNG
replacement. Refs #1193.
Loads global scripts for most script contexts for consistency.
Adds simulation tests for global scripts.

This was SVN commit r12056.
2012-07-03 02:16:45 +00:00
2ee9981d99 Replace boost::uniform_real to avoid OOS caused by changes in behaviour between Boost versions
This was SVN commit r11857.
2012-05-13 23:40:06 +00:00
32d2927449 Adds UTF-8 support for JavaScript files.
This was SVN commit r11750.
2012-05-04 21:48:46 +00:00
da4c1c8f2b Fixes handling of UTF-8 encoded JSON files (stripping BOM if necessary). Fixes #1375.
This was SVN commit r11739.
2012-05-04 03:46:05 +00:00
edc62a240a Try to avoid some type warnings
This was SVN commit r11558.
2012-04-18 21:02:11 +00:00
c56f96040e Implement healing. Fixes #999.
This was SVN commit r11536.
2012-04-17 20:22:13 +00:00
f1e73807a8 Fix formatting
This was SVN commit r11377.
2012-03-20 18:13:27 +00:00
0b0f2e9e30 Fixed broken tests by silently failing if Math.js is not found. This is not ideal but seems better than everything else.
This was SVN commit r11253.
2012-03-05 21:20:39 +00:00
e2e5c81272 Added safe (identical across platforms) replacement sin and cos functions for scripts. This is part of #1193.
This was SVN commit r11226.
2012-03-03 00:06:16 +00:00
7fa6afac37 Corrects some Doxygen comments and adds a few others of interest.
This was SVN commit r11209.
2012-03-01 03:55:05 +00:00
182bf2b4af Vague start at hypothetical Android support
This was SVN commit r10923.
2012-01-17 22:05:43 +00:00
1e4b950ed1 This was SVN commit r10870. 2012-01-05 03:38:54 +00:00
dbf27dbc5e Fix #1065 (incorrect printf format string), based on patch by Echelon9
This was SVN commit r10823.
2011-12-29 01:40:24 +00:00
vts
db864f10c3 Rendering marker lines between buildings and rally points
Added command button to focus on rally point
(implements #524)

This was SVN commit r10704.
2011-12-10 07:07:04 +00:00
8492426a14 Rough support for profiling replay mode and scripts
This was SVN commit r10634.
2011-11-29 20:32:43 +00:00
5bd7b74ec7 Fix ABI incompatibility with --with-system-mozjs185 in debug mode (see #990).
This was SVN commit r10535.
2011-11-14 18:18:04 +00:00
85e16f95b1 Use debug_printf for script print() function, so it's more visible on Windows
This was SVN commit r10435.
2011-10-27 14:19:37 +00:00
0e39511b3a Attempts to fix random map OOS errors by avoiding parsing data to floats (uses CFixedVector3D instead). See #977.
Changes to rmgen API for consistency and support of 3D
position/rotation.

This was SVN commit r10326.
2011-09-26 21:36:33 +00:00
78fd3a2ba2 Fix compatibility with Boost 1.47
This was SVN commit r9905.
2011-07-24 11:41:06 +00:00
ea7f65818a Avoid release-mode-only warning
This was SVN commit r9857.
2011-07-17 01:26:04 +00:00
2f0bd8d8b0 Upgrade to SpiderMonkey 1.8.5 (fixes #734)
This was SVN commit r9852.
2011-07-16 23:24:14 +00:00
8eb7af4ac9 Be a bit more robust to build environment changes.
Reduce some module dependencies.
Clean up some unused instantiations.

This was SVN commit r9827.
2011-07-15 13:22:48 +00:00
a8fdcfde59 Fixes broken autostart for random maps with AI
This was SVN commit r9699.
2011-06-27 23:27:25 +00:00
5bc125a91f Changes terrain data returned by CMapGenerator to typed arrays, instead of an array of objects (this greatly reduces the size of the serialized data)
This was SVN commit r9664.
2011-06-26 02:56:54 +00:00
34186dd017 refactor file interface. requires workspace update
- separate file_system_util into vfs functions (-> vfs/vfs_util) and
file_system (avoids ugly fs_util namespace prefix)
- get rid of non-portable O_BINARY_NP etc. flags
- use standard O_WRONLY etc. flags instead of LIO_WRITE; but avoid the
need for specifying O_CREAT|O_TRUNC
- only open files for aio when O_DIRECT is specified (which 0ad does
not) - avoids wasting time and security issues
- return file descriptor directly instead of via output param
- waio: safer FCB mechanism that avoids mixing descriptors between lowio
and aio

This was SVN commit r9550.
2011-05-25 10:39:13 +00:00
b741feafb1 Add global deepcopy() function in scripts, to do a structured clone of objects.
Remove an unused include.

This was SVN commit r9506.
2011-05-12 23:50:42 +00:00
fffcdbbf21 Balances random map resources.
Attempts to avoid "invalid argument" errors in typed arrays by forcing
them to integer (see #658).
Removes script preloading from map generator (VFS is thread-safe now)
Removes thread checking from ScriptInterface file loading functions.
Adjusts starting entities in civ data.

This was SVN commit r9435.
2011-05-04 21:24:25 +00:00
cccd6849a7 cleanup (requires update-workspaces)
lib_errors.cpp: replace with status.cpp, adapt to needs at work
wutil: fix runtime warning reported via feedback box
config: merge CONFIG_PARANOIA and !CONFIG_FINAL into
CONFIG_ENABLE_CHECKS
add openmp, pointer_typedefs.h

This was SVN commit r9410.
2011-05-03 12:38:42 +00:00
4663ac0fe7 split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.
the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
2011-04-30 13:01:45 +00:00
b4503bb61e Simplifies random map output, see #782.
Changes random maps to XZ coordinates, matching the engine.
More documentation for rmgen library.

This was SVN commit r9271.
2011-04-16 04:04:06 +00:00
481f570a0e CMapGeneratorWorker thread safety issue. Fixes #783.
VFS access moved to main thread, where random map scripts are preloaded
and stored prior to use by the worker thread.
Adds LoadGlobalScript to ScriptInterface, for evaluating script content
in the global scope.

This was SVN commit r9261.
2011-04-15 05:23:51 +00:00
f072b47dc1 Warn earlier about some non-thread-safe calls.
This was SVN commit r9252.
2011-04-14 14:28:24 +00:00
bd0063607a Fix build in Clang
This was SVN commit r9213.
2011-04-09 00:05:37 +00:00
e5e9e38532 Fix GCC 4.6 "set but not used" warnings
This was SVN commit r9194.
2011-04-07 16:34:51 +00:00
9193ba56f9 Build fixes and whatnot
This was SVN commit r9115.
2011-03-23 21:15:22 +00:00
588bfa11bf remove unnecessary utf8 includes
This was SVN commit r9110.
2011-03-23 16:32:44 +00:00
dcd192cb60 refactor path interface:
- use wrapper class instead of std::wstring (reduces mixing of
strings/paths; allows safe+easy join via operator/ and convenient
case-insensitive comparison via operator==, avoids NativePathFromString,
similar to boost::filesystem)
- NativePath -> OsPath
- add hash and To/FromJSVal for Path
- add TS_ASSERT_PATH_EQUALS
- replace _wfopen_s with sys_OpenFile
- remove obsolete SortFiles/Directories

This was SVN commit r9107.
2011-03-23 13:36:20 +00:00
f618605477 Changes default random map sizes.
Tweaks random map resources.
Adds support for circular maps to rmgen library.
Various fixes in map generator.
On Miletus map, change player 2 civ, as Romans are not fully implemented
(fixes #758)

This was SVN commit r9104.
2011-03-23 08:12:04 +00:00
575e3b0a69 Don't enable JITs when they can interfere with profiling.
Fix dangerous trailing slashes.

This was SVN commit r9103.
2011-03-23 00:36:34 +00:00
0e0ed94926 Implements random map system, fixes #6.
Includes default library "rmgen" w/ API based on rmgen tool.
Modifies rmgen scripts Cantabrian Highlands, Neareastern Badlands, and
Latium.
Old map support dropped from MapReader.
Fixes a few bugs in existing game setup and initialization scripts.

This was SVN commit r9096.
2011-03-22 01:34:45 +00:00
6d25329412 # towards locale-independent pathnames on Linux
c.f.
http://www.wildfiregames.com/forum/index.php?showtopic=14541&st=0&p=217250&#entry217250
and 2011-03-19 meeting

This was SVN commit r9090.
2011-03-21 17:53:13 +00:00
7d6cfe58de Fix non-PCH build
This was SVN commit r9037.
2011-03-06 00:01:23 +00:00
16a4eb36dd Various minor optimisations.
Enable SpiderMonkey method JIT in Release mode.
Add Engine.ProfileStart/Engine.ProfileStop functions for scripts.
Fix AI to clone initial entity data and shared metadata.

This was SVN commit r9003.
2011-03-03 00:16:14 +00:00
d805ef356e FileExists -> VfsFileExists (see next commit)
scriptInterface: fix bool cast warning

This was SVN commit r8984.
2011-02-25 16:30:55 +00:00
f6c1d98c9a Fix #739 (test failures).
Use JSON in debug serializer output unless it fails due to e.g. cyclic
values, in which case use toSource.
Disable file stats code by default, since its output isn't used.

This was SVN commit r8975.
2011-02-24 00:32:38 +00:00
6b783aebd6 Try to fix build errors
This was SVN commit r8973.
2011-02-22 21:50:26 +00:00
8f59d52697 sync with work; fix compile error due to lack of boost/serialization in 0ad svn
This was SVN commit r8965.
2011-02-21 09:23:51 +00:00
d75d9c3b75 Make the script profiler more useful, by giving the filename/line for anonymous functions.
Fix the turn-based profiler a bit.

This was SVN commit r8964.
2011-02-21 02:16:12 +00:00
c29f2d26b3 Add some more stuff to hwdetect, because there can never be too much
This was SVN commit r8951.
2011-02-20 00:54:36 +00:00
1c7e33b528 Remove a load of implicit CStr type conversions, since they're error-prone and can cause silent data loss.
Handle most CStr8/CStrW conversions via UTF-8 instead of effectively
assuming Latin-1.
Return UTF-8 strings from Xeromyces API.

This was SVN commit r8929.
2011-02-17 20:08:20 +00:00
0da7e822ff # Add opt-in automatic feedback system.
Add GL implementation limits to hwdetect.
Make the in-game manual support multiple text files.
Remove unnecessary instruction on how to close the manual window.
Make guitextobject.caption return the original value without stripping
formatting tags.
Remove unused non-VFS support from config system.
Support writing config files back to their original path.
Remove unnecessary user profile directory; use normal config directory.

This was SVN commit r8925.
2011-02-16 20:40:15 +00:00
b8925fbbc9 # Support AI construction of buildings.
Pass terrain passability data to AI scripts.
Expand pathfinder passability data to 16 bits per tile, to allow more
classes.
Support 16-bit ints in serializer.
Partially support JS typed arrays.
Allow foundations to be placed on top of units (fixes #499).
Stop farms and fishes blocking movement (fixes #534).
Add obstruction flags to allow finer control over what they block.
Associate entity IDs with obstruction shapes, to allow finding colliding
entities.
Support moving to the edge of a target entity with inactive obstruction.
Support foundation entities in AI.
Support playing as non-hele civs.

This was SVN commit r8899.
2011-02-10 16:06:28 +00:00
6af877a1cb Fix Windows crash caused by calling js_free (which calls free from the wrong CRT).
Fix some warnings.

This was SVN commit r8873.
2011-01-29 17:50:42 +00:00
f39f279132 Add AI script code to provide a cleaner API around the engine interface.
Handle AIProxy entirely through scripts.
Support structured clones of script values.
Improve performance.
Support multiple script contexts sharing a runtime.
Use a separate context per AI player.

This was SVN commit r8866.
2011-01-15 23:35:20 +00:00
dd501b2a5a # Add initial basic player AI framework.
Support direct access to serializer streams, so serializers can be
nested.
Make component script "this.template" read-only.
Stop globally-subscribed component scripts receiving messages posted to
local components, to reduce out-of-sync risks.
Move pathfinder data out of entity template directory.
Fix GuiInterface deserialization.

This was SVN commit r8865.
2011-01-12 12:29:00 +00:00
f0476b61fb Fix #476 (Use JS_New for ScriptInterface::CallConstructor)
This was SVN commit r8638.
2010-11-17 16:56:11 +00:00
404456ee8e Fix int8_t redefinition errors in VC2010
This was SVN commit r8635.
2010-11-17 03:02:04 +00:00
bd3bd084c0 Support new SpiderMonkey API.
wposix: Define int8_t compatibly with SpiderMonkey.
Remove unused camera, lightenv JS interfaces.
Remove most of vector JS interface.
Remove some of the redundant JS string conversion functions.
Remove unneeded vmem, _lodBias functions.
Clean up some formatting.

This was SVN commit r8629.
2010-11-16 23:00:52 +00:00
13d2e44ff5 Run GC frequently in the simulation script context, to keep memory usage down
This was SVN commit r8622.
2010-11-15 15:03:40 +00:00
5d764f1435 Run network server in a separate thread, to minimise latency.
Make some parts of logger and console thread-safe.
Simplify console: remove special commands; remove prefix for script
commands.
Remove LOG_ONCE, to simplify logger.
Change some code to use the new logger interface.
Fix OOS when revealing map.
Clean up some formatting.

This was SVN commit r8511.
2010-10-31 22:00:28 +00:00
c0a7a36f7a Use JSFastNative API in more places, for improved compatibility with future SpiderMonkey versions.
Remove some unnecessary script-exposed functions, and move some more
into the Engine namespace.

This was SVN commit r8428.
2010-10-21 19:54:59 +00:00
db047e5bee Cache message JS conversions, to make broadcasts faster
This was SVN commit r8120.
2010-09-17 17:49:39 +00:00
624e8490a2 Increase script memory limit more
This was SVN commit r8117.
2010-09-17 17:40:44 +00:00
2e7436434d warning fixes: mostly size_t vs. specialized API type and other type conversion.
added player_id_t typedef and INVALID_PLAYER, use that instead of -1.
also added sanity checks to cpu.cpp to ensure ARCH_* is correct (see
http://www.wildfiregames.com/forum/index.php?showtopic=13327&hl=)
and further predefined macros to arch.h just to be sure.

This was SVN commit r8079.
2010-09-05 09:38:30 +00:00
5e15a0279e Print JS stack trace when reporting exceptions.
Increase maximum logger message size.
Fix GC bug.

This was SVN commit r8063.
2010-09-03 20:06:17 +00:00
2b57f4f998 # Initial support for formation movement.
Support asynchronous path queries.
Allow escaping when stuck in impassable terrain tiles.
Split Update message in multiple phases, to cope with ordering
requirements.
Support automatic walk/run animation switching.

This was SVN commit r8058.
2010-09-03 09:55:14 +00:00
5fbbc27dfd Fix crash when calling JSFastNatives with too few arguments (they don't guarantee to give the number requested in the definition)
This was SVN commit r8028.
2010-08-23 14:30:13 +00:00
91cd032827 Add basic replay recorder/player to help debugging and performance testing.
This was SVN commit r7863.
2010-08-06 22:16:05 +00:00
65bcedb9fc Load map descriptions from their XML file.
Add basic hold-fire stance, and use it for some test maps.
Add JSON data container to map XML files, to simplify the interaction
between scripts and maps.
Fix fixed-point printing so it roundtrips safely through map files.
Fix camera startup positions in old-format maps.

This was SVN commit r7844.
2010-08-04 21:15:41 +00:00
b292a32505 Add JS memory usage to profiler.
Add dumpHeaps() console function for debugging JS memory usage.
Increase default JS heap size.
Make call-time profile table appear first when toggling.
Remove some unused script functions.

This was SVN commit r7842.
2010-08-02 19:23:58 +00:00
0cd0a1f584 # Add auto-attacking of nearby enemies.
Add general range-detection code.
Avoid unnecessarily computing 3D entity positions.

This was SVN commit r7817.
2010-07-29 20:39:23 +00:00
c4350d86de Avoid unnecessary dynamic allocation when calling script functions.
Use tracer instead of rooting in ValueCloner, to avoid memory
allocations.

This was SVN commit r7770.
2010-07-19 23:03:33 +00:00
5d5cb02b21 Disable visible logging of network messages
This was SVN commit r7708.
2010-07-06 20:31:05 +00:00
586ba51e4a Fix lossy fixed<->jsval conversion.
(Hopefully this will really fix the OOS errors.)

This was SVN commit r7692.
2010-07-04 19:47:31 +00:00
1c0536bf08 # Refactored the networking code, and redesigned the game setup screen.
Major updates to most network classes.
Simplify CNetServer so it doesn't duplicate any client behaviour; all
players now run CNetClient.
Remove most player/slot management from networking code.
Wait for all players to finish loading before starting the simulation.
Remove CGameAttributes; attributes are now just a JS object.
Remove CPlayer; they are now just simulation entities.
Handle player colours via simulation system.
Add a default map for Atlas, so it always has something to load.
Move network documentation to Doxygen.
Remove lots of now-unused code.

This was SVN commit r7653.
2010-06-30 21:41:04 +00:00
c5d204c7ff Enable latest JS language features.
Load GUI scripts as UTF-8.

This was SVN commit r7650.
2010-06-30 21:23:41 +00:00
65cf204423 Display warnings and errors on screen for a short time (fixes #119).
Add warn(), error() functions for simulation scripts.

This was SVN commit r7600.
2010-05-31 22:44:59 +00:00
5ce9acc263 MSVC warning fixes
This was SVN commit r7580.
2010-05-25 18:44:33 +00:00
47a03c3397 Replace JS_Enumerate with manual enumeration, to avoid its memory allocations.
Use LookupProperty to avoid having to check for getters.
Add a quicker method of rooting many script values.

This was SVN commit r7579.
2010-05-25 18:24:12 +00:00
f902803af2 Windows build fixes
This was SVN commit r7566.
2010-05-22 14:27:53 +00:00
386f322b1c Make Math.random() more deterministic
This was SVN commit r7563.
2010-05-22 00:38:33 +00:00
c684c211a2 # Basic experimental multiplayer integration with new simulation system.
Add new turn manager that should be more correct and potentially more
efficient.
Remove evil CNetServer/CNetClient multiple inheritance of CTurnManager.
Add multiplayer autostart.
Various minor cleanups.

This was SVN commit r7551.
2010-05-20 00:59:01 +00:00
f95eb6ca85 Fix accidental include
This was SVN commit r7540.
2010-05-12 13:09:11 +00:00
434248167b Fix warnings in tests
This was SVN commit r7535.
2010-05-10 09:52:35 +00:00
037770a2a3 Fix use of 'undefined' sound group on death.
Warn about implicit script/native type conversions.

This was SVN commit r7527.
2010-05-09 13:56:06 +00:00
e144ef03a2 Windows build warning fix
This was SVN commit r7510.
2010-05-07 19:33:14 +00:00
d0599f4c7a Share component template scripts to save some memory.
This was SVN commit r7504.
2010-05-07 00:24:22 +00:00
fe53bce3b1 Rewrite the clone-object-between-JS-contexts code (for GUI<->simulation interface) to be more efficient.
Delete unnecessary unused incomplete profiler scripting support.
Clean up some JSAPI code to use newer features.
Display simulation script functions in the profiler.

This was SVN commit r7503.
2010-05-05 22:36:35 +00:00
f33706bf8b Switch everything to 15.16-bit precision fixeds, to allow more accurate unit vectors and angles.
This was SVN commit r7497.
2010-05-02 20:32:37 +00:00
4fe991074f Expose Footprint::GetShape and TemplateManager::FindAllTemplates to scripts.
Make CSimContext accessible to all component code, so they don't all
have to save their own copies of it.

This was SVN commit r7490.
2010-05-01 09:48:39 +00:00
3a1abb5d8f # Compile gameplay scripts in strict mode.
Fixes #487.

This was SVN commit r7456.
2010-04-14 18:57:50 +00:00
cf48ff0588 Expose JS_HasProperty
This was SVN commit r7449.
2010-04-09 18:45:28 +00:00
45fa351feb Revert unnecessary bcb462ad87
This was SVN commit r7422.
2010-04-01 08:18:16 +00:00
bcb462ad87 windows build fix
(should HAVE_VALGRIND go into e.g. lib/config2.h?)

This was SVN commit r7420.
2010-03-31 22:24:16 +00:00
9b6326f124 Always build with Valgrind support. Always use the bundled Valgrind header.
This was SVN commit r7397.
2010-03-26 10:31:47 +00:00
00e18e4ea8 Report S3TC non-support with an in-game GUI message box.
Fixes #313.

This was SVN commit r7390.
2010-03-23 22:45:07 +00:00
7a870170c9 SpiderMonkey version check
This was SVN commit r7372.
2010-03-20 17:00:21 +00:00
ed69187450 Build with spidermonkey-tip by default. Remove codepaths for old SpiderMonkey.
This was SVN commit r7366.
2010-03-19 20:54:44 +00:00
31febafb05 Compatibility with non-threadsafe SpiderMonkey
This was SVN commit r7364.
2010-03-19 19:54:00 +00:00
06928f7694 # Basic bandbox selection of units in new simulation system
This was SVN commit r7349.
2010-03-11 20:01:16 +00:00
b25076ed4d Min/max range support in pathfinder
This was SVN commit r7311.
2010-02-06 20:58:48 +00:00
3f1dfce41b Simplify GUI/simulation interface
This was SVN commit r7286.
2010-01-25 22:31:43 +00:00
953fb41c82 # Basic in-game building placement with new simulation system
This was SVN commit r7285.
2010-01-24 17:24:35 +00:00
7c2e9027c2 # Rewrite of the game's simulation system
Giant merge from
http://svn.wildfiregames.com/hg-source/file/5fb522019d5e
Infrastructure is largely complete, gameplay is largely missing
Disabled by default; use command-line flag "-sim2"
(Second attempt at commit...)

This was SVN commit r7259.
2010-01-09 19:20:14 +00:00