Commit Graph

874 Commits (master)

Author SHA1 Message Date
Günther Brammer 525cdc11a3 Deduplicate calculation of the relative stack position of local variables 2016-04-28 02:59:11 +02:00
Günther Brammer 071feaa78f Deduplicate loop control handling in the script parser 2016-04-28 02:59:11 +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 97406d24d2 Script: Add Construction and Destruction effect callbacks 2016-04-28 01:08:04 +02:00
Günther Brammer 50378ffda0 Script: CreateEffect starts effects that receive callbacks themselves 2016-04-28 01:08:04 +02:00
Sven Eberhardt 881534bee0 Qt Editor: Shape properties 2016-04-25 16:17:10 -04:00
Lukas Werling aeabe28d82 Remove AsyncRandom() script function
We couldn't think of any reason you'd want to use this over regular
Random() in script.
2016-04-25 17:18:07 +02:00
Günther Brammer e5cfb1858f Script: GetName() can return the property a proplist was defined in
This means that the ActMaps do not need to repeat their name anymore,
provided that all Scripts use GetName() instead of directly accessing .Name.
2016-04-24 19:40:29 +02:00
Günther Brammer 5a470f51f8 Move Effect functions to C4Script.cpp 2016-04-24 19:40:29 +02:00
Günther Brammer 2cdf553953 Change effect list getting function parameter type to C4PropList*
This makes it possible to move the effect functions to C4Script.cpp.
2016-04-24 19:40:29 +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
Günther Brammer e2c6c2a841 Do not use C4Object in C4Effect
Instead, the pointer to the effect list is passed to the functions that
previously used the object to determine it.
2016-04-24 19:40:28 +02:00
Günther Brammer c89e73608b Unite getting the effects list from a C4Object pointer into a function
This way, that function can be re-implemented in standalone c4script.
2016-04-24 19:40:28 +02:00
Günther Brammer 42a15e3be9 Convert C4Effect parameters that do not need to be C4Object* to C4PropList* 2016-04-24 19:40:28 +02:00
Günther Brammer bfb9b6b1fd Drop the roundtrip through C4ID for the effect C4Def command target
Unfortunately, this complicates the C4Effect::CompileFunc to stay
compatible.
2016-04-24 19:40:27 +02:00
Günther Brammer 632c5cbd0f Refactor effect callbacks into helper functions 2016-04-24 19:40:27 +02:00
Günther Brammer e22ca51f72 Don't leak references to Strings on script errors (#583) 2016-04-24 19:40:27 +02:00
Günther Brammer 5fbac346d3 Incompatible type warnings work for parameters with type declarations 2016-04-24 19:40:27 +02:00
Günther Brammer 55572720bc Make the C4ScriptHost a ComponentHost again 2016-04-24 19:40:27 +02:00
Günther Brammer fb76308812 Make C4ValueConv::Type a constexpr variable instead of an inline function 2016-04-24 19:40:26 +02:00
Nicolas Hake 19a3d43558 Fix definition of explicitly sized enums 2016-04-24 15:20:28 +02:00
Nicolas Hake baad3aef3c C4ScriptHost: add const proplist accessor
This accessor does not need to be virtual itself, because we don't want
people to override it; it calls the nonconst accessor anyway, which is
virtual.
2016-04-24 14:01:23 +02:00
Nicolas Hake 96223f154c C4ValueMapNames: mark GetItemNr const
It doesn't change anything, so callers don't need a nonconst object.
2016-04-24 14:01:23 +02:00
Nicolas Hake caf44e2473 Remove specious space from Aul operator table 2016-04-24 14:01:23 +02:00
Nicolas Hake 770be2dafe Aul: Allow AB_ERR to carry more detailed error information 2016-04-24 14:01:23 +02:00
Nicolas Hake 367f58b1cc C4AulParseError: Enable creation from host and source pointer
Instead of having a C4AulParseError constructor read the location data
from the parse state, allow explicit construction from a known location.
2016-04-24 14:01:23 +02:00
Nicolas Hake cfdb1142b8 Move C4AulParse declaration into separate header 2016-04-24 14:01:23 +02:00
Sven Eberhardt c0228be4e7 Qt Editor: More editor property types and functionality 2016-04-16 22:05:35 -04:00
Sven Eberhardt 2a2fc68e3f Qt Editor: Add user properties 2016-04-09 14:29:02 -04:00
Nicolas Hake aa06b3b6f6 C4AulParse: Drop unused ATT_STAR
ATT_STAR has been rolled into ATT_OPERATOR and is no longer used
anywhere.
2016-04-07 20:52:31 +02:00
Nicolas Hake f963a398aa Define NORETURN annotation for MSVC 2016-04-07 20:52:28 +02:00
Sven Eberhardt 879d501592 Merge remote-tracking branch 'remotes/origin/qteditor' into qteditor
Conflicts:
	src/editor/C4ConsoleQtPropListViewer.cpp
	src/editor/C4ConsoleQtPropListViewer.h
	src/script/C4ValueArray.cpp
2016-04-04 19:34:02 -04:00
Sven Eberhardt 98c36e5955 Qt Editor: Implement setting of properties 2016-04-03 23:46:58 -04:00
Sven Eberhardt e8f48fd53e Qt Editor: Win32 build fixes 2016-04-03 23:46:20 -04:00
Nicolas Hake 9dddf289db Merge branch 'master' into qteditor 2016-04-03 21:06:32 +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
Nicolas Hake 0537df5f23 C4Object: Move C4Def.h dep out of header
C4Def is only ever used as a pointer inside C4Object.h, so we don't need
to include C4Def.h from it.
2016-04-03 13:24:26 +02:00
Maikel de Vries d6b963d321 remove unused LineMaxDistance property 2016-03-22 22:26:46 +01:00
Günther Brammer b54ddc7663 Merge branch script 2016-03-01 03:04:17 +01:00
David Dormagen 4c6d347c4d C4ValueArraySortStringscomp: silenced string-to-bool-conversion warning
VisualStudio gave a "performance warning" about this implicit cast. I actually don't know why, but this change makes the intention clearer anyway (since we are not returning the string contents but just whether they exist). So it's probably not bad regardless of whether the warning is weird.

