Commit Graph

10097 Commits (directional-lights)
 

Author SHA1 Message Date
Maikel de Vries 1eb17613bc keypad: allow alternative graphics for its buttons 2016-10-01 16:32:29 +02:00
Maikel de Vries df43ab86f2 add IsAnimal to animals for finding them 2016-10-01 16:32:29 +02:00
Sven Eberhardt 9299ec4223 Fix max energy in AI test scenario 2016-10-01 10:26:43 -04:00
Sven Eberhardt b317afbadc Fix division by zero on progress bars with max=0 2016-10-01 10:26:25 -04:00
Sven Eberhardt d35fc728bf Fix DrawParticleLine documentation and example #1823 2016-10-01 10:19:40 -04:00
Armin Burgmeier 836927d93c Don't leak static proplists with cyclic references
If a local variable in a definition was set to a proplist inside the
Definition() callback, and that proplist contained cyclic references
then those references were leaked. Typically cyclic references for
script-created proplists are broken in
C4PropListScript::ClearScriptPropLists, however definition proplists
are changed to be static proplists in
C4PropList::FreezeAndMakeStaticRecursively.

To fix this, each script host maintains a list of proplists made static
by FreezeAndMakeStaticRecursively, and explicitly deletes all of these
proplists on Clear().

This leak also leads to an assertion failure inside
C4PropListScript::ClearScriptPropLists in debug mode, and can also be
observed by C4PropList::PropLists not being empty after game clear.

The definition in Objects.ocd/Helpers.ocd/UserAction.ocd constructs
cyclic proplists in its Definition() call. A simpler, more minimal way
to provoke the leak is the following (it provokes the leak but not the
assertion failure):

    local bla;

    func Definition(def)
    {
        bla = {};
        bla.test = { Name="Test222" , Options = { Name="Test333" } };
        bla.test.Options.Link = { Name="Test444", Blub=bla.test };
    }
