Merge lp:~widelands-dev/widelands/remove-double into lp:widelands

Proposed by Shevonar
Status: Merged
Merged at revision: 6958
Proposed branch: lp:~widelands-dev/widelands/remove-double
Merge into: lp:widelands
Diff against target: 181 lines (+0/-128)
3 files modified
src/ui_basic/panel.cc (+0/-5)
src/wlapplication.cc (+0/-102)
src/wlapplication.h (+0/-21)
To merge this branch: bzr merge lp:~widelands-dev/widelands/remove-double
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+216066@code.launchpad.net

Description of the change

Removes the --double command line parameter

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

maybe you can also get rid of some header? otherwise lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_basic/panel.cc'
2--- src/ui_basic/panel.cc 2014-04-15 15:36:36 +0000
3+++ src/ui_basic/panel.cc 2014-04-16 11:24:14 +0000
4@@ -230,11 +230,6 @@
5 if (_flags & pf_child_die)
6 check_child_death();
7
8-#ifndef NDEBUG
9-#ifndef _WIN32
10- WLApplication::yield_double_game ();
11-#endif
12-#endif
13 // Wait until 1second/maxfps are over.
14 diffTime = SDL_GetTicks() - startTime;
15 if (diffTime < minTime)
16
17=== modified file 'src/wlapplication.cc'
18--- src/wlapplication.cc 2014-04-07 20:46:53 +0000
19+++ src/wlapplication.cc 2014-04-16 11:24:14 +0000
20@@ -89,14 +89,6 @@
21 #include "wui/interactive_player.h"
22 #include "wui/interactive_spectator.h"
23
24-#ifndef NDEBUG
25-#ifndef _WIN32
26-int32_t WLApplication::pid_me = 0;
27-int32_t WLApplication::pid_peer = 0;
28-volatile int32_t WLApplication::may_run = 0;
29-#endif
30-#endif
31-
32 #define MINIMUM_DISK_SPACE 250000000lu
33 #define SCREENSHOT_DIR "screenshots"
34
35@@ -1082,20 +1074,6 @@
36 m_commandline.erase("datadir");
37 }
38
39- if (m_commandline.count("double")) {
40-#ifndef NDEBUG
41-#ifndef _WIN32
42- init_double_game();
43-#else
44- wout << _("\nSorry, no double-instance debugging on _WIN32.\n\n");
45-#endif
46-#else
47- wout << _("--double is disabled. This is not a debug build!") << endl;
48-#endif
49-
50- m_commandline.erase("double");
51- }
52-
53 if (m_commandline.count("verbose")) {
54 g_verbose = true;
55
56@@ -1260,13 +1238,6 @@
57 " Only move a window to the edge of a panel\n"
58 " if the window is overlapping with the\n"
59 " panel.") << "\n\n";
60-#ifndef NDEBUG
61-#ifndef _WIN32
62- wout
63- << _(" --double Start the game twice (for localhost network\n"
64- " testing)") << "\n\n";
65-#endif
66-#endif
67 wout
68 << _(" --verbose Enable verbose debug messages") << "\n" << endl;
69 wout
70@@ -1277,79 +1248,6 @@
71 "Hope you enjoy this game!") << "\n\n";
72 }
73
74-#ifndef NDEBUG
75-#ifndef _WIN32
76-/**
77- * Fork off a second game to test network gaming
78- *
79- * \warning You must call this \e before any hardware initialization - most
80- * notably before \ref SDL_Init()
81- */
82-void WLApplication::init_double_game ()
83-{
84- if (pid_me != 0)
85- return;
86-
87- pid_me = getpid();
88- pid_peer = fork();
89- //TODO: handle fork errors
90-
91- assert (pid_peer >= 0);
92-
93- if (pid_peer == 0) {
94- pid_peer = pid_me;
95- pid_me = getpid();
96-
97- may_run = 1;
98- }
99-
100- signal (SIGUSR1, signal_handler);
101-
102- atexit (quit_handler);
103-}
104-
105-/**
106- * On SIGUSR1, allow ourselves to continue running
107- */
108-void WLApplication::signal_handler(int32_t) {++may_run;}
109-
110-/**
111- * Kill the other instance when exiting
112- *
113- * \todo This works but is not very clean (each process killing each other)
114- */
115-void WLApplication::quit_handler()
116-{
117- kill (pid_peer, SIGTERM);
118- sleep (2);
119- kill (pid_peer, SIGKILL);
120-}
121-
122-/**
123- * Voluntarily yield to the second Widelands process. This was implemented
124- * because some machines got horrible responsiveness when using --double, so we
125- * forced good reponsiveness by using cooperative multitasking (between the two
126- * Widelands instances, that is)
127- */
128-void WLApplication::yield_double_game()
129-{
130- if (pid_me == 0)
131- return;
132-
133- if (may_run > 0) {
134- --may_run;
135- kill (pid_peer, SIGUSR1);
136- }
137-
138- if (may_run == 0)
139- usleep (500000);
140-
141- // using sleep instead of pause avoids a race condition
142- // and a deadlock during connect
143-}
144-#endif
145-#endif
146-
147 /**
148 * Run the main menu
149 */
150
151=== modified file 'src/wlapplication.h'
152--- src/wlapplication.h 2014-04-06 17:14:28 +0000
153+++ src/wlapplication.h 2014-04-16 11:24:14 +0000
154@@ -182,27 +182,6 @@
155 bool campaign_game();
156 void replay();
157
158-#ifndef NDEBUG
159-#ifndef _WIN32
160- //not all of these need to be public, but I consider signal handling
161- //a public interface
162- //@{
163- void init_double_game();
164- static void signal_handler (int32_t sig);
165- static void quit_handler();
166- static void yield_double_game();
167- //@}
168-
169- // Used for --double
170- //@{
171- static int32_t pid_me;
172- static int32_t pid_peer;
173- ///\todo Explain me
174- static volatile int32_t may_run;
175- //@}
176-#endif
177-#endif
178-
179 static void show_usage();
180
181 static void emergency_save(Widelands::Game &);

Subscribers

People subscribed via source and target branches

to status/vote changes: