diff options
author | David Athay <ko2fan@gmail.com> | 2008-03-05 18:44:03 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-03-05 18:44:03 +0000 |
commit | 431a0b17e7eee6b27f98b74f4d073f2131a089dd (patch) | |
tree | 446344a335696f12d1eec05a731b094c2d44d991 /src/net | |
parent | 8d2f8756b0e85f14b5d80ec63dc5e5a7f5f5de3d (diff) | |
download | mana-client-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.gz mana-client-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.bz2 mana-client-431a0b17e7eee6b27f98b74f4d073f2131a089dd.tar.xz mana-client-431a0b17e7eee6b27f98b74f4d073f2131a089dd.zip |
Fixed guild creation.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/guildhandler.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 48d2e837..5bacaaa1 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -3,7 +3,7 @@ * A file part of The Mana World * * Created by David Athay on 01/03/2007. - * + * * Copyright (c) 2007, The Mana World Development Team * All rights reserved. * @@ -27,7 +27,7 @@ * * $Id$ */ - +#include <iostream> #include "guildhandler.h" #include "protocol.h" @@ -55,7 +55,7 @@ GuildHandler::GuildHandler() 0 }; handledMessages = _messages; - + } void GuildHandler::handleMessage(MessageIn &msg) @@ -73,7 +73,7 @@ void GuildHandler::handleMessage(MessageIn &msg) joinedGuild(guildId, guildName, true); } } break; - + case CPMSG_GUILD_INVITE_RESPONSE: { logger->log("Received CPMSG_GUILD_INVITE_RESPONSE"); @@ -82,7 +82,7 @@ void GuildHandler::handleMessage(MessageIn &msg) // TODO - Acknowledge invite was sent } } break; - + case CPMSG_GUILD_ACCEPT_RESPONSE: { logger->log("Received CPMSG_GUILD_ACCEPT_RESPONSE"); @@ -94,7 +94,7 @@ void GuildHandler::handleMessage(MessageIn &msg) joinedGuild(guildId, guildName, false); } } break; - + case CPMSG_GUILD_GET_MEMBERS_RESPONSE: { logger->log("Received CPMSG_GUILD_GET_MEMBERS_RESPONSE"); @@ -103,7 +103,9 @@ void GuildHandler::handleMessage(MessageIn &msg) std::string guildMember; Guild *guild; short guildId = msg.readInt16(); - guild = player_node->findGuildById(guildId); + guild = player_node->getGuild(guildId); + if (!guild) + return; while(msg.getUnreadLength()) { guildMember = msg.readString(); @@ -115,24 +117,24 @@ void GuildHandler::handleMessage(MessageIn &msg) guildWindow->updateTab(); } } break; - + case CPMSG_GUILD_INVITED: { logger->log("Received CPMSG_GUILD_INVITED"); std::string inviterName = msg.readString(); std::string guildName = msg.readString(); - + // Open a dialog asking if the player accepts joining the guild. guildWindow->openAcceptDialog(inviterName, guildName); } break; - + case CPMSG_GUILD_REJOIN: { logger->log("Received CPMSG_GUILD_REJOIN"); std::string guildName = msg.readString(); short guildId = msg.readInt16(); bool leader = msg.readInt8(); - + joinedGuild(guildId, guildName, leader); } break; } @@ -141,10 +143,8 @@ void GuildHandler::handleMessage(MessageIn &msg) void GuildHandler::joinedGuild(short guildId, const std::string &guildName, bool leader) { // Add guild to player and create new guild tab - player_node->addGuild(guildId, leader); - Guild *guild = player_node->findGuildById(guildId); + Guild *guild = player_node->addGuild(guildId, leader); guild->setName(guildName); guildWindow->newGuildTab(guildName); - guildWindow->requestMemberList(guildId); } |