Commit Graph

419 Commits

Author SHA1 Message Date
Twan van Laarhoven 8b25815f72 Re-enabled intrusive_ptr 2020-05-07 22:25:02 +02:00
Twan van Laarhoven 360f8d71ad Fix: check starting_age <= age, instead of starting_age < age. Otherwise we can get into an infinite loop. 2020-05-07 02:56:43 +02:00
Twan van Laarhoven e005d47d56 Use std::enable_shared_from_this instead of thisP parameters. 2020-05-06 22:59:10 +02:00
Twan van Laarhoven c00d1f2236 Use script_nil instead of creating ScriptObjects with null pointers.
Fixes #18
2020-05-04 19:58:12 +02:00
Twan van Laarhoven 74230fefeb Fix #17: change &instrs[pos] to &instrs[0]+pos to avoid debug assertions when pos=instrs.size() 2020-05-04 13:22:44 +02:00
Twan van Laarhoven 9f99bf4658 There is little point to a pool allocator with shared_ptr, since ref counters are still allocated as well. 2020-05-04 00:44:50 +02:00
Twan van Laarhoven 30391672ad Exception instead of warning 2020-04-30 14:25:18 +02:00
Twan van Laarhoven a11af1767c Fix #6, fix #7: infinite loops/infinite recursion in regex script functions are now "nice" exceptions 2020-04-30 14:08:06 +02:00
Twan van Laarhoven a1d54f36fc Use LocalFileName class for file names inside a package. 2020-04-30 00:20:32 +02:00
Twan van Laarhoven 5f615b3117 Fix #5. Use our own function instead of wxRemoveFile, because the latter shows an error when the file doesn't exist. 2020-04-28 21:25:05 +02:00
Twan van Laarhoven 618df3b534 Script parser now produces warnings about statements where expressions are expected, and about the = comparison operator. 2020-04-27 19:14:17 +02:00
Twan van Laarhoven af7e8c9d39 Switch (back) to our own Color type instead of using wxColour.
The reason is that wxColour's default constructor creates an invalid color (what is that even?). It is nicer to just have default be transparent.
2020-04-26 21:41:35 +02:00
Twan van Laarhoven c324c8bbbb to_code now adds quotes around strings.
to_code for map now includes keys.
This maans that the basic script-functions test passes.
2020-04-26 17:35:14 +02:00
Twan van Laarhoven 2e897edbbf Use toSomeType() instead of operator SomeType in ScriptValue.
This means that we are more explicit about type conversions.
Also use override specifiers for overriden virtual functions in ScriptValue.
2020-04-26 17:03:43 +02:00
Twan van Laarhoven 54a3cbfde3 Replace include guards by #pragma once 2020-04-26 01:25:16 +02:00
Twan van Laarhoven bad9981ad9 Cleaned up copyright block.
Removed the year so we don't get tempted to change this ever again.
2020-04-26 01:11:14 +02:00
Twan van Laarhoven 4327abb803 Remove DECLARE_TYPEOF
It is no longer needed since C++11
2020-04-26 00:51:16 +02:00
Twan van Laarhoven 5e92d9455c Code cleanup: remove messy spaces before line continuation (\) in macros 2020-04-26 00:37:13 +02:00
Twan van Laarhoven 7d06e903a4 Rename script function rotate -> rotate_image 2020-04-25 23:46:30 +02:00
Twan van Laarhoven 37c8641641 Replace scoped_ptr by unique_ptr 2020-04-25 22:28:32 +02:00
Twan van Laarhoven 787a707900 Use std::shuffle instead of std::random_shuffle, since the latter is removed in C++17 2020-04-25 22:20:51 +02:00
Twan van Laarhoven 0d42df1537 Fix type conversion errors in GCC/wxGTK 2020-04-25 22:20:51 +02:00
Twan van Laarhoven 64ea1d7322 Clean up pointer use:
* Use unique_ptr for Actions instead of manual memory management
 * Use unique_ptr in KeywordDatabase
 * Use unique_ptr instead of shared_ptr for file formats
 * Don't pass shared_ptr to Reader/Writer, use references instead
Also
 * Switch to C++17 so we can use map::try_emplace
