Commit Graph

97 Commits

Author SHA1 Message Date
6eaf76d653 Actually seed the random number generator used in the simulation. Reviewed by sanderd17, fixes #4127.
This was SVN commit r18604.
2016-08-14 16:28:54 +00:00
f4898c18d8 SpiderMonkey 38 removes the JS_LookupProperty{,ById} API. Refs #3708.
Use JS_GetProperty{,ById} instead.
Ensure that we break if someone tries to serialize a getter by using
something similar to what we used pre 47a03c3397.
https://bugzilla.mozilla.org/show_bug.cgi?id=1094176

This was SVN commit r17633.
2016-01-11 20:03:33 +00:00
3fd4d07ca1 Test \0 in object property names for serializing.
This was SVN commit r17539.
2015-12-22 19:01:18 +00:00
efda359acc Use new when calling the builtin typed array constructor.
The current code will be forbidden in ES6.

This was SVN commit r17504.
2015-12-19 01:10:13 +00:00
c0b4e78801 Fixes stream serialization bug on OS X 10.8 and older, which caused instant OOS in multiplayer games, fixes #3108.
Fixes test failures on OS X 10.7 and older, refs #3109

This was SVN commit r17133.
2015-10-15 03:31:30 +00:00
2aef62d65f Handle backrefs properly for maps and sets. Fixes #3374.
Allocate the tag for the backreference before deserializing the content,
to match the order of serializing.

This was SVN commit r16959.
2015-08-30 04:51:16 +00:00
c9893b3dd0 Test serialization of nested maps. Refs #3164, #3374.
This was SVN commit r16954.
2015-08-30 00:06:39 +00:00
b8a20c958c Do not serialize properties for Sets. Serialization tests for Map and Set.
This was SVN commit r16620.
2015-05-04 01:41:09 +00:00
bb9de80dd4 Convert CConsole to take UTF-8 strings.
This avoids vswprintf failures when printing non-ASCII char* strings
from CLogger into the console.

Also convert ScriptInterface::ToString to return UTF-8, to avoid some
utf8_from_wstring calls.

Also remove some unused and redundant CConsole functions.

