Commit Graph

62 Commits (b00b8554abf003bf6dc65d912b4eb2a4a790491c)

Author SHA1 Message Date
Günther Brammer b00b8554ab Merge branch script 2016-04-28 03:25:44 +02:00
Günther Brammer efd4724084 Script: Add Scenario effects
These work just like global effects, except that effects from CreateEffect
get the scenario as target parameter in the callbacks.
2016-04-28 02:53:21 +02:00
Günther Brammer e8811a7b21 Move global effects from ::Game to ::ScriptEngine
This even enables some simplification in the CompileFuncs, since the global
effects were already put in the same section as the other ScriptEngine
parts. The callback for updates due to relinks also fits nicely.

The reset in C4Game::Default was redundant with C4Game::Clear already.
2016-04-24 19:40:28 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Günther Brammer 6f98fb2e66 Remove C4AulScript class
It isn't needed to hold engine functions anymore, because those are just
put into C4PropLists.
2016-02-02 02:57:47 +01:00
Günther Brammer b21acff0c7 Move Scriptparser State into C4ScriptHost 2016-02-02 02:57:46 +01:00
Günther Brammer 9dadfba5af Move GlobalNamed.SetNameList call after Link() into Link()
It isn't clear whether that call is necessary since the C4AulScriptEngine
constructor already does this, but it is clear that duplicating the call
all over is a bad idea.
2016-01-25 00:00:58 +01:00
Günther Brammer 5a570b96f1 Remove now unnecessary stubs from C4ScriptStandaloneStubs 2016-01-24 02:09:14 +01:00
Günther Brammer e1a38ee010 Move references to ::Objects and ::MaterialMap from C4AulLink to C4Game
This changes the order in which the various parts of the engine are updated
after a definition reload, but they should not interfere with each other.
2016-01-24 02:09:14 +01:00
Nicolas Hake 617a0828fb Aul: Throw exceptions by value, not by pointer
Throwing values instead of pointers simplifies memory management at the
catch site.
2015-12-08 13:17:40 +01:00
Nicolas Hake 96fcf1389a Aul: Make engine not automatically log error summary
Getting the error summary written to the log/console automatically may
be useful for general game usage, but when testing Aul we just end up
with thousands of useless messages in the output. Let the caller log the
message if it's really desired.
2015-12-08 13:17:39 +01:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Günther Brammer b7a022852e Revert "Move C4Aul code into separate subdirectory"
The distinction between the "aul" and "non-aul" parts of
the script engine are mostly historical accident, and the
current organization of the source code does not use
sub-subdirectories. I'd like to keep it that way.

This reverts commit 69ba06b8d0.
2014-05-12 02:24:19 +02:00
Nicolas Hake 69ba06b8d0 Move C4Aul code into separate subdirectory 2014-05-11 16:17:48 +02:00
Günther Brammer 22016e075f Replace some usages of C4ID with C4Def*
In particular those that made the c4script shell depend on C4Id.cpp.
2014-04-19 19:02:22 +02:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Günther Brammer 42608c5209 Remove C4DirectExecScript, use an existing scripthost for the eval function
Since the scripthost isn't used to store the bytecode anymore,
Parse_Expression doesn't modify it anymore. So there is no need for a
temporary one.
2013-01-23 21:36:21 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Günther Brammer a528b0d76e Silence some g++ warnings 2012-06-15 18:16:49 +02:00
Günther Brammer bd371e38c1 Make the child pointers of the scriptengine C4AulScript*s again
The rope will create a C4AulScript for the rope engine functions instead of
putting them into the global scope, and we might want to put C4Object-only
functions into a separate C4AulScript some day, too.
2012-06-07 21:07:31 +02:00
Günther Brammer c6fe23729b Replace function list from C4AulScript with proplist enumeration
This finally makes the function list in C4AulScript unnecessary.
2012-05-28 00:50:13 +02:00
Günther Brammer 487a0ea38f Store a copy of the proplist the preparser created for include/appendto
The parser now copies the contents of the proplists in the order of their
source scripts into the final proplist. This way, local variable contents
get properly included, and the list of functions has one user less.
2012-05-28 00:31:55 +02:00
Günther Brammer e26bc8e33a Move some parser implementation details to C4ScriptHost 2012-05-27 23:47:07 +02:00
Günther Brammer 7e00f3b5ad Use printf format instead of two strings for script warnings and errors 2012-05-26 00:22:22 +02:00
Günther Brammer 62bc721a65 Make the child pointers of the scriptengine C4ScriptHost*s
This only tightens up the types a bit.
2012-05-15 19:32:58 +02:00
Günther Brammer ceb9c45984 Fix Script runtime reload
Just removing the right amount of functions from the proplists is
somewhat tricky, unfortunately.
2012-05-25 17:25:53 +02:00
Günther Brammer 752e945b8d Call C4PropList::Freeze in Link, remove now empty AfterLink functions
AfterLink was otherwise only used for the TimerCalls, which are now gone.
2012-05-06 00:06:33 +02:00
Günther Brammer 67d8ac47e9 Keep functions across script reloads
For functions that are not appended/included, this is done by reusing them.
Functions that are not in the new script version are left with their code
raising and error. Appended/included functions are handled by a reference count.
2012-02-02 01:16:14 +01:00
Günther Brammer 65801a5188 Remove C4AulFunc::LinkedTo
The parser doesn't need it to find the functions it has to parse anymore.

