#include "MyPlayer.h"

int MyPlayer :: playerCount;

/**
* Constructor
*/
MyPlayer :: MyPlayer()
{
    coconutLobbing = 0;	// How proficient player is at lobbing coconuts
    squirrelLobbing = 0;	// How proficient player is at lobbing squirrels
    horseShoeLobbing = 0;	// How proficient player is at lobbing horse shoes
}

/**
* Copy constructor
*/
MyPlayer :: MyPlayer(const MyPlayer& srcMyPlayer)
{
    operator=(srcMyPlayer);
}

/**
* Sets this object equal to incoming object
*/
const MyPlayer& MyPlayer :: operator=(const MyPlayer& srcMyPlayer)
{
    unsigned int i;

    /* Bunch of player characteristics */
    name = srcMyPlayer.name;
    jobCode = srcMyPlayer.jobCode;
    likesNutsInBannanaBread = srcMyPlayer.likesNutsInBannanaBread;

    /* Measurements */
    memcpy(nostrilSize, srcMyPlayer.nostrilSize, sizeof(int) * ARRAYSZ_NOSTRILSIZE);
    memcpy(eyeballRadius, srcMyPlayer.eyeballRadius, sizeof(int) * ARRAYSZ_EYEBALLRADIUS);
    eyebrowDensity = srcMyPlayer.eyebrowDensity;
    height = srcMyPlayer.height;

    /* Weapon proficiencies */
    coconutLobbing = srcMyPlayer.coconutLobbing;
    squirrelLobbing = srcMyPlayer.squirrelLobbing;
    horseShoeLobbing = srcMyPlayer.horseShoeLobbing;

    /* Player count */

    return(*this);
}

/**
* Writes this object from a stream
*/
void MyPlayer :: write(UGStreamWriter* ugsw)
{
    unsigned int i;

    /* Bunch of player characteristics */
    ugsw -> writeString(name);
    ugsw -> writeChar(jobCode);
    ugsw -> writeBool(likesNutsInBannanaBread);

    /* Measurements */

    for (i = 0; i < ARRAYSZ_NOSTRILSIZE; i++)
        ugsw -> writeInt(nostrilSize[i]);


    for (i = 0; i < ARRAYSZ_EYEBALLRADIUS; i++)
        ugsw -> writeInt(eyeballRadius[i]);

    ugsw -> writeInt(eyebrowDensity);
    ugsw -> writeInt(height);

    /* Weapon proficiencies */
    ugsw -> writeChar(coconutLobbing);
    ugsw -> writeChar(squirrelLobbing);
    ugsw -> writeChar(horseShoeLobbing);

    /* Player count */
}

/**
* Reads this object from a stream
*/
void MyPlayer :: read(UGStreamReader* ugsr)
{
    unsigned int i;

    /* Bunch of player characteristics */
    ugsr -> readString(name);
    ugsr -> readChar(jobCode);
    ugsr -> readBool(likesNutsInBannanaBread);

    /* Measurements */

    for (i = 0; i < ARRAYSZ_NOSTRILSIZE; i++)
        ugsr -> readInt(nostrilSize[i]);


    for (i = 0; i < ARRAYSZ_EYEBALLRADIUS; i++)
        ugsr -> readInt(eyeballRadius[i]);

    ugsr -> readInt(eyebrowDensity);
    ugsr -> readInt(height);

    /* Weapon proficiencies */
    ugsr -> readChar(coconutLobbing);
    ugsr -> readChar(squirrelLobbing);
    ugsr -> readChar(horseShoeLobbing);

    /* Player count */
}

/**
* Logs this class's info to a stream
* 
* @param outStr The stream theis class is being logged to
* @param indent The amount we we indent each line in the class output
* @param logChildren Whether or not we will write objects side this object
* to the debug stream
*/
#ifdef _LOG_IT
void MyPlayer :: logIt(std::ostream &outStr, std::string indent, bool logChildren) const
{
    unsigned int i;

    outStr << indent << " -- MyPlayer begin -- " << endl;
    /* Bunch of player characteristics */
    outStr << indent << "name: " << name << endl;
    outStr << indent << "jobCode: " << jobCode << endl;
    outStr << indent << "likesNutsInBannanaBread: " << likesNutsInBannanaBread << endl;

    /* Measurements */
    outStr << indent << "nostrilSize: ";
    for (i = 0; i < ARRAYSZ_NOSTRILSIZE; i++)
        outStr << indent << nostrilSize[i] << "  ";
    outStr << endl;

    outStr << indent << "eyeballRadius: ";
    for (i = 0; i < ARRAYSZ_EYEBALLRADIUS; i++)
        outStr << indent << eyeballRadius[i] << "  ";
    outStr << endl;

    outStr << indent << "eyebrowDensity: " << eyebrowDensity << endl;
    outStr << indent << "height: " << height << endl;

    /* Weapon proficiencies */
    outStr << indent << "coconutLobbing: " << coconutLobbing << endl;
    outStr << indent << "squirrelLobbing: " << squirrelLobbing << endl;
    outStr << indent << "horseShoeLobbing: " << horseShoeLobbing << endl;

    /* Player count */
    outStr << indent << "playerCount: " << playerCount << endl;
    outStr << indent << " -- MyPlayer end -- " << endl;
}
#endif

/**
* 
* 
* @param name 
* @param countSomething 
* @param anArray 
* 
* @return 
*/ 
bool MyPlayer :: weeeHoo(const std::string name, const short& countSomething, const unsigned char anArray[]) const
{
    
    return();
}

/**
* 
* 
* @param type 
* @param howMuch 
* @param howFast 
*/ 
void MyPlayer :: eatFood(short type, const short& howMuch, unsigned char howFast)
{
    
}

/**
* 
* 
* @param type 
* @param howMuch 
* 
* @return 
*/ 
short MyPlayer :: drinkStuff(short type, const short& howMuch)
{
    
    return();
}

/**
* 
* 
*/ 
void MyPlayer :: sleep()
{
    
}