Commit Graph

48 Commits (master)

Author SHA1 Message Date
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
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 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
Lukas Werling 302fa5e362 Qt Editor: Make main loop calls more efficient 2016-06-20 16:56:20 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Nicolas Hake 24b54211c5 Drop Min, Max, Swap for std::min, std::max, std::swap
The C++ standard library comes with perfectly fine implementations of
these functions, so there's no point in reimplementing them just for the
hell of it.
2015-11-15 13:53:01 +01:00
Sven Eberhardt 737b1fd8fd Save screenshots in background thread (#998, #1104).
Also ensure music keeps streaming while collecting data for full map screenshot.
2015-09-29 20:48:34 -04:00
Sven Eberhardt c94814f374 Fix signed/unsigned comparison warning. 2015-02-07 14:01:14 +01:00
Günther Brammer 8889aeb128 win32: Compile Win32 scheduler for other GUI toolkits, too 2015-01-01 22:13:56 +01:00
Martin Plicht 46df9d758c StdScheduler: Make DoScheduleProcs virtual, override it in C4AbstractApp and set isInManualLoop flag around the DoScheduleProcs call so the FlushMessages() of C4AbstractApp will happen when isInManualLoop is true 2014-02-16 14:54:32 +01:00
Martin Plicht c3dd3a08ce StdScheduler::Added is not necessarily called from the thread the
procedure is meant to be run on, so introduce yet another StdScheduler
extra method StartOnCurrentThread which on Mac OS X does the actual run
loop registration stuff and needs to be called from the actual thread
the scheduler is supposed to run on

StdSchedulerMac: Remove SCHAdditions objects again
2014-02-16 10:18:38 +01:00
Martin Plicht d504626a40 StdScheduler: Split into StdSchedulerWin32/StdSchedulerPoll/StdSchedulerMac 2014-01-23 17:53:40 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Tobias Zwick 74087e2fc2 remove superfluous IsScheduledExecution
use C4TimeMilliseconds::PositiveInfinity instead to denote that the next tick should not be executed.
2013-12-09 00:50:01 +07:00
Tobias Zwick fe2a400c02 replace global function GetTime() with class function C4TimeMilliseconds::Now() 2013-12-07 21:27:01 +07:00
Tobias Zwick 94c618d153 add new type C4TimeMilliseconds for time measurements to solve problems when GetTime() overflows (#251)
The new type C4TimeMilliseconds behaves for the most part like a uint32_t but is overflow-proof in comparisons.
In some places, a 0-value (or uint_max) of the variable storing the time had the special meaning "not set yet". This has been resolved by having it as a pointer to C4TimeMilliseconds with NULL meaning that it has not been set yet.
2013-12-04 19:35:07 +07:00
Tobias Zwick 7b9c1d5a9e refactor: consistently use time_t t... variables for times in network system, scheduler, gui
The network used to cast GetTime() to int, but GetTime() is an unsigned long. This might cause problems if GetTime() returns big integers (see #251). To solve this, the StdSchedulerProc interface had to be extended with another function in order to eliminate the magic return value -1 of GetNextTick for "no scheduled execution".
2013-11-29 17:28:04 +07:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Günther Brammer 40de33ca3c win32: Make sdl-mainloop option work
As it doesn't have the editor, this is only useful for compiling
more of our code on more platforms.
2012-03-23 22:53:56 +01:00
Günther Brammer 1929e8d779 linux: add CLOEXEC flag to miscellaneous calls 2012-03-05 02:48:27 +01:00
Armin Burgmeier de4a93cfc5 win32: Actually use the new delay when the timer delay is updated
Instead of just re-creating the timer with the old value. This fixes using
/speed to make the game faster than the default.
2012-02-12 15:54:36 +01:00
Armin Burgmeier 70a67204cb win32: Scheduler runs timeouted procs also when flooded by event inputs (#256) 2012-02-12 15:15:03 +01:00
Günther Brammer 1cafba4be8 Rename files implementing C4AbstractApp and C4Window 2011-10-03 17:19:24 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Günther Brammer ce8012f998 unix: Do not leak CStdNotifyProc fds 2011-06-27 01:51:05 +02:00
Peter Wortmann bfb0849fe5 Fixed Mac build 2011-05-21 16:38:54 +01:00
Günther Brammer 513dd9b252 A simple priority mechanism for the StdScheduler
Everything is more important than the next game tick: network activity,
user input or editor redraw.

On windows, the ordering is still delegated to (Msg)WaitForMultipleObjects.
2011-03-19 13:59:56 +01:00
Günther Brammer cacceef1c6 linux: use eventfd for CStdNotifyProc 2011-03-17 02:26:37 +01:00
Günther Brammer 03b3678050 Remove unused CStdNotifyProc::Check 2011-03-17 02:22:33 +01:00
Günther Brammer 8036211c30 linux: Use timerfd instead of poll timeouts 2011-03-15 17:27:10 +01:00
Günther Brammer 6c2a89eaf8 Replace timeGetTime with a platformneutral GetTime wrapper 2011-03-13 17:25:35 +01:00
Günther Brammer 8569eaab8c win32: Do not include windows.h from PlatformAbstraction.h
A few windows headers are still included, but not the big offenders
rpcndr.h, wingdi.h and winuser.h. Unfortunately, the latter two need to be
included from StdWindow.h, so still wind up in a lot files, which means
some of the #defines in them need to be undone. To avoid doing that in
multiple places, a few more files include StdWindow.h now.
2011-03-11 03:48:25 +01:00
Günther Brammer 57f9600de1 scheduler: Only execute one proc per poll call
The Execute callback could create a new proc which made the poll results
and proc list disagree, confusing the loop.
2011-01-07 00:22:44 +01:00
Günther Brammer be342d4a51 copyright notices update 2010
This time with more manual checking and using git blame -M -C, so that
a few cases of copied code get a copyright notice corresponding to
their initial introduction.
2010-12-23 01:01:24 +01:00
Armin Burgmeier 9f65838ae8 Fix a couple of compiler warnings 2010-04-28 23:43:25 +02:00
Armin Burgmeier d52fd9eadb Pass correct poll result (revents) to glib mainloop
This fixes saving games in developer mode on Linux
2010-03-31 19:14:10 +02:00
Armin Burgmeier c8c26a0933 StdScheduler: Only execute timeouts after all events have been processed (#207) 2010-03-30 16:16:27 +02:00
Benjamin Herr 4378de147c Rerun astyle with missing \ added 2010-03-28 20:58:01 +02:00
Günther Brammer b4e37b070b Change all indentation with spaces to use tabs instead
This is a whitespace-only patch. Hopefully, it'll only affect rarely-changed
parts of the engine, since all regularly maintained pieces should already
use tabs.
2010-03-27 17:05:02 +01:00
Armin Burgmeier c0d0c97620 Revert 487d2791bdc5, instead comment out the check in C4FileMonitor::Execute
Breaks network games otherwise
2010-03-21 01:22:24 +01:00
Armin Burgmeier 72c64176ae Pass correct pollfd to ScheduleProcs; fixes crash when C4FileMonitor is executed 2010-03-18 21:36:39 +01:00
Benjamin Herr f3b35227ea avoid lots of gcc warnings 2010-01-25 05:00:59 +01:00
Nicolas Hake f0fdf5e992 Prepare for precompiled headers 2009-10-20 05:39:24 +02:00
Nicolas Hake 314e106dbf #40: win32: Fix message filtering in StdScheduler
StdScheduler used a message filter that didn't match the messages that
using the task switcher generated, so it always waited for an input
or timer message before dispatching.
2009-10-14 01:41:27 +02:00
Günther Brammer 9a8b5dd739 Replace BOOL by bool, TRUE by true, FALSE by false 2009-08-15 20:50:32 +02:00
Günther Brammer 572d00c32e Move all source files
This might make stuff easier to find.
2009-08-10 17:59:18 +02:00