And the global proplist can be cleared before removing the functions,
instead of having engine functions deregister themselves and script
functions being deregistered when their linked function is removed.
2012-02-13 22:20:10 +01:00
Günther Brammer 30c843925f Script: Include each script at most once
If a script includes two others which each include the same fourth, the
script only gets one copy. Which one is arbitrary and subject to change.
2012-01-25 03:50:24 +01:00
Günther Brammer 18038f45d3 Implement the function overload tree using the proplists
Instead of carefully inserting functions at the start or end of the list,
build the list just before the parser runs, at the same time as filling
the proplist where the functions are looked up.

This way, the overloaded function is simply the one that was previously in
the proplist, is not needed outside of the overloading function, and can thus
be replaced in the proplist.
2012-01-27 00:20:55 +01:00
Günther Brammer f61ebfc453 Replace C4AulScript tree structure with a list 2012-01-25 04:15:39 +01:00
Günther Brammer ae11dfd1e4 Remove #strict infrastructure
The next incompatible changes to C4Script will probably use something else
anyway.
2012-01-25 04:15:53 +01:00
Günther Brammer 0403bed306 Put functions into their proplists 2011-10-15 01:38:59 +02:00
Günther Brammer b3aff643f3 Script reloading does not clear local variable defaults
The defaults are filled in by the preparser, which is only invoked for
changed scripts.
2011-10-04 22:16:27 +02:00
Günther Brammer 8185d318bf Script: Add a proplist representing the global scope, named "Global" 2011-10-04 22:12:45 +02:00
Günther Brammer f166fdaed7 Move Parser from C4AulScript to C4ScriptHost 2011-10-13 18:01:02 +02:00
Günther Brammer 843642271d Script: local variables work for the Scenario and definition calls
This requires replacing C4AulScript::Def with C4AulScript::GetPropList() and
C4DefScriptHost::Def, and making C4GameScriptHost::GetPropList return the
scenario proplist prototype.

Definition calls won't be able to change the local variables, of course.

Other proplists will be able to use local variables once they can have
functions.
2011-09-29 03:49:21 +02:00
Günther Brammer 0cd46a2ebc Wrap C4AulFunc::Name in C4AulFunc::GetName() 2011-10-14 00:40:55 +02:00
Günther Brammer 65a11ef1c3 Script: Remove unused function "descs" 2011-09-29 02:46:26 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Günther Brammer 8323f6c01d Add a standalone C4Script interpreter 2011-03-05 17:40:22 +01:00
Günther Brammer 264009060c Script: Remove Method from function descs 2011-03-03 02:25:01 +01:00
Günther Brammer e250312c26 Move C4DefList class into from C4Def.cpp/h to new C4DefList.cpp/h 2011-03-03 17:10:22 +01:00
Günther Brammer 7ce65373a3 Replace C4AList with some std::lists 2011-02-26 00:48:19 +01:00
Günther Brammer 7be90977bf Make C4ScriptHost have a C4ComponentHost member instead of inheriting
Previously, C4ScriptHost needlessly derived from two classes.
2011-02-06 21:37:19 +01:00
Günther Brammer 6d3feabe69 Reduce #includes so that C4Include.h doesn't include C4Value.h
This should avoid many complete rebuilds.
2011-01-08 17:04:20 +01:00
Günther Brammer be342d4a51 copyright notices update 2010
This time with more manual checking and using git blame -M -C, so that
a few cases of copied code get a copyright notice corresponding to
their initial introduction.
2010-12-23 01:01:24 +01:00
Günther Brammer 93d3bc7d2f Script: Thaw and clean definition proplists for reload (#405) 2010-09-22 03:33:57 +02:00