2016-09-30 17:50:41 -10:00
Sven Eberhardt d04476ad0b Allow oversize and rotation of fence 2016-09-30 22:23:11 -04:00
Sven Eberhardt 0604a815d0 Fix undefined constant in keypad 2016-09-30 21:40:57 -04:00
Maikel de Vries fa977149e9 make firefly use insect swarm library 2016-09-30 18:58:42 +02:00
Maikel de Vries b42a4b824b insect swarm: fix movement issues 2016-09-30 18:58:42 +02:00
Armin Burgmeier 732fff3029 Fix possible use of uninitialized variables
For example, creating a C4WindowSDL and deleting it without calling
::Init() on it would lead to use of uninitialized variables.
2016-09-27 21:52:55 -10:00
Maikel de Vries 32f5b1cb25 add keypad to decoration objects
This can control lots of things and triggers on entering the correct code.
2016-09-26 17:15:37 +02:00
Lukas Werling 8a09fcc1b1 Increase REPL output depth to 10 (from 1)
This makes working with nested arrays and proplists a lot less annoying.
2016-09-26 16:33:24 +02:00
Lukas Werling 10622a9b61 Add generic A* implementation for path finding in graphs 2016-09-26 16:30:47 +02:00
Maikel de Vries 679eedaf50 GetPathLength: add optional depth parameter
This is also exposed by the PathFinder defcore entry.
2016-09-25 21:48:19 +02:00
Maikel de Vries 0e76c85531 make line overlap check a global function
This avoids code duplication and really is a Math.c function.
2016-09-24 17:30:19 +02:00
Maikel de Vries fb38acb946 allow setting plr view/zoom at player start object 2016-09-23 20:21:34 +02:00
Maikel de Vries 18424aaaa7 add rule to control pump speed 2016-09-23 09:26:06 +02:00
Maikel de Vries 4c7d27ec64 bats require less space on placement 2016-09-23 09:18:57 +02:00
Maikel de Vries 3df960851c _inherited() for trees to access library functionality 2016-09-20 15:11:32 +02:00
Lukas Werling c3cf464a83 Editor: Fix scenario open filter (#1817) 2016-09-18 23:22:39 +02:00
Lukas Werling 880981ad31 Fix build on systems with non-long regex index types 2016-09-18 19:40:32 +02:00
Maikel de Vries 823b13d764 add simple string to integer conversion function
Just a basic one in C4Script for now.
2016-09-18 11:30:35 +02:00
Lukas Werling fbb8ad5d87 Add RegexSplit() 2016-09-18 11:10:19 +02:00
Lukas Werling 219f81f004 Regex: Fix off-by-one error 2016-09-18 10:49:06 +02:00
Lukas Werling 619ad27a91 Regex: Fix infinite loop with zero-length matches 2016-09-18 01:16:06 +02:00
Lukas Werling db12ed7c99 Remove FindSubstring as it's really really slow
Use RegexSearch() instead, which is 100 times faster for large strings
(see benchmark results below).

Example benchmark:

    global func TestFindSubstring(int iterations)
    {
    	var result;
    	for (var i = 0; i < iterations; i++)
    	{
    		result = FindSubstring(hamlet, "and");
    	}
    	return result;
    }

    global func TestRegexSearch(int iterations)
    {
    	var result;
    	for (var i = 0; i < iterations; i++)
    	{
    		result = RegexSearch(hamlet, "and");
    	}
    	return result;
    }

    global func RunBenchmark(int iterations)
    {
    	StartScriptProfiler();
    	Log("FindSubstring: %d iterations", iterations);
    	var substr = TestFindSubstring(iterations);
    	Log("RegexSearch: %d iterations", iterations);
    	var regex = TestRegexSearch(iterations);
    	StopScriptProfiler();

    	if (!DeepEqual(regex, substr))
    		Log("Results differ: %v vs %v", substr, regex);
    }

Results:

    FindSubstring: 100 iterations
    RegexSearch: 100 iterations
    Profiler statistics:
    ==============================
    48903ms      Global.FindSubstring
    48903ms      Global.TestFindSubstring
    47979ms      Global.TakeString
    00504ms      Global.TestRegexSearch
    00016ms      Global.PushBack
    ==============================
2016-09-17 20:08:43 +02:00
Lukas Werling b614209593 SDL: Use OpenGL 3.1 if 3.2 is not available (like WGL) 2016-09-17 12:32:18 +02:00
Nicolas Hake 6a6f4520d3 Merge pull request GH #25 from Mailaender/appdata
Added a Linux AppData file
2016-09-17 11:55:43 +02:00
Nicolas Hake 59173dbd12 Merge pull request GH #27 from lheckemann/master
Require Qt 5.4+ for editor — needs QOpenGLWidget
2016-09-17 11:03:00 +02:00
Linus Heckemann 355b6fe070 Require Qt 5.4+ for editor — needs QOpenGLWidget 2016-09-17 08:23:07 +01:00
Lukas Werling d7cd224a4f Add functions RegexReplace, RegexSearch and RegexMatch 2016-09-16 23:46:03 +02:00
Maikel de Vries 4b54b86d30 add function to find substrings 2016-09-16 17:25:22 +02:00
Mark ae1de739b0 Wooden Bridge: Return other bridge in CombineWith()
Apparently the return value is not used anywhere; the change allows chaining multiple bridges in a comfortable call.
2016-09-15 19:25:16 +02:00
Mark 58d42b8fd8 Library Lamp: Extracted functions.
Did this change a long time ago, probably for re-using functions in a derived object.
2016-09-15 19:17:17 +02:00
Sven Eberhardt 0cdad64934 Fix goal and rule displays (#1811) 2016-09-14 21:46:16 -04:00
Sven Eberhardt 22af9f0e8c Fix landscape placement functions (#1820, #1821) 2016-09-14 21:30:57 -04:00
Sven Eberhardt 61b1ab08ad Editor: More shortcuts; show helper shortcuts in tools menu 2016-09-10 01:17:40 -04:00
Sven Eberhardt d3d7256fec Fix missing achievement in Krakatoa's Krach (#1819) 2016-09-10 01:17:39 -04:00
Lukas Werling 8d9657a800 Change default puncher address to netpuncher.openclonk.org 2016-09-09 18:31:39 +02:00
Sven Eberhardt 2490ef4584 Editor: Add more shortcut keys 2016-09-09 00:56:16 -04:00
Sven Eberhardt e67e429fef Editor: Improve default layout and raise proper dialogues on tool change 2016-09-09 00:56:15 -04:00
Lukas Werling c41f93a2f6 Fix c4script and mape build 2016-09-08 21:45:30 +02:00
Lukas Werling f7376169b9 Fix crash when starting a game in fullscreen mode 2016-09-08 21:26:59 +02:00
Lukas Werling 7177c261b3 Bring back and fix the netpuncher
As carrier-grade NATs are becoming common, many players cannot host
Clonk games at all. The simple STUN-like netpuncher from Clonk Rage
which was removed three years ago is already effective against some
DS-Lite NATs.

With some extensions, we should be able to make it work with more
restrictive NATs as well.

This reverts commit 72002cc366.
2016-09-08 21:10:06 +02:00
Sven Eberhardt 53b365a6d2 Editor: Add shortcuts, menu items, tooltips 2016-09-08 01:56:01 -04:00
Sven Eberhardt 0e02bad837 Editor: Disable reinit scenario button if no scenario is loaded 2016-09-08 00:25:17 -04:00
Sven Eberhardt b95d1387a4 Editor: Add "reset to saved scenario" command 2016-09-07 01:53:54 -04:00
Sven Eberhardt 856730aabd Fix some signed/unsigned warnings 2016-09-07 01:53:54 -04:00
Sven Eberhardt 2c20204021 Add C4SECT_ReinitScenario flag for LoadScenarioSection
This also resets the script engine and does player init callbacks. Useful to restart the scenario in the editor.
2016-09-07 01:53:53 -04:00