Commit Graph

366 Commits (3a3ed01c898bf6b23abf42d256bea890d275434e)

Author SHA1 Message Date
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 a2015e0db1 editor: Move function autocompletion list generation to C4AulScriptEngine
This actually removes some code duplication and makes the ScriptEngine
API smaller.
2011-01-13 01:09:06 +01:00
Günther Brammer 58a257f763 editor: Display object properties well readable 2011-01-13 17:55:58 +01:00
Günther Brammer 94335b6a49 editor: Move object debug information into C4Object(List) 2011-01-12 23:43:05 +01:00
Günther Brammer b1cc96d6ce Fix a mismatched malloc/delete resulting from StdStdBuf::GrabPointer usage 2011-01-12 19:58:33 +01:00
Günther Brammer 6d3feabe69 Reduce #includes so that C4Include.h doesn't include C4Value.h
This should avoid many complete rebuilds.
2011-01-08 17:04:20 +01:00
Günther Brammer 4e75f2a134 Merge Plane branch
Conflicts:
	src/C4Game.cpp
	src/C4Game.h
2011-01-08 17:39:59 +01:00
Günther Brammer 241869b1e6 objects: Replace the sorting functionality of Categories with a Plane property
This makes changing the drawing order a lot easier.
2010-12-27 20:15:55 +01:00
Günther Brammer 96fa57eb6b objects: Replace Grab defcore value with Touchable property 2011-01-02 23:55:48 +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 877dfee49e objects: Remove Chop command, OCF_Chop, CHOP procedure, Chop defcore val, FX_Call_DmgChop 2011-01-02 01:18:45 +01:00
Günther Brammer 4984cd6b99 objects: Remove DFA_BUILD procedure 2011-01-04 00:55:42 +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 884572bbb3 Script: Reflect C++ effect variables as properties
With references gone, the engine can sanely run code upon modification of
properties, or throw exceptions on read-only ones. This obsoletes one use
case of GetEffect, simplifying the function a lot.
2010-12-24 15:10:39 +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
Maikel de Vries 53e507d2c5 Engine: Removed Power system including all components
Removed power lines, power connects, energy rule, power OCFs, Energy command, C4Script CheckEnergyNeedChain and EnergyCheck, Action EnergyUsage and documentation.
2010-12-15 21:02:50 +01:00
Günther Brammer 6140c73e81 Script: Change effect functions to use the effect instead of the number
This doesn't require any script changes because the effect callbacks don't
heed the parameter type information.
2010-12-20 00:19:24 +01:00
Günther Brammer e2c6a5fd17 Script: Effects are now proplists, too
This doesn't yet affect any script interfaces,
2010-12-20 00:13:56 +01:00
Günther Brammer f801ab61f5 Clear out interned strings instead of them deregistering themselves
This probably prevents a crash when the strings are destructed after the
set.

Also show all C4Strings that are still in the stringtable at the end for
debugging purposes.
2010-12-17 00:31:51 +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 fccd5597bc Physical: Replace Throw with a ThrowSpeed property 2010-12-13 02:17:21 +01:00
Günther Brammer b9c1790c48 Physical: Replace Breath with a MaxBreath property 2010-12-12 23:01:08 +01:00
Günther Brammer b591ee0dc2 Physical: Replace Energy with a MaxEnergy property 2010-12-12 22:38:15 +01:00
Günther Brammer 1760c8851d Physical: Make BreatheWater and CorrosionResist simple properties 2010-12-12 21:49:47 +01:00
Günther Brammer 07025c2613 Physical: Walk speed and acceleration is now an Action property 2010-12-11 21:10:05 +01:00
Günther Brammer 00a07a1d24 Script: Add ResetProperty to reset properties to reflect the prototype 2010-12-12 01:49:05 +01:00
Günther Brammer f02580df14 Script: Inline C4String::IncRef/DecRef
No measurement whether this helps, but these functions are very simple.
2010-12-08 23:27:02 +01:00
Günther Brammer 0fdd134728 Action: Procedure is specified by a String
Also moves the Action Procedure names to the central stringtable.
2010-12-08 23:17:00 +01:00
Günther Brammer c16102ec9b Shrink StdBuf from 24 to 16 bytes and C4PropList from 56 to 48 on amd64
There's no need for Buffers which exceed 4 GB size in Clonk. C4PropList
just had some padding for alignment.
2010-12-06 19:04:32 +01:00
Günther Brammer 4e4d32f86b Create preallocated C4Strings statically instead of allocating each one
This makes it easy to convert a C4String* to a C4PropertyName, which will
be useful for reflection of internal properties.
2010-12-06 16:24:41 +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 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 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 7f899cc1b0 Make AssignRemoval a C4Object-only-feature, C4PropLists don't need it 2010-10-30 00:05:36 +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
Günther Brammer 4876db8f2d Remove unused C4PropList::HasProperty
There might be a usecase for finding out from script whether a property is
on an object instead of a prototype of the object, but so far that feature
has not been missed.
2010-10-17 22:15:32 +02:00
Günther Brammer 01eed03487 Make C4PropList::Properties private instead of protected 2010-10-17 22:13:12 +02:00
Günther Brammer 4438986167 Script: don't crash on 0[n]
The typecheck relied on the fact that nullpointers were always C4V_Any,
which is not true anymore. Instead, directly check that the array that will
be used is not a nullpointer, which aligns the check with the usage instead
of C4Value implementation details.
2010-10-25 03:40:57 +02:00
Günther Brammer fe9a13f071 Script: proplist access via foo.bar returns nil for nonexistent properties
Previously, it returned the proplist, which was neither helpful nor
intended.
2010-10-18 01:45:49 +02:00
Nicolas Hake 4a1a9cc2b0 msvc: Avoid a stupid warning 2010-09-29 23:19:43 +02:00
Günther Brammer 93d3bc7d2f Script: Thaw and clean definition proplists for reload (#405) 2010-09-22 03:33:57 +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
Armin Burgmeier 479362b87c Fix a crash bug on 64 bit 2010-09-22 02:14:16 +02:00
Armin Burgmeier ba3308d1c6 Fix initialization order in C4Value constructors 2010-09-15 21:23:02 +02:00
Günther Brammer f1e27ca7db Script: a[0:GetLength(a)-1] returns a copy of the array
Previously, returning the same array was an optimization that could not be
noticed from script, because arrays were copied on write.
After noref, this caused a big difference between a[0:] and a[1:], which is
bad.
2010-09-12 18:27:09 +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 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