diff options
author | David Athay <ko2fan@gmail.com> | 2008-07-22 13:47:35 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-07-22 13:47:35 +0000 |
commit | 19a3d8395772b65d0624d2413c2e7e8b845cdb7d (patch) | |
tree | ce330de2bbbf871a6a8c19763862cc48b4c09741 /src | |
parent | 90b35878719aea081232adbb58fc906a3b3e0f79 (diff) | |
download | mana-19a3d8395772b65d0624d2413c2e7e8b845cdb7d.tar.gz mana-19a3d8395772b65d0624d2413c2e7e8b845cdb7d.tar.bz2 mana-19a3d8395772b65d0624d2413c2e7e8b845cdb7d.tar.xz mana-19a3d8395772b65d0624d2413c2e7e8b845cdb7d.zip |
Add permissions to guild members. Alt-Gr fix for Rotonen from 0.0
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/guild.cpp | 7 | ||||
-rw-r--r-- | src/guild.h | 2 | ||||
-rw-r--r-- | src/net/guildhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/protocol.h | 2 | ||||
-rw-r--r-- | src/player.cpp | 4 | ||||
-rw-r--r-- | src/player.h | 2 |
7 files changed, 17 insertions, 14 deletions
diff --git a/src/game.cpp b/src/game.cpp index f0209b73..afd4cba4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -652,7 +652,7 @@ void Game::handleInput() // Keys pressed together with Alt/Meta // Emotions and some internal gui windows #ifndef __APPLE__ - if (event.key.keysym.mod & KMOD_ALT) + if (event.key.keysym.mod & KMOD_ALT && event.key.keysym.mod ^ KMOD_LCTRL) #else if (event.key.keysym.mod & KMOD_LMETA) #endif diff --git a/src/guild.cpp b/src/guild.cpp index 4f28d8b5..c02af865 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -23,10 +23,13 @@ #include "guild.h" -Guild::Guild(short id, bool inviteRights): +Guild::Guild(short id, short rights): mId(id), - mCanInviteUsers(inviteRights) + mCanInviteUsers(false) { + // to invite, rights must be greater than 0 + if (rights > 0) + mCanInviteUsers = true; } void Guild::addMember(const std::string &name) diff --git a/src/guild.h b/src/guild.h index 969b146e..e262d3df 100644 --- a/src/guild.h +++ b/src/guild.h @@ -35,7 +35,7 @@ public: /** * Constructor with guild id passed to it */ - Guild(short id, bool inviteRights); + Guild(short id, short rights); /** * Set the guild's name diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 151abe03..51393168 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -137,19 +137,19 @@ void GuildHandler::handleMessage(MessageIn &msg) guild->addMember(guildMember); guildWindow->setOnline(guild->getName(), guildMember, true); break; - + case GUILD_EVENT_LEAVING_PLAYER: guild->removeMember(guildMember); break; - + case GUILD_EVENT_ONLINE_PLAYER: guildWindow->setOnline(guild->getName(), guildMember, true); break; - + case GUILD_EVENT_OFFLINE_PLAYER: guildWindow->setOnline(guild->getName(), guildMember, false); break; - + default: logger->log("Invalid guild event"); } @@ -201,12 +201,12 @@ void GuildHandler::joinedGuild(MessageIn &msg) { std::string guildName = msg.readString(); short guildId = msg.readInt16(); - bool leader = msg.readInt8(); + short permissions = msg.readInt16(); short channelId = msg.readInt16(); std::string announcement = msg.readString(); // Add guild to player and create new guild tab - Guild *guild = player_node->addGuild(guildId, leader); + Guild *guild = player_node->addGuild(guildId, permissions); guild->setName(guildName); guildWindow->newGuildTab(guildName); guildWindow->requestMemberList(guildId); diff --git a/src/net/protocol.h b/src/net/protocol.h index 89713591..52db350b 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -143,7 +143,7 @@ enum { CPMSG_GUILD_QUIT_RESPONSE = 0x0361, // B error CPMSG_GUILD_INVITED = 0x0370, // S char name, S guild name, W id - CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, B rights, W channel + CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, W rights, W channel, S announce // Party PCMSG_PARTY_INVITE = 0x03A0, // S name diff --git a/src/player.cpp b/src/player.cpp index 61730724..49f0221d 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -153,9 +153,9 @@ void Player::setSprite(int slot, int id, const std::string &color) Being::setSprite(slot, id, color); } -Guild* Player::addGuild(short guildId, bool inviteRights) +Guild* Player::addGuild(short guildId, short rights) { - Guild *guild = new Guild(guildId, inviteRights); + Guild *guild = new Guild(guildId, rights); mGuilds.insert(std::pair<int, Guild*>(guildId, guild)); return guild; } diff --git a/src/player.h b/src/player.h index 89cc1207..7e86b1e1 100644 --- a/src/player.h +++ b/src/player.h @@ -93,7 +93,7 @@ class Player : public Being /** * Adds a guild to the player. */ - Guild* addGuild(short guildId, bool inviteRights); + Guild* addGuild(short guildId, short rights); /** * Removers a guild from the player. |