http://stackoverflow.com/questions/1847860/why-is-there-a-performance-warning-on-cast-pointer-to-bool
2016-02-27 11:42:37 +01:00
Sven Eberhardt 771a333e21 Qt Editor: Add effects to object list view + fixes
Also remove cache of C4Values and use callbacks on object and effect deletion instead.
2016-02-21 22:23:42 -05:00
Sven Eberhardt 2af22ee824 New editor (Qt-based)
Work in progress. So far only for Windows.
2016-02-15 08:38:06 -05:00
Günther Brammer 0c0c64642a Remove unused #define in C4AulParse 2016-02-12 17:15:46 +01:00
Maikel de Vries 159dbf071f make ContactCalls a property instead of DefCore entry
This allows for useful runtime changes, like disabling contact calls when an animal dies.
2016-02-08 21:25:43 +01:00
Günther Brammer fdbad8fe83 Simplify the test for loop end in parameter parsing
Instead of storing in fDone whether the token is a ')', make that the loop
condition.
2016-02-02 02:57:50 +01:00
Günther Brammer f1b99aa355 Avoid pushing and popping an unused parameter with ... 2016-02-02 02:57:49 +01:00
Günther Brammer 6a6c0d8b0b Optionally warn about too many parameters in -> calls, too
While at it, only consult the right function for direct calls, not any
other function with the same name.
2016-02-02 02:57:49 +01:00
Günther Brammer b2c263bd0e Don't mark the condition of do-while as a jump target without a continue
In contrast to the other loops, where the condition is always jumped to.
2016-02-02 02:57:49 +01:00
Günther Brammer 00f013d59e Optimize accessing the same variable as was just now set 2016-02-02 02:57:49 +01:00
Günther Brammer b7eff7f55f Set jump target flag for bytecode added after MakeSetter removed one
Also avoid removing the original bytecode if it is DUP, LOCALN or GLOBALN.
This way, setting the jump target flag can be avoided in some cases.
2016-02-02 02:57:49 +01:00
Günther Brammer 532b47ed27 Optimize do; while(!...) from two bytecodes to one
This revealed that the code for setting Par.i was wrong before, but didn't
matter because the jump target for all CONDN was set afterwards. But the
jumptarget for COND was set directly, and must be adjusted to account for
the bytecode that gets optimized away.
2016-02-02 02:57:49 +01:00
Günther Brammer 168ac8bb40 Remove pointer to start of variables from function context
It pointed always to Pars + Func->GetParCount(). The only users were
VARN_CONTEXT, which can be replaced with PARN_CONTEXT that way, and
FOREACH_NEXT, where the parser can do the math and simply give a number
relative to the current stack position, like regular variable usages do.
2016-02-02 02:57:48 +01:00
Günther Brammer 45003d55fb Guard against script stack overflow on the first script call, too
This can happen when an engine function is made to call a script function
when the stack is almost exhausted. Since there was nothing catching that
exception, it'd mean a program abort. Move the bulk of the exception
handler to the outer Exec function, and only keep the saving of the exact
code position in the inner one.

While at it, simplify the pushing of the parameters to simply push the
right amount of parameters instead of pushing ten and then popping the
excess. Also move the creation of dummy parameters for DirectExec into
DirectExec().
2016-02-02 02:57:48 +01:00
Günther Brammer 5bb3d7cb77 Use a null C4ScriptHost to parse DirectExec code
This mostly makes Parse_Expression use the case for functions in proplists
instead of the other for local variable lookup.
2016-02-02 02:57:48 +01:00
Günther Brammer ac9106d197 Remove some unused and unsound C4Value operators 2016-02-02 02:57:48 +01:00
Günther Brammer 39d04360c4 Add some const (C4StringTable::FindString) 2016-02-02 02:57:48 +01:00
Günther Brammer 87689d9f49 Move the global proplist from a member of ScriptEngine to an ancestor
While at it, denumerate the global proplist. Not that it contains anything
to denumerate, but someday it might?
2016-02-02 02:57:48 +01: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 9dafc6424b Make the ScriptEngine not a C4AulScript
Every script has its own C4ScriptHost, the ScriptEngine doesn't use
anything from C4AulScript.
2016-02-02 02:57:47 +01:00
Günther Brammer 473415bafa Stop using virtual functions to distinguish profiling all or some functions 2016-02-02 02:57:47 +01:00
Günther Brammer 9742a404ff Move Script Parser warning function to C4ScriptHost 2016-02-02 02:57:47 +01:00
Günther Brammer a6020197d7 Move script string table to C4ScriptHost
The string table in C4AulScriptEngine was never loaded.
2016-02-02 02:57:47 +01:00
Günther Brammer d3890f8c99 Remove empty C4AulScript::Clear()
The virtual call was only made from ~C4AulScript, and the deriving classes
already called their own Clear() from their own destructors.
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 2fe0beebdb Move contents of src/gamescript into other directories
C4Effect will get moved into the ScriptEngine, and just three source files
is a bit too little for one directory.
2016-02-02 02:57:46 +01:00
Günther Brammer 2ebd1a98ad Script: Functions in constant proplists can access their properties 2016-02-02 02:57:46 +01:00
Günther Brammer f757706e68 Make the C4Script tokenizer context-independant 2016-02-02 02:57:46 +01:00
Günther Brammer 9193c8938b Retire the split between Parse_Expression and Parse_Expression2
In earlier C4Script versions, there were multiple variants of expressions,
all followed by the same operator options, but nowadays everything is more
uniform.
2016-02-02 02:57:46 +01:00
Günther Brammer 79043c8424 Reset the size of a C4Set in Clear()
This bug manifested itself in mysteriously growing PropLists with nil keys.

