diff --git a/src/characters.h b/src/characters.h index 941de50..fb1ed8c 100644 --- a/src/characters.h +++ b/src/characters.h @@ -13,7 +13,6 @@ #include "constants.h" #include "position.h" -#include "layer.h" #include "potion.h" #include "rng.h" diff --git a/src/constants.h b/src/constants.h index b697615..f4316de 100644 --- a/src/constants.h +++ b/src/constants.h @@ -31,9 +31,6 @@ enum game_command {game_command_terminate = 0, enum stat_name {HP, ATK, DEF, hostile}; -const int LAYER_CNT = 4; // TODO: update as you go -enum layer_num {map = 0, objects, characters, shop}; - const int RACE_CNT = 4; // TODO: update as you go enum race {rshade = 0, rvampire, rgoblin, rdrow /* TODO: fill out the other races (including enemies) */}; @@ -109,5 +106,6 @@ const int COLOR_BLACK_ON_WHITE = 8; typedef std::vector position_list; typedef std::vector direction_list; +typedef std::vector gold_list; #endif diff --git a/src/inventory.h b/src/inventory.h deleted file mode 100644 index 00b572f..0000000 --- a/src/inventory.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __INVENTORY_H__ -#define __INVENTORY_H__ - -class inventory final { -private: - object_list objects; - -}; - -#endif diff --git a/src/layer.h b/src/layer.h deleted file mode 100644 index 15ddb7d..0000000 --- a/src/layer.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * CS 246 Final Project - * File: map.h - * Purpose: handles map functionality - */ - -#ifndef __LAYER_H__ -#define __LAYER_H__ -#include "constants.h" -#include "display.h" - -class layer { -public: - const layer_num num; - - layer(const layer_num ln): num{ln} {} - - virtual void print() const = 0; - virtual void print(display &display) const = 0; -}; - -#endif diff --git a/src/log.h b/src/log.h index 342329d..ccaa105 100644 --- a/src/log.h +++ b/src/log.h @@ -6,12 +6,11 @@ #include #include "constants.h" #include "characters.h" -#include "objects.h" class logger final { private: std::ofstream out; - std::vector display; + std::vector contents; public: logger(std::ofstream &&new_out); @@ -22,6 +21,7 @@ public: void print_turn(const unsigned turn); void print_player(std::unique_ptr &player); void print_chlist(const character_list &chlist); + void print_gold(const gold_list &gold_piles); void print_potions(const potion_list &potions); }; diff --git a/src/map.cc b/src/map.cc index a7d186d..d9827cd 100644 --- a/src/map.cc +++ b/src/map.cc @@ -5,14 +5,12 @@ #include #include -game_map::game_map(int lvl): - layer{layer_num::map} { +game_map::game_map(int lvl) { level = lvl; // TODO: randomly generate a map } -game_map::game_map(const std::string &map_data, int lvl): - layer{layer_num::map} { +game_map::game_map(const std::string &map_data, int lvl) { level = lvl; std::istringstream iss{map_data}; diff --git a/src/map.h b/src/map.h index de0477d..58fe7c2 100644 --- a/src/map.h +++ b/src/map.h @@ -8,14 +8,12 @@ #define __MAP_H__ #include #include -#include "objects.h" #include "constants.h" #include "display.h" #include "position.h" -#include "layer.h" #include "characters.h" -class game_map final: public layer { +class game_map final { public: game_map(int lvl = 0); // randomly generate one // initialize using stored data diff --git a/src/objects.h b/src/objects.h deleted file mode 100644 index c2e0424..0000000 --- a/src/objects.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CS 246 Final Project - * File: map.h - * Purpose: handles map functionality - */ - -#ifndef __OBJECTS_H__ -#define __OBJECTS_H__ -#include -#include -#include "layer.h" -#include "display.h" - -class object { - // TODO: design the entire class -public: - void print() {} // use ncurses - void print(display &display) {} -}; - -class object_list final: public layer { -private: - -}; - -// TODO: throw potion into another header - -class potion final: public object { - // TODO: design the entire class -}; - -class potion_list final: public layer { -private: - std::vector> potions; - // TODO: design the entire class -}; - -#endif diff --git a/src/potions/restore_health.cc b/src/potions/restore_health.cc index 8cb646b..6d725c0 100644 --- a/src/potions/restore_health.cc +++ b/src/potions/restore_health.cc @@ -9,9 +9,9 @@ void restore_health::apply(enum race &race, int &HP, int &ATK, int &DEF, float &base_hit_rate) { if (remaining_duration > 0) { if (race == rdrow) - HP = std::max(HP + 7, MAX_HP[race]); + HP = std::min(HP + 7, MAX_HP[race]); else - HP = std::max(HP + 5, MAX_HP[race]); + HP = std::min(HP + 5, MAX_HP[race]); --remaining_duration; }