// $Id: playerdata.h,v 1.5 2006/08/07 17:24:48 matthew Exp $ // Fish Supper // Copyright (C) 2006 Matthew Clarke // // 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. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #ifndef _PLAYERDATA_H_ #define _PLAYERDATA_H_ #include "enums.h" #include "constants.h" #include "playdisplay.h" #include "SDL.h" #include #include namespace FS { class PlayerData { private: int level; int num_lives; int score; CrystalColor * crystals_held; bool crystals_held_allocated; int max_crystals; bool check_crystals(CrystalColor color_0, CrystalColor color_1); void tidy_up_crystals(); SDL_Rect dest_rect; SDL_Rect erase_rect; SDL_Rect dirty_rect; public: PlayerData(); ~PlayerData(); void reset(int start_level); void set_max_crystals(int mc); void set_crystals_held(CrystalColor * crystals, int n); void print_crystals_held() const; void draw_crystals_held(PlayDisplay * pd); // NEW! bool is_allowed_on_log(LogColor lc, PlayDisplay * pd); CrystalColor add_crystal(CrystalColor cc, PlayDisplay * pd); bool inc_level(); int get_level() const { return level; } void inc_score(int pts) { score += pts; } int get_score() const { return score; } // returns number of lives left int dec_num_lives() { return --num_lives; } int get_num_lives() const { return num_lives; } const SDL_Rect & get_crystals_held_bounding_box() { return dirty_rect; } }; // class PlayerData } // namespace FS #endif