Code Search for Developers
 
 
  

playerclient.h from FreePop at Krugle


Show playerclient.h syntax highlighted

/***************************************************************************
                           playerclient.h
                           -------------------
    begin                : Wed Jun 9 2004
    copyright            : (C) 2004 by Brendon Higgins
    email                : freepop-devel@lists.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PLAYERCLIENT_H_INCLUDED
#define PLAYERCLIENT_H_INCLUDED

#include <player.h>

class CL_NetPacket;

/**
 * Player info, client edition.
 */
class PlayerClient {
private:
    /**
     * The slot number this player occupies.
     */
    int slot;

    /**
     * The player's name.
     */
    std::string name;
    
    /**
     * The player's signature colour.
     */
    unsigned int colour;

    /**
     * Current number of peeps who follow this player.
     */
    int numPeeps;
    
    /**
     * Current number of settlements of this player.
     */
    int numTowns;
    
    /**
     * The number of different leaders this player has had.
     * Number of times this player's leader has died + 1.
     */
    int numLeaders;

    /**
     * Is this the local player's info?
     */
    bool local;

    /**
     * The name change signal.
     */
    static CL_Signal_v2<const std::string&, PlayerClient*> mSigNameChange;

    /**
     * The colour change signal.
     */
    static CL_Signal_v2<unsigned int, PlayerClient*> mSigColourChange;

public:
    /**
     * Constructor.
     */
    PlayerClient(CL_InputSource &is);

    /**
     * Destructor.
     */
    ~PlayerClient();
    
    /**
     * Is this the local player?
     */
    bool isLocal() const;

    /**
     * Get the slot number of this player. This can be used as a unique
     * identifier.
     */
    int getSlot() const;

    /**
     * Get this player's name.
     */
    const std::string& getName() const;
    
    /**
     * Set this player's name.
     */
    void setName(CL_NetComputer& server, const std::string& n);
    
    /**
     * Called when this player's name has changed.
     */
    void onNameChange(CL_NetPacket& p);

    /**
     * The name change signal. Slots are passed the old name and a pointer to
     * the PlayerClient which contains the new name.
     */
    static CL_Signal_v2<const std::string&, PlayerClient*>& sigNameChange();
    
    /**
     * Get this player's colour.
     */
    unsigned int getColour() const;
    
    /**
     * Set this player's colour.
     */
    void setColour(CL_NetComputer& server, unsigned int c);
    
    /**
     * Called when this player's colour has changed.
     */
    void onColourChange(CL_NetPacket& p);

    /**
     * The colour change signal. Slots are passed the old colour and a pointer
     * to the PlayerClient which contains the new colour.
     */
    static CL_Signal_v2<unsigned int, PlayerClient*>& sigColourChange();
    
    /**
     * Called to process a message.
     */
    void onMessage(CL_NetPacket& p);
    
    /**
     * Create a packet with header information for a message type \p t.
     */
    CL_NetPacket startMessage(int t) const;
};

#endif /* ndef PLAYERCLIENT_H_INCLUDED */




See more files for this project here

FreePop

FreePop is a multi-platform tile-based game based on the great old game Populous 2 by Bullfrog Productions Ltd., but much improved.

Project homepage: http://sourceforge.net/projects/freepop
Programming language(s): C++
License: other

  Makefile.am
  client.cpp
  client.h
  clientmisc.cpp
  clientmisc.h
  clientstate.cpp
  clientstate.h
  connectstate.cpp
  connectstate.h
  cropsclient.cpp
  cropsclient.h
  entityclient.cpp
  entityclient.h
  entityclientfactory.cpp
  entityclientfactory.h
  firecolumnclient.cpp
  firecolumnclient.h
  gamestate.cpp
  gamestate.h
  loadstate.cpp
  loadstate.h
  mapclient.cpp
  mapclient.h
  maptileclient.cpp
  maptileclient.h
  messagebox.cpp
  messagebox.h
  oversprite.cpp
  oversprite.h
  paintable.cpp
  paintable.h
  pausefader.cpp
  pausefader.h
  peepclient.cpp
  peepclient.h
  peepmagnetclient.cpp
  peepmagnetclient.h
  playerclient.cpp
  playerclient.h
  playeroptionsdialog.cpp
  playeroptionsdialog.h
  rockclient.cpp
  rockclient.h
  swampclient.cpp
  swampclient.h
  townclient.cpp
  townclient.h
  treeclient.cpp
  treeclient.h
  worldclient.cpp
  worldclient.h