Commit Graph

4349 Commits (master)

Author SHA1 Message Date
gitMarky 4a2048575f Refactor movement code (#87)
Improve readability by adding appropriate parentheses and braces, and fixing misleading/confusing whitespace. Extract SolidMask removal to a function since it's used in several places.
2019-03-05 21:15:39 +01:00
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 319dc87eea Remove #undef new/delete before Qt includes
This has not been necessary anymore since a1885006 ("Remove MS CRT
memory management debugging").
2019-02-19 15:35:00 +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
Nicolas Hake a0c9bfd931 Aul: Correctly check for enable/disable keywords in warning pragma
The parser was only checking that the passed setting matched the
beginning of the expected keyword, instead of checking for the full
length. This way, users could write "#warning e" instead of the
expected "#warning enable" and still have it work.
2019-02-17 11:58:03 +01:00
Nicolas Hake c8d22e321b Aul: Throw correct exception on parameter-less warning pragma
When no parameter followed the "#warning" pragma, because the end
iterator would be located before the begin iterator, basic_string's
constructor would throw std::length_error. Check for this case
beforehand so we can throw the expected C4ParseError instead.
2019-02-17 11:58:03 +01:00
Lukas Werling ee35d256aa Add basic character classes to WildcardMatch() 2019-02-03 19:14:53 +01:00
Lukas Werling 75d4ac2512 Fix team count inconsistency with random teams (#2051)
Switching to random teams would remove all teams but the first two on
the host, but not on the clients. With this fix, the extra teams are
removed on the clients as well. This fixes a desync when using
GetTeamCount() in a sync-relevant way.
2019-02-02 00:27:36 +01:00
Nicolas Hake 486619b653 Script: Test SetLength parameter 0 for nil (GH #79)
SetLength didn't check whether its first parameter was valid, and
attempted to dereference a NULL pointer when passed nil.
2019-01-05 19:25:35 +01:00
Lukas Werling 3a59c15250 Add openclonk:// protocol handler (#1657) 2019-01-02 17:16:09 +01:00
Nicolas Hake 5cf852d8ab C4Property: Add missing template<> specifier
MSVC doesn't care, apparently.
2019-01-01 21:55:42 +01:00
Nicolas Hake 0a81206b7e C4Property: Remove raw operator void*
operator void* is a quick and dirty workaround for the lack of
explicit operator bool in old C++ standards. Since we can use
explicit operator bool now, we don't need the operator void*
anymore.

Incidentally, that operator also allowed C4Set to equality compare
C4Property entries, which is unintuitive. Replace it with an
explicit specialization of C4Set::Equals.
2019-01-01 21:35:08 +01:00
Nicolas Hake 31c7805f10 C4Set: Replace elements with zero-initialized ones on clear
C4Set used to set its removed elements to nullptr. This requires
some special handling from non-pointer entries like C4Property.
Overwriting the element with a zero-initialized one removes this
requirement, leading to improved type safety on the part of
C4Property.
2019-01-01 21:35:08 +01:00
Nicolas Hake 3a8830af6e C4Effect: Remove obsolete fire effect constants
These constants aren't used anywhere inside the engine anymore and
should therefore be removed.
2019-01-01 20:52:38 +01:00
Nicolas Hake 3edc6d9ead Fix misleading indentation on several controlled statements
The C++ standard doesn't require us to stuff multiple statements
onto the same line, so we should avoid this for readability reasons.
This is especially true if one of the statements is controlled and
others aren't.
2018-12-31 14:27:14 +01:00
Nicolas Hake dca6d2caaf C4Landscape: Correct really badly misleading indentation
Some code here was indented like it still belonged to the loop
above, but never did, and was never intended to. This is an
excellent argument for why braces are good, especially for
statements which span more than one line.
2018-12-31 14:17:23 +01:00
Nicolas Hake c638647227 CMake: Remove <locale.h> test
We're not using the <locale.h> header anywhere besides including it
for no purpose, so we can drop the test (and the inclusion).
Additionally, the header is part of standard C++.
2018-12-31 12:30:06 +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
Mark 6351fe7a66 GetEnergy() offers exact energy value optionally (Bug #2043) 2018-12-20 08:40:04 +01:00
Lukas Werling 34d89adf47 Fix build on gcc 4.x 2018-10-15 21:01:15 +02:00
Lukas Werling 952cfef497 Add missing C4Include include in C4ConsoleQtShapes
Qt's moc generates another source file that includes this header without
including C4Include.h first. The generates source file thus doesn't
compile. It is unclear to me why this isn't an issue with our current
build setup (it is an issue with a meson-based build).
2018-10-14 23:19:32 +02:00
Lukas Werling a73e5fc871 undef "s" macro in C4Config
Necessary for unity builds, but also has a high conflict probability in
general.
2018-10-14 23:16:59 +02:00
Lukas Werling ca11d86893 Add missing include guards
These are necessary for unity builds.
2018-10-14 23:15:01 +02:00
Lukas Werling 7273b87b01 StdAdaptors: Replace array size macros with templates 2018-10-14 23:07:23 +02:00
Lukas Werling 55c34ecbd7 Add git branch to C4Version.h
The branch information is necessary for upcoming automatically-updating
snapshots. For Travis, cmake will also pick up the branch name from the
C4REVISION_BRANCH environment variable.
2018-10-03 23:44:35 +02:00
Lukas Werling 950ad4cf2f Fix C4ScriptLibrary destruction
C4PropListStaticMember must be deleted manually.
2018-09-25 20:02:51 +02:00
Lukas Werling 82feac4ccb Remove broken assert() 2018-09-25 20:02:51 +02:00
Lukas Werling 5395a8dc84 Add WITH_APPDIR_INSTALLATION configuration option
With this option enabled, `make install` will install the files in an
AppDir-compatible directory structure suitable for creating an AppImage.
2018-09-24 19:22:32 +02:00
Lukas Werling 2fb14b026d Script: Remove effect after error in Timer
As the timer tends to run more than once, you'd also very likely get the
error more than once. The timer also often determines the effect
lifetime, making a broken effect live forever.

This was especially annoying with one-off Schedule() invokations
that wouldn't even stop throwing errors after finishing the
designated number of repeats. Although fixing just that script
function would have been possible, I believe that a more general
solution for all effects is useful.
2018-08-26 23:15:05 +02:00
Nicolas Hake f5988085a7 Figure out whether a warning/error was #include'd or #appendto'd
We already notified the user on warning/error that the mistake
happened in a different script than the one we were currently
compiing. It's not too difficult to figure out whether that other
script was added due to an #include or an #appendto directive, so we
can just show the user which one it is.

We also don't show warnings in #include'd scripts anymore, since
they get compiled individually anyway and all warnings will show up
there. This way we don't duplicate warnings several times.
2018-07-24 14:35:12 +02:00
Nicolas Hake 829bb8cb28 Script functions: remove all BCCs at once instead of individually 2018-07-24 14:24:19 +02:00
Nicolas Hake 1cd3534740 C4KeyboardInput: Replace std::bind2nd &c by lambda
std::ptr_fun and std::bind_2nd have been deprecated since C++11, and
are no longer part of the standard since C++17.
2018-07-24 14:21:42 +02:00
Nicolas Hake 4c43ebf58c Warn when using variables outside of their block
When we introduce block scoping, using variables declared in a more
narrow scope from a block with wider scope will fail. Warn about
these so people can avoid it and fix their code.
2018-07-23 12:12:23 +02:00
Nicolas Hake 81dff1b92a Disable suspicious_assigment warning in for conditions
While I do not agree with the idea of using straight assignments in
the condition of a for loop, people are divided on the argument and
lots of old code uses it.
2018-07-23 08:29:46 +02:00
Lukas Werling f8c0fe6f82 Fix fallthrough in command line parsing 2018-04-23 12:12:32 +02:00
Lukas Werling 6d5dc2b92e c4group -l: Print both file and contents CRC
The contents CRC is the number that actually counts for group equality,
whereas the file CRC may differ, for example because of different
compression.
2018-04-21 21:41:28 +02:00
Lukas Werling 9fed69f3fa Add resolution uniform for sprite and mesh shaders (#2031)
The landscape shader already has such a uniform.
2018-04-18 12:02:43 +02:00
Lukas Werling 9a6772c27e Fix phase by xdir for DFA_Push (#2030) 2018-04-18 11:35:28 +02:00
Mark 25d008e99d FatalError: Allow formatting the message directly
FatalError(Format(...)) was necessary previously. Actually it seems not
like a huge thing, but being able to format the string directly in
FatalError is a lot more convenient.
2018-04-12 21:39:06 +02:00
Lukas Werling d9f9a2a9a3 Find_Property: Implement searching for specific value (#2021) 2018-04-08 15:00:27 +02:00
Mark 4212310a9f Renamed *MissionAccess functions
Added legacy wrappers and updated the documentation.
2018-04-05 19:34:16 +02:00
Nicolas Hake 704994f1b9 Remove warning on assignment in while() conditions (for now) 2018-04-04 21:42:24 +02:00
Mark 1682f62df8 Function: SetNextScenario
Renamed and documented the former function SetNextMission. Added a script wrapper for the old function that issues a warning. Renaming is based on the fact that the docu speaks of scenarios, and other functions, such as GainScenarioAchievement already use this terminology
2018-04-04 21:17:16 +02:00
Nicolas Hake 18b23d3d1e Merge pull request from ckanibal:slashfix
Slashfix (GH-68)
2018-03-29 14:48:45 +02:00
Nicolas Hake c73b8b3ece Warn on assignments where an expression is expected
This introduces a new diagnostic (suspicious_assignment) which
issues when an the compiler finds an assignment either where a
condition is expected or as the parameter to return.
2018-03-27 08:12:21 +02:00
Kanibal f24d685a47 win32: fix handling of forward slashes 2018-03-15 23:49:00 +01:00
Lukas Werling 99ef4ce853 Implement TCP Simultaneous Open for IPv6 2018-03-09 23:20:00 +01:00
Lukas Werling ee34ac1b06 Add C4NetIOTCP::Bind() for binding without connect 2018-03-07 17:30:58 +01: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
Nicolas Hake e3de9f1003 Add BLAKE2 library and expose its a CS hash algorithm to script
The crypto "library" only consists of a single function at the
moment because that's all that users have asked for so far. It is
also highly experimental. We will make an attempt to keep the public
interface (i.e. the interface provided by Library_Crypto.c) stable,
but it might still change if necessary. The internal interface
(provided via the global _Crypto proplist) is not for public
consumption and will probably change at some point.
2018-02-25 10:23:30 +01:00