Nicolas Hake
cada67c097
Prohibit overriding local vars with functions ( #1831 )
...
The old parser threw a standard compile error in this case; the
AST-based parser threw an ICE, which is ultimately the same thing but
made it sound like the parser was at fault. And maybe it is, and we
should allow code like "local a; func a() {}" but that seems like it
should be a conscious design decision.
2016-10-21 22:32:24 +02:00
Julius Michaelis
8d2f2846b5
Fix mac build
...
Also move some stuff around once again…
2016-10-21 01:25:48 +02:00
Julius Michaelis
5b7c5b48ee
Fix mape and mac build
...
Attempt #1 .
2016-10-20 20:36:52 +02:00
Julius Michaelis
34a9a1de8d
Twiddle with header organization: lib{misc,c4script} do no longer include GL/glew.h
...
(Yes, it is just that complicated.)
2016-10-20 18:46:32 +02:00
Nicolas Hake
e2fd7095c1
Merge branch 'ast'
...
# Conflicts:
# src/C4Include.h
# src/script/C4AulCompiler.cpp
# src/script/C4AulParse.cpp
# src/script/C4AulParse.h
# src/script/C4ScriptHost.cpp
# src/script/C4ScriptHost.h
# tests/CMakeLists.txt
2016-10-20 17:33:02 +02:00
Nicolas Hake
266feeda4d
Aul: Add AST generation tests
...
Just making sure the parser creates the AST the way we expect before we
hand off the code to the codegen.
2016-10-20 17:20:55 +02:00
Nicolas Hake
118961d0b7
Aul: fix octal escape parsing
...
Bet you didn't know C4Script supported octal escapes inside strings.
Well, it didn't; or at least not correctly.
2016-10-20 16:53:23 +02:00
Nicolas Hake
5915f79960
Don't entirely recreate global vars in second compile pass
...
This allows people to properly cross-reference two proplists from each
proplist's initializer.
2016-10-19 14:20:48 +02:00
Nicolas Hake
021a6e89f5
Implement direct execution of whole function definitions
...
This implements the changes made in c6e4bfd
on the AST-based parser.
2016-10-19 14:20:47 +02:00
Nicolas Hake
1a8db9e109
Make C4ScriptHost store C4Value refs to owned functions
...
C4Value already handles refcounting properly for us, so we don't need to
do it manually. It might still be worth manually refcounting them
to avoid the boxing/unboxing overhead, but it's only needed at load and
unload so it's not a priority at the moment.
2016-10-19 14:20:46 +02:00
Nicolas Hake
5f3dbdd417
Reject function expressions inside proplists inside functions
...
These aren't supported by the codegen on account of not working in
savegames.
2016-10-19 14:20:45 +02:00
Nicolas Hake
9caaf1e298
Aul: Split out error handling into a separate class for easier testing
...
By using an extern error handler in the script engine, we can mock that
handler and make sure something that should fail actually does, instead
of having to parse log messages.
2016-10-19 14:20:41 +02:00
Nicolas Hake
b2d5164a0f
Remove re namespace alias
...
This alias is a legacy from when we were using Boost.Regexp to
workaround a broken implementation in GCC's libstdc++ earlier than 4.9.
2016-10-19 13:46:03 +02:00
Nicolas Hake
a188500609
Remove MS CRT memory management debugging
...
Redefining new breaks perfectly valid code, but only on MSVC and only in
one particular configuration (Debug). This is very annoying because it
means people not using MSVC, or even people doing Release builds, can
write standards-conforming code which then may fail to build for other
people.
2016-10-19 13:46:01 +02:00
Nicolas Hake
f7a04624eb
Remove references to functions defined in unloading defs ( #1776 )
2016-10-19 13:45:59 +02:00
Nicolas Hake
ab1e6bd5a4
Allow proplist-local funcs to access vars of their owner's prototype
...
Thanks to JCaesar for providing this test case.
2016-10-19 13:45:35 +02:00
Nicolas Hake
46f342dd0c
Tests: Split test helper functions into Expr/Code/Script evaluators
...
RunExpr will evaluate and return the value of a single expression.
RunCode will evaluate a full function body.
RunScript will compile a complete standalone script and return the
return value of its Main() function.
2016-10-19 13:45:11 +02:00
Sven Eberhardt
a0580580aa
Add rdir parameter to user action object creation
2016-10-16 21:47:20 -04:00
Nicolas Hake
1b32633806
Add C4LangStringTable::system_string_table def'n to standalone stubs
2016-10-16 20:11:13 +02:00
Maikel de Vries
0d6a8497fc
allow setting the rotation of an created object in editor user actions
2016-10-16 19:59:54 +02:00
Lukas Werling
2163e27661
Add documentation for SetSky()
2016-10-16 19:41:03 +02:00
Armin Burgmeier
2362a73e60
FnSetSky: open Graphics.ocg before re-loading sky ( #1827 )
...
Needed to load shader slices in C4Sky::Init.
2016-10-16 10:04:54 -07:00
Armin Burgmeier
8f61918219
Initialize graphics when re-loading sky ( #1827 )
...
Need this so that C4Sky::Init can read the shaders.
2016-10-16 10:04:54 -07:00
Maikel de Vries
9aaec9a009
add option to door to lock it with a given key
2016-10-16 18:47:45 +02:00
Maikel de Vries
5e7ce466e1
add key object
...
Can be used to open doors, etc. Editor interactions and stuff are still on the todo.
2016-10-16 18:47:45 +02:00
Maikel de Vries
ff2c32b77e
play keypad sounds only for operating player
2016-10-16 18:47:45 +02:00
Maikel de Vries
e124433cd5
fix playing sound when trying to enter enemy door
2016-10-16 18:47:45 +02:00
Maikel de Vries
b4cdeb3da4
base material & production: add fail safes and remove entries with zero material
2016-10-16 18:47:45 +02:00
Nicolas Hake
8f47edc1e3
Fix destruction order of system string table vs. editor
...
Depending on the mood of the linker, the editor may have been
constructed before and destroyed after the system-wide string table
because they weren't defined in the same file. Destruction of the editor
tries to load some strings, which would then access the already
destroyed string table and thus crash.
2016-10-16 18:40:51 +02:00
Sven Eberhardt
24c386c67f
Editor: Fix recent scenario display on welcome page if a recent entry was opened via path including Scenario.txt
...
Always show the name of the enclosing .ocs file.
2016-10-16 09:52:48 -04:00
Sven Eberhardt
cd9d6f5c6f
Editor: Show full path name in sound delegate display string
2016-10-16 01:15:38 -04:00
Sven Eberhardt
38cf275de7
Editor: Implement saving of editable enum delegates
2016-10-16 01:12:21 -04:00
Sven Eberhardt
386f178568
Editor: Auto-focus enum child editors for int, string, color and any types
2016-10-15 18:26:03 -04:00
Sven Eberhardt
028b576ab3
Editor: Change initial tool to "object edit"
2016-10-15 11:43:55 -04:00
Sven Eberhardt
c44a776090
Editor: Fix object list update on object removal
2016-10-15 11:43:12 -04:00
Sven Eberhardt
978afbc4a2
Editor: Focus object script box on double-clicking item in object list
2016-10-15 10:39:33 -04:00
Sven Eberhardt
d24afbe835
Editor: Fix display of non-object properties
...
Fixes property display of definitions, Global and Scenario.
2016-10-15 10:06:44 -04:00
Sven Eberhardt
06a438e05e
Editor object list: Remove effects; add Global and Scenario
2016-10-15 10:06:44 -04:00
Sven Eberhardt
4b3f8c0fef
Remove EditCursorSelection and EditCursorDeselection callbacks
...
They never worked properly in network mode because all users would see the changes.
EditorProps, EditorActions and shape delegates now provide the functionality to have custom object editing widgets.
This also fixes a bug with the selection callback causing the object list to act up.
2016-10-15 10:06:43 -04:00
Lukas Werling
59b5525a41
Rework sky definition parsing
...
This also adds a broken SetSky() script function which was the main
motivation for the rework. See #1827
2016-10-15 13:34:39 +02:00
Mark
44b2fda439
Cloud: Insert snow only if allowed to
2016-10-14 18:43:35 +02:00
Sven Eberhardt
15d850e4ec
Editor: Add effects to property viewer
2016-10-14 10:50:17 -04:00
Maikel de Vries
ce92a3cc16
add floor switch object to Decoration.ocd
2016-10-13 23:11:58 +02:00
Nicolas Hake
66d5ef8b08
Reset codegen target after parsing nested function
...
Parsing a function expression inside another function failed to reset
the code generator target to the containing function, so all following
bytecode would still be appended to the nested function, leaving the
container broken.
2016-10-12 14:56:54 +02:00
Mark
0996c6e31e
Cloud: Play sound at rain impact location
...
The cloud does this with a helper object.
2016-10-11 21:51:32 +02:00
Mark
7df951fb65
Cloud: Mode without material insertion
...
Added a mode where the cloud does not extract or insert any materials, so that the rain is just a decorative element of the game.
2016-10-11 21:19:21 +02:00
Nicolas Hake
d9696d2f88
Reorder game cleanup
...
The order in which game components were cleaned up seemed rather
arbitrary, so let's change that into blocks of reasonably connected
parts.
2016-10-11 19:44:29 +02:00
Nicolas Hake
14bfd7ea59
Clear console pointers earlier
...
It doesn't make a lot of sense to keep console pointers around while the
objects and scripts have already been deleted. Clear them earlier so we
don't have any dangling pointers.
2016-10-11 19:44:27 +02:00
Lukas Werling
170a793a44
Windows: Only write to stdout if there is no debugger
2016-10-11 18:07:31 +02:00
Sven Eberhardt
510d91fd00
Editor: Allow movement of HorizontalFix items by holding Shift and on object duplication
2016-10-10 21:46:17 -04:00