• Main Page
  • Classes
  • Files
  • File List
  • File Members

code/include/Profile.h

Go to the documentation of this file.
00001 /*
00002  * TetriCycle
00003  * Copyright (C) 2009, 2010 Cale Scholl
00004  *
00005  * This file is part of TetriCycle.
00006  *
00007  * TetriCycle is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License as published
00009  * by the Free Software Foundation, either version 3 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * TetriCycle is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with TetriCycle.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 /** @file Profile.h
00022  * @brief Defines the Profile struct.
00023  * @author Cale Scholl / calvinss4
00024  */
00025 
00026 #pragma once
00027 #ifndef __PROFILE_H__
00028 #define __PROFILE_H__
00029 
00030 #include <cstring> // for memset
00031 #include <vector>  // for vector
00032 
00033 #include "defines_Powerup.h" // for PowerupId
00034 #include "defines_Player.h"  // for DEFAULT_MAX_PLAYLINES
00035 
00036 using std::vector;
00037 
00038 /// A player profile.
00039 struct Profile
00040 {
00041   Profile() : isPowerupEnabled(g_totalPowerups, true),
00042               maxLines(DEFAULT_MAX_PLAYLINES),
00043               attackRate(DEFAULT_ATTACK_RATE),
00044               powerupRate(DEFAULT_POWERUP_RATE)
00045   {
00046     memset(powerupStartQueue, POWERUP_ID_NONE, sizeof(powerupStartQueue));
00047   }
00048 
00049   Profile(const Profile &profile) : 
00050     isPowerupEnabled(profile.isPowerupEnabled),
00051     maxLines(profile.maxLines),
00052     attackRate(profile.attackRate),
00053     powerupRate(profile.powerupRate)
00054   {
00055     memcpy(powerupStartQueue, profile.powerupStartQueue, sizeof(powerupStartQueue));
00056   }
00057 
00058   vector<bool> isPowerupEnabled; ///< whether powerups are enabled/disabled for this player
00059   PowerupId powerupStartQueue[MAX_ACQUIRED_POWERUPS]; ///< powerups this player starts with
00060   u16 maxLines;   ///< number of lines needed to win the game
00061   u16 attackRate; ///< attack opponents every time score is a multiple of attackRate
00062   u8 powerupRate; ///< every 'powerupRate' pieces will be a powerup piece
00063 };
00064 
00065 #endif // __PROFILE_H__

Generated on Wed Oct 20 2010 17:06:58 for TetriCycle by  doxygen 1.7.1