Commit Graph

887 Commits (master)

Author SHA1 Message Date
Lukas Werling c9ee2c3eab Fix "no matching sound" error spam
Previously, the error message was only silenced for openclonk-server,
but appeared for openclonk if compiled without sounds.

Possible side effect: no local sounds will play if the global Sound.ocg
cannot be loaded. I don't think this is something we should support.
2019-02-20 09:36:35 +01:00
Lukas Werling 60841c1d96 Write text files with unix file endings
The old LineFeed constant caused problems with Qt. Using \n directly is
easier and I don't think there's a reason left to use \r\n anyways.
We've always converted the files in the repository. Nowadays, even
notepad.exe works with unix file endings.
2019-02-19 15:28:12 +01:00
Lukas Werling ee35d256aa Add basic character classes to WildcardMatch() 2019-02-03 19:14:53 +01:00
Nicolas Hake 8298813a90 CMake: Remove <direct.h> test
We're not using the <direct.h> header anywhere besides including it
for no purpose, so we can drop the test (and the inclusion).
2018-12-31 12:20:39 +01:00
Lukas Werling ca11d86893 Add missing include guards
These are necessary for unity builds.
2018-10-14 23:15:01 +02:00
Lukas Werling 82a43b7cd9 Disable broken console input on Windows
C4StdInProc blocks on read() on Windows, stopping everything.
2018-03-07 15:27:51 +01:00
Lukas Werling 55a81ea76a Launch editor via argv[0] on Unix systems without /proc/self/exe (#1999) 2018-02-17 12:57:43 +01:00
Lukas Werling 9855f9355e Autodetect "/proc/self/exe"-equivalent on FreeBSD (#1999) 2018-02-17 12:41:16 +01:00
Julius Michaelis a130f59f54 Fix mac build likely broken in 13f082e8c8. (Attempt 1) 2018-02-12 11:28:14 +01:00
Julius Michaelis 9d61cc9bc9 Fix Mac build broken in b11564168, attempt 2 2018-01-19 13:01:26 +01:00
Julius Michaelis 914d3798a4 Addedum to the control fixes in b11564168 (#1693, #1982):
- Allow configuring keyboard keys with modifier keys
 - Allow using Alt as a key in game on linux
   (I'm still puzzled why only Ctrl and Shift where implemented in so many places)
 - Adjust the deserializer and PlayerControls.txt to match the serializer for mouse keys
 - Refactor C4PlayerControl::DoMouseInput a little bit
 - Try to fix the Mac build (attempt 1)
 - Fix a bug in C4KeyCodeEx::CompileFunc where it set an incorrect KeyComboItem::sKeyName
 - Fix(?) StdCompilerConfigRead not doing anything on NoSeparator
2018-01-19 11:23: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 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 a630d2b94b Silence "Warning: could not find sound matching '...'" in openclonk-server 2017-08-26 10:56:14 +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
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
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
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
Sven Eberhardt 52caf696e6 Fix crash on network join in Win32 scheduler 2017-03-27 19:55:56 -04:00
Sven Eberhardt 66117de82f Fix Windows config writing of custom key overloads 2017-03-26 20:55:27 -04:00
Nicolas Hake 9f7128a60e StdCompiler: Add override specifiers 2017-03-24 08:52:32 +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 78b43e2182 StdCompiler: Add support for std::string 2017-03-23 16:35:25 +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 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
Julius Michaelis 5ad6012a3f Silence warning on switch over sdl scancodes 2017-02-21 19:37:20 +01:00
Nicolas Hake 561e083181 Win32: Fix build with MSVC's Clang-based toolset
Well, somewhat. I can't get Clang/C2 to build Qt so I can't build OC
with Qt support.
2017-01-07 13:41:47 +01:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Julius Michaelis 9ab410e47d SDL: Notify C4Application of resolution / window size changes. 2016-10-29 14:15:09 +02:00
Nicolas Hake bce0b45413 Editor: Fix scheduler timer so it doesn't busy wait (#1834)
36/1000 is always 0 and doesn't make a lot of sense anyway. Use 1000/36
(aka 1000ms/36fps) instead so the UI thread has some time to rest.

Also use a Qt::PreciseTimer so Qt doesn't try to coalesce the scheduler
timer with other timers to save energy.
2016-10-28 21:31:14 +02:00
Julius Michaelis 376ca5a9df Prevent using USE_CONSOLE in lib{misc,c4script} 2016-10-22 17:42:23 +02:00
Lukas Werling 4d5bb7304c Fix game controllers not working with the editor 2016-10-10 14:16:18 +02:00
Armin Burgmeier 561651b715 Fix issues with resolution switching on Linux
* Engine would always open up in Fullscreen and then switch to Windowed
   instead of just starting up as Windowed.

 * Could not change resolution because bit depth or refresh rate did not match
   * handle RefreshRate==0 as "any", just like windows

   * Remember refresh rate in combo box that enumerates all the modes and
     propagate to video mode setting instead of assuming all modes have the
     same refresh rate.

   * Report bit depth as 32 even if SDL tells us it's 24. Other parts of the
     code require it to be equal to 32, but 24 works just fine.

 * Changing from fullscreen to windowed when "Screen" was selected in
   resolution combo box (i.e. iXRes==-1) makes the window tiny (0x0 pixels).
2016-10-05 21:38:46 -07:00
Armin Burgmeier 25b1a49543 Set last error when setting resolution fails
The last error is displayed in the GUI, so until now there was just a "(null)"
string there.

The whole (SDL) resolution switching code is completely broken as well, but
that's a different story...
2016-10-03 22:39:46 -07:00
Armin Burgmeier 732fff3029 Fix possible use of uninitialized variables
For example, creating a C4WindowSDL and deleting it without calling
::Init() on it would lead to use of uninitialized variables.
2016-09-27 21:52:55 -10:00
Sven Eberhardt 856730aabd Fix some signed/unsigned warnings 2016-09-07 01:53:54 -04:00
Lukas Werling 2044fc3c06 SDL: Fix wrong keyboad button labels 2016-08-20 23:16:31 +02:00
Lukas Werling 26a552473c Add support for two extra mouse buttons (#mantis-is-down-right-now)
This also fixes a missing definition for "MiddleDouble". Only
implemented for SDL and Qt, someone else will have to do Windows.
2016-08-18 22:43:42 +02:00
Lukas Werling abef0da0aa Fix RestartApplication on Linux
(and hopefully don't break it on Windows)
2016-08-11 22:11:15 +02:00
Sven Eberhardt 4869eff787 Allow joining to editor games through startup network dialogue 2016-08-10 19:35:39 -04:00
Lukas Werling ec128bede4 Qt editor: Fix freeze during lobby and loading on Linux 2016-08-08 17:24:44 +02:00
Sven Eberhardt c78a98d4b3 Fix crash on uninitialized pointer in Qt GL window initialization 2016-08-06 15:22:58 -04:00
Lukas Werling b7359e0c27 Remove the GTK platform (USE_GTK)
The GTK code does not work with the Qt editor. The simpler SDL2 platform
does, so we have little reason to keep the GTK code.

Note that GTK is still a dependency for mape.

Discussion: http://forum.openclonk.org/topic_show.pl?tid=3328
2016-08-03 16:25:46 +02:00
Lukas Werling 582c82c159 Qt editor/Linux: Fix crash on player removal
See 69fff71abf
2016-08-01 13:54:35 +02:00
Sven Eberhardt 69fff71abf Qt editor: Fix crash on player removal 2016-07-31 23:22:09 -04:00