This was SVN commit r16333.
2015-02-14 01:49:34 +00:00
e06a7b37d8 Convert debug_printf to take UTF-8 strings instead of wchar_t.
This fixes the problem where passing a non-ASCII string to
debug_printf(L"%hs", s) caused vswprintf_s to fail on Linux (because it
doesn't know what encoding the char* is meant to have). Now debug
messages will remain as UTF-8 until they reach the OS.

Fixes #3021.

This was SVN commit r16332.
2015-02-14 01:45:13 +00:00
c02a7e1a7b SpiderMonkey 31 upgrade
This upgrade also introduces exact stack rooting (see to the wiki:
JSRootingGuide) and fixes problems with moving GC. This allows us to
enable generational garbage collection (GGC).
Measurements a few months ago have shown a performance improvement of a
non-visual replay of around 13.5%. This probably varies quite a bit, but
it should be somewhere between 5-20%. Memory usage has also been
improved. Check the forum thread for details.

Thanks to everyone from the team who helped with this directly or
indirectly (review, finding and fixing issues, the required C++11
upgrade, the new autobuilder etc.)! Also thanks to the SpiderMonkey
developers who helped on the #jsapi channel or elsewhere!

Fixes #2462, #2415, #2428, #2684, #1374
Refs #2973, #2669

This was SVN commit r16214.
2015-01-24 14:46:52 +00:00
dcf5a2667f CLogger: Use cppformat instead of sys_vswprintf.
sys_vswprintf relies on platform-specific printf implementations, which
vary widely between platforms (in handling of truncation, return values,
use of %s/%S/%hs/%ls for mixing char and wchar_t strings, etc) and are
therefore a pain.

Use cppformat's fmt::sprintf instead, which has very similar syntax to
sprintf but is more C++ish and is portable.

Also, wchar_t is stupid, so use char* strings (which are expected to be
UTF-8) in CLogger. This creates a bit of a pain with changing all
callers to convert to char* strings, but that's their fault for not
using UTF-8 already.

Refs #3011.

This was SVN commit r16182.
2015-01-22 20:30:05 +00:00
fd93e4ae74 Remove testing of some special templates. We need to find a good way to generate template subsets, refs #2951.
This fixes the tests fail introduced in b05879e151.

This was SVN commit r16033.
2014-12-09 23:20:31 +00:00
c5c394fd17 Fix some disabled tests.
This was SVN commit r15673.
2014-08-24 15:29:53 +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
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
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
d117d96d22 Simplify component deserialization.
Deserialize SYSTEM_ENTITY before any other entities. This makes it safe
for Deserialize() methods to access system components (mirroring how
Init() can already access system components).

Add a Deserialized message, sent after all entities have been
deserialized, to help with some other sequencing problems.

This was SVN commit r15264.
2014-06-01 18:14:09 +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
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
ef888367aa Cleanup tex_codec, fixes #2456, patch by IronNerd.
This was SVN commit r14836.
2014-03-13 04:16:20 +00:00
9780d7177d Adds some missing vars.
This was SVN commit r14742.
2014-02-09 16:04:30 +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
dddc9bab7f Fix tests.
This was SVN commit r14452.
2013-12-30 18:55:37 +00:00
7901ed51d4 Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.

This was SVN commit r13938.
2013-10-04 02:29:16 +00:00
05422ad545 Avoid slightly-expensive QueryInterface() calls
Add CEntityHandle which wraps an entity_id_t and also has a pointer to a
per-entity array of IComponents. QueryInterface/CmpPtr on a handle just
involve a couple of pointer dereferences instead of a map lookup.

This requires sizeof(void*) per registered interface type per entity,
which is currently ~0.5KB per entity, which shouldn't be a problem.

This was SVN commit r13825.
2013-09-11 20:41:53 +00:00
0c16980408 Fix tests.
This was SVN commit r13709.
2013-08-19 10:55:35 +00:00
b3653cfe16 Updates bundled Valgrind headers to 3.8.1 and fixes test build, patch by Markus, fixes #1971
This was SVN commit r13473.
2013-06-12 03:38:37 +00:00
29549561e1 Add flag to VisualActor for entities that should only be visible in Atlas. Patch by KareemErgawy. Fixes #1411.
This was SVN commit r13465.
2013-06-09 23:18:21 +00:00
88c4e5bdd0 Extends binary serializer to support some standard JS classes: Number, String, Boolean. Fixes #406.
Extends binary serializer to support typed arrays.
Extends binary serializer to support custom JS prototype objects in AIs,
fixes #407.
Allows full serialization of AIs (not yet implemented). Refs #1089,
#1886
Increases binary serializer script backref arena from 8 MB to 16 MB,
refs #1842

This was SVN commit r13429.
2013-05-26 21:57:24 +00:00
1fb7889539 Postproc manager
This was SVN commit r12755.
2012-10-15 10:34:23 +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
ebe5b66ba3 Fix test failure caused by f660f834bf.
This was SVN commit r12014.
2012-06-24 21:03:46 +00:00
vts
6b50a660b9 Added elapsed real time (as opposed to elapsed simulation time) to MT_Interpolate messages. Fixes leftover TODO from #824. Refs #824.
This was SVN commit r11944.
2012-06-06 19:37:03 +00:00
vts
34fc883317 Pretty unit selection overlay rings. Fixes #824.
This was SVN commit r11623.
2012-04-22 04:04:02 +00:00
vts
d7128572ae Removed logger output for XML token node tests
This was SVN commit r11360.
2012-03-17 23:03:02 +00:00
vts
31da0a746b Fixes crash when removing non-existent tokens from XML 'token' nodes
This was SVN commit r11342.
2012-03-15 22:57:08 +00:00
vts
b8e8602e39 Fixed test failure in test_CmpTemplateManager.h after atlas selection improvement
This was SVN commit r11182.
2012-02-27 19:10:49 +00:00
08bd07ddd6 Adds safe bool operator to ICmpPtr, replacing the null() method, based on patch by leper. Also changes bool operator in AtSmartPtr to safe bool. Fixes #1077.
Changes some CmpPtr variable names for consistency.

This was SVN commit r11036.
2012-02-08 02:46:15 +00:00
0ec4242962 Detect and fix printf signedness errors. Fixes #1086, #1087.
This was SVN commit r10846.
2012-01-01 16:43:10 +00:00
301854702c add support for removing individual files from VFS and a mechanism for automatically doing so (add filename.extension.DELETED to the same directory/archive), as discussed in meeting.
refactor: split up Invalidate into RemoveFile+RepopulateDirectory
GameSetup: fix: ensure the first mod always overrides game files,
irrespective of timestamp.

This was SVN commit r10610.
2011-11-26 18:37:53 +00:00
d57bb00ece Fix sparse array serialization
This was SVN commit r10442.
2011-10-27 20:56:32 +00:00
29e4f633f1 Add initial serialization test mode.
Reduce some dependencies on CSimulation2 to provide more flexibility.

This was SVN commit r10426.
2011-10-24 14:31:05 +00:00
b6d04004b6 Avoid errors when using planes in formations, by not allowing them to join formations
This was SVN commit r9776.
2011-07-07 17:05:22 +00:00
2c58b07223 # Add experimental fighter planes.
This was SVN commit r9605.
2011-06-09 19:44:40 +00:00
f608b44d1d fix self-test and map load on Windows (avoid mixing dir separators).
add more specific error codes (used at work)

This was SVN commit r9462.
2011-05-06 18:45:30 +00:00
a122f55bde Avoid hardcoding the actor entity template details.
This was SVN commit r9183.
2011-04-06 21:01:00 +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
c3405e6f50 path improvements/fixes:
- replace more std::wstring with Native or VfsPath; wstring_from_utf8 ->
NativePathFromString
- replace sequences of Join(Path(), Basename+extension) with
ChangeExtension in wsdl, CacheLoader
- add Path::IsDirectory to replace .empty() / path_is_dir_sep(.back()).
also changed behavior to reflect the fact that "" is the VFS root
_directory_
- Path::Join now allows 2 identical path types (e.g. VfsPath) or one
char* literal (prevents inadvertently introducing non-safe characters).
to convert from wstring or wchar_t, use an explicit ctor (e.g.
VfsPath(wchar_t_string))

This was SVN commit r9091.
2011-03-21 19:54:08 +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