Nicolas Hake
43c6f946dd
Aul: Split assignment op from standard BinOp
...
Assignment was special-cased everywhere, so it can just as well get a
separate AST node.
2016-05-13 13:50:29 +02:00
Nicolas Hake
daf3424e63
Delete some commented-out legacy function parameters
2016-05-13 13:14:23 +02:00
Nicolas Hake
092a23c2f7
Aul: Parse scripts into an AST, then generate bytecode from that
...
This commit contains a fairly substantial rewrite of the C4Script code
generator. Instead of generating bytecode while parsing the script,
we're now parsing the script into a syntax tree, and have any further
processing happen on that instead of the raw source.
At this time, the code generator emits the same bytecode as the old
parser; there are several optimization opportunities that arise from the
new possibility to emit code out of order from its specification by the
author.
Compared to the old compiler, this one is still rather deficient when
dealing with incorrect code; it's also not emitting several warnings
that used to be diagnosed.
2016-05-12 19:43:48 +02:00
Nicolas Hake
78e5f8528d
C4PropList::GetParent: make const
2016-05-12 18:47:53 +02:00
Nicolas Hake
5872b5e8ae
C4AulFunc::GetFullName: make const
2016-05-11 17:15:47 +02:00
Nicolas Hake
10abb1bbdb
Remove unused C4AUL_CodeBufSize
2016-05-11 17:15:47 +02:00
Nicolas Hake
a100b93e7f
DEBUG_BYTECODE_DUMP: Allow setting from build system
2016-05-11 17:15:47 +02:00
Nicolas Hake
16641d3841
C4AulScriptFunc::DumpByteCode: properly align BCC names
...
The old code just appended eight spaces when the type of the BCC was
shorter than eight chars.
2016-05-11 17:15:47 +02:00
Nicolas Hake
26334cb4d7
Aul: Join AB_INT + AB_Neg
2016-05-09 12:33:59 +02:00
Nicolas Hake
34556e3e81
Aul: Join AB_STRING+AB_ARRAYA to AB_PROP
2016-05-09 12:33:58 +02:00
Nicolas Hake
33f7fb935f
C4AulCompiler: Rename iStack to stack_height
2016-05-09 12:33:51 +02:00
Nicolas Hake
41000a8f9a
C4AulCompiler: Rename pLoopStack to active_loops
2016-05-09 12:21:33 +02:00
Nicolas Hake
d0dbe05876
C4AulCompiler: Rename fJump to at_jump_target
...
You have no idea how much I hate systems hungarian.
2016-05-09 12:21:33 +02:00
Nicolas Hake
f0b4ef46a5
GetStackValue: Remove "default: /* unreachable */"
...
Without an explicit default case, the compiler can warn about unhandled
enum values inside the switch.
2016-05-09 12:21:33 +02:00
Nicolas Hake
7a135a060f
C4AulParse: Take GetTokenName out of public interface
2016-05-09 12:21:33 +02:00
Nicolas Hake
0a3b31e735
C4AulParse::AddVarAccess: Move to C4AulCompiler
2016-05-09 12:21:33 +02:00
Nicolas Hake
0342711cd4
C4AulCompiler: Take GetStackValue out of public interface
2016-05-09 12:21:33 +02:00
Nicolas Hake
792e12adad
C4AulCompiler: Split into separate file
2016-05-09 12:21:33 +02:00
Nicolas Hake
c8d71d47c0
C4CodeGen: Rename to C4AulCompiler
...
I need to split up C4CodeGen into smaller parts, and having the bit that
actually generates the bytecode named C4CodeGenCodeGen would be silly.
2016-05-09 12:21:33 +02:00
Günther Brammer
69427a484a
C4AulParse: Check for function names after '->' with the helper function
2016-05-05 02:47:17 +02:00
Günther Brammer
994cb52cea
C4AulParse: Don't escape spaces in bytecode dumps of strings
2016-05-05 02:38:36 +02:00
Günther Brammer
99f704fbb8
Script: Prevent writes to constant arrays
2016-05-05 02:10:41 +02:00
Günther Brammer
9741af42fd
Replace all usages of the old local variables list with properties
2016-05-01 00:28:37 +02:00
Günther Brammer
7792acdff0
Script: Check for functions before keywords
...
This unifies the lookup for local variables and functions. Its slightly
awkward that global functions can overload if and Par now, but local
variables already could.
2016-05-01 00:28:37 +02:00
Günther Brammer
30f7457d89
Remove unused macros leftover from removed script features
2016-05-01 00:28:37 +02:00
Günther Brammer
b8f2d0ca87
Script: Repeat the parser error message when executing a broken function
2016-05-01 00:28:37 +02:00
Günther Brammer
17b18da26c
Make bytecode dump work again
...
Dumping the bytecode before adding EOFN while depending on that to signal
the end isn't such a hot idea.
2016-05-01 00:28:37 +02:00
Günther Brammer
904bf78d68
Don't crash when deserializing an effect with object command target ( #1730 )
2016-04-29 00:16:20 +02:00
Günther Brammer
4092911349
Move code generation into its own class
2016-04-28 03:25:47 +02:00
Günther Brammer
b00b8554ab
Merge branch script
2016-04-28 03:25:44 +02:00
Günther Brammer
d45ac946fe
Add C4AulParseError constructor and cease reusing it for warnings
...
The nontrivial code that formats the position is now a function of
C4AulParse used by both warnings and errors.
2016-04-28 02:59:12 +02:00
Nicolas Hake
a8f4bd3960
C4AulParseError: Avoid the second string parameter
...
While I'm not a big fan of hiding flow control in a function, Error()
handles formatting and saves me from calling FormatString().getData() a
lot.
2016-04-28 02:59:12 +02:00
Günther Brammer
4b43576f83
Script: Complain about some attempts to Call nonexistant function again
...
This code got lost in the function pointer rewrite.
2016-04-28 02:59:12 +02:00
Günther Brammer
3760363a3b
Script: Add GetPrototype and SetPrototype functions
...
This should eventually replace the Prototype property, so that proplists
can be used as a key-value-storage without any hidden gotchas.
The Prototype is such a magical property that any code dealing with all
properties has to special-case it anyway, and isn't even returned by
GetProperties().
2016-04-28 02:59:11 +02:00
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