Commit Graph

62 Commits (73d1d358003efc565da539fc6dc7cfae70126113)

Author SHA1 Message Date
Günther Brammer 73d1d35800 Script: Optionally warn about empty function call parameters 2011-02-02 22:06:53 +01:00
Günther Brammer 5d3eff754b Script: Empty function parameters default to nil instead of 0 2011-02-02 21:45:46 +01:00
Günther Brammer ec7e35a25a Script: Optional warnings about deprecated functions and 0->nil conversion 2011-01-16 21:26:18 +01:00
Günther Brammer 846e707134 objects: Remove OCF_Living in favor of OCF_Alive 2011-01-02 19:40:48 +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 6025602038 Script: Correctly backtrace exceptions
Global functions conspire with appendto/include to make this all horribly
fragile.
2010-12-22 04:26:37 +01:00
Günther Brammer 40c24961dd Correctly map bytecode to linenumber for global/appended/included functions
The method to get the C4AulScript instance that stores the bytecode of a
function is ridiculous, but at least it's now capsuled in a function. While
at it, this also always stores the bytecode index instead of a bytecode
pointer in the function.
2010-12-22 02:10:58 +01:00
Günther Brammer b562acb32c Script: Remove EffectVar, update effect documentation 2010-12-21 21:57:40 +01:00
Nicolas Hake dbb75f98cb win64: Fix crash when a C4String gets allocated at >4GB 2010-12-16 17:26:52 +01:00
Günther Brammer 26c670b29d Improve internal C4PropList interface for predefined property names
SetProperty now also has a wrapper, and the common case of
GetPropertyVal(P_Foo) is now GetProperty(P_Foo).
2010-12-06 16:19:15 +01:00
Sven Eberhardt 7e971d7405 fix error when accessing &Code[0] on empty code during script parsing
caused by 4d1af7ffee78, when code was changed from a C style array into a std::vector
2010-12-07 19:27:59 +01:00
Günther Brammer d02c424dab Script: Split SPos out of the bytecode into an extra vector for speed
SPos is only needed to display debug messages. Not having that data in the
cache for normal execution speeds up script execution by ten percent on at
least one artificial benchmark.
2010-10-25 23:48:08 +02:00
Günther Brammer 4a256d1953 Script: Every identifier is allowed after a dot
Previously, the tokenizer would emit special tokens for a few keywords. Now
every keyword is handled by the parser. This allows one to use keywords as
identifiers everywhere it is unambiguous.
2010-10-20 00:37:31 +02:00
Armin Burgmeier 479362b87c Fix a crash bug on 64 bit 2010-09-22 02:14:16 +02:00
Günther Brammer 64f424cc51 Script: Add | operator to constants
This is the only operator that is necessary for the ActMaps. Ideally, every
operator would work, but I don't know how to achieve that without massive
code duplication. So just duplicate a little to make it work.
2010-09-09 22:41:41 +02:00
Günther Brammer b55c88d486 Script: Add initialization to local named variables (properties) 2010-09-09 22:36:00 +02:00
Günther Brammer ef76b26c4a Script: Save readonly proplists inline so that they do not need a number 2010-09-08 20:09:27 +02:00
Günther Brammer bf9137149c Script: Initial proplists are readonly at runtime
That way, recreating them from game data during savegame load won't
suddenly revert changes, because there aren't any changes.
2010-09-08 14:54:39 +02:00
Günther Brammer 984c3430ac Script: constants can contain proplists and arrays
Only supporting the literal syntax for them, with the same
constraints for the contents as for toplevel constants.
2010-09-09 02:18:19 +02:00
Günther Brammer e342dc9b35 Script: Remove last, already dead, traces of C4ID constants 2010-08-19 19:05:48 +02:00
Günther Brammer b34efab246 Script: Add foo.bar syntactic sugar for foo["bar"] 2010-08-15 01:53:18 +02:00
Günther Brammer 713531bb91 Script: Remove obsolete '&' token (always an operator now) 2010-08-14 23:02:07 +02:00
Peter Wortmann 9c9a898911 Fixed a few scripts to work without references, to the best of my knowledge. 2010-08-03 22:33:03 +01:00
Peter Wortmann 24cfd14f1c Support for setting array slices 2010-08-03 21:47:45 +01:00
Peter Wortmann cf4e83c151 Merge with default, including some small Script cleanups 2010-08-01 16:23:36 +01:00
Günther Brammer 696520dfb4 Script: Avoid conversion warning false positives (#246) 2010-07-31 19:29:31 +02:00
Günther Brammer 06c62b31bd Script: Only warn about missing functions in the Parser
Non-failsafe calls will abort at runtime, but they might
only be used in a never taken branch, so unconditionally
aborting the function is wrong.
2010-06-27 02:03:23 +02:00
Armin Burgmeier 9f65838ae8 Fix a couple of compiler warnings 2010-04-28 23:43:25 +02:00
Peter Wortmann edb4a4a0b2 Completely removed references from the engine, changed array semantics to not copy automatically, implemented postfix ++/-- correctly 2010-04-08 02:47:45 +02:00
Peter Wortmann efb5925129 Modified parser to use setter bytecode in place of references.
Currently kills:
* a[...] = ... -> Currently a copy is changed and then discarded, need to rework array semantics.
* bla->EffectVar(...) = ... -> Normal EffectVar is rewritten to SetEffectVar - but this won't work for calls. We need a better solution anyway.
* All scripts that use references, obviously. Just have a look at the parser warnings.
2010-04-07 15:04:19 +02:00
Benjamin Herr adc278dc57 Add array slicing syntax ary[begin:end]
... which evaluates to a copy of the elements with indices in the range
[begin,end), where either index might be omitted, defaulting to 0 or the
length of the string respectively
2010-04-05 17:41:36 +02:00
Armin Burgmeier c2924041c9 Fix seperate->separate everywhere 2010-04-01 23:08:06 +02:00
Benjamin Herr 4378de147c Rerun astyle with missing \ added 2010-03-28 20:58:01 +02:00
Günther Brammer 5a44edb613 Store objectlocal named variables as properties
One still has to declare them in before usage, but LocalN can create new
variables now.
2010-03-27 18:52:32 +01:00
Günther Brammer 99040a3dd1 Script: Remove ne, eq and S= 2010-03-22 22:26:41 +01:00
Günther Brammer 1446f585d7 Rename C4V_pC4Value to C4V_Ref 2010-03-22 22:16:46 +01:00
Günther Brammer 8c13465ef3 Script: += and friends result in integers, and check for them
Before, var a = nil; a+=25; would result in any/25, violating a constraint.
The operators also didn't check that the input was an integer.

/= and / now raise an exception on division-by-zero.
2010-03-18 23:59:50 +01:00
Armin Burgmeier 7b7414a8bb C4AulParseState: Fix usage of unintialized variable
ClearToken checks TokenType which might not be initialized yet
2010-03-18 20:15:13 +01:00
Armin Burgmeier 7d17cb28e6 Fix a few compiler warnings 2010-03-16 12:39:58 +01:00
Günther Brammer 8753019c77 Script: Remove last remains of obj->C4ID::Foo()
They didn't do anything anyway anymore besides using a TODO marker.
2010-03-06 20:51:14 +01:00
Günther Brammer 3e6153098b Script: Warn about type conversions that are going to fail
At the moment, only function parameters are checked, and only immediate
type errors are catched - if there's a variable in between, the parser
won't see it. Still useful to catch some errors before running the
code.
2010-03-06 20:49:29 +01:00
Günther Brammer e09b3b02b3 Scriptparser: Fix crash on C4ID starting with a number
The C4ID syntax removal was not thorough enough: The tokenizer did
nothing in the C4ID state anymore except traversing the string, but not all
instances of reaching that state were removed. As a result, the tokenizer
read past the script end.
2010-03-05 00:26:29 +01:00
Günther Brammer e3292ad0f5 Remove obsolete code introduced by the debugger merge 2010-03-05 22:25:37 +01:00
Martin Plicht 4902679b56 DirectExec and C4ControlScript support executing script expressions that access variables and parameters of the parent context (used for watch expressions while debugging) 2010-04-26 22:16:45 +02:00
Sven Eberhardt 6158aec581 Removed internal score counting by player wealth/owned objects
Unified and renamed all Points/Value/Score functions/field names into Score
Some MSVC warning fixes
2010-04-21 21:12:49 +02:00
Armin Burgmeier 70ac17c040 Mingw64 build fixes 2010-04-18 22:02:01 +02:00
Günther Brammer b81931a419 Miscellanous FIXME removals 2010-02-23 21:49:57 +01:00
Martin Plicht cf382f34ce Merge, resolving C4NetIO conflict 2010-02-03 03:39:21 +01:00
Sven Eberhardt dfbcfb29e3 fix script string table leak 2010-01-30 17:51:26 +01:00
Benjamin Herr f3b35227ea avoid lots of gcc warnings 2010-01-25 05:00:59 +01:00