[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src ai.cpp ai_interface.hpp animated.cp...
From: |
Yann Dirson |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src ai.cpp ai_interface.hpp animated.cp... |
Date: |
Sun, 27 Feb 2005 13:15:22 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Yann Dirson <address@hidden> 05/02/27 18:15:22
Modified files:
src : ai.cpp ai_interface.hpp animated.cpp config.cpp
config.hpp font.cpp game.cpp game_events.cpp
gamestatus.cpp leader_list.cpp multiplayer.cpp
multiplayer_connect.hpp multiplayer_create.cpp
multiplayer_lobby.cpp multiplayer_ui.cpp
multiplayer_wait.cpp network.cpp network.hpp
network_worker.cpp network_worker.hpp
preferences.cpp preferences.hpp
src/editor : editor.cpp
src/widgets : scrollpane.hpp textbox.hpp
Log message:
dos2unix
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.140&tr2=1.141&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_interface.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/animated.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.128&tr2=1.129&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.201&tr2=1.202&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.cpp.diff?tr1=1.121&tr2=1.122&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gamestatus.cpp.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/leader_list.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.142&tr2=1.143&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.cpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network_worker.cpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network_worker.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.135&tr2=1.136&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.hpp.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.93&tr2=1.94&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.hpp.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.140 wesnoth/src/ai.cpp:1.141
--- wesnoth/src/ai.cpp:1.140 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/ai.cpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.140 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: ai.cpp,v 1.141 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -351,17 +351,17 @@
}
}
-gamemap::location ai_interface::move_unit(location from, location to,
std::map<location,paths>& possible_moves)
-{
- const location loc = move_unit_partial(from,to,possible_moves);
- const unit_map::iterator u = info_.units.find(loc);
- if(u != info_.units.end()) {
- u->second.set_movement(0);
- }
-
- return loc;
-}
-
+gamemap::location ai_interface::move_unit(location from, location to,
std::map<location,paths>& possible_moves)
+{
+ const location loc = move_unit_partial(from,to,possible_moves);
+ const unit_map::iterator u = info_.units.find(loc);
+ if(u != info_.units.end()) {
+ u->second.set_movement(0);
+ }
+
+ return loc;
+}
+
gamemap::location ai_interface::move_unit_partial(location from, location to,
std::map<location,paths>& possible_moves)
{
LOG_AI << "ai_interface::move_unit " << (from.x + 1) << "," << (from.y
+ 1)
@@ -407,8 +407,8 @@
}
}
- if(rt != p.routes.end()) {
- current_unit.set_movement(rt->second.move_left);
+ if(rt != p.routes.end()) {
+ current_unit.set_movement(rt->second.move_left);
std::vector<location> steps = rt->second.steps;
@@ -432,7 +432,7 @@
}
}
- if(n != 6) {
+ if(n != 6) {
current_unit.set_movement(0);
//enter enemy ZoC, no movement left
break;
}
@@ -1566,7 +1566,7 @@
for(std::map<std::string,int>::iterator j =
unit_movement_scores_.begin(); j != unit_movement_scores_.end(); ++j) {
const game_data::unit_type_map::const_iterator info =
gameinfo_.unit_types.find(j->first);
if(info == gameinfo_.unit_types.end()) {
- continue;
+ continue;
}
const int best_score = best_scores[info->second.usage()];
Index: wesnoth/src/ai_interface.hpp
diff -u wesnoth/src/ai_interface.hpp:1.2 wesnoth/src/ai_interface.hpp:1.3
--- wesnoth/src/ai_interface.hpp:1.2 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/ai_interface.hpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: ai_interface.hpp,v 1.2 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: ai_interface.hpp,v 1.3 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -98,10 +98,10 @@
///'from': the location of the unit being moved.
///'to': the location to be moved to. This must be a valid move for the
unit
///'possible_moves': the map of possible moves, as obtained from
'calculate_possible_moves'
- location move_unit(location from, location to,
std::map<location,paths>& possible_moves);
-
- ///this function is identical to 'move_unit', except that the unit's
movement isn't set to 0
- ///after the move is complete.
+ location move_unit(location from, location to,
std::map<location,paths>& possible_moves);
+
+ ///this function is identical to 'move_unit', except that the unit's
movement isn't set to 0
+ ///after the move is complete.
location move_unit_partial(location from, location t,
std::map<location,paths>& possible_moves);
///this function is used to calculate the moves units may possibly make.
Index: wesnoth/src/animated.cpp
diff -u wesnoth/src/animated.cpp:1.2 wesnoth/src/animated.cpp:1.3
--- wesnoth/src/animated.cpp:1.2 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/animated.cpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: animated.cpp,v 1.2 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: animated.cpp,v 1.3 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Copyright (C) 2005 by Guillaume Melquiond <address@hidden>
@@ -11,8 +11,8 @@
See the COPYING file for more details.
*/
-
-#include "global.hpp"
+
+#include "global.hpp"
//#include <string>
//#include <vector>
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.128 wesnoth/src/config.cpp:1.129
--- wesnoth/src/config.cpp:1.128 Sun Feb 20 21:45:21 2005
+++ wesnoth/src/config.cpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.128 2005/02/20 21:45:21 silene Exp $ */
+/* $Id: config.cpp,v 1.129 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -698,19 +698,19 @@
{
clear();
read_compressed_internal(data.begin(),data.end(),schema,0);
-}
-
-bool config::detect_format_and_read(const std::string& data)
-{
- try {
- compression_schema schema;
- read_compressed(data,schema);
- return true;
- } catch(config::error&) {
- }
-
- read(data);
- return false;
+}
+
+bool config::detect_format_and_read(const std::string& data)
+{
+ try {
+ compression_schema schema;
+ read_compressed(data,schema);
+ return true;
+ } catch(config::error&) {
+ }
+
+ read(data);
+ return false;
}
config::child_itors config::child_range(const std::string& key)
Index: wesnoth/src/config.hpp
diff -u wesnoth/src/config.hpp:1.56 wesnoth/src/config.hpp:1.57
--- wesnoth/src/config.hpp:1.56 Sun Feb 20 21:45:21 2005
+++ wesnoth/src/config.hpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: config.hpp,v 1.56 2005/02/20 21:45:21 silene Exp $ */
+/* $Id: config.hpp,v 1.57 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -66,21 +66,21 @@
//you can re-use the same schema on the sending end, and the receiver
can store the schema,
//meaning that the entire schema won't have to be transmitted each time.
std::string write_compressed(compression_schema& schema) const;
- void read_compressed(const std::string& data, compression_schema&
schema); //throws config::error
-
- std::string write_compressed() const {
- compression_schema schema;
- return write_compressed(schema);
- }
-
- void read_compressed(const std::string& data) {
- compression_schema schema;
- read_compressed(data,schema);
- }
-
- //function which reads a file, and automatically detects whether it's
compressed or not before
- //reading it. If it's not a valid file at all, it will throw an error
as if it was trying to
- //read it as text WML. Returns true iff the format is compressed
+ void read_compressed(const std::string& data, compression_schema&
schema); //throws config::error
+
+ std::string write_compressed() const {
+ compression_schema schema;
+ return write_compressed(schema);
+ }
+
+ void read_compressed(const std::string& data) {
+ compression_schema schema;
+ read_compressed(data,schema);
+ }
+
+ //function which reads a file, and automatically detects whether it's
compressed or not before
+ //reading it. If it's not a valid file at all, it will throw an error
as if it was trying to
+ //read it as text WML. Returns true iff the format is compressed
bool detect_format_and_read(const std::string& data); //throws
config::error
typedef std::vector<config*> child_list;
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.93 wesnoth/src/editor/editor.cpp:1.94
--- wesnoth/src/editor/editor.cpp:1.93 Fri Feb 25 01:07:20 2005
+++ wesnoth/src/editor/editor.cpp Sun Feb 27 18:15:21 2005
@@ -1006,10 +1006,10 @@
bool map_editor::save_map(const std::string fn, const bool
display_confirmation) {
std::string filename = fn;
if (filename == "") {
- filename = filename_;
- if(filename == "") {
- edit_save_as();
- return true;
+ filename = filename_;
+ if(filename == "") {
+ edit_save_as();
+ return true;
}
}
else {
Index: wesnoth/src/font.cpp
diff -u wesnoth/src/font.cpp:1.105 wesnoth/src/font.cpp:1.106
--- wesnoth/src/font.cpp:1.105 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/font.cpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: font.cpp,v 1.105 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: font.cpp,v 1.106 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1227,8 +1227,8 @@
fontlist.back().present_codepoints.push_back(std::pair<size_t, size_t>(r1, r2));
}
- }
-
+ }
+
return true;
}
}
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.201 wesnoth/src/game.cpp:1.202
--- wesnoth/src/game.cpp:1.201 Sun Feb 27 18:10:48 2005
+++ wesnoth/src/game.cpp Sun Feb 27 18:15:20 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.201 2005/02/27 18:10:48 ydirson Exp $ */
+/* $Id: game.cpp,v 1.202 2005/02/27 18:15:20 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1500,44 +1500,44 @@
}
p = q;
}
- } else if(val == "--compress" || val == "--decompress") {
- if(argc != arg+3) {
- std::cerr << "format of " << val << " command:
" << val << " <input file> <output file>\n";
- return 0;
- }
-
- const std::string input(argv[arg+1]);
- const std::string output(argv[arg+2]);
-
- const std::string in(read_file(input));
- if(in == "") {
- std::cerr << "could not read file '" << input
<< "'\n";
- return 0;
- }
-
- config cfg;
-
- const bool compress = val == "--compress";
- try {
- const bool is_compressed =
cfg.detect_format_and_read(in);
- if(is_compressed && compress) {
- std::cerr << input << " is already
compressed\n";
- return 0;
- } else if(!is_compressed && !compress) {
- std::cerr << input << " is already
decompressed\n";
- return 0;
- }
-
- const std::string res(compress ?
cfg.write_compressed() : cfg.write());
- write_file(output,res);
-
- } catch(config::error& e) {
- std::cerr << input << " is not a valid Wesnoth
file: " << e.message << "\n";
- } catch(io_exception& e) {
- std::cerr << "IO error: " << e.what() << "\n";
- }
-
- return 0;
+ } else if(val == "--compress" || val == "--decompress") {
+ if(argc != arg+3) {
+ std::cerr << "format of " << val << " command:
" << val << " <input file> <output file>\n";
+ return 0;
+ }
+
+ const std::string input(argv[arg+1]);
+ const std::string output(argv[arg+2]);
+
+ const std::string in(read_file(input));
+ if(in == "") {
+ std::cerr << "could not read file '" << input
<< "'\n";
+ return 0;
+ }
+
+ config cfg;
+
+ const bool compress = val == "--compress";
+ try {
+ const bool is_compressed =
cfg.detect_format_and_read(in);
+ if(is_compressed && compress) {
+ std::cerr << input << " is already
compressed\n";
+ return 0;
+ } else if(!is_compressed && !compress) {
+ std::cerr << input << " is already
decompressed\n";
+ return 0;
+ }
+
+ const std::string res(compress ?
cfg.write_compressed() : cfg.write());
+ write_file(output,res);
+
+ } catch(config::error& e) {
+ std::cerr << input << " is not a valid Wesnoth
file: " << e.message << "\n";
+ } catch(io_exception& e) {
+ std::cerr << "IO error: " << e.what() << "\n";
+ }
+
+ return 0;
}
}
@@ -1696,8 +1696,8 @@
//just means the game should quit
} catch(end_level_exception&) {
std::cerr << "caught end_level_exception (quitting)\n";
- } catch(std::bad_alloc&) {
- std::cerr << "Ran out of memory. Aborted.\n";
+ } catch(std::bad_alloc&) {
+ std::cerr << "Ran out of memory. Aborted.\n";
} /*catch(...) {
std::cerr << "Unhandled exception. Exiting\n";
}*/
Index: wesnoth/src/game_events.cpp
diff -u wesnoth/src/game_events.cpp:1.121 wesnoth/src/game_events.cpp:1.122
--- wesnoth/src/game_events.cpp:1.121 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/game_events.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: game_events.cpp,v 1.121 2005/02/21 09:05:51 silene Exp $ */
+/* $Id: game_events.cpp,v 1.122 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1210,11 +1210,11 @@
const size_t team_num = size_t(side-1);
const std::vector<gamemap::location> locs(multiple_locs(cfg));
-
+
for(std::vector<gamemap::location>::const_iterator i =
locs.begin(); i != locs.end(); ++i) {
if(game_map->is_village(*i)) {
get_village(*i,*teams,team_num,*units);
- }
+ }
}
}
Index: wesnoth/src/gamestatus.cpp
diff -u wesnoth/src/gamestatus.cpp:1.56 wesnoth/src/gamestatus.cpp:1.57
--- wesnoth/src/gamestatus.cpp:1.56 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/gamestatus.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: gamestatus.cpp,v 1.56 2005/02/21 09:05:51 silene Exp $ */
+/* $Id: gamestatus.cpp,v 1.57 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,7 +17,7 @@
#include "game_config.hpp"
#include "gamestatus.hpp"
#include "language.hpp"
-#include "log.hpp"
+#include "log.hpp"
#include "preferences.hpp"
#include "statistics.hpp"
#include "util.hpp"
Index: wesnoth/src/leader_list.cpp
diff -u wesnoth/src/leader_list.cpp:1.5 wesnoth/src/leader_list.cpp:1.6
--- wesnoth/src/leader_list.cpp:1.5 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/leader_list.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: leader_list.cpp,v 1.5 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: leader_list.cpp,v 1.6 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "leader_list.hpp"
#include "wml_separators.hpp"
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.142 wesnoth/src/multiplayer.cpp:1.143
--- wesnoth/src/multiplayer.cpp:1.142 Sun Feb 27 18:10:48 2005
+++ wesnoth/src/multiplayer.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.142 2005/02/27 18:10:48 ydirson Exp $ */
+/* $Id: multiplayer.cpp,v 1.143 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "multiplayer.hpp"
#include "multiplayer_ui.hpp"
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.30
wesnoth/src/multiplayer_connect.hpp:1.31
--- wesnoth/src/multiplayer_connect.hpp:1.30 Wed Feb 23 22:45:00 2005
+++ wesnoth/src/multiplayer_connect.hpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.30 2005/02/23 22:45:00 gruikya Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.31 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -37,7 +37,7 @@
network::connection connection;
};
- typedef std::vector<connected_user> connected_user_list;
+ typedef std::vector<connected_user> connected_user_list;
class side {
public:
Index: wesnoth/src/multiplayer_create.cpp
diff -u wesnoth/src/multiplayer_create.cpp:1.7
wesnoth/src/multiplayer_create.cpp:1.8
--- wesnoth/src/multiplayer_create.cpp:1.7 Sun Feb 27 17:15:38 2005
+++ wesnoth/src/multiplayer_create.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_create.cpp,v 1.7 2005/02/27 17:15:38 gruikya Exp $ */
+/* $Id: multiplayer_create.cpp,v 1.8 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "show_dialog.hpp"
#include "multiplayer_create.hpp"
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.62
wesnoth/src/multiplayer_lobby.cpp:1.63
--- wesnoth/src/multiplayer_lobby.cpp:1.62 Fri Feb 25 01:07:19 2005
+++ wesnoth/src/multiplayer_lobby.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.cpp,v 1.62 2005/02/25 01:07:19 ydirson Exp $ */
+/* $Id: multiplayer_lobby.cpp,v 1.63 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "multiplayer_lobby.hpp"
#include "filesystem.hpp"
Index: wesnoth/src/multiplayer_ui.cpp
diff -u wesnoth/src/multiplayer_ui.cpp:1.7 wesnoth/src/multiplayer_ui.cpp:1.8
--- wesnoth/src/multiplayer_ui.cpp:1.7 Sat Feb 26 22:41:19 2005
+++ wesnoth/src/multiplayer_ui.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_ui.cpp,v 1.7 2005/02/26 22:41:19 gruikya Exp $ */
+/* $Id: multiplayer_ui.cpp,v 1.8 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "multiplayer_ui.hpp"
#include "network.hpp"
Index: wesnoth/src/multiplayer_wait.cpp
diff -u wesnoth/src/multiplayer_wait.cpp:1.6
wesnoth/src/multiplayer_wait.cpp:1.7
--- wesnoth/src/multiplayer_wait.cpp:1.6 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/multiplayer_wait.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_wait.cpp,v 1.6 2005/02/26 22:16:34 Sirp Exp $ */
+/* $Id: multiplayer_wait.cpp,v 1.7 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -10,7 +10,7 @@
See the COPYING file for more details.
*/
-
+
#include "global.hpp"
#include "log.hpp"
Index: wesnoth/src/network.cpp
diff -u wesnoth/src/network.cpp:1.50 wesnoth/src/network.cpp:1.51
--- wesnoth/src/network.cpp:1.50 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/network.cpp Sun Feb 27 18:15:21 2005
@@ -410,27 +410,27 @@
disconnection_queue.push_back(sock);
}
-connection receive_data(config& cfg, connection connection_num, int timeout)
-{
- int cur_ticks = SDL_GetTicks();
- while(timeout >= 0) {
- const connection res = receive_data(cfg,connection_num);
- if(res != 0) {
- return res;
- }
-
- if(timeout > 0) {
- SDL_Delay(1);
- }
-
- const int ticks = SDL_GetTicks();
- timeout -= maximum<int>(1,(ticks - cur_ticks));
- cur_ticks = ticks;
- }
-
- return 0;
-}
-
+connection receive_data(config& cfg, connection connection_num, int timeout)
+{
+ int cur_ticks = SDL_GetTicks();
+ while(timeout >= 0) {
+ const connection res = receive_data(cfg,connection_num);
+ if(res != 0) {
+ return res;
+ }
+
+ if(timeout > 0) {
+ SDL_Delay(1);
+ }
+
+ const int ticks = SDL_GetTicks();
+ timeout -= maximum<int>(1,(ticks - cur_ticks));
+ cur_ticks = ticks;
+ }
+
+ return 0;
+}
+
connection receive_data(config& cfg, connection connection_num)
{
if(!socket_set) {
@@ -473,39 +473,39 @@
set_remote_handle(*i,remote_handle);
continue;
- }
-
- network_worker_pool::receive_data(sock);
- SDLNet_TCP_DelSocket(socket_set,sock);
- }
- }
-
- std::vector<char> buf;
- TCPsocket sock = connection_num == 0 ? 0 : get_socket(connection_num);
- sock = network_worker_pool::get_received_data(sock,buf);
- if(sock == NULL) {
- return 0;
- }
-
- SDLNet_TCP_AddSocket(socket_set,sock);
-
- connection result = 0;
- for(connection_map::const_iterator j = connections.begin(); j !=
connections.end(); ++j) {
- if(j->second.sock == sock) {
- result = j->first;
- break;
- }
- }
-
- if(result == 0) {
- return result;
- }
-
- const schema_map::iterator schema = schemas.find(result);
- wassert(schema != schemas.end());
-
-
cfg.read_compressed(std::string(buf.begin(),buf.end()),schema->second.incoming);
-
+ }
+
+ network_worker_pool::receive_data(sock);
+ SDLNet_TCP_DelSocket(socket_set,sock);
+ }
+ }
+
+ std::vector<char> buf;
+ TCPsocket sock = connection_num == 0 ? 0 : get_socket(connection_num);
+ sock = network_worker_pool::get_received_data(sock,buf);
+ if(sock == NULL) {
+ return 0;
+ }
+
+ SDLNet_TCP_AddSocket(socket_set,sock);
+
+ connection result = 0;
+ for(connection_map::const_iterator j = connections.begin(); j !=
connections.end(); ++j) {
+ if(j->second.sock == sock) {
+ result = j->first;
+ break;
+ }
+ }
+
+ if(result == 0) {
+ return result;
+ }
+
+ const schema_map::iterator schema = schemas.find(result);
+ wassert(schema != schemas.end());
+
+
cfg.read_compressed(std::string(buf.begin(),buf.end()),schema->second.incoming);
+
return result;
}
Index: wesnoth/src/network.hpp
diff -u wesnoth/src/network.hpp:1.22 wesnoth/src/network.hpp:1.23
--- wesnoth/src/network.hpp:1.22 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/network.hpp Sun Feb 27 18:15:21 2005
@@ -80,7 +80,7 @@
//received in cfg. Times out after timeout milliseconds. Returns
//the connection that data was received from, or 0 if timeout
//occurred. Throws error if an error occurred.
-connection receive_data(config& cfg, connection connection_num=0);
+connection receive_data(config& cfg, connection connection_num=0);
connection receive_data(config& cfg, connection connection_num, int timeout);
//sets the default maximum number of bytes to send to a client at a time
Index: wesnoth/src/network_worker.cpp
diff -u wesnoth/src/network_worker.cpp:1.17 wesnoth/src/network_worker.cpp:1.18
--- wesnoth/src/network_worker.cpp:1.17 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/network_worker.cpp Sun Feb 27 18:15:21 2005
@@ -5,9 +5,9 @@
#include "network.hpp"
#include "thread.hpp"
#include "wassert.hpp"
-
+
#include <algorithm>
-#include <cerrno>
+#include <cerrno>
#include <deque>
#include <iostream>
#include <map>
@@ -28,18 +28,18 @@
bool managed = false;
typedef std::vector< buffer * > buffer_set;
-buffer_set bufs;
-
-//a queue of sockets that we are waiting to receive on
-typedef std::vector<TCPsocket> receive_list;
-receive_list pending_receives;
-
-//access to this variable isn't synchronized -- it's non-critical
-//and we don't want to pay the synchronization cost when it's rarely
-//cared about.
-std::pair<int,int> current_transfer_stats;
-
-typedef std::deque<buffer> received_queue;
+buffer_set bufs;
+
+//a queue of sockets that we are waiting to receive on
+typedef std::vector<TCPsocket> receive_list;
+receive_list pending_receives;
+
+//access to this variable isn't synchronized -- it's non-critical
+//and we don't want to pay the synchronization cost when it's rarely
+//cared about.
+std::pair<int,int> current_transfer_stats;
+
+typedef std::deque<buffer> received_queue;
received_queue received_data_queue;
enum SOCKET_STATE { SOCKET_READY, SOCKET_LOCKED, SOCKET_ERROR };
@@ -49,52 +49,52 @@
threading::mutex* global_mutex = NULL;
threading::condition* cond = NULL;
-std::vector<threading::thread*> threads;
-
-SOCKET_STATE receive_buf(TCPsocket sock, std::vector<char>& buf)
-{
- char num_buf[4];
- int len = SDLNet_TCP_Recv(sock,num_buf,4);
-
- if(len != 4) {
- return SOCKET_ERROR;
- }
-
- len = SDLNet_Read32(num_buf);
-
- if(len < 1 || len > 100000000) {
- return SOCKET_ERROR;
- }
-
- buf.resize(len);
- char* beg = &buf[0];
- const char* const end = beg + len;
-
- current_transfer_stats.first = 0;
- current_transfer_stats.second = len;
-
- while(beg != end) {
- const int len = SDLNet_TCP_Recv(sock,&buf[0],end - beg);
- if(len <= 0) {
- return SOCKET_ERROR;
- }
-
- beg += len;
-
- current_transfer_stats.first = beg - &buf[0];
- }
-
- return SOCKET_READY;
+std::vector<threading::thread*> threads;
+
+SOCKET_STATE receive_buf(TCPsocket sock, std::vector<char>& buf)
+{
+ char num_buf[4];
+ int len = SDLNet_TCP_Recv(sock,num_buf,4);
+
+ if(len != 4) {
+ return SOCKET_ERROR;
+ }
+
+ len = SDLNet_Read32(num_buf);
+
+ if(len < 1 || len > 100000000) {
+ return SOCKET_ERROR;
+ }
+
+ buf.resize(len);
+ char* beg = &buf[0];
+ const char* const end = beg + len;
+
+ current_transfer_stats.first = 0;
+ current_transfer_stats.second = len;
+
+ while(beg != end) {
+ const int len = SDLNet_TCP_Recv(sock,&buf[0],end - beg);
+ if(len <= 0) {
+ return SOCKET_ERROR;
+ }
+
+ beg += len;
+
+ current_transfer_stats.first = beg - &buf[0];
+ }
+
+ return SOCKET_READY;
}
int process_queue(void* data)
{
LOG_NW << "thread started...\n";
for(;;) {
-
- //if we find a socket to send data to, sent_buf will be
non-NULL. If we find a socket
- //to receive data from, sent_buf will be NULL. 'sock' will
always refer to the socket
- //that data is being sent to/received from
+
+ //if we find a socket to send data to, sent_buf will be
non-NULL. If we find a socket
+ //to receive data from, sent_buf will be NULL. 'sock' will
always refer to the socket
+ //that data is being sent to/received from
TCPsocket sock = NULL;
buffer *sent_buf = NULL;
@@ -108,28 +108,28 @@
socket_state_map::iterator lock_it =
sockets_locked.find((*itor)->sock);
wassert(lock_it !=
sockets_locked.end());
if(lock_it->second == SOCKET_READY) {
- sent_buf = *itor;
- sock = sent_buf->sock;
- bufs.erase(itor);
+ sent_buf = *itor;
+ sock = sent_buf->sock;
+ bufs.erase(itor);
break;
}
- }
-
- if(sock == NULL) {
- receive_list::iterator itor =
pending_receives.begin(), itor_end = pending_receives.end();
- for(; itor != itor_end; ++itor) {
- socket_state_map::iterator
lock_it = sockets_locked.find(*itor);
- wassert(lock_it !=
sockets_locked.end());
- if(lock_it->second ==
SOCKET_READY) {
- sock = *itor;
-
pending_receives.erase(itor);
- break;
- }
- }
- }
-
- if(sock != NULL) {
- break;
+ }
+
+ if(sock == NULL) {
+ receive_list::iterator itor =
pending_receives.begin(), itor_end = pending_receives.end();
+ for(; itor != itor_end; ++itor) {
+ socket_state_map::iterator
lock_it = sockets_locked.find(*itor);
+ wassert(lock_it !=
sockets_locked.end());
+ if(lock_it->second ==
SOCKET_READY) {
+ sock = *itor;
+
pending_receives.erase(itor);
+ break;
+ }
+ }
+ }
+
+ if(sock != NULL) {
+ break;
}
if(managed == false) {
@@ -139,15 +139,15 @@
cond->wait(*global_mutex); // temporarily
release the mutex and wait for a buffer
}
- }
-
+ }
+
wassert(sock);
LOG_NW << "thread found a buffer...\n";
- SOCKET_STATE result = SOCKET_READY;
+ SOCKET_STATE result = SOCKET_READY;
std::vector<char> buf;
-
+
if(sent_buf != NULL) {
std::vector<char> &v = sent_buf->buf;
for(size_t upto = 0, size = v.size(); result !=
SOCKET_ERROR && upto < size; ) {
@@ -158,14 +158,14 @@
} else {
upto += res;
}
- }
-
- delete sent_buf;
- sent_buf = NULL;
-
- LOG_NW << "thread sent " << v.size() << " bytes of
data...\n";
- } else {
- result = receive_buf(sock,buf);
+ }
+
+ delete sent_buf;
+ sent_buf = NULL;
+
+ LOG_NW << "thread sent " << v.size() << " bytes of
data...\n";
+ } else {
+ result = receive_buf(sock,buf);
}
{
@@ -175,12 +175,12 @@
lock_it->second = result;
if(result == SOCKET_ERROR) {
++socket_errors;
- }
-
- //if we received data, add it to the queue
- if(result == SOCKET_READY && buf.empty() == false) {
- received_data_queue.push_back(buffer(sock));
- received_data_queue.back().buf.swap(buf);
+ }
+
+ //if we received data, add it to the queue
+ if(result == SOCKET_READY && buf.empty() == false) {
+ received_data_queue.push_back(buffer(sock));
+ received_data_queue.back().buf.swap(buf);
}
}
}
@@ -232,40 +232,40 @@
LOG_NW << "exiting manager::~manager()\n";
}
}
-
-void receive_data(TCPsocket sock)
-{
- {
- const threading::lock lock(*global_mutex);
-
- pending_receives.push_back(sock);
-
sockets_locked.insert(std::pair<TCPsocket,SOCKET_STATE>(sock,SOCKET_READY));
- }
-
- cond->notify_one();
-}
-
-TCPsocket get_received_data(TCPsocket sock, std::vector<char>& buf)
-{
- const threading::lock lock(*global_mutex);
- received_queue::iterator itor = received_data_queue.begin();
- if(sock != NULL) {
- for(; itor != received_data_queue.end(); ++itor) {
- if(itor->sock == sock) {
- break;
- }
- }
- }
-
- if(itor == received_data_queue.end()) {
- return NULL;
- } else {
- buf.swap(itor->buf);
- const TCPsocket res = itor->sock;
- received_data_queue.erase(itor);
- return res;
- }
-}
+
+void receive_data(TCPsocket sock)
+{
+ {
+ const threading::lock lock(*global_mutex);
+
+ pending_receives.push_back(sock);
+
sockets_locked.insert(std::pair<TCPsocket,SOCKET_STATE>(sock,SOCKET_READY));
+ }
+
+ cond->notify_one();
+}
+
+TCPsocket get_received_data(TCPsocket sock, std::vector<char>& buf)
+{
+ const threading::lock lock(*global_mutex);
+ received_queue::iterator itor = received_data_queue.begin();
+ if(sock != NULL) {
+ for(; itor != received_data_queue.end(); ++itor) {
+ if(itor->sock == sock) {
+ break;
+ }
+ }
+ }
+
+ if(itor == received_data_queue.end()) {
+ return NULL;
+ } else {
+ buf.swap(itor->buf);
+ const TCPsocket res = itor->sock;
+ received_data_queue.erase(itor);
+ return res;
+ }
+}
void queue_data(TCPsocket sock, std::vector<char>& buf)
{
@@ -297,14 +297,14 @@
else
new_bufs.push_back(*i);
}
- bufs.swap(new_bufs);
-
- for(received_queue::iterator j = received_data_queue.begin(); j !=
received_data_queue.end(); ) {
- if(j->sock == sock) {
- j = received_data_queue.erase(j);
- } else {
- ++j;
- }
+ bufs.swap(new_bufs);
+
+ for(received_queue::iterator j = received_data_queue.begin(); j !=
received_data_queue.end(); ) {
+ if(j->sock == sock) {
+ j = received_data_queue.erase(j);
+ } else {
+ ++j;
+ }
}
}
@@ -317,10 +317,10 @@
SDL_Delay(10);
}
- const threading::lock lock(*global_mutex);
-
- if(first_time) {
-
pending_receives.erase(std::remove(pending_receives.begin(),pending_receives.end(),sock),pending_receives.end());
+ const threading::lock lock(*global_mutex);
+
+ if(first_time) {
+
pending_receives.erase(std::remove(pending_receives.begin(),pending_receives.end(),sock),pending_receives.end());
}
const socket_state_map::iterator lock_it =
sockets_locked.find(sock);
@@ -353,11 +353,11 @@
}
return 0;
-}
-
-std::pair<int,int> get_current_transfer_stats()
-{
- return current_transfer_stats;
+}
+
+std::pair<int,int> get_current_transfer_stats()
+{
+ return current_transfer_stats;
}
}
\ No newline at end of file
Index: wesnoth/src/network_worker.hpp
diff -u wesnoth/src/network_worker.hpp:1.2 wesnoth/src/network_worker.hpp:1.3
--- wesnoth/src/network_worker.hpp:1.2 Sat Feb 26 22:16:34 2005
+++ wesnoth/src/network_worker.hpp Sun Feb 27 18:15:21 2005
@@ -1,6 +1,6 @@
#ifndef NETWORK_WORKER_HPP_INCLUDED
#define NETWORK_WORKER_HPP_INCLUDED
-
+
#include <map>
#include <vector>
@@ -20,17 +20,17 @@
bool active_;
};
-
-//function to asynchronously received data to the given socket
-void receive_data(TCPsocket sock);
-
-TCPsocket get_received_data(TCPsocket sock, std::vector<char>& buf);
+
+//function to asynchronously received data to the given socket
+void receive_data(TCPsocket sock);
+
+TCPsocket get_received_data(TCPsocket sock, std::vector<char>& buf);
void queue_data(TCPsocket sock, std::vector<char>& buf);
bool socket_locked(TCPsocket sock);
void close_socket(TCPsocket sock);
-TCPsocket detect_error();
-
+TCPsocket detect_error();
+
std::pair<int,int> get_current_transfer_stats();
}
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.135 wesnoth/src/preferences.cpp:1.136
--- wesnoth/src/preferences.cpp:1.135 Fri Feb 25 01:07:19 2005
+++ wesnoth/src/preferences.cpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.135 2005/02/25 01:07:19 ydirson Exp $ */
+/* $Id: preferences.cpp,v 1.136 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -716,11 +716,11 @@
void set_show_fps(bool value)
{
fps = value;
-}
-
-bool compress_saves()
-{
- return prefs["compress_saves"] != "no";
+}
+
+bool compress_saves()
+{
+ return prefs["compress_saves"] != "no";
}
std::set<std::string> &encountered_units() {
Index: wesnoth/src/preferences.hpp
diff -u wesnoth/src/preferences.hpp:1.48 wesnoth/src/preferences.hpp:1.49
--- wesnoth/src/preferences.hpp:1.48 Sun Feb 20 15:27:25 2005
+++ wesnoth/src/preferences.hpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.hpp,v 1.48 2005/02/20 15:27:25 Sirp Exp $ */
+/* $Id: preferences.hpp,v 1.49 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -147,8 +147,8 @@
void set_show_haloes(bool value);
bool show_fps();
- void set_show_fps(bool value);
-
+ void set_show_fps(bool value);
+
bool compress_saves();
std::set<std::string> &encountered_units();
Index: wesnoth/src/widgets/scrollpane.hpp
diff -u wesnoth/src/widgets/scrollpane.hpp:1.5
wesnoth/src/widgets/scrollpane.hpp:1.6
--- wesnoth/src/widgets/scrollpane.hpp:1.5 Mon Feb 21 00:26:37 2005
+++ wesnoth/src/widgets/scrollpane.hpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollpane.hpp,v 1.5 2005/02/21 00:26:37 Sirp Exp $ */
+/* $Id: scrollpane.hpp,v 1.6 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -44,10 +44,10 @@
scrollpane(display &d);
virtual void set_location(SDL_Rect const &rect);
-
- //VC++ doesn't like a 'using scrollarea::set_location' directive here,
so we declare
- //an inline forwarding function instead
- void set_location(int x, int y) { widget::set_location(x,y); }
+
+ //VC++ doesn't like a 'using scrollarea::set_location' directive here,
so we declare
+ //an inline forwarding function instead
+ void set_location(int x, int y) { widget::set_location(x,y); }
virtual void hide(bool value=true);
Index: wesnoth/src/widgets/textbox.hpp
diff -u wesnoth/src/widgets/textbox.hpp:1.38
wesnoth/src/widgets/textbox.hpp:1.39
--- wesnoth/src/widgets/textbox.hpp:1.38 Mon Feb 21 00:23:44 2005
+++ wesnoth/src/widgets/textbox.hpp Sun Feb 27 18:15:21 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.hpp,v 1.38 2005/02/21 00:23:44 Sirp Exp $ */
+/* $Id: textbox.hpp,v 1.39 2005/02/27 18:15:21 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -43,10 +43,10 @@
void set_wrap(bool val);
- void set_location(const SDL_Rect& rect);
-
- //VC++ doesn't like a 'using scrollarea::set_location' directive here,
so we declare
- //an inline forwarding function instead
+ void set_location(const SDL_Rect& rect);
+
+ //VC++ doesn't like a 'using scrollarea::set_location' directive here,
so we declare
+ //an inline forwarding function instead
void set_location(int x, int y) { widget::set_location(x,y); }
protected:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src ai.cpp ai_interface.hpp animated.cp...,
Yann Dirson <=