Günther Brammer
efad172ec6
Script: Compare readonly proplists by their contents
...
This way, breaking the identity relationship on savegame load will not be
noticable by script.
2010-09-10 23:01:30 +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
153646b3d7
Script: Move Action initialization to script, make it static const
...
Finally. :-)
2010-09-09 22:38:25 +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
6d3fc6032b
Remove the last traces of the Strings.txt
2010-09-08 20:08:13 +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
1a3f8fe80b
Script: Make a[-n]=foo work
...
Before, negative indices would alias to 0, which is not helpful.
2010-09-08 00:41:59 +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
275e9dfd7d
Script: Revise error messages for uniformity
...
All messages end with a . now, don't quote c4value types and call the i in
a[i] "index".
2010-09-08 00:46:01 +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
09218cbdf1
Fix merge mistakes
2010-09-11 19:20:52 +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
Günther Brammer
40e2406a03
stringtable: Destroy strings before the set containing them
...
So that they can remove themselves from the set,
2011-01-07 00:52:53 +01:00
Peter Wortmann
cc3795ef4f
Removed ObjectsInt and FindInternal, it has been a NOP for long enough. If we really want to find rules faster, we should consider having (bounded?) per-definition object lists. That way, FindObjects() & co would benefit as well.
2010-08-05 19:48:22 +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
Sven Eberhardt
e3a69d50fa
Kill some outdated CON_* constants registered by engine
...
Update GetPlayerControlName to use GetConstantNameByValue
2010-07-30 20:50:35 +02:00
Günther Brammer
dfc4070498
Script: Don't crash on obj[nil]
2010-07-15 20:26:53 +02:00
Günther Brammer
9bae376055
Remove old style Cursor and other dead code
2010-07-06 02:10:54 +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
Günther Brammer
abdf54b01b
Script: a["foo"] overwrote a
...
C4AulExec::Exec passed the element on the stack to
C4PropList::GetPropertyVal which contained the reference to the variable
"a". C4Value::operator= follows this reference, so use Set() instead.
2010-04-04 01:53:53 +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
Benjamin Herr
27287b981f
Reformat everything according to style guidelines
...
as per http://forum.openclonk.org/topic_show.pl?tid=208
and http://wiki.openclonk.org/w/Style_Guidelines
via astyle
--brackets=break
--indent=tab=2
--keep-one-line-statements
--keep-one-line-blocks
--indent-namespaces
--convert-tabs
--recursive
--exclude=zlib
--exclude=tinyxml
src/\*.h src/*.cpp
2010-03-28 19:58:21 +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
2e379712fb
Add C4PropList::GetPropertyVal to get a property directly
...
This should theoretically be more efficient than first creating a reference
and then dereferencing that. But mostly it's for more interface clarity.
2010-03-27 19:16:48 +01:00
Günther Brammer
452ee57d04
Small C4Value cleanup
2010-03-25 21:42:47 +01:00
Günther Brammer
b4e37b070b
Change all indentation with spaces to use tabs instead
...
This is a whitespace-only patch. Hopefully, it'll only affect rarely-changed
parts of the engine, since all regularly maintained pieces should already
use tabs.
2010-03-27 17:05:02 +01:00
Benjamin Herr
6cb483bc4b
C4Value::DenumeratePointer(): Print int with %d
...
not intptr_t
2010-03-22 22:27:00 +01:00
Benjamin Herr
5aec29c8a1
Remove spurious , at the end of enum list
2010-03-22 15:38:43 +01:00
Günther Brammer
32ec6abace
Script: Add a new reference type to C4Value storing proplist and key
...
This way, a mere reference does not need to add an entry to a proplist. This
can be deferred to the point when the reference is used to change the value.
2010-03-23 23:56:59 +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
79e78e3a10
Script: Prepare for C4Value::GetRefVal to create a new entry in a proplist
2010-03-22 19:32:10 +01:00
Günther Brammer
608fadce6b
Script: ++ and -- throw when applied to nonintegers
2010-03-22 19:00:29 +01:00
Günther Brammer
5d2c3d4c2b
Savegames: (De)serialize PropLists
...
Because PropLists have an identity, they need to be saved in a central
place and have C4Values reference them, the same as objects. Objects.txt
can be used for that.
This doesn't save PropLists which are definitions. These are reloaded from
the c4ds at game start and identified by their C4ID, not their number.
2010-03-22 00:40:03 +01:00
Benjamin Herr
5ccb193928
override both Close() overrides in C4AulDebug
...
If we only override the Close() function with no parameters, the
overload taking an addr_t gets hidden. So we specifically override that
as well, preventing a gcc warning.
2010-03-21 19:18:27 +01:00
Günther Brammer
538af1eef7
Merge
2010-03-21 00:45:22 +01:00
Armin Burgmeier
4db22e4a1b
Fix Prototype refcounting
...
This patch produces a measurable slowdown on my computer, but it's not
directly related to the change but probably rather to hashtable collisions
in C4StringTable.h. The performance drop vanishes when increasing the
initial size of the hashtable.
I am not changing that right now because a) it's rather unrelated to
this change and b) would require some more profiling to find a good value.
Maybe changing the hash function or increasing the hash table size before
it's half full would be better things to do.
2010-03-19 01:21:54 +01:00
Armin Burgmeier
56e33cc626
Make an object's current action a property
...
This fixes a crash on reload since the Action.pActionDef pointer becomes
invalid otherwise
2010-03-19 00:04:29 +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
6613bdb129
C4AulScript: Properly release Code on Unlink, fixing a crash on Relink
2010-03-18 22:10:32 +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
d2deb1096b
Add the "MeshTransformation" property ( #197 )
2010-03-17 13:43:17 +01:00
Armin Burgmeier
7d17cb28e6
Fix a few compiler warnings
2010-03-16 12:39:58 +01:00
Armin Burgmeier
f72b2a16e7
Fix camera position for pictures, allow arbitrary mesh transformation instead ( #106 )
2010-03-15 22:50:11 +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
Martin Plicht
99cbfecdff
Debugger: Execute scripts using the calling object
2010-04-26 20:16:04 +02:00
Martin Plicht
faffb26b95
C4ControlScript::Execute informs the debugger about evaluated scripts
2010-04-26 20:13:36 +02:00
Martin Plicht
1d9911ced7
Debugger: Fix typo + change format of the VAR command result
2010-03-22 10:54:41 +01: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
Günther Brammer
b09fc47349
Remove unused operator from C4V_Data helper union
2010-04-15 23:00:07 +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
Nicolas Hake
766abfd190
msvc: Working build on x64
...
Win64 is a LLP64 architecture, so please don't use a long for storing
pointers. Use intptr_t instead.
2010-02-28 01:42:57 +01:00
Martin Plicht
15967dc313
Reorder preprocessor directives in C4AulDebug.cpp to make compiler happy
2010-02-24 19:16:17 +01:00
Martin Plicht
2bb528b5d4
Define NOAULDEBUG to compile without C4AulDebug
2010-02-23 19:29:26 +01:00
Martin Plicht
8e1390c92e
debug branch brought up to date
2010-02-19 15:54:31 +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
Nicolas Hake
ed6f9424d7
Allow IDs longer than 4 characters
...
All C4IDs are now stored in auto-created global constants with the same name
as the ID itself. There is no special parsing of IDs anymore; this means that
you need to use the C4Id function if you aren't sure whether an ID exists.
IDs in portrait strings aren't working, since I expect portrait support to be
removed from the engine.
2010-01-25 16:57:57 +01:00
Nicolas Hake
a41f896921
Replace global C4ID consts with member consts
2010-01-25 04:14:52 +01:00
Martin Plicht
9d565fb3fd
Debugger: Add VAR command to query the value of a variable
2010-01-21 16:22:33 +01:00
Martin Plicht
7966e59e18
Debugger: Not scenario-relative but relative to the scenario's container
2010-01-16 05:24:10 +01:00
Martin Plicht
a519a5f352
Debugger: Send scenario-relative paths
2010-01-16 02:32:53 +01:00
Martin Plicht
98dfe3dc1a
Debugger: Return correct script path (pOrgScript)
2010-01-15 15:31:51 +01:00
Martin Plicht
cee326dd57
Debugger: Stack frame support (not finished)
2010-01-15 05:46:16 +01:00
Martin Plicht
db281e3d10
Add C4AulDebug command to toggle breakpoint (TBR)
2010-01-15 01:47:20 +01:00
Martin Plicht
5fb1c7847d
Fix some merge issues and put C4AulExec class definition into C4AulExec.h
2010-01-14 23:31:38 +01:00
Martin Plicht
03881cec3f
Add C4AulDebug.cpp (was moved from gui)
2010-01-13 19:26:03 +01:00
Martin Plicht
250d42fbff
Fix C4AulScriptContext::dump so it does not call itself -.-
2010-01-13 19:20:42 +01:00
Martin Plicht
6333f0e6ba
Add a NULL check in C4AulScriptContext::ReturnDump and restore put AB_DEBUG chunk before AB_RETURN
2010-01-13 18:42:15 +01:00
Martin Plicht
f1b615e7ec
Merge default into debug
2010-01-13 18:07:58 +01:00
Armin Burgmeier
fb95c3af2e
Merge mesh into default
2010-01-04 01:10:31 +01:00
Sven Eberhardt
23a206ccdd
implement *Mouse*Wheel1Up/Down for player controls
...
implement mouse wheel viewport zoom as async PlayerControl
2009-12-31 18:20:45 +01:00
Sven Eberhardt
6b89a5dd57
engine support for Drag+Drop in script (WIP)
2009-12-30 20:16:32 +01:00
Nicolas Hake
1c11c4dd34
Merged PlrCtrl into default
2009-12-17 14:06:24 +01:00
Nicolas Hake
963dbe463b
#57 : Ensure global variable "Action" exists before assigning
2009-12-14 14:16:09 +01:00
Tobias Zwick
edec15d64f
merge
2009-11-30 17:24:14 +01:00
mizipzor
a53dae0c1b
Fixed compilation in MSVC2010
2009-11-25 19:38:54 +01:00
Nicolas Hake
1a933780d4
Fix assertion and crash on game teardown ( #37 , #42 )
...
Also, the build works on linux again. Whee!
2009-11-25 16:04:32 +01:00
Nicolas Hake
9ef7fc0d96
Script: Expose string tables at runtime
...
Use Translate(string) to access the translation
2009-11-12 16:57:37 +01:00
Armin Burgmeier
49e607bab0
Added includes and forward declarations, fixing the build
2009-10-26 00:09:34 +01:00
Nicolas Hake
8736ab11bc
Script: Allow \n, \x??, \??? escapes
2009-10-21 04:34:15 +02:00
Nicolas Hake
86e52a9295
#24 : C4Script: Allow strings of arbitrary length
2009-10-21 03:41:55 +02:00
Nicolas Hake
52bde5a579
Remove BIG_C4INCLUDE define
2009-10-20 06:21:12 +02:00
Richard Gerum
0dac409510
merged default into mesh
2009-10-14 16:42:23 +02:00
Sven Eberhardt
af8a4d56b7
silenced some msvc warnings
2009-10-13 20:41:57 +02:00
Tobias Zwick
f584896446
merge
2009-10-08 20:51:31 +02:00
Armin Burgmeier
406dc7c734
Implement perspective rendering
2010-02-06 18:33:30 +01:00
Armin Burgmeier
778ec7278f
Merged default into mesh
2009-09-19 13:13:10 -04:00
Günther Brammer
8cbadabef2
C4Value: 0 can be converted to everything, just as nil
...
This should give us the best of both ways: Everybody can keep using 0 as a
nullpointer, but 0 and nil are still distinguishable.
2009-09-05 17:54:56 +02:00
Günther Brammer
e25ae9ef9f
C4Script: add do-while-loop
...
A very old feature request.
2009-08-28 04:44:53 +02:00
Armin Burgmeier
4fa029df2c
Merged default into mesh
2009-08-27 21:35:55 -04:00
Günther Brammer
6c61db0fab
Recognize global constants even if they begin a statement
...
Feuermonster reported that
static const foo = 0;
func bar() { foo = 5; }
resulted in a confusing error message.
2009-08-26 16:59:00 +02:00
Günther Brammer
0254addc90
Fix DebugRec
2009-08-25 17:50:51 +02:00
Armin Burgmeier
e2c68254a5
Added includes and forward declarations to headers
...
So that they can be included individually
2009-09-21 00:01:55 -04:00
Günther Brammer
9a8b5dd739
Replace BOOL by bool, TRUE by true, FALSE by false
2009-08-15 20:50:32 +02:00
Günther Brammer
f0adbfe5b4
C4Value: Document the reasons for HasBaseArray
2009-08-15 14:15:10 +02:00
Günther Brammer
7621c97b92
Remove backward compatibility to very old saved C4ValueLists
2009-08-12 19:55:09 +02:00
Sven Eberhardt
df6010a148
merge
2009-08-12 17:27:43 +02:00
Nicolas Hake
276a5abfed
Removed default-this object parameter from a lot of functions
2009-08-12 22:44:09 +02:00
Günther Brammer
572d00c32e
Move all source files
...
This might make stuff easier to find.
2009-08-10 17:59:18 +02:00