Commit Graph

366 Commits (3a3ed01c898bf6b23abf42d256bea890d275434e)

Author SHA1 Message Date
Günther Brammer 3a3ed01c89 Savegames: Save readonly proplists by their name
For example, the proplist in Clonk.ActMap.Walk is saved as DClonk.ActMap.Walk.
Should the script defining the proplist change while the savegame is stored,
the proplist will have the new contents instead of the old ones after savegame
load.

Also, save functions as DFlint.Hit instead of fDFlint.Hit. Loading uses the same
code as static proplist loading.

Curiously, this makes g++ 4.4 use the C4RefCntPointer move constructor,
which was broken until now. Fix it to take a mutable rvalue reference.
2012-06-01 17:27:59 +02:00
Günther Brammer ef3078d1d0 Remove unused C4Value constructor 2012-05-14 16:18:20 +02:00
Günther Brammer 9c3f949142 Point to the beginning of the current token in script error messages 2012-05-16 23:24:40 +02:00
Günther Brammer 065b100dad Script: eval throws an exception when the script does not end after the expression 2012-05-08 01:03:29 +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 830d6093a9 Fix Call error message 2012-05-07 21:28:43 +02:00
Günther Brammer 93169c7d33 Script: Make Call() throw again if neither function nor ~ is present
And skip a ~ in the function name again.
2012-05-07 20:49:08 +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 46fd427224 Simplify Fn_this
cthr->Obj is now 0 or == cthr->Def.
2012-04-28 22:02:35 +02:00
Günther Brammer fb4bac65be Remove C4AulContext::Caller 2012-04-28 21:32:29 +02:00
Günther Brammer 8a4181a3be Replace C4AulObjectContext* with a simple C4Object* parameter 2012-04-28 22:04:36 +02:00
Maikel de Vries 6fcc0f6d2e Removed TimerCall in favour of AddTimer script implementation 2012-05-05 12:09:44 +02:00
Günther Brammer 133e987902 Script: Throw instead of silently using nil for this after RemoveObject 2012-04-29 16:53:29 +02:00
Günther Brammer 2e9ae057ad Remove obsolete assertion from FnTranslate (#746)
The rules for ctx->Obj and ctx->Def changed recently. The latter is now the
real this pointer, and Obj is Def->GetObject(). There's no need to check
this in FnTranslate.
2012-04-28 20:25:04 +02:00
Günther Brammer 1a29f8625d Reorder engine source file organization a bit
This mostly consists of flattening the hierarchy, splitting the
graphics stuff out of platform, and a few smaller cleanups.
2012-04-27 19:04:43 +02:00
Maikel de Vries 4a56f8d7c1 Replaced defcore values related to fire with properties 2012-04-28 16:17:38 +02:00
Maikel de Vries 16fa9cf341 Placement is now a property instead of DefCore value 2012-04-16 22:17:05 +02:00
Julius Michaelis d93384beb6 Add forgotten C4Value::operator== case for C4V_Function 2012-04-15 16:33:39 +02:00
Nicolas Hake 7efd9a9b9a Aul: Add new nil-coalescing operator ??
This short-circuiting operator will evaluate to its first operand if the operand
is not nil, or to its second operand otherwise. Its intended use is to simplify
defaulting expressions that may evaluate to nil to a valid value.
2012-04-15 15:44:01 +02:00
Tobias Zwick 46156e3f1c show tooltip for C4D_MouseSelect using the property "Tooltip"
+ remove references to the old and obsolete "help mode"
2012-04-15 12:09:54 +02:00
Julius Michaelis 57a07a95ab Add forgotten string for function type values to GetC4VName 2012-04-14 16:53:35 +02:00
Günther Brammer f89f19b2cb Script: No #appendto in Defs or global functions in #appendtos (#734)
So the only thing #appendtos may contain are lokal functions and variables,
which are only reachable via the Definition the script is appended to, and
global constants and variables, which only need to be parsed once. Thus,
#appendto scripts can skip being parsed without a definition, and the
errors that sometimes produces are gone.
2012-04-13 21:43:43 +02:00
Günther Brammer ac02380b58 Script: this->RemoveObject() changes this to nil (#722) 2012-04-13 20:28:30 +02:00
Günther Brammer fe261ffca0 Script: GetType returns C4V_C4Object for objects again 2012-04-13 18:38:30 +02:00
Günther Brammer f245af8972 Rename C4AulParseState to C4AulParse 2012-04-12 21:03:14 +02:00
Günther Brammer 05ef63bf64 Script: Make 0==nil false again
This was probably broken by the C4V_Any/C4V_Nil separation. Also clean
the function up a bit and add an assert that should catch similar stuff in
the future.
2012-04-11 02:25:24 +02:00
Julius Michaelis 335a6e0598 Fix C4ValueArray 2012-04-09 22:04:03 +02:00
Julius Michaelis 939f4c69ca Fix array slice setting 2012-04-08 12:44:17 +02:00
Julius Michaelis dcf59a4d61 Disallow cyclic prototyping 2012-04-08 12:43:19 +02:00
Günther Brammer 40de33ca3c win32: Make sdl-mainloop option work
As it doesn't have the editor, this is only useful for compiling
more of our code on more platforms.
2012-03-23 22:53:56 +01:00
Martin Plicht 30840696c6 C4AulScriptEngine::Clear: Don't create GlobalPropList just to Clear() it 2012-03-22 21:49:55 +01:00
Günther Brammer 6126df616c Make engine compile with debugrecs again 2012-03-11 17:52:00 +01:00
Armin Burgmeier 86af00a313 Fix the build 2012-03-12 23:41:07 +01:00
Günther Brammer 5c235cc23e Savegames: Fix loading of global variables (#726)
The global variables ended up with the temporary name list created during
load that didn't necessarily contain all variables or even in the right
order. As far as I can tell, this happened since 2005, but nobody noticed
because the list of global variables didn't tend to change between save and
load.
2012-03-10 22:45:42 +01:00
Günther Brammer dfea0914a9 Merge the functions pointer branch 2012-03-09 17:42:48 +01:00
Julius Michaelis 5716bb1e47 C4AulScript::DirectExec: Throw on parsing errors, too, when fPassErrors is set. 2012-03-09 11:45:25 +01:00
Günther Brammer 71e108f16a Start of a C4Script API third party programs could use
This is very experimental, subject to change, and the single function not
at all useful yet.
2012-03-04 21:23:11 +01:00
Günther Brammer 6486ea9e19 Script: Disallow "new Clonk {}" for now
Eventually, "new Clonk {}" will create a C4Object. Prevent anyone from
using it before then.
2012-02-25 22:10:03 +01:00
David Dormagen 4169a9232c swapped parameters of GetIndexOf 2012-02-25 21:57:39 +01:00
Günther Brammer ce27d42ac7 Remove unused C4AulScript::Owner
C4AulScript::Translate referenced it, but used it only when called from
eval, which is not done.
2012-02-17 01:04:05 +01:00
Günther Brammer 464d372034 Make C4GameScriptHost save to call again for (c4script standalone) 2012-02-17 00:30:00 +01: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 1e7f32af48 Move C4AulFunc to its own header file
This is necessary since C4Value.h will call a function from C4AulFunc.
2012-02-13 18:00:35 +01:00
Günther Brammer 8091dff419 Clean up C4AulScriptFunc API 2012-02-01 03:49:50 +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 42679e48fb Script: Inherit local variable initialization from #included scripts
This is done by creating their values in the parser. Global constants are
still created in the preparser so that they are available to the parser.
2012-01-25 00:36:11 +01:00
Günther Brammer 378e502c85 C4Script parser goes through the entire script instead of only functions
This should not change anything about which functions are created
by include/appendto and what inherited calls.
2012-01-27 00:42:41 +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