[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp multiplayer_l...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp multiplayer_l... |
Date: |
Sun, 04 Sep 2005 11:52:18 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/09/04 15:52:18
Modified files:
src : multiplayer_lobby.cpp multiplayer_lobby.hpp
Log message:
attempt to fix memory leaks in mp lobby
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.83&tr2=1.84&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.83
wesnoth/src/multiplayer_lobby.cpp:1.84
--- wesnoth/src/multiplayer_lobby.cpp:1.83 Thu Aug 11 19:01:36 2005
+++ wesnoth/src/multiplayer_lobby.cpp Sun Sep 4 15:52:17 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.cpp,v 1.83 2005/08/11 19:01:36 j_daniel Exp $ */
+/* $Id: multiplayer_lobby.cpp,v 1.84 2005/09/04 15:52:17 Sirp Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -166,17 +166,22 @@
}
if(map_data != "") {
- try {
- gamemap map(game_config(), map_data);
- const surface
mini(image::getMinimap(100,100,map,0));
-
- //generate a unique id to show the map as
- std::stringstream id;
- id << "addr " << mini.get();
- std::string const &image_id = id.str();
- image::register_image(image_id, mini);
+ try {
+ std::string& image_id = minimaps_[map_data];
+
+ if(image_id.empty()) {
+ gamemap map(game_config(), map_data);
+ const surface
mini(image::getMinimap(100,100,map,0));
+
+ //generate a unique id to show the map
as
+ std::stringstream id;
+ id << "addr " << mini.get();
+ image_id = id.str();
+ image::register_image(image_id, mini);
+ }
+
+ str << "&" << image_id << COLUMN_SEPARATOR;
- str << "&" << image_id << COLUMN_SEPARATOR;
} catch(gamemap::incorrect_format_exception& e) {
std::cerr << "illegal map: " << e.msg_ << "\n";
}
Index: wesnoth/src/multiplayer_lobby.hpp
diff -u wesnoth/src/multiplayer_lobby.hpp:1.13
wesnoth/src/multiplayer_lobby.hpp:1.14
--- wesnoth/src/multiplayer_lobby.hpp:1.13 Sat Jun 4 19:16:05 2005
+++ wesnoth/src/multiplayer_lobby.hpp Sun Sep 4 15:52:17 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_lobby.hpp,v 1.13 2005/06/04 19:16:05 ott Exp $ */
+/* $Id: multiplayer_lobby.hpp,v 1.14 2005/09/04 15:52:17 Sirp Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -13,6 +13,8 @@
#ifndef MULTIPLAYER_LOBBY_HPP_INCLUDED
#define MULTIPLAYER_LOBBY_HPP_INCLUDED
+
+#include <map>
#include "config.hpp"
#include "display.hpp"
@@ -61,7 +63,9 @@
lobby_sorter sorter_;
gui::menu games_menu_;
- int current_game_;
+ int current_game_;
+
+ std::map<std::string,std::string> minimaps_;
};
}
- [Wesnoth-cvs-commits] wesnoth/src multiplayer_lobby.cpp multiplayer_l...,
David White <=