Some usages of Clear were simply to clean the newly-allocated table, and
need to continue to do so.
2016-01-25 00:54:58 +01:00
Günther Brammer 88185a60f9 Script: Sort the result of GetProperties lexically
Also, deal with non-string values in the C4ValueArray properly.
2016-01-25 00:00:59 +01:00
Günther Brammer 5708ba2e72 Remove superfluous wrapper function C4AulStartTrace 2016-01-25 00:00:58 +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 5be63d1e96 Use macros to reduce duplication in script engine definitions
While at it, make AddFunc take a C4PropList* instead of a C4AulScript*.
2016-01-25 00:00:58 +01:00
Günther Brammer 5287121d86 Use void instead of C4Void for engine functions that always return nil
This allows the removal of quite a few return C4Void();.

Also stop pretending that Nillable<void> is the same class as Nillable<T>.
Its only function was as an implementation detail for C4Void, which doesn't
need any implementation details anymore.
2016-01-25 00:00:58 +01:00
Günther Brammer f78d7712a5 Replace C4AulDefFuncHelper with template functions
This avoids duplication of code in C4AulObjectFunc and C4AulEngineFunc
at the cost of boilerplate code working around the lack of partial
function template spezializations.

Instead of ThisImpl and ExecImpl, we could have multiple C4AulEngineFunc
spezializations deriving from a common template, but that would require
even longer and duplicated boilerplate.
2016-01-25 00:00:58 +01:00
Günther Brammer 22113fd6fc Convert C4AulDefFunc* templates to variadic templates 2016-01-25 00:00:58 +01:00
Günther Brammer 0a8960f969 Reimplement C4AulParSet constructor as a variadic template
This allows the constructor to accept all types there is a C4Value
constructor for.
2016-01-25 00:00:57 +01:00
Günther Brammer 6b514893f9 Replace C4ValueConv::ToC4V with C4Value constructors
Also don't rely on int32_t != long and drop now unnecessary MSVC workaround.
2016-01-25 00:00:57 +01:00
Günther Brammer b08f51372a Add more overloads of the C4Value constructor
This allows one to use the C4Value constructor instead of
C4ValueConv. To avoid unintended implicit conversions like
const char * to bool, add a private template constructor that
catches everything not in the list of intended constructors.
2016-01-25 00:00:57 +01:00
Günther Brammer 05359179e7 Initialize C4AulParSet from C4Value[] with a function, not constructor
This avoids confusion with a variadic template constructor that could take
the same arguments.
2016-01-24 12:27:23 +01:00
Günther Brammer 234101ddbc Remove C4Script.h from C4Aul.h 2016-01-24 12:27:23 +01:00
Günther Brammer c3c402061b Move struct C4ScriptConstDef to C4AulDefFunc.h 2016-01-24 12:27:23 +01:00
Günther Brammer 20c22582ec Move DirectExec from C4AulScript to C4AulExec
In the long term, there is no reason DirectExec should be concerned with
C4AulScript/C4ScriptHost. In the meantime, the lookup code from Fneval can
be moved into the function.

This allows eval in scenario script to access scenario script locals, but
that seems harmless.
2016-01-24 12:27:23 +01:00
Günther Brammer 7cc1334963 Move C4ValueToMatrix helper functions to the file using them most 2016-01-24 12:27:23 +01:00
Günther Brammer 4f620c1537 Parse array expression with fewer lines of code
Instead of tracking the status with a variable, simply test the loop-end
condition directly, and reduce code duplication between empty and non-empty
array contents.
2016-01-24 12:27:23 +01:00
Günther Brammer b7bd48a73f Unify the various Parse_-Functions to consume the last token they match 2016-01-24 12:27:23 +01:00
Günther Brammer 6a5b571fe3 Drop warning about trailing comma at the end of a parameter list
A trailing comma does not change the behaviour of a function call, so it is
totally harmless.
2016-01-24 12:27:23 +01:00
Günther Brammer 4c01592196 Move C4AulScriptFunc into its own source file 2016-01-24 12:27:23 +01:00
Günther Brammer 514c2b8f34 Combine C4String, C4AulFunc, C4ValueArray reference counting 2016-01-24 12:27:23 +01:00
Günther Brammer ca9d95b25f Replace various C4AulFunc::Exec with C4PropList::Call
In C4Control.cpp, this improves correctness by selecting the right global
function instead of a random function.
2016-01-24 12:27:23 +01:00
Günther Brammer 93bf8f4779 Script: Allow "new Foo {}" in constant expressions 2016-01-24 12:27:23 +01:00
Günther Brammer f6c2906660 Script: Constant proplist expressions can contain function definitions
Most of the changes are for exception safety. The parser references the
function stored in Fn when the function body contains a syntax error, so
the function has to stay around. In order to avoid memory leaks, store the
function and its containing proplist in their destinations before they get
fully parsed.

This doesn't allow functions directly in static constants or arrays.
Future work: Putting the owning proplist in the scope chain.
2016-01-24 12:27:23 +01:00
Günther Brammer 507b63a55a Functions store their containing proplist instead of the C4AulScript
The C4AulScript containing the source of the function was already mostly
used to get the relevant proplist or available from context. This will
allow more than one proplist plus the global one per scripthost to contain
functions.
2016-01-24 12:27:23 +01:00
Günther Brammer 4d1f5d95c2 Script: Prevent usage of deleted objects via this()
Apparently, this wasn't done already because of compatibility concerns. The
beginning of a release cycle is the perfect moment to finally complete the
prevention of using deleted objects from script.
2016-01-24 12:25:15 +01:00
Günther Brammer 7c022085ee Improve script bytecode dump formatting slightly 2016-01-24 02:09:15 +01:00
Günther Brammer e790d2c327 Remove duplicated stubs for the scriptengine from mape 2016-01-24 02:09:14 +01:00
Günther Brammer 5a570b96f1 Remove now unnecessary stubs from C4ScriptStandaloneStubs 2016-01-24 02:09:14 +01:00
Günther Brammer 6b6dd96719 Move GameScript.GRBroadCast to Game.GRBroadCast
This avoids a dependency on ::Objects from C4ScriptHost.
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
Günther Brammer 9833c1ef2d Remove never used NeedDefinitionContext
Every function that accepts a definition also accepts an object instead, so
NeedNonGlobalContext is the exception to use.
2016-01-24 02:09:13 +01:00
Günther Brammer b7ecc49a02 Remove a bit of dead code from C4Value 2016-01-24 02:09:13 +01:00
Nicolas Hake 4fddda20f9 C4Script: Accept array parameter for Min, Max
Min/Max with array parameter will return the smallest/largest value of
all elements of the array. If any array element is not an integer, nor
convertible to integer, the function will fail.
2016-01-23 13:49:10 +01:00
Nicolas Hake 9a9bcd0568 C4AulError: derive from std::exception 2016-01-23 13:49:08 +01:00
Günther Brammer a5af9089a8 Script: Check parameter types of engine callbacks, too
This prevents a crash when an incompatible engine function is used as an
engine callback function.

