[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp multiplayer...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp multiplayer... |
Date: |
Wed, 23 Feb 2005 17:45:01 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/02/23 22:45:00
Modified files:
src : multiplayer_connect.cpp multiplayer_connect.hpp
Log message:
* Fixed the level description not being update when a side is tropped,
on the
multiplayer game setup code
* Most updates are now done using diffs, and not full re-sends of the
level, on
MP game setup.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.113&tr2=1.114&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.113
wesnoth/src/multiplayer_connect.cpp:1.114
--- wesnoth/src/multiplayer_connect.cpp:1.113 Wed Feb 23 22:00:55 2005
+++ wesnoth/src/multiplayer_connect.cpp Wed Feb 23 22:45:00 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.113 2005/02/23 22:00:55 j_daniel Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.114 2005/02/23 22:45:00 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -527,14 +527,7 @@
// network:
if (changed) {
update_playerlist_state();
-
- config old_level = level_;
- update_level();
-
- config diff;
- diff.add_child("scenario_diff",level_.get_diff(old_level));
-
- network::send_data(diff);
+ update_and_send_diff();
}
}
@@ -557,8 +550,6 @@
itor->resolve_random();
}
- update_level();
-
// FIXME: This is to be reviewed!
recorder.set_save_info(state_);
recorder.set_skip(-1);
@@ -571,7 +562,7 @@
network::send_data(lock);
// Re-sends the whole level
- network::send_data(level_);
+ update_and_send_diff();
config cfg;
cfg.add_child("start_game");
@@ -615,8 +606,7 @@
users_.erase(player);
update_user_combos();
}
-
- network::send_data(level_);
+ update_and_send_diff();
return;
}
}
@@ -663,9 +653,8 @@
// sides_[side_taken].set_connection(sock);
sides_[side_taken].import_network_user(data);
- update_level();
update_playerlist_state();
- network::send_data(level_);
+ update_and_send_diff();
LOG_NW << "sent player data\n";
@@ -715,9 +704,7 @@
//if there have been changes to the positions taken,
//then notify other players
if(changes) {
- // FIXME: shouldn't a diff be sent here instead?
- update_level();
- network::send_data(level_);
+ update_and_send_diff();
update_playerlist_state();
}
}
@@ -961,6 +948,15 @@
}
}
+void connect::update_and_send_diff()
+{
+ config old_level = level_;
+ update_level();
+ config diff;
+ diff.add_child("scenario_diff",level_.get_diff(old_level));
+ network::send_data(diff);
+}
+
bool connect::sides_available()
{
for(side_list::const_iterator itor = sides_.begin(); itor !=
sides_.end(); ++itor) {
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.29
wesnoth/src/multiplayer_connect.hpp:1.30
--- wesnoth/src/multiplayer_connect.hpp:1.29 Tue Feb 22 23:07:19 2005
+++ wesnoth/src/multiplayer_connect.hpp Wed Feb 23 22:45:00 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.29 2005/02/22 23:07:19 gruikya Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.30 2005/02/23 22:45:00 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -162,6 +162,9 @@
// Updates the level_ variable to reflect the sides in the sides_ vector
void update_level();
+
+ // Updates the level, and send a diff to the clients
+ void update_and_send_diff();
// Returns true if there still are sides available for this game
bool sides_available();