|
From: <ufo...@li...> - 2009-05-01 20:07:27
|
Revision: 1105
http://ufo2000.svn.sourceforge.net/ufo2000/?rev=1105&view=rev
Author: nachtwolf
Date: 2009-05-01 20:07:26 +0000 (Fri, 01 May 2009)
Log Message:
-----------
* Fix for bug #451 : Assert Failed 417 of multiplay.cpp.
* Added an alert for when opponent leaves the game.
* Version bump for Beta 1105
Modified Paths:
--------------
trunk/src/connect.cpp
trunk/src/multiplay.cpp
trunk/src/version.h
Modified: trunk/src/connect.cpp
===================================================================
--- trunk/src/connect.cpp 2009-04-27 06:00:48 UTC (rev 1104)
+++ trunk/src/connect.cpp 2009-05-01 20:07:26 UTC (rev 1105)
@@ -115,7 +115,7 @@
remote_win->printstr("and upgrade your UFO2000 version\n");
remote_win->printstr(tmp);
}
- net->send("QUIT");
+ net->send_quit();
net->SEND = 0;
DONE = 1;
}
@@ -130,7 +130,7 @@
remote_win->printstr("\nUnfortunately your opponent has an\n");
remote_win->printstr("outdated UFO2000 version and you will be\n");
remote_win->printstr("unable to play until he upgrades\n");
- net->send("QUIT");
+ net->send_quit();
net->SEND = 0;
}
DONE = 1;
@@ -155,7 +155,7 @@
remote_win->redraw();
break;
case KEY_ESC:
- net->send("QUIT");
+ net->send_quit();
net->SEND = 0;
DONE = 1;
break;
@@ -208,9 +208,9 @@
{
lua_message( "Enter: Connect::do_planner" );
MODE = PLANNER;
-
int mouse_leftr = 1, mouse_rightr = 1;
int DONE = 0;
+ int REMOTE_LEFT = 0;
//HOST = 0;
FINISH_PLANNER = 0;
@@ -231,7 +231,7 @@
Map *map = new Map(mapdata);
BITMAP *map2d = map->create_bitmap_of_map(0);
int map2d_x = (640 - map2d->w) / 2;
-
+
if (HOST) {
target_uints[1] = &remote;
target_uints[0] = &local;
@@ -276,16 +276,48 @@
}
net->send_terrain_crc32("", 0);
#define map g_map
-
+
// Wait until a complete list of remote terrains is received
- while (g_net_allowed_terrains.find("") == g_net_allowed_terrains.end()) {
+ while ((g_net_allowed_terrains.find("") == g_net_allowed_terrains.end()) && (!REMOTE_LEFT)) {
net->check();
rest(1);
+
+ process_keyswitch();
+
+ if (keypressed()) {
+ CHANGE = 1;
+
+ int scancode;
+ int keycode = ureadkey(&scancode);
+
+ switch (scancode) {
+ case KEY_ESC:
+ if (askmenu( _("EXIT MISSION-PLANNER") )) {
+ net->send_quit();
+ net->SEND = 0;
+ REMOTE_LEFT = 1;
+ }
+ break;
+ default:
+ if (g_console->process_keyboard_input(keycode, scancode))
+ net->send_message((char *)g_console->get_text());
+ }
+ }
}
-
// Remove end marker
g_net_allowed_terrains.erase("");
+ if (REMOTE_LEFT) {
+ delete map;
+ SCREEN2H = old_SCREEN2H;
+ destroy_bitmap(screen2);
+ screen2 = create_bitmap(SCREEN2W, SCREEN2H); clear(screen2);
+ clear(screen);
+ g_console->resize(SCREEN_W, SCREEN_H - SCREEN2H);
+ g_console->set_full_redraw();
+ return 0;
+ }
+
if (g_net_allowed_terrains.size() == 0) {
alert( "", _("Remote player does not have any of your maps"), "",
_("OK"), NULL, 0, 0);
@@ -341,7 +373,7 @@
g_console->printf( COLOR_SYS_INFO1, _("To edit a soldier, CTRL-click on his name.") );
g_console->printf( COLOR_SYS_INFO1, _("Left-click to place a soldier on the map, right-click to remove him.") );
g_console->printf( COLOR_SYS_PROMPT, _("When finished, click SEND, then START. Press ESC to quit, F1 for help.") );
-
+
while (!DONE) {
rest(1); // Don't eat all CPU resources
Modified: trunk/src/multiplay.cpp
===================================================================
--- trunk/src/multiplay.cpp 2009-04-27 06:00:48 UTC (rev 1104)
+++ trunk/src/multiplay.cpp 2009-05-01 20:07:26 UTC (rev 1105)
@@ -452,8 +452,11 @@
int Net::recv_quit()
{ // "QUIT"
+ //Is this really an error ??
error("Remote exit from game");
- return 1;
+ alert( "", _("Your opponent left the game"), "",
+ _("OK"), NULL, 0, 0);
+ return 1;
}
extern void restartgame();
Modified: trunk/src/version.h
===================================================================
--- trunk/src/version.h 2009-04-27 06:00:48 UTC (rev 1104)
+++ trunk/src/version.h 2009-05-01 20:07:26 UTC (rev 1105)
@@ -23,7 +23,7 @@
#define UFO_VERSION_TAG "beta9"
#define UFO_VERSION_STRING "0.9"
-#define UFO_REVISION_NUMBER 1103
+#define UFO_REVISION_NUMBER 1105
#ifndef UFO_SVNVERSION
#define UFO_SVNVERSION "unknown"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|