Commit Graph

1158 Commits (55db5fa98afa9a64678a1b5f2a9a9d41e8bb5888)

Author SHA1 Message Date
Günther Brammer 1e28504cde Optimize the script interpreter a bit
Integer and boolean constants aren't wrapped in a temporary C4Value. The
overflow check is reduced to one subtractions and comparison to a compile
time constant. C4Value::Set(const C4Value&) doesn't duplicate the check for
the setting to the same value in C4Value::Set(C4V_Data, C4V_Type).
2011-04-10 02:00:27 +02:00
Günther Brammer 5596a57d83 Do not check for stack underflow in release builds
Unlike overflows, underflows can only occur when the parser is faulty. In
release builds they just slow the interpreter down.
2011-04-10 17:52:20 +02:00
Günther Brammer dbe7c37db0 Script: Only debug if the debugger was present before compilation
This saves a lot of AB_DEBUG bytecodes in the normal case.
2011-04-10 03:40:55 +02:00
Günther Brammer 435ed78cd9 Script: Remove unimplemented Par(n)=foo 2011-04-10 02:05:11 +02:00
Günther Brammer a3fab0234e Create PropLists with one bytecode instead of one per property 2011-04-09 21:35:16 +02:00
Günther Brammer 71f42d7d8f Correct assert checking that the bytecodepointer is still in the function
Previously, if the first byte code of the function was an AB_FUNC, the
assert would erroneously fail.
2011-04-12 00:10:51 +02:00
Günther Brammer 4575f28605 Log call stack when using a deleted object 2011-04-13 15:38:49 +02:00
Günther Brammer 4ae204e2fb Remove unnecessary includes pulling C4GUI into the script engine 2011-04-13 15:37:12 +02:00
Günther Brammer 9b3afcef04 Remove IDS_LANG_CHARSET and supporting code, everything is in UTF-8 now 2011-04-09 02:51:57 +02:00
Günther Brammer 21e28a4689 Script: Use Unicode instead of Byte strings
Internally, strings are UTF-8 as before, but GetChar returns an
Unicode code point instead of a byte from the UTF-8 encoded string,
and Format("%c") takes an Unicode code point as well.
2011-03-10 00:26:31 +01:00
Günther Brammer e537296829 editor: Change FileSelect abstraction to use StdStrBuf
Of course, windows still uses a buffer on the stack, but at least the other
versions don't.
2011-04-08 23:52:40 +02:00
Nicolas Hake 05608a3edd CStdFont: Assert UTF-8 conformance before drawing or measuring text 2011-04-05 21:03:15 +02:00
Nicolas Hake fea8b6ee9f C4Gui::Edit: Enable correct cursor movement and text selection on UTF-8 strings 2011-04-05 21:00:02 +02:00
Nicolas Hake c4276e84c4 Split UTF-8 validation out of StdStrBuf 2011-04-05 20:58:40 +02:00
Nicolas Hake 5e2e25cc74 win32: Fix StdCompilerConfigRead::ReadString 2011-04-05 18:04:32 +02:00
Nicolas Hake ab2be9b53f win32/msvc: Fix build 2011-04-05 18:03:27 +02:00
Günther Brammer 3f7e879ffe win32: Use Unicode APIs for the user interface 2011-04-03 15:47:02 +02:00
Günther Brammer 0abe1bb633 win32: Use Unicode registry APIs 2011-04-02 18:48:01 +02:00
Günther Brammer 702dc65b83 win32: Add helper functions to convert UTF-8 to UTF-16
They mostly add automatic memory management to MultiByteToWideChar.
2011-04-02 16:48:54 +02:00
Günther Brammer 2133ed2cd8 Add missing move constructors to StdCopy*Buf 2011-04-02 18:09:46 +02:00
Günther Brammer 6e30f2b7e8 win32: Remove unused StdConfig class and associated Registry APIs
It has long since been replaced by the StdCompilerConfig* classes. A few
of the Registry functions are still used in other code, and a few are now
implementation details.
2011-04-02 17:49:55 +02:00
Günther Brammer bd051a972d win32: Remove duplicate file type association code from the engine
The installer already does this, and on newer windows versions the engine
isn't able to do this anyway.
2011-04-02 17:31:01 +02:00
Günther Brammer b46b827cdc Add a few virtual destructors
This ensures that classes that inherit from these have their destructors
called even if they are deleted with a pointer to the base class.
Though at the moment, this just silences a warning.
2011-04-02 00:18:14 +02:00
Günther Brammer ce6f2c9fe0 editor/gtk: Use "draw" instead of "expose-event" signal with GTK+ 3.0
Since the event resp. cairo context isn't used, both events can share a
handler for now.
2011-03-31 00:48:47 +02:00
Günther Brammer 6768614feb Silence various warnings 2011-03-28 20:58:42 +02:00
Günther Brammer 1c43f9dd76 sdl: fixes inspired by compiler warnings 2011-03-30 21:18:16 +02:00
Günther Brammer b2b4176745 Undeprecate the Melee rule
The Melee rule is the interface to distinguish Melee- and Cooperative
scenarios for various purposes. Using a separate flag might be cleaner, but
would violate the do-not-repeat-yourself-rule.
2011-03-30 21:17:57 +02:00
Günther Brammer c6751e1620 Undeprecate C4ID::Clonk
The Clonk C4ID is used as a default for scenarios that do not specify a
crew.
2011-03-30 21:15:16 +02:00
Günther Brammer 4f62dac0bc Rewrite C4Group::View a bit for clarity 2011-03-30 21:13:47 +02:00
Günther Brammer 5d0df4f028 win32: Miscellanous fixes inspired by compiler warnings 2011-03-30 21:06:30 +02:00
Günther Brammer 259c4aa30a Fix DirectoryIterator::DirectoryIterator(const DirectoryIterator &)
Thankfully, this copy constructor is unused, so nothing relied on the
previously broken behaviour.
2011-03-30 21:11:37 +02:00
Günther Brammer 3bbf7c6c38 Add DirectoryIterator & DirectoryIterator::operator = (const DirectoryIterator &)
Because every class with pointer members should have one.
2011-03-30 21:04:42 +02:00
Günther Brammer 24fe22faff Remove redundant check for AB_FUNC bytecode having a function
AB_FUNC always has a function.
2011-03-28 20:57:51 +02:00
Günther Brammer 5b808be269 Remove some unused variables
gcc 4.6 finds variables that are write-only.
2011-03-28 19:31:28 +02:00
Günther Brammer 881e883ecc Script: Remove Bubble engine function in favor of the script implementation 2011-03-30 21:10:05 +02:00
Günther Brammer 3844dc8740 Script: PlayerObjectCommand only takes ints as Tx parameter
C4Object::ObjectCommand was not updated for the C4Value-in-C4Command change
and still exposed the raw pointer values. Given that SetCommand works just
fine for "Call" commands, simply change the Tx parameter to int.
2011-03-28 18:43:59 +02:00
Günther Brammer 7fa761a2a6 Script: AddMenuItem any parameter only accepts object and definition proplists 2011-03-27 18:17:18 +02:00
Günther Brammer 303359f4ab Particles: Remove the unused target coordinates from Face
Particles were always drawn centered around their position, and the
"used because stup" comment explaining the use of C4TargetRect instead of
C4Rect is probably outdated.
2011-03-28 18:36:16 +02:00
Günther Brammer e31e2351c6 Do not update waypoints before transfer zones
Unused variable noticed by gcc 4.6.
2011-03-28 18:38:44 +02:00
Günther Brammer 0c5f1be59d Fix network connection error messages after OSTR removal
Using const char * as an out parameter doesn't work. Finally noticed by
gcc 4.6.
2011-03-28 18:29:19 +02:00
Günther Brammer 38ee07e7fc Remove unused third StdStdBuf::ReplaceChar parameter
C4InputValidation tried to use it but obviously couldn't. Validation of
absolute windows filepaths remains as broken as before.
2011-03-28 18:27:01 +02:00
Günther Brammer 2031fb0644 Do not enumerate pointers before saving
Instead, retrieve the number on demand during serialization. This saves
lots of unnecessary code and makes serialization actually not modify the
objects. At least with the exception of nInfo, but that should be save.
2011-03-28 00:15:06 +02:00
Günther Brammer 8a17593c99 Fix StdMeshInstance deserialization
The BitfieldAdapt had a builtin default of 0 for serialization, so it needs
that default when deserializing. Also remove that builtin default.

When AnimationNodes were loaded out of order, some of them were thrown away
when their vector was shortened. Don't shorten the vector during load.
2011-03-31 01:25:27 +02:00
Günther Brammer b403fc61c1 Reduce code duplication a bit 2011-04-01 00:03:02 +02:00
Günther Brammer e6e5b801d6 Check proplist reference lists in debug builds
This should help find the next added-to-list-twice bug.
2011-03-31 22:53:07 +02:00
Günther Brammer 38e9926c12 Do not add a C4Value to a proplist reference list it already is on
This could happen when nType was PropList or Object and Type was the other.
2011-03-31 22:26:07 +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 c8ad0228b2 Store Objects in the Game.txt instead of a separate Objects.txt 2011-03-27 16:51:14 +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 5fd6770edd Re-add entry in player menu to save the game 2011-03-27 18:22:55 +02:00