summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_content.cpp9
-rw-r--r--src/network/network_content.h2
-rw-r--r--src/network/network_content_gui.cpp1
3 files changed, 11 insertions, 1 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index bdb3608ed..fa7f83624 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -218,7 +218,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
ContentInfo *ci = *iter;
bool found = false;
for (ContentIterator iter2 = this->infos.Begin(); iter2 != this->infos.End(); iter2++) {
- ContentInfo *ci2 = *iter;
+ ContentInfo *ci2 = *iter2;
if (ci->type == ci2->type && ci->unique_id == ci2->unique_id &&
(!send_md5sum || memcmp(ci->md5sum, ci2->md5sum, sizeof(ci->md5sum)) == 0)) {
found = true;
@@ -746,6 +746,13 @@ void ClientNetworkContentSocketHandler::CheckDependencyState(ContentInfo *ci)
}
}
+void ClientNetworkContentSocketHandler::Clear()
+{
+ for (ContentIterator iter = this->infos.Begin(); iter != this->infos.End(); iter++) delete *iter;
+
+ this->infos.Clear();
+}
+
/*** CALLBACK ***/
void ClientNetworkContentSocketHandler::OnConnect(bool success)
diff --git a/src/network/network_content.h b/src/network/network_content.h
index ac169313f..6e683dd7e 100644
--- a/src/network/network_content.h
+++ b/src/network/network_content.h
@@ -117,6 +117,8 @@ public:
ConstContentIterator Get(uint32 index) const { return this->infos.Get(index); }
/** Get the end of the content inf iterator. */
ConstContentIterator End() const { return this->infos.End(); }
+ /** Clear all downloaded content information. */
+ void Clear();
/** Add a callback to this class */
void AddCallback(ContentCallback *cb) { this->callbacks.Include(cb); }
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 398f838da..2497c5a38 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -684,6 +684,7 @@ static const WindowDesc _network_content_list_desc = {
void ShowNetworkContentListWindow(ContentVector *cv, ContentType type)
{
#if defined(WITH_ZLIB)
+ _network_content_client.Clear();
if (cv == NULL) {
_network_content_client.RequestContentList(type);
} else {