Commit Graph

43 Commits (d11e6afff4ecd9007b930825a3e9e5d5f1c20886)

Author SHA1 Message Date
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
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
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 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
Benjamin Herr 6cb483bc4b C4Value::DenumeratePointer(): Print int with %d
not intptr_t
2010-03-22 22:27:00 +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 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 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
Günther Brammer b81931a419 Miscellanous FIXME removals 2010-02-23 21:49:57 +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 52bde5a579 Remove BIG_C4INCLUDE define 2009-10-20 06:21:12 +02: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 9a8b5dd739 Replace BOOL by bool, TRUE by true, FALSE by false 2009-08-15 20:50:32 +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