2020-04-25 22:20:51 +02:00
Twan van Laarhoven 708b4389a0 Use make_intrusive/make_shared for smart pointer construction. 2020-04-25 22:20:51 +02:00
Twan van Laarhoven 4258ce1c6c Remove AColor class, because wxColour now supports alpha values. 2020-04-25 22:20:50 +02:00
Twan van Laarhoven 8f8e2cea65 Expose the 'warning' function, and added a similar 'error' function.
Add documentation.
2020-04-23 20:22:43 +02:00
Twan van Laarhoven bad896898f Don't throw Char* 2020-04-23 19:56:46 +02:00
Twan van Laarhoven 713a9e4a40 Use underscores instead of spaces for all internal names. And renamed some script functions at the same time.
* cannocial_name_form now outputs "_", where it used to use " "
* this simplifies reflectio and scripting code, because now C++ names are also MSE internal names
* added 'caption' property to fields. This is used instead of the name in NativeLookEditor, since the latter will now contain underscores.
* renamed text related script functions for consistency, since we were touching that part of the code anyway.
2020-04-22 23:48:26 +02:00
Twan van Laarhoven a6cd6c2dd0 Spelling of canonical 2020-04-21 21:48:47 +02:00
Twan van Laarhoven 59d59e97fd fixed: write_image_file failed with --export with relative path, because the is-relative-to-target-dir check was wrong 2020-04-21 00:13:23 +02:00
Twan van Laarhoven b283a02d2f to_code and to color conversion for ScriptNil 2020-04-20 22:45:20 +02:00
Twan van Laarhoven b0180547ae Fix Regex::replace_all to actually do something 2020-04-20 21:19:09 +02:00
Twan van Laarhoven 24f4b4edba Add type_name function to query the type of a value 2020-04-18 22:03:25 +02:00
Twan van Laarhoven 332f7b9ed8 getContext() clears "card" from the context 2020-04-18 21:34:31 +02:00
Twan van Laarhoven 9c9eba77a0 Fix: substr("foo",begin:3) now returns "" instead of true 2020-04-18 19:34:32 +02:00
Twan van Laarhoven 3b4f3a948c Fix: length now works correctly for maps 2020-04-18 19:32:25 +02:00
Twan van Laarhoven 0d38c64e86 Fix parsing issues on linux: iswalpha and friends don't work correctly on non-ascii characters. 2020-04-18 01:01:57 +02:00
Twan van Laarhoven 0cffdb7d1a move reverse_string to string.hpp 2020-04-14 20:27:39 +02:00
Twan van Laarhoven 6e7a4485a8 Cleaned up utf8 decoding code.
It was actually completely broken in newer wxWidgets versions, putting '\0' characters in the string, which broke things like concatenation.
2020-04-08 01:24:19 +02:00
Twan van Laarhoven 35a89676b4 CMake file
Update to C++ 11: std::shared_ptr, for each loops
Update to wxWidgets 3.0+
2020-04-08 01:10:01 +02:00
Lymia Aluysia 1d912a6853 Update copyright strings. 2017-01-18 08:52:57 -06:00
Lymia Aluysia d2c635f739 Change tabs to two spaces. 2017-01-18 08:43:21 -06:00
Lymia Aluysia 8c960f0c34 Work on compiling on mingw 2017-01-18 04:56:16 -06:00
twanvl 262b684469 don't warn about \' escape sequence.
added numeric escapes

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1643 0fc631ac-6414-0410-93d0-97cfa31319b6
2011-01-25 22:42:54 +00:00
twanvl bd55326c7d * Added console panel for evaluating scripts and showing error messages.
* Rewrite of error queue code: errors are now pulled, instead of being turned into messageboxes automatically.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1629 0fc631ac-6414-0410-93d0-97cfa31319b6
2011-01-21 13:26:03 +00:00
twanvl 53bbcfe9a9 Be explicit about type of angles: either Radians or Degrees.
Angles are always doubles.
Internally use radians as much as possible.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1605 0fc631ac-6414-0410-93d0-97cfa31319b6
2011-01-09 14:49:59 +00:00
twanvl b47bb7c3fe added some math script functions:
* sin, cos, tan (radians)
 * sin_deg, cos_deg, tan_deg (degrees)
 * exp, log (base e), log10
 * sqrt, pow

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1602 0fc631ac-6414-0410-93d0-97cfa31319b6
2011-01-08 22:15:54 +00:00
twanvl 195a318001 compatibility with wxWdigets 2.9+: use wxString::const_iterator instead of raw Char*
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1526 0fc631ac-6414-0410-93d0-97cfa31319b6
2010-12-07 21:02:04 +00:00
twanvl 9735e24517 Added a panel showing profiler timings
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1523 0fc631ac-6414-0410-93d0-97cfa31319b6
2010-10-13 21:35:30 +00:00
twanvl 13a051b967 Fix error in vc9: don't index outside vector
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1512 0fc631ac-6414-0410-93d0-97cfa31319b6
2010-10-03 15:28:12 +00:00