Commit Graph

4349 Commits (master)

Author SHA1 Message Date
Lukas Werling 3f48488fef Add Fulgen's real name to credits 2017-12-22 18:08:25 +01:00
Lukas Werling 585eb7db6d Fix C4LogBuf breaking lines within markup
In a text line containing <c ff0000>markup</c>, C4LogBuf would
occasionally split the line after <c, producing broken markup.
Additonally, markup spanning multiple lines would always stop at the end
of the first line.

With this commit, lines are never broken within tags and any unclosed
tags are repeated on the following line.
2017-12-21 22:57:52 +01:00
Lukas Werling e83ca471c0 Render (updated) credits with C4GUI 2017-12-21 22:57:37 +01:00
Lukas Werling 3b358e0a98 Fix condition in font loading code
This was inherited from CR.
2017-12-21 22:57:37 +01:00
Julius Michaelis 99fe7a1a2c Use Reloc.Open for Origin entries in Scenario.txt (#1966) 2017-12-21 16:39:15 +01:00
Lukas Werling 298feab441 Change netpuncher protocol to be more extensible
- Each packet has a version field.

 - Clients connecting to the netpuncher always send a request packet.
   This allows the netpuncher to react differently depending on the
   client's version.

 - Encode packets as binary instead of ASCII. This allows adding fields
   while maintaining compatibility.
2017-12-14 17:22:38 +01:00
Lukas Werling 3476d76e61 C4NetIOUDP: Fix sending data before ConnOK
With my fix from 9eb2478b2 ("C4NetIOUDP: Fix timeout during non-MC
connection"), C4NetIOUDP would send data packets to the master server
before the ConnOK packet. The server would then discard these data
packets, resulting in a one-second delay until retransmission.
2017-12-14 14:35:07 +01:00
Julius Michaelis be10e95698 Prevent SEGV on duplicate material names with different case (#1359) 2017-12-10 15:09:51 +01:00
Julius Michaelis d94dcc8267 Fix iLevel parameter of SoundAt (#1681) 2017-12-05 16:57:14 +01:00
Julius Michaelis 1ca46c80ad Poll for stdin close in C4StdInProc 2017-12-05 04:13:28 +01:00
Lukas Werling 9eb2478b2c C4NetIOUDP: Fix timeout during non-MC connection
The "normal" connection process is a three-way handshake (Conn->,
<-Conn, ConnOK->). When establishing a multicast connection, this
handshake is repeated via the MC address. However, the code always
expected that second handshake to happen and thus ran into a timeout on
the client in the non-MC case, repeating the handshake a second time. In
the end, it usually still worked as the server supports reconnecting,
but packets may be lost in the process.
2017-12-02 18:52:10 +01:00
Lukas Werling 2d4934e4dd Fix C4NETIO_DEBUG 2017-12-02 18:52:10 +01:00
Lukas Werling be9d3032e2 Add ExecutePXS script function
Before commit 5a652f23e ("Fix missing C4PXSSystem::Clear
implementation"), ChristmasIce would keep all snow PXS between scenario
section changes. That looked pretty neat, so I'm introducing this script
function to allow properly implementing it.
2017-11-12 22:00:52 +01:00
Lukas Werling 5a652f23ef Fix missing C4PXSSystem::Clear implementation
On scenario section change, the old PXS would continue to exist.
2017-11-12 11:57:41 +01:00
Maikel de Vries a9675eafa3 perform callbacks when moving contents when container is removed (#1950) 2017-11-11 09:12:46 +01:00
Lukas Werling 3cce9f44c7 Fix another preprocessor conditional for MinGW 2017-11-09 09:33:29 +01:00
Lukas Werling cfee39bbe5 Fix preprocessor conditional for Windows(/MinGW) 2017-11-08 22:29:38 +01:00
Lukas Werling 739de3f6c8 Fix log file permissions on Linux 2017-11-08 20:21:25 +01:00
Lukas Werling 587f5b5f0e Simplify C4PXSSystem
The old system allocated chunks of PXS on demand. I can't think of a
good reason to do this.

The savegame format changes slightly to not require saving full chunks,
however old savegames will still load fine (invalid PXS within chunks
are moved out during the next Execute() call).
2017-11-08 17:33:35 +01:00
Lukas Werling 607e8873e5 Fix landscape diff application (GH-58)
Savegames with a foreground material diff but no background material
diff would not apply the foreground diff at all. As the background
material rarely changes, this broke runtime joining for most scenarios.
2017-11-08 11:34:58 +01:00
Lukas Werling 1182e5ebd5 Don't truncate the log file while checking flock 2017-11-08 00:23:44 +01:00
Lukas Werling 60692c793d Fix assertion failure when joining with openclonk-server 2017-11-05 22:23:38 +01:00
Clonkonaut cc163b21b0 New engine recognised property: MaterialIncinerate.
Objects will be incinerated by incendiary material (which before was only possible by using ContactIncinerate).
local MaterialIncinerate = true; - object will burn in lava not from other burning objects.
2017-11-01 00:49:26 +01:00
Lukas Werling b94c3757a6 Fix water sliding on lava (#1946) 2017-10-14 17:46:04 +02:00
Lukas Werling 1541bf62c1 Fix buffer overrun in RealPath
This usually isn't an issue, but is caught by -fcheck-pointer-bounds.
2017-09-17 18:51:41 +02:00
Julius Michaelis 94394c2e2a Fix some valgrind warnings and a leak in openclonk-server 2017-09-01 15:59:46 +02:00
Julius Michaelis a630d2b94b Silence "Warning: could not find sound matching '...'" in openclonk-server 2017-08-26 10:56:14 +02:00
Julius Michaelis ef1c275227 Better error messages for non-constant expressions in 'static const' declarations
cf. #1922
2017-08-26 10:39:38 +02:00
Julius Michaelis e4adb0fd76 Fix StdCompilerINIWrite/19c1badfa 2017-08-25 15:10:28 +02:00
Julius Michaelis 19c1badfa6 Fix StdCompilerINIWrite/08714a67f 2017-08-24 16:40:05 +02:00
Kanibal e727d35202 Share time information (frameCounter and realtime) with landscape shaders 2017-08-23 23:53:55 +02:00
Kanibal c1143a2e51 Add remaining glUniform-functions 2017-08-23 23:53:55 +02:00
David Dormagen 6fa13d8717 C4TimeMilliseconds: fixed comparison & stopped reloading shaders every frame
Imagine lhs being 0 and rhs being more than int32_t can handle. And then imagine subtracting them and casting them to int32_t.
That's what happened e.g. in void C4ShaderCall::Start() when ScriptShader.LastUpdate was 0. This caused the shaders to reload every frame;
at least when in the main menu. This lead to serious lagging (of the cursor) for me.

Note that the subtraction operator in C4TimeMilliseconds.cpp has a similar issue. This might need a fix or at least high awareness by users. Maybe an assert or something.

PS: Who thought that doing the comparison with a subtraction was a good idea? This is not assembler :I
2017-08-15 10:04:54 +02:00
David Dormagen 8d1aa0c0c2 DirectoryIterator: only append DirectorySeparator if necessary 2017-08-15 10:04:46 +02:00
Julius Michaelis 08714a67f8 Mess up StdCompilerINIWrite in an attempt to fix #1921 2017-08-15 05:50:38 +02:00
Maikel de Vries efe7dcf251 add Find_Cone to find objects in a cone
The reason for an engine function for this is speed, an implementation in script needs Find_Func and ensures slowness.
2017-07-19 22:04:43 +02:00
Maikel de Vries 0d58380dbf unify two implementations of Angle in the engine
There seems to be no reason to have two different implementation and the one in FnAngle seemed the most sane and complete one.
2017-07-19 22:04:43 +02:00
Nicolas Hake e5b15a494c Drop C4AulParSet defaulted ctor
Having the ctor defaulted confuses MSVC 2015 and makes it not use the
templated ctor below even for calls with a parameter list,
thus skipping required initialization.
2017-07-18 02:24:04 +02:00
Maikel de Vries f5f8b18204 remove unused AttractLightning defcore entry
Not used in either the engine or in script, script implementation of lightning can use a script defined property.
2017-07-15 14:00:19 +02:00
Maikel de Vries 4a093b747e remove unused FireTop defcore entry
This has been obsolete since fire is implemented in C4Script.
2017-07-15 13:40:37 +02:00
Sven Eberhardt 856dfc9aa9 Fix duplicate editor action buttons #1884 2017-07-11 21:25:08 -07:00
Sven Eberhardt 0c50e81413 Scenario list loader: Ignore .ocd and .ocg files when looking recursively for scenarios 2017-07-11 20:45:57 -07:00
Sven Eberhardt 17153c6fbe Show currently loaded item in gray while loading scenario list for scenario selection 2017-07-11 20:45:19 -07:00
Sven Eberhardt aa7c964fab Ignore main exe path for group loading when loading data from planet/ subfolder
This fixes a slowdown in scenario selection when some of the dependency folders (e.g. qt) are searched for scenarios.

Should also fix a bug where music is loaded from the exe path instead of planet/ if present
2017-07-11 20:43:21 -07:00
Sven Eberhardt 8dffeadc56 Fix slowdown during startup scenario list loading #1721
(the one that could be averted by wiggling the mouse)
2017-07-11 18:24:14 -07:00
Sven Eberhardt a74dcc5450 Editor: Support localized definition group folder names (from Title.txt) 2017-05-27 16:30:59 +09:00
Tushar Maheshwari a661eab867 Automatic fixes using clang-tidy for header files
A follow-up on a previous PR GH-41. The discussion in the forum can be
viewed at http://forum.openclonk.org/topic_show.pl?pid=33086.
Run clang-tidy (without auto, pass-by-value and using checks) to fix the
header files not modified in the previous PR.

Summary of the changes:

 - C++11 member initialization.
 - nullptr instead of 0 for pointers.
 - override for functions declared virtual in base class.
 - default trivial special member functions
2017-05-15 13:46:46 +02:00
Tushar Maheshwari 3a4f49ad90 Revisit #includes
Consolidate the include statements scattered across the code in accordance
with the comment in C4Include.h. The advantages are listed in the same
comment.
Furthermore, it follows llvm-include-order which is the logical
extrapolation of the project's style guideline wherever possible
(C4Include.h being the most-frequent exception).
2017-05-15 13:24:59 +02:00
Sven Eberhardt 041e562542 Add HorizontalFix and VerticalFix support for "point" editor property delegate 2017-05-10 18:42:56 -04:00
Lukas Werling 15e5857689 Change alut includes to <AL/alut.h>
Alut's pkg-config definition only adds the top-level include directory
containing the AL directory to the include paths. This works on most
platforms because OpenAL adds that AL directory. However, with nix,
these two directories are distinct and the build fails.
2017-05-10 23:23:09 +02:00
Sven Eberhardt 1b4fd9abe3 Editor: Add translation overview table (Tools menu) 2017-05-09 22:43:56 -04:00
Sven Eberhardt 3289068ee0 Move C4PropertyPath class into its own files 2017-05-09 22:43:06 -04:00
Sven Eberhardt 94669cebe4 Merge branch 'master' of ssh://git.openclonk.org/openclonk
Conflicts:
	src/editor/C4ConsoleQtPropListViewer.cpp
2017-05-07 15:16:01 -04:00
Sven Eberhardt 9eedfe268c Editor: Reduce size of string localization button 2017-05-07 15:02:09 -04:00
Sven Eberhardt 206451eb6b Add prototype in proplist string and JSON serialization 2017-05-07 14:27:19 -04:00
Sven Eberhardt 4fac960cf4 Editor: Add localized string support 2017-05-07 14:26:30 -04:00
Tushar Maheshwari e58a7884e4 Automatic fixes using clang-tidy
See http://forum.openclonk.org/topic_show.pl?tid=3376 for discussion.

Close GH-41
2017-05-03 20:30:45 +02:00
Nicolas Hake 33a0b41179 Trans_Rotate: disallow rotation around null vector (#1908)
Trans_Rotate will now raise at runtime if the user tries to generate a
rotation matrix around a null vector instead of crashing with #DE.
2017-04-29 14:45:10 +02:00
Nicolas Hake 95c31df9e9 Fix assertion-enabled build 2017-04-19 10:32:34 +02:00
Nicolas Hake c41bd063bd Stop disabling debugrec code by preprocessor
The optimizer is going to remove dead code anyway, and has the
additional advantage of doing syntax checking, so the code won't
silently break when someone changes something.
2017-04-19 09:47:21 +02:00
Nicolas Hake 81e49fe0f5 Fix several broken conversions from C4Fixed->bool->int (#1904)
This is why non-explicit operator bool is bad.
2017-04-19 09:24:27 +02:00
Nicolas Hake fc1a7a59c8 Use C4Real instead of C4Fixed where representation is irrelevant
While C4Real is just a typedef for C4Fixed, it signifies more clearly
that we don't care about the memory representation at the point of use.
2017-04-19 09:14:39 +02:00
Nicolas Hake bc5df7f35b CMake: Add date of commit to logfile
But only if the build is from a clean index. Otherwise, the logfile will
contain the date of build.
2017-04-12 12:34:36 +02:00
Nicolas Hake b87f8e3f47 C4Script: Add ParseInt function
ParseInt() will take a string parameter and try to convert it into an
integer. If the conversion fails, it returns nil.
2017-04-11 14:21:25 +02:00
Lukas Werling 5719524241 Move C4AchievementGraphics to its own file
Scenario parameters are useful in a script-only context (such as the one
mape uses). C4AchievementGraphics introduces a dependency on C4Surface
which isn't available in that context.
2017-04-03 11:55:22 +02:00
Julius Michaelis 97bdddba24 Fix strict aliasing violation, make C4Real pass is_pod 2017-04-03 11:14:27 +02:00
Lukas Werling f03a1d618d Use average texture color for BMP palette
Previously, it would just use first pixel of the texture image. With our
current textures, this is a pretty bad approximation. For example,
firestone ends up yellow rather than red.

Additionally, this helps tools like mape/ocmapgen which do not load any
texture graphics but just set the texture's average color.

This also fixes the sky color which was previously overwritten.
2017-04-01 20:20:10 +02:00
Sven Eberhardt 52caf696e6 Fix crash on network join in Win32 scheduler 2017-03-27 19:55:56 -04:00
Sven Eberhardt bcecff2811 Fix BOOL->bool conversion 2017-03-26 21:20:39 -04:00
Sven Eberhardt c300c79cc7 Fix Windows saving of keyboard config if custom assignments are deleted (hack) 2017-03-26 21:19:58 -04:00
Sven Eberhardt 66117de82f Fix Windows config writing of custom key overloads 2017-03-26 20:55:27 -04:00
Sven Eberhardt 83af5ad794 Fix a script reload bug
Thawing needs to catch some of the deeper nested proplists because they are modified in the EditorProp initialization Definition()-callbacks.
2017-03-26 13:31:55 -04:00
Nicolas Hake 48513291e7 C4ConsoleQtNewScenarioDlg: Avoid std::string conversion ambiguity 2017-03-24 09:08:47 +01:00
Nicolas Hake 9f7128a60e StdCompiler: Add override specifiers 2017-03-24 08:52:32 +01:00
Nicolas Hake b312ec96b4 StdCompiler: Add CompileFunc for std::string
Somehow, MSVC seems to synthesize a CompileFunc for std::string??
2017-03-23 22:31:40 +01:00
Nicolas Hake c56bc4193e Replace InterlockedFoo by std::atomic
Atomic increments/decrements are part of C++11, so we don't need to use
or implement InterlockedWhatever anymore.
2017-03-23 17:03:16 +01:00
Nicolas Hake 007a05468e C4Scenario: Remove fixed char buffers 2017-03-23 16:35:25 +01:00
Nicolas Hake 78b43e2182 StdCompiler: Add support for std::string 2017-03-23 16:35:25 +01:00
Lukas Werling 19b00b7862 Use backward-cpp on Linux for nicer stack traces 2017-03-21 20:17:55 +01:00
Lukas Werling 22161ae561 Client: Send netpuncher request as soon as possible
Previously, the SReq packet would only be sent after receiving an
ID from the netpuncher. Instead, we can send the request as soon as the
C4NetIOUDP connection setup finishes.
2017-03-21 17:14:33 +01:00
Lukas Werling d4bb760b17 Move OnPuncherConnect to C4Network2
All the other puncher handling functions are there as well.
2017-03-21 17:14:33 +01:00
Lukas Werling 9b61ba468d Fix JSON serialization of proplists within arrays 2017-03-18 00:26:58 +01:00
Lukas Werling 8ca3801741 Do the initial client->host connection in stages
With the IPv6 support, hosts now often list around 20 addresses.
However, most of these are local only and thus rarely result in a
successful connection. With the introduction of address sorting in
7d5596220 ("Sort addresses used for initial host connection",
2017-02-26), the connection succeeds with the first few addresses most
of the time.

This commit changes the initial connection process to start with only
the first four addresses. After 100 ms, it proceeds with the next four
addresses and so on. This should reduce the packet volume significantly
as the connection should be established after only one or two steps.

We may want to tweak the parameters if this turns out to make joining
slower in practise. In a "normal" setup, the first four addresses should
be the IPv6 privacy and stable addresses, and the next four addresses
should include the IPv4 addresses from masterserver and netpuncher.
100 ms are long enough to get an answer from the host and short enough
to not bother the player too much.
2017-03-17 23:02:45 +01:00
Nicolas Hake 7f2cce6f79 Fix WITH_AUTOMATIC_UPDATE, non-Windows platforms 2017-03-16 23:18:38 +01:00
Nicolas Hake a151ac12de C4Application: Remove StdStrBuf 2017-03-16 19:13:06 +01:00
Nicolas Hake d6c9a11678 StdRegistry: Remove unused support for separated config values
The config read/write code never uses StdCompiler::Separator. Removing
support for it from StdRegistry makes the code simpler.
2017-03-16 18:51:16 +01:00
Nicolas Hake 22f42123e8 C4AbstractApp: Remove StdStrBuf 2017-03-16 18:51:16 +01:00
Nicolas Hake c5ed6e7dc8 Move strprintf to Standard
strprintf works like asprintf, except it returns a std::string.
2017-03-16 18:51:16 +01:00
Nicolas Hake f9d78b8629 Win32: Add LPCWSTR->std::string conversion helper 2017-03-16 18:51:16 +01:00
Julius Michaelis 183c6e076f silence 'could not connect to' spam in lobby 2017-03-14 22:49:35 +01:00
Nicolas Hake ed193a0715 Aul: use %u instead of %zu for parameter indexes
MinGW uses an ancient version of the CRT, which doesn't support the z
modifier for integer types in printf. Use %u instead and cast to
unsigned.
2017-03-14 00:45:27 +01:00
Nicolas Hake dc6804c12d Aul: Fix invalid_escape_sequence warning message
The message used a %s where a %c was correct, and therefore tried to
access invalid memory.
2017-03-14 00:28:41 +01:00
Sven Eberhardt be66da2c7b Fix editor network join on Windows 2017-03-11 15:10:25 -05:00
Sven Eberhardt 5dfd723708 New scenario dialogue: Redraw definition list after template changed 2017-03-11 14:30:46 -05:00
Nicolas Hake 41f4779d74 StdCompiler: Use terms "Serializer" and "Deserializer"
Instead of "Compiler" and "Decompiler", which make me look up what's
even going on each time I see them, use the standard terms "serializer"
and "deserializer".
2017-03-11 15:05:41 +01:00
Nicolas Hake e3d6486f2a Move GetRelativePath to C4Language
C4Language is the only consumer of GetRelativePath. It cannot handle
arbitrarily sized paths, so discourage new code from using it by moving
it to C4Language.cpp.

Also remove the buffer size parameter which was always defaulted anyway
and use template parameter deduction to always get the correct size.
2017-03-11 13:47:18 +01:00
Nicolas Hake d9f9d9ba38 C4MapCreator: Remove unused optional parameter
No code called C4MapCreator::Create with the fLayers parameter omitted
or set to false, so we can just remove it.
2017-03-11 11:35:33 +01:00
Nicolas Hake 6386621a4a Mark an unchanged parameter as const
Fixes build on standards-compliant C++ compilers.
2017-03-11 11:35:32 +01:00
Sven Eberhardt 6937969175 Force pre-select definitions specified in [Definitions] section of editor template c4s (#1898) 2017-03-11 00:13:49 -05:00
Lukas Werling 2c3a770415 Fix crash on invalid Editor.geometry (#1897) 2017-03-10 22:02:32 +01:00
Maikel de Vries 0d7c8aacca adjust moveto command to make the clonk move while jumping 2017-03-07 20:20:59 +01:00
Nicolas Hake c8d37a5346 C4DrawT: Remove unused functions, add override specifiers 2017-03-05 12:41:51 +01:00
Lukas Werling 3ebedd0c5f Rank private/UL addresses lower than global ones
Also adds some tests. Yay tests!
2017-02-28 22:15:29 +01:00
Lukas Werling d7e71d8362 Double the maximum address count to accomodate IPv6
With the addition of IPv6, some computers with lots of addresses are
reaching the old address limit of 20 addresses. We'll have to see how
this works out in practise. Maybe we'll have to do the connection in
stages to prevent sending out too many packets at once (like only
connecting to the first five addresses initially, then after a timeout
the next five, and so on).
2017-02-27 22:52:24 +01:00
Lukas Werling aa5f5cd654 Convert IPv4-mapped IPv6 peer addresses to IPv4
This avoids duplicating these addresses when broadcasting them.
2017-02-26 23:36:32 +01:00
Lukas Werling 7d55962208 Sort addresses used for initial host connection
Computers with multiple (possibly virtual) network adapters can have
tons of link-local fe80::/64 IPv6 addresses. Connections to those hosts
would run into a timeout before getting to public addresses behind the
link-local ones.

By sorting the address list, we can prioritize public IPv6 addresses if
supported by the client, then try IPv4 before working through the swamp
of link-local addresses.
2017-02-26 23:36:32 +01:00
Sven Eberhardt c8aa5fff8f Fix missing return value in C4PropertyDelegateFactory::PasteFromClipboard 2017-02-26 11:00:20 -05:00
Sven Eberhardt 5032e61dea Editor: Add OnUpdate to all delegates and EditorPropertyChanged callbacks to selected root object 2017-02-26 10:53:59 -05:00
Sven Eberhardt 750d9dafb9 Remove positional parameters in aul compiler warning strings
Feel free to revert this commit when windows autobuilds are no longer done using mingw
2017-02-24 21:42:25 -05:00
Lukas Werling d8e0b33192 Put scenario parameters in SCENPAR proplist 2017-02-21 21:14:43 +01:00
Julius Michaelis 5ad6012a3f Silence warning on switch over sdl scancodes 2017-02-21 19:37:20 +01:00
Julius Michaelis d81a7f10e3 Silence a lot of inconsistent-missing-override warnings 2017-02-21 19:03:46 +01:00
Julius Michaelis 5f1ad6a5d7 Travis: fancy stuff
- gtest
 - colors
 - container based builds and GCC PCH (for a faster: "you failed")
2017-02-21 17:13:18 +01:00
Sven Eberhardt 9abb0bc200 Fix drawing of editor shape delegate polylines with settings StartFromObject=true and Relative=false 2017-02-20 22:25:28 -05:00
Sven Eberhardt 198d11427d Fix crash on script error outside function [Knueppel-crash] 2017-02-20 18:45:11 -05:00
Sven Eberhardt e3eec21271 Editor: Add arrow drawing option to polyline delegate 2017-02-20 14:05:24 -05:00
Sven Eberhardt 294b679961 Editor: Add StartFromCenter option to polyline delegate 2017-02-20 13:39:46 -05:00
Sven Eberhardt cc0371bdf5 Add PIF_NoScenarioSave option to script players 2017-02-20 13:39:11 -05:00
Sven Eberhardt 6579798907 Add editor enum option to force value serialization on foreign values 2017-02-19 20:36:40 -05:00
Sven Eberhardt 69b0fd4f1a Do not call InitializePlayers after script player join if no human players joined 2017-02-19 20:36:40 -05:00
Nicolas Hake 168824a603 Win32: Use _vsprintf_p instead of v(a)s(n)printf (#1892)
This makes it possible to use positional parameters in format strings on
all platforms.
2017-02-19 12:57:27 +01:00
Sven Eberhardt a7bbda4ca1 Fix order of InitializePlayer(s) callbacks in non-network games with teams enabled [Luchs] 2017-02-18 18:26:21 -05:00
Lukas Werling a4492dd828 Fix double escaping of Statistics JSON
As newlines are already escaped in the JSON, this is safe.
2017-02-18 19:08:15 +01:00
Lukas Werling 87ee44964c Send script-defined statistics to the masterserver
After GameOver(), the global function CollectStatistics() is called
which in turn calls CollectStats() on all definitions and the Scenario.
The results are collected into a proplist and sent to the masterserver
as JSON.

The intended purpose is to collect statistics like weapon kill counts
and evaluate them across all online games to improve balancing.
2017-02-17 23:29:16 +01:00
Lukas Werling ee0b1c2599 Implement JSON serialization for C4Value 2017-02-17 23:29:01 +01:00
Nicolas Hake 78bbbc917b Fallback to sane settings when compiling scripts without ScriptHost
Compilation without an associated ScriptHost happens in a call to eval,
in which case we'll fall back to the default warning settings (because
we don't have a location which we could get settings from).

Fixes #1891.
2017-02-16 19:32:42 +01:00
Lukas Werling 181f7ab471 Prefer public/stable IPv6 source addresses
We don't benefit at all from privacy addresses as we're publishing all
local addresses in any case. By preferring stable addresses, we can
avoid reconnection issues after the preferred address changes.

This API is defined in RFC5014, but apparently only implemented in
Linux.
2017-02-14 21:44:05 +01:00
Nicolas Hake 1594acd3ed Aul: Warn if a function parameter shadows a local variable
Yeah. Aul looks up function parameters before local variables when
trying to resolve an identifier. Usually this doesn't matter, but you'll
notice it if you have a local variable and a parameter with the same
name, because the variable should be initialized to nil yet you get the
value of the parameter.
2017-02-13 17:20:03 +01:00
Nicolas Hake 2b5d34f420 Aul: Remove unnecessary virtual dtor from Script node
The dtor (which didn't even do anything) broke testing on g++ and clang,
because they correctly delete some ctors if the dtor is declared.
2017-02-13 15:23:51 +01:00
Nicolas Hake 30c5bb5f8d Aul: Allow the user to selectively enable/disable warnings
This commit introduces a new Aul directive "#warning", which can be used
to enable or disable warnings for a particular piece of code.

"#warning enable" enables all warnings.
"#warning disable" disables all warnings.
"#warning enable empty_parameter_in_call" selectively enables one
specific warning while not affecting any other.

All warnings that used to be controlled by Developer.ExtraWarnings
remain disabled by default.
2017-02-13 15:07:50 +01:00
Nicolas Hake 23bf3c4f0a Aul: Don't explicitly prepend "ERROR" to runtime errors
Since the error handler would itself prepend "ERROR", runtime errors
used to be written as "ERROR: ERROR: <whatever>".
2017-02-13 15:07:50 +01:00
Nicolas Hake a026bda561 Aul: Let error handler count warnings and prepend severity
Instead of explicitly writing to the log, let C4AulParse and
C4ScriptHost warnings go to the error handler to do with as it sees fit.
2017-02-13 15:07:50 +01:00
Nicolas Hake 5f520c6326 C4AulCompiler: Don't double-count compile time warnings 2017-02-13 15:07:50 +01:00
Sven Eberhardt 2b888fd136 Enlarge initial client connection dialogue to accommodate long ipv6 addresses 2017-02-12 11:48:55 -05:00
Sven Eberhardt 22306bd266 Editor: Add templates for new scenarios 2017-02-05 16:08:29 -05:00
Nicolas Hake a33d98ee71 Aul: Warn on empty controlled statement
Aul will now emit a warning if you type something like
    if (...); return true;
(note the semicolon right after the condition). It will also warn on an
empty 'else' branch. If you actually intended to have a no-op there, use
an empty block '{}'.
2017-02-05 14:17:37 +01:00
Nicolas Hake 9a201441d5 Mat insertion: Fix broken conditional 2017-02-05 13:51:04 +01:00
Nicolas Hake 9bddba53df Improve CStdStream const correctness 2017-02-05 13:26:24 +01:00
Nicolas Hake b0898f4e1a C4Group: Pull most the data members out of the header 2017-02-05 13:26:23 +01:00
Nicolas Hake bcbd368ffd C4Group: Rename "Status" enum to "SourceType" 2017-02-05 13:20:18 +01:00
Nicolas Hake 71f8cb0699 C4Application: Remove unused flag IsInGameTick 2017-02-05 13:20:18 +01:00
Lukas Werling 487fcc362d Linux: Read IPv6 addresses from /proc/net/if_inet6
In contrast to getifaddrs(), /proc/net/if_inet6 allows filtering
deprecated privacy addresses. As these addresses generally won't be
useful for new connections, there's no reason to include them and they
only cause unnecessary connection attempts.
2017-02-02 22:23:12 +01:00
Maikel de Vries 4d6be35c32 allow script players to join in network rounds (#1885) 2017-02-02 21:47:56 +01:00
Julius Michaelis 80c07d34e4 Add [Landscape] Secret to Scenario.txt to default-disable black NO_OWNER viewports
Related to: c569036d1d
2017-01-24 18:50:30 +01:00
Lukas Werling 459adbd199 Fix local network discovery on Windows (#1886)
On Windows, we cannot resolve addresses using getaddrinfo() before
initializing Winsock. By storing the address as string, the address
parsed later on.
2017-01-21 16:03:03 +01:00
Lukas Werling ef4f1d9231 Merge branch 'ipv6' 2017-01-18 21:59:16 +01:00
Lukas Werling e3a0f2f8b5 Implement Happy Eyeballs for C4Network2HTTPClient
This should make masterserver requests more reliable for users with a
bad IPv6 connection.

See RFC6555
2017-01-18 21:55:17 +01:00
Lukas Werling 894edfce5b Allow adding connections from other addresses
Forcing a static address does not work for IPv6 where everyone has
multiple addresses that change over time. For example, adding a new
connection would fail if the preferred privacy address changes during
a game.
2017-01-18 21:55:17 +01:00
Lukas Werling 6677295bac Serialize addresses in UDP connection packages
The previous approach of just embedding the raw struct fails miserably
when trying to transfer AF_INET6 across platforms.
2017-01-18 21:55:17 +01:00
Lukas Werling 6af32a7c46 Fix IPv6 sockets on Windows not being dual-stack
On Linux, all IPv6 sockets are dual-stack per default; on Windows, they
are not. It's still a good idea to set the option on Linux as well as
the default value can be changed.

When connecting via TCP, C4NetIO still creates IPv4 sockets, so no dual
stack option is required there.
2017-01-18 21:54:50 +01:00