X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fchannel.c;h=db5cfaa4c0e1e5aff595bd029be368dd0b784e20;hb=3cdeee27cb0c83268f73bfb8a745b0da9dd3f175;hp=1e71be3db880492061e52e3495aa91665565a581;hpb=90a18c3aebe9e2478bc9b24bd2d1680e1487cf8f;p=umurmur.git diff --git a/src/channel.c b/src/channel.c index 1e71be3..db5cfaa 100644 --- a/src/channel.c +++ b/src/channel.c @@ -254,14 +254,11 @@ void Chan_addChannel(channel_t *parent, channel_t *ch) } -int Chan_playerJoin(channel_t *ch, client_t *client) +int Chan_playerLeave(client_t *client) { channel_t *leaving = NULL; int leaving_id = -1; - /* Only allowed in one channel at a time */ - Log_debug("Add player %s to channel %s", client->playerName, ch->name); - if (client->channel) { list_del(&client->chan_node); leaving = (channel_t *)client->channel; @@ -270,6 +267,17 @@ int Chan_playerJoin(channel_t *ch, client_t *client) Chan_freeChannel(leaving); } } + return leaving_id; +} + +int Chan_playerJoin(channel_t *ch, client_t *client) +{ + int leaving_id; + + Log_debug("Add player %s to channel %s", client->playerName, ch->name); + + /* Only allowed in one channel at a time */ + leaving_id = Chan_playerLeave(client); list_add_tail(&client->chan_node, &ch->clients); client->channel = (void *)ch; return leaving_id;