Unfortunately, this breaks any scripts that have wrong type information in
engine callbacks and only worked because those were ignored.
2016-01-16 18:26:18 +01:00
Günther Brammer 21d8a2a64a Use 32 bit math for +1, ++, -1, etc. in script (#1389)
The engine has a few more usages of the operators, but they don't look
prone to overflowing. The other operators in Script already used SetInt,
which always truncates to 32 bit.
2016-01-15 20:19:21 +01:00
Günther Brammer 00a4c6c428 Replace BorderBound DefCore value with BorderBound object property 2016-01-01 22:18:41 +01:00
Günther Brammer 16ef28e05f Drop unused C4VERSIONBUILDNAME and C4ENGINEINFO
This was used to name snapshot releases of the Network2 branch, and has
seen almost no use since.

C4ENGINEINFO(LONG) was a duplicate of C4ENGINENAME and C4ENGINECAPTION.
2015-12-29 15:47:55 +01:00
Günther Brammer 8e889479cc Script: Find_Property can also search for engine-defined properties
Previously it used a C4PropList API that only checked the properties
set by script.
2015-12-22 18:07:38 +01:00
Nicolas Hake 1f020542d2 Implement Translate() falling back on missing translations (#1502)
Translate() used to select the script which it checked for translations
before actually looking up the string key. Change it so if the object
the context of which it was called in doesn't have a matching
translation, the string table of the script containing the call is used
instead.
2015-12-17 18:56:05 +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
Sven Eberhardt 310daf8b3f Fix static const arrays (#906) 2015-12-07 23:38:40 -05:00
Sven Eberhardt d758c85028 Add max memory time to music resume feature (#1461) 2015-12-03 19:17:41 -05:00
Nicolas Hake 24b54211c5 Drop Min, Max, Swap for std::min, std::max, std::swap
The C++ standard library comes with perfectly fine implementations of
these functions, so there's no point in reimplementing them just for the
hell of it.
2015-11-15 13:53:01 +01:00
Sven Eberhardt d136dc22c0 Implement landscape inflammation.
It used to create the non-existent FLAM objects from the engine. Use a script callback to a global function that creates Flame objects instead.
2015-10-09 16:24:16 -04:00
Peter Wortmann f0030e33e0 Warning fixes
Actually pretty sure a few of them were bugs. Hopefully no new
ones were introduced here.
2015-10-03 15:32:39 +01:00
Sven Eberhardt 17e0e2f423 Add breaks between music. 2015-09-30 22:50:18 -04:00
Sven Eberhardt d3ee2fac57 Fix sorting of script and engine functions in dropdown menu in editor. 2015-09-26 20:10:55 -04:00
Nicolas Hake 6a11e3e811 Stop checking for rvalue ref support
We already require support for std::unique_ptr, which itself requires
support for rvalue references. As such, we know we can use rvalue
references, and thus don't have to keep carrying dead code around.
2015-09-20 13:27:14 +02:00
Sven Eberhardt b683e47499 Add LightOffset property to allow light sources to origin from locations other than the object center. 2015-09-16 21:14:08 -04:00
David Dormagen cd82b41c06 particles: added CollisionDensity to specify with which kind of material a particle will collide 2015-09-12 10:53:23 +02:00
Maikel de Vries a7480ba0ef fix crash for Translate on strings without translation
Thanks to Isilkor
2015-09-12 00:11:24 +02:00
Nicolas Hake 4ae2d9f70b C4Script: Allow executing strings from cmdline instead of only files 2015-09-04 13:40:27 +02:00
Nicolas Hake 2b876a6cb6 C4Script: Split stubs from script runner 2015-09-04 13:21:06 +02:00
Nicolas Hake 082b3e7360 C4AulParse: Properly escape strings when dumping bytecode
Instead of just writing the raw string to stderr, escape them first so
newlines and other control characters don't result in strangely
formatted output.
2015-09-04 12:57:30 +02:00
Sven Eberhardt 20d3de46cd Fix some unused variables. 2015-09-03 21:26:49 -04:00
Sven Eberhardt 84fbff95a8 Add Find_Property. 2015-09-02 23:55:45 -04:00
David Dormagen ac738735b2 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/Vehicles.ocd/Airplane.ocd/Script.c
	src/game/C4Game.cpp
	src/game/C4GraphicsSystem.cpp
	src/gamescript/C4GameScript.cpp
2015-09-02 08:19:34 +02:00
Sven Eberhardt 3886f76bf3 Do not hang when a C4Value with prop list pointer is not cleared at game end.
Just cause an assertion in debug mode instead.
2015-08-29 13:22:55 -04:00
Sven Eberhardt 6ab6a1ac3c Add script interface for some EFX sound modifiers. 2015-08-27 21:44:23 -04:00
Sven Eberhardt d7a0d291e2 Fix 64 bit build. 2015-08-21 15:03:13 -04:00
Sven Eberhardt cf940d639b Fix memory leak caused by circular prop list chains.
The shapes library has such pointer chains. The leaks were getting pretty heavy because they included pointers to C4AulFuncs, which kept a lot of parts of the script engine and string tables in memory.
2015-08-20 20:19:38 -04:00
Sven Eberhardt 5ec9999d4c Fix crash on global or scenario script reload.
The string table of System.ocg scripts (except the global System.ocg) pointed to nowhere after the initial load phase, but is still required for reload. Added a ref counting option to keep these string tables alive.
2015-08-20 13:15:11 -04:00
David Dormagen 36544bd56c Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/Libraries.ocd/Producer.ocd/Script.c
	planet/Objects.ocd/Structures.ocd/Foundry.ocd/Script.c
	planet/Objects.ocd/Vegetation.ocd/Branch.ocd/Script.c
	planet/Objects.ocd/Vegetation.ocd/Trunk.ocd/Script.c
	planet/System.ocg/FindLocation.c
2015-08-02 19:24:04 +02:00
David Dormagen d5f4805f18 fixed desync
The desync was caused by PropList->GetProperties returning the properties in an arbitrary order. They are now sorted first.
The debug logs are left in place, because I assume that I will need them again and they prove to be helpful.
2015-08-02 19:12:09 +02:00
Sven Eberhardt 0d48105b46 Added shape library.
Also fixed some coconut tree reproduction issues.
2015-07-31 00:42:01 -04:00
David Dormagen 196f528201 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/HUD.ocd/FancyGridMenu.ocd/DefCore.txt
	planet/Objects.ocd/HUD.ocd/GridMenu.ocd/DefCore.txt
	planet/Objects.ocd/Helpers.ocd/Dummy.ocd/Graphics.png
	planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c
	planet/Objects.ocd/Items.ocd/Weapons.ocd/Javelin.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionMenu.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Flag.ocd/Marker.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Producer.ocd/Script.c
	planet/Objects.ocd/Structures.ocd/Flagpole.ocd/Script.c
	planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c
	src/game/C4Game.cpp
	src/gamescript/C4GameScript.cpp
	src/gui/C4GameMessage.cpp
	src/landscape/C4Landscape.cpp
2015-06-03 22:32:36 +02:00
Sven Eberhardt 116a5b4ae6 Add Find_InArray (#1073). 2015-04-28 18:59:50 +02:00
Nicolas Hake be1a148915 Aul: Remove C4AulAccess enum
We're not doing access controls anyway, so tracking information about it
isn't useful.
2015-03-25 22:32:19 +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
David Dormagen dae7f11a70 custom GUIs: added property GraphicsName to specify graphics of Symbol (if Symbol is a definition)
f.e. {Symbol = Icon_Number, GraphicsName = "Inf"}
2015-03-23 15:34:09 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Nicolas Hake e2a8f6d303 Reorder some declarations and initializations to avoid order mismatch
While none of the mismatches were having a side-effect, this silences a
number of -Wreorder warnings which were drowning out potentially
important diagnostics.
2015-02-04 22:12:42 +01:00
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01:00
Günther Brammer a92c22a7b3 Merge various build system fixes and cleanups 2015-01-25 18:50:29 +01:00
David Dormagen bd04722553 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/HUD.ocd/Controller.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionMenu.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/Script.c
	src/game/C4GraphicsSystem.cpp
	src/game/C4GraphicsSystem.h
	src/game/C4Viewport.cpp
	src/gui/C4GameMessage.cpp
2015-01-15 19:57:01 +01:00
Maikel de Vries 4ea0cb0ca6 make ContainBlast a property instead of DefCore entry 2015-01-15 17:46:53 +01:00
Julius Michaelis 8e7001ba0f Fix self-overwrite in C4ValueArray::SetSlice (#1212: Array manipulation goes wrong ) 2015-01-09 15:09:36 +09:00
Sven Eberhardt 42b9ca4577 Add custom EditCursorCommands available in editor context menu.
Example: this.EditCursorCommands = ["Explode(20)"] on an item will offer a menu entry to explode the object. Commands may be either strings or function pointers, but function pointers will always be called by name.
2015-01-03 23:21:36 +01:00
Günther Brammer a0bddb92a3 Use size_t for a loop variable that is compared with a sizeof() result
src/script/C4Script.cpp:159:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (long i = 0; i < sizeof(values) / sizeof(*values); ++i) \
                     ^
2015-01-03 20:58:07 +01:00
David Dormagen f89b8c8319 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/Environment.ocd/Cloud.ocd/DefCore.txt
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionMenu.ocd/DefCore.txt
	planet/Objects.ocd/Libraries.ocd/PowerConsumer.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/PowerProducer.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Producer.ocd/Script.c
	planet/System.ocg/ClonkControl.c
	src/gui/C4MouseControl.cpp
	src/landscape/C4PXS.cpp
2014-12-25 15:24:19 +01:00
Tobias Zwick d59b1e5e5b reduce version numbering from x.y.z (x does never changes) to y.z 2014-12-12 21:57:52 +01:00
David Dormagen 952f06b173 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
2014-09-29 11:47:09 +02:00
Sven Eberhardt 131cc016cb Fix C4PropList::RemoveCyclicPrototypes() declaration 2014-09-26 22:11:10 +02:00
Sven Eberhardt 44e5c2542f Fix crash when loading proplists with non-static prototypes from saved games.
The code accessed a non-denumerated pointer.
2014-09-26 19:31:26 +02:00
David Dormagen 5722339e83 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/HUD.ocd/Controller.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Structure.ocd/Script.c
	src/gamescript/C4GameScript.cpp
	src/gui/C4GameMessage.cpp
	src/gui/C4Gui.h
	src/gui/C4GuiDialogs.cpp
	src/gui/C4GuiWindow.cpp
2014-08-13 11:52:41 +02:00
Armin Burgmeier 92720cf490 Allow C4ScriptHost to load a script from memory
This will allow mape to feed the Map.c that is being edited directly to
the map generator.
2014-08-04 13:04:34 -04:00
Sven Eberhardt 5cd9b915b0 Added some dialogue functions and speaker portraits. UpdatedAddMenuItem and CustomMessage to allow more customization for picture graphics.
I would prefer to render the models for speaker portraits directly. However, it seems like it's not currently possible to clip or render models to offscreen surfaces.
2014-07-05 15:25:30 +02:00
David Dormagen fb1ee2f88f the Trans_* mesh-transformation-functions are now implemented in the Engine instead of System.ocg 2014-06-27 20:36:47 +02:00
Günther Brammer 130a275dea Correct a comment about GetDataString safety 2014-05-25 22:47:56 +02: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
Nicolas Hake 0f48e0c4b9 Aul: ExtraWarn when turning a fn varargs in body
Par() calls and '...' in function calls make functions take varargs
without this being obvious from the header. ExtraWarn about this so people
who care about it can add an ellipsis to the parameter list.
2014-05-04 17:15:43 +02:00
Nicolas Hake 8ab7a83e3b Aul: Allow '...' as final parameter in func decls
Accepting an ellipsis as the final parameter in a function declaration
makes it immediately obvious that the function can take a variable number
of parameters
2014-05-04 17:15:42 +02:00
Sven Eberhardt 91db5d33c2 Added SolidMaskPlane property.
If an object moves and other objects are attached to its SolidMask, only objects in front of this plane are moved along with it. Defaults to Plane if zero.
2014-05-04 14:16:46 +02:00
Nicolas Hake 48c1f387f0 Require semicolon after 'do' loop
This makes C4Script consistent with C-based languages, and current usage
on master shows that in the majority of cases, the author expected to have
to place a semicolon after the loop anyway.
2014-05-03 10:07:41 +02:00
Sven Eberhardt b8cd437fc9 Fix C4ID parameters to engine functions. 2014-04-20 18:43:29 +02:00
Sven Eberhardt 445d759a72 Change == and != to do pointer comparison on arrays and proplists (formerly === and !==). Remove === and !=== and introduce function DeepEqual for contents comparison.
There have been some bugs and crashes related to unwanted deep comparison (e.g. in the maze scenario). Scripters very rarely need deep comparison, so it should not be the default for the most commonly used operator.

This also changes behaviour of GetIndexOf to do pointer comparison.

This change has Guenther's seal of approval.
2014-04-19 22:33:31 +02:00
Günther Brammer 04e1c74c05 Merge Call fix commit 2014-04-19 19:02:27 +02:00
Günther Brammer 69f64ea341 Store Prototype directly in PropLists, not as a normal property
This is mostly to prevent crashes when prototypes are deleted.

Also change proplist savegame format to not include the constant flag - all
constant proplists are not stored in savegames anymore, but recreated from
the game data. Store the prototype at that position instead.
2014-04-19 19:02:22 +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
Günther Brammer 64e258f814 Use the bytecode parameter for operators as result modifier flag
Previously, the parameter stored the operator number, but that was
only used for the purpose of optimizing unnecessary inc/dec away.
2014-04-19 19:02:22 +02:00
Günther Brammer 082a85228c Script: Constant expressions can access properties of constant proplists 2014-04-19 19:02:22 +02:00
Günther Brammer 4c9f3777c5 Make the script parser a bit more concise
Factor the common if (TokenType != t) UnexpectedToken() into a function.
Write the end-of-list-or-comma as one if and one Match instead of a long
switch-case-statement.
2014-04-19 19:02:22 +02:00
Günther Brammer 3c5152d3ba Allow Call to call 10-parameter-functions like GameCall again
CheckParTypes now requires that the parameter array passed in is long
enough, just like Exec does. Luckily, FnCall has a ParSet, which is always
long enough.
2014-04-19 19:01:57 +02:00
Julius Michaelis f4e93d13bf Add parameter type check for FnCall 2014-04-17 19:24:36 +02:00
Nicolas Hake 8254621b95 c4script-cli: Initialize PRNG 2014-04-16 13:30:41 +02:00
David Dormagen 5c17b48bc2 Merge branch 'master' into Controls 2014-03-26 23:58:24 +01:00
David Dormagen 75e776cb04 custom GUIs: added "Margin" property
The property can be used to give GUI windows a margin. Either the same margin in all directions (Margin = "1em") or different margins (Margin = ["1em", "2em", "10$", "0.5em"] - [left, top, right, bottom]).
2014-02-26 22:37:12 +01:00
Nicolas Hake 7b495cdef4 C4Script: Allow more format flags
In addition to field width and precision, also accept sign flags (+, -,
<space>) and the "alternate output" flag (#).
2014-02-17 23:10:50 +01:00
David Dormagen 350513defa custom Gui: added "Player" property, for standard visibility
This was solved via Target+Visibility before, but is such a main feature (more guis will be for a specific player than for everyone) that it legitimates an own property
2014-02-15 18:48:39 +01:00
David Dormagen 06ac00ace8 Merge branch 'master' into Controls
Conflicts:
	CMakeLists.txt
	Makefile.am
	planet/Objects.ocd/HUD.ocd/Controller.ocd/Script.c
	planet/Objects.ocd/Items.ocd/Weapons.ocd/Club.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	src/control/C4Control.cpp
	src/control/C4Control.h
	src/gamescript/C4GameScript.cpp
2014-02-15 14:44:57 +01:00
Sven Eberhardt dd0438b55d Added helper function LogCallStack.
Useful when you need a stack trace but don't want to break execution flow.
2014-01-04 14:22:41 +01:00
Sven Eberhardt ca941b8e1e Fix "ParentKeyName" assertion when a script error occurs during scenario object initialization. 2014-01-03 18:59:31 +01:00
Sven Eberhardt 5094cc5c1b Reworked "Save as scenario" option in editor to write a script file instead of Game.txt. 2013-12-27 17:10:09 +01: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
Tobias Zwick 325053410f rename script callback UpdateTransferZone to OnSynchronized (#220) 2013-12-17 23:16:11 +07:00
David Dormagen e42450ef5b different optimizations to particle creation
This patch might speed up particle creation by around 25%. See crucible review https://crucible.openclonk.org/cru/ENGINE-15
2013-12-16 17:34:15 +01:00
Sven Eberhardt 25ddb14dca Rework prop list renumbering on section load (again).
Turns out changing prop list numbers while they are still indexed by number in the hash map was a bad idea. Existing prop lists are now de-numbered, pushed to an external shelve and re-numbered when added after section load.
2013-12-15 15:46:18 +01:00
Sven Eberhardt 1cca6fd1ad Rework section load again.
Now clears numbers of all existing proplists and renumbers them after loading. Fixes some assertions and duplicate numbers during loading.
2013-12-15 14:06:21 +01:00
Sven Eberhardt 8d1fbd1401 Fix engine internal smoke.
Smoke() used to create a Smoke particle directly, but the particle definitions changed. Now it just calls the global script function to create smoke.
2013-12-14 12:09:31 +01:00
Tobias Zwick fe2a400c02 replace global function GetTime() with class function C4TimeMilliseconds::Now() 2013-12-07 21:27:01 +07:00
Tobias Zwick 94c618d153 add new type C4TimeMilliseconds for time measurements to solve problems when GetTime() overflows (#251)
The new type C4TimeMilliseconds behaves for the most part like a uint32_t but is overflow-proof in comparisons.
In some places, a 0-value (or uint_max) of the variable storing the time had the special meaning "not set yet". This has been resolved by having it as a pointer to C4TimeMilliseconds with NULL meaning that it has not been set yet.
2013-12-04 19:35:07 +07:00
Tobias Zwick 5bee448745 update documentation around ActMap (2) 2013-11-30 13:11:36 +07:00
Tobias Zwick 932853d1d8 update documentation around ActMap 2013-11-30 11:45:31 +07:00
Tobias Zwick b4732f50c3 document properties of definitions, mark the ones missing yet in the source file 2013-11-30 00:39:29 +07:00
Nicolas Hake 1204d7d2d9 C4Aul: Fix broken reload from incorrect par count
When reloading a function, C4AulParse didn't reset the parameter count.
This resulted in the function's ParCount to eventually increase above
C4AUL_MAX_Par, at which point parameter type checking would access
invalid memory.
2013-11-02 13:40:33 +01:00
Nicolas Hake 003f897cbe C4AulFunc: Improve const correctness 2013-11-02 13:40:33 +01:00
Martin Plicht 608f23ece6 debugger: C4AulDebug: Do not call Execute on each DebugStep call 2013-10-16 13:43:02 +02:00
Martin Plicht 788ffdd93c C4ScriptStandalone: Fix compilation (C4AulDebug changes) 2013-10-14 07:21:34 +02:00
Martin Plicht 0fd9ebc2ed debugger: Ignore active breakpoints when no peer connected 2013-10-14 07:12:44 +02:00
Martin Plicht 91f8d32d69 debugger: Make it work again (some issues remaining, setting breakpoints on included scripts is questionable and listener socket setup sometimes hangs..) 2013-10-13 23:03:25 +02:00
Martin Plicht d164a2d50a C4Value: Implement some crude infinite recursion guard which happens solely inside C4Value::operator== 2013-10-13 11:55:01 +02:00
Sven Eberhardt 8cf8ad00e5 Added MAPALGO_Lines.
This might make life easier for people who transition from Landscape.txt.

For new maps, lines should probably better be drawn using MAPALGO_Poly in a loop. This gives you more control over individual line widths, angles, etc.
2013-10-12 19:28:22 +02:00
David Dormagen 1cb2296a37 dynamic particles: added on collision functions PC_Die and PC_Bounce 2013-10-07 20:56:53 +02:00
David Dormagen 85e0d9788a dynamic particles: added property CollisionVertex 2013-10-07 20:56:52 +02:00
David Dormagen 9753b48f7e dynamic particles: now respect particles' aspect ratio; added PV_Speed, added property Stretch 2013-10-07 20:56:51 +02:00
David Dormagen 2e2c40db07 dynamic particles: added phase property; added parameters to PV_Step; objects now draw their particles correctly; fixed PV_Random 2013-10-07 20:56:51 +02:00
David Dormagen ba41d77e0b dynamic particles: added BlitMode property (supports additive and 0) 2013-10-07 20:56:50 +02:00
David Dormagen e43b9d4fee dynamic particles: added rotation property
added PV_Step and PV_Direction
2013-10-07 20:56:50 +02:00
David Dormagen 40b66d1c76 added (early demo of) new particle system which should both be faster and more flexible than the old one 2013-10-07 20:56:49 +02:00
Nicolas Hake 7e260aa9de Remove C4ControlScript::fInternal
fInternal basically acted as a reverse "evil bit" as in RFC 3514: when
set, the engine would not do any checks on the script contained in the
control packet, nor log the script (visibly in game; the packet log
would of course contain the packet). A malicious game client thus would
be able to inject arbitrary script without people (immediately) noticing
anything was amiss.

As of this patch, only the host is able to execute arbitrary scripts,
and those will be shown in the message board for all players to see.
This privilege can be irrevocably disabled in network games by any
client by using the "/nodebug" message board command.

Closes #936.
2013-09-04 20:18:06 +02:00
Nicolas Hake 5b25b75370 Script executed on behalf of a script debugger is not engine-internal
While fInternal-flagged script controls may be useful for debuggers to
evaluate watch expressions because they don't get shown ingame, they
also bypass all checks the engine does and as such are a nightmare in
network play.

Part of #936.
2013-09-04 14:55:54 +02:00
Nicolas Hake 58a39e972f Improve C4Object const correctness 2013-08-31 23:23:35 +02:00
Tobias Zwick 9027544c37 Merge branch 'master' into Controls 2013-06-04 20:13:35 +02:00
Martin Plicht eaf93d6a0e Also check for DebugRec flag in #ifdef DEBUGREC_* blocks 2013-05-25 23:01:41 +02:00
Martin Plicht 524fe879aa Make DEBUGREC define a commandline option 2013-05-25 22:51:32 +02:00
David Dormagen d18d8c65c9 Merge branch 'Menus' into Controls 2013-05-24 01:24:57 +02:00
Sven Eberhardt 4557d1638e Added property LineMaxDistance to let a line break when connected objects are too far apart. 2013-05-09 12:02:44 +02:00
David Dormagen 9ad9a67939 Merge branch 'master' into Menus
Conflicts:
	src/script/C4StringTable.cpp
	src/script/C4StringTable.h
2013-04-07 23:02:36 +02:00
David Dormagen 1c05f22d41 added OnClose callback
more tests
minor fixes
2013-04-07 22:52:45 +02:00
David Dormagen c2ba7e65d7 improved menu functionality; added test scenario and helper objects 2013-04-04 18:36:27 +02:00
Günther Brammer a0f328468e Don't change Scenario.Prototype on Game.txt load
C4Value used itself as temporary storage, so when loading Scenario.Prototype
into Scenario.Prototype, bad things happened.
2013-04-01 23:56:22 +02:00
Sven Eberhardt 6250ff1766 Silence a few MSVC warnings 2013-04-01 12:48:02 +02:00
Sven Eberhardt 1e1d4eb78a Fix potential double-free of static Map and MapLayer prop lists (#935) 2013-03-27 21:48:18 +01:00
Nicolas Hake 459fce0758 Replace std::auto_ptr with std::unique_ptr
std::auto_ptr has awkward copy semantics and is deprecated in C++11.
2013-03-26 15:43:01 +01:00
Sven Eberhardt 671a815223 Fix MapLayer functions on derived prop lists (#935) 2013-03-24 13:29:04 +01:00
Günther Brammer 03a045810e Script: Ignore attempts to set Scenario.Prototype
This is mostly for the benefit of savegames, which rely on being able to
save scenario functions as Scenario.Prototype.*, but also removes an
opportunity to break things.
2013-03-22 23:00:12 +01:00
Sven Eberhardt ec38b4d9e4 Fix some C4MapScript dependencies 2013-03-22 22:24:20 +01:00
Sven Eberhardt 57e63a5275 Added support for scripted maps (Map.c) and documentation. 2013-03-19 00:36:06 +01:00
Sven Eberhardt b0a0d2a83c Rework logging of unfreed C4Strings a bit 2013-03-19 00:36:05 +01:00
Günther Brammer 2d86e47c04 Fix use-after-free in C4Value::CompileFunc
C4StringTable::RegString modifies the provided StdStrBuf. Use FindString
instead, since GetPropertyByS reliably returns failure for a
freshly-registered string anyway.
2013-03-10 22:47:17 +01:00
Günther Brammer 16f3fe34e1 Use correct exception when unable to compile a static proplist
excNotFound is used to signal that the end of a list is reached. But these
error conditions in C4Value::CompileFunc signal some logic error, not
finding an end-of-list marker instead of a C4Value.
2013-03-10 22:46:32 +01:00
Günther Brammer dfc4b9e077 Increase exception-safety of C4PropListNumbered::CompileFunc 2013-03-10 21:40:22 +01:00
Günther Brammer deeb6eeba5 Clean up a forgotten C4DirectExecScript
Found by ker.
2013-03-10 17:37:30 +01:00
Günther Brammer 6b097a49c5 Some slight parser cleanups 2013-03-10 17:37:30 +01:00
Günther Brammer a384e1bdbd Make most of C4AulParse private
This finishes the transformation from a struct to share some variables
when the parser was first split into multiple functions to a C++ class.
2013-03-10 17:37:30 +01:00
Günther Brammer 7be81f78e8 C4GameObjects::ObjectPointer does not need to be virtual 2013-03-10 17:37:30 +01:00
Sven Eberhardt cc44b71756 Fix SIGFPE exception on INT_MIN/-1 and INT_MIN%-1 in C4Script 2013-02-26 21:41:27 +01:00
David Dormagen d3dba14323 added support for custom menus and dialogs 2013-02-12 20:39:20 +01:00
Günther Brammer 1cf1be1c6d Hold a reference to the temporary proplist used in case of script errors
The parser does not know whether the constant proplist it is about to fill
is missing because it was overwritten by a later local/constant, or because
the preparser was interrupted by a script error and didn't store its
proplist. Thus, the parser cannot simply give up at that point, and in
order to keep things simple it creates a throwaway proplist. This proplist
was thrown away too soon, though.

Thanks to Zapper for the testcase.
2013-02-12 01:11:31 +01:00
Günther Brammer df3fcd2b2b Document C4PropList internals a bit 2013-02-11 22:23:05 +01:00
Sven Eberhardt bf8655ab1d Fix Call() in global context (required for ScheduleCall) 2013-01-31 22:38:16 +01:00
Günther Brammer a62e556b63 Script: Reimplement GameCall in C4Script 2013-01-23 21:36:21 +01:00
Günther Brammer f38670abc3 Script: Functions can shadow global variables
Previously, declaring a global variable could break another script that had
a function with the same name.
2013-01-23 21:36:21 +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 57c01ac537 Rename C4AulParse::a to C4AulParse::Host and add C4AulParse::Engine
C4AulParse::Host is now only used for local variables and named functions.

Global directexec functions have neither, so they won't need a scripthost
at all anymore.
2013-01-23 21:36:21 +01:00
Günther Brammer ce87faaf9e Fix #including a definition that has local variables with proplists
The missing break meant that the freshly created copy of the proplist would
get overwritten by the original, which was thankfully caught and announced
with "internal error: constant proplist has the wrong parent".

Thanks to Zapper for the testcase.
2013-01-18 01:45:06 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00