Martin Plicht
d164a2d50a
C4Value: Implement some crude infinite recursion guard which happens solely inside C4Value::operator==
2013-10-13 11:55:01 +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
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
864c5c7ea8
copyright notices update 2012
2013-01-12 16:31:40 +01:00
Günther Brammer
4b2ea86726
Script: compare proplists by their contents instead of their identity
...
Objects, effects and definitions each have unique numbers/ids, so are
compared by identity as a shortcut.
2012-06-02 15:56:20 +02:00
Günther Brammer
c8907f5204
Shorten C4Value::GetDataString for Objects, Definitions and static proplists
...
The new output is also more often an expression that returns the value when
evaluated.
2012-05-08 02:24:43 +02:00
Günther Brammer
3a3ed01c89
Savegames: Save readonly proplists by their name
...
For example, the proplist in Clonk.ActMap.Walk is saved as DClonk.ActMap.Walk.
Should the script defining the proplist change while the savegame is stored,
the proplist will have the new contents instead of the old ones after savegame
load.
Also, save functions as DFlint.Hit instead of fDFlint.Hit. Loading uses the same
code as static proplist loading.
Curiously, this makes g++ 4.4 use the C4RefCntPointer move constructor,
which was broken until now. Fix it to take a mutable rvalue reference.
2012-06-01 17:27:59 +02:00
Julius Michaelis
d93384beb6
Add forgotten C4Value::operator== case for C4V_Function
2012-04-15 16:33:39 +02:00
Julius Michaelis
57a07a95ab
Add forgotten string for function type values to GetC4VName
2012-04-14 16:53:35 +02:00
Günther Brammer
05ef63bf64
Script: Make 0==nil false again
...
This was probably broken by the C4V_Any/C4V_Nil separation. Also clean
the function up a bit and add an assert that should catch similar stuff in
the future.
2012-04-11 02:25:24 +02:00
Günther Brammer
406b7c4eca
Savegames: (De)serialize functions in c4values
2012-02-13 18:12:08 +01:00
Günther Brammer
a684ab4aba
Script: Infrastructure for functions as a value type
2011-09-25 01:20:18 +02:00
Günther Brammer
8185d318bf
Script: Add a proplist representing the global scope, named "Global"
2011-10-04 22:12:45 +02:00
Günther Brammer
a24ebc4936
Script: Add a proplist representing the scenario, named "Scenario"
...
The proplist is accessible from script via a global constant.
2011-09-25 23:24:29 +02:00
Günther Brammer
c63b66e909
Script: Add def and effect parameter types
2011-09-24 18:37:28 +02:00
Günther Brammer
dbaa638166
Clean up C4Value::CompileFunc
2011-09-26 21:57:25 +02:00
Günther Brammer
32e7eb2904
Only use C4V_C4Object as typecheck target, tag the values with C4V_Proplist
...
This simplifies a few places which had to check for both tags before.
2011-09-26 20:22:31 +02:00
Günther Brammer
8758e35255
Remove redundant C4Value::GetTypeInfo
2011-08-21 14:40:29 +02:00
Günther Brammer
4a32e63c46
Savegames: Correctly Denumerate the first enumerated value ( #657 )
...
When that value was copied it went from Enum 0 to nil. While this could
be fixed by making C4V_Enum a NullableType, counting from 1 is a tiny bit
less code overall.
2011-09-19 23:02:18 +02:00
Günther Brammer
9bc61db360
copyright notices update 2011
2011-09-01 16:58:52 +02:00
Günther Brammer
a533b93f10
Do not print a deleted-object-warning while warning about that object
2011-05-25 20:09:12 +02:00
Günther Brammer
37242503df
Read old nil C4Values from player files for compatibility with 5.1
2011-05-21 23:13:49 +02:00
Günther Brammer
e0f49b4cca
Handle unknown C4Value type tags in player files or save games
2011-05-21 23:12:43 +02:00
Günther Brammer
2d9d0d8596
Reduce verbosity of backtraces with object parameters
2011-05-09 23:19:31 +02:00
Günther Brammer
f97cde74c3
Split C4V_Any into C4V_Nil for the data type and C4V_Any for the typecheck
2011-05-09 14:37:28 +02:00
Günther Brammer
fed6d6a0de
Script: Debug output for proplist contains all properties
2011-05-05 22:27:22 +02:00
Günther Brammer
7eedece257
Replace C4Value typecheck table with switch statements
...
This has the advantage that the compiler can simplify the check when the
target type is known at compile time.
2011-04-10 03:46:59 +02:00
Günther Brammer
b1a76adb62
Fix debug build
2011-04-14 15:36:31 +02:00
Günther Brammer
b403fc61c1
Reduce code duplication a bit
2011-04-01 00:03:02 +02:00
Günther Brammer
f3365ab73b
Arrays with multiple references are stored just once
...
This is done with the new C4ValueNumbers class. Every array and proplist
with the exception of objects, definitions and effects gets a number
when the game is saved and is restored via that number on load.
2011-03-27 18:14:41 +02:00
Günther Brammer
f582a97998
Add C4ValueNumbers helper class and pass it through to C4Value::CompileFunc
...
In preparation of using that class to enumerate and denumerate various
pointers.
2011-03-26 23:59:35 +01:00
Günther Brammer
75dc49e746
Replace Objects.ObjectNumber with C4PropListNumbered::CheckPropList
...
There's no need to go through the entire object list to get an object
number, so convert most usages of ObjectNumber(obj) with obj->Number. Add a
new method to check proplist pointers for debugging purposes to
C4PropListNumbered.
2011-02-06 01:59:49 +01:00
Günther Brammer
a7615ddced
Make C4PropListNumbered global data static members of the class
...
Previously, this was in ::Game and ::Objects. Both classes still work on
that data, but not as much as before.
2011-03-05 03:32:51 +01:00
Günther Brammer
8749395a18
Use Nillable<void>() instead of C4VNull as the always-nil return value
2011-03-03 00:57:38 +01:00
Günther Brammer
bdbe3beabf
Optimize the template engine script function wrappers slightly
2011-03-02 23:42:34 +01:00
Günther Brammer
e250312c26
Move C4DefList class into from C4Def.cpp/h to new C4DefList.cpp/h
2011-03-03 17:10:22 +01:00
Günther Brammer
ed86af5f29
Script: Proplists with Object prototypes are also Objects
2011-03-02 14:12:06 +01:00
Günther Brammer
e4ef7e3d98
Replace C4VID with C4VPropList
...
Most callsites use C4Id2Def instead, but for some a def->id->def
indirection could be removed.
2011-02-05 23:09:09 +01:00
Günther Brammer
5e156a07d1
Script: == works when one side is an object with proplist type label
...
I don't actually know how to get to that situation in script, but when it
happens, everything else expecting an object would correctly accept it
despite the proplist label.
2011-01-15 23:03:01 +01:00
Günther Brammer
a89667f3d7
Merge C4ValueList and C4ValueArray into one class
...
Now that the last usage of numbered variables in effects is gone,
C4ValueList wasn't used except as a base class. If the array and
refcounting aspect should be separated at all, the reference count
should be in the base class.
2010-12-27 17:05:35 +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
8bd9179606
Script: Inline C4Value::Set and the C4Value functions it calls
...
Apart from these functions just being small enough to reasonably
inline, the compiler might be able to optimize parts of them away based on
knowledge of the type of the new or old content of the C4Value.
On at least one artificial benchmark, this does help significantly.
2010-10-26 03:05:20 +02:00
Günther Brammer
7d3811fc76
Script: Arrays do not autoextend when accessed
...
Done by constifying the C4ValueList interface. To avoid rewriting some code that
uses that interface, also constify some C4Value functions. While at it,
replace the dynamic function call for C4Value conversion with a switch.
This makes C4Value conversion not actually convert anything, but the only
case left is conversion to bool, which already occurs when the value is
read.
2010-09-20 19:49:00 +02:00
Günther Brammer
cf92ceae2d
Merge branch 'norefs'
...
Conflicts:
planet/Melees.c4f/Ruins.c4s/ObjectFade.c4d/Script.c
planet/Objects.c4d/Goals.c4d/KingOfTheHill.c4d/Script.c
planet/Objects.c4d/Goals.c4d/LastManStanding.c4d/Relaunch.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/BlackPowder.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Coal.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Earth.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Firestone.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Gold.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Ice.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Loam.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Metal.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Ore.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Rock.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Snow.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Sulphur.c4d/Script.c
planet/Objects.c4d/Items.c4d/Resources.c4d/Wood.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Axe.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Balloon.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Barrel.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Boompack.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/CableReel.c4d/PowerLine.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/CableReel.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Dynamite.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/DynamiteBox.c4d/Fuse.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/DynamiteBox.c4d/Igniter.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/DynamiteBox.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/GrappleBow.c4d/Hook.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/GrappleBow.c4d/Rope.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/GrappleBow.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Hammer.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/JarOfWinds.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/OrbOfTelekinesis.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Pickaxe.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/PowderKeg.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Ropeladder.c4d/LadderGrabber.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Ropeladder.c4d/LadderSegment.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Ropeladder.c4d/Script.c
planet/Objects.c4d/Items.c4d/Tools.c4d/Shovel.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Arrow.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Club.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Javelin.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Ammo.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Script.c
planet/Objects.c4d/Items.c4d/Weapons.c4d/Shield.c4d/Script.c
planet/Objects.c4d/Vehicles.c4d/Cannon.c4d/Script.c
planet/Objects.c4d/Vehicles.c4d/Lorry.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/FlagGoal.c4d/Flag.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/FlagGoal.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/MenuDeco.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/ObjectRestorer.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/TutGuide.c4d/Script.c
planet/Tutorial.c4f/Tutorial.c4d/TutorialGoal.c4d/Script.c
planet/Tutorial.c4f/Tutorial03.c4s/ShootTheTargets.c4d/Script.c
src/game/object/C4Def.h
2010-09-11 19:30:45 +02:00
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
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
Peter Wortmann
cf4e83c151
Merge with default, including some small Script cleanups
2010-08-01 16:23:36 +01:00