removed room.* (unused)

This commit is contained in:
2024-07-13 14:22:06 -04:00
parent 9fdbf141d3
commit 3ae82841f4
6 changed files with 19 additions and 45 deletions

View File

@ -13,21 +13,6 @@ struct gold {
typedef std::vector<gold> gold_list; typedef std::vector<gold> gold_list;
int rand_gold_pile(RNG *rng) { int rand_gold_pile(RNG *rng);
const int denominator = 8;
const int normal = 5;
const int dragon = 6;
int tmp = rng->rand_under(denominator);
if (tmp < normal)
return GOLD_NORMAL;
else if (tmp < dragon)
return GOLD_DRAGON;
else
return GOLD_SMALL;
return 0;
}
#endif #endif

View File

@ -5,10 +5,10 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "display.h" #include "display.h"
#include "gold.h"
#include "enemies.h" #include "enemies.h"
#include "potions.h" #include "potions.h"
#include "constants.h" #include "constants.h"
#include "gold.h"
#include "map.h" #include "map.h"
class level { class level {

View File

@ -47,22 +47,3 @@ int RNG::exclude_middle(const int lower_bound, const int upper_bound,
int tmp = (curr_rand_num % (upper_bound - lower_bound - 1)); int tmp = (curr_rand_num % (upper_bound - lower_bound - 1));
return tmp >= excluded ? tmp + 1 : tmp; return tmp >= excluded ? tmp + 1 : tmp;
} }
template<class T> T RNG::rand_exclude(std::vector<T> &vec, T &target) {
std::size_t idx = 0;
for (; idx < vec.size(); ++idx)
if (vec[idx] == target)
break;
return vec[exclude_middle(0, vec.size(), idx)];
}
template<class T> T RNG::get_rand_in_vector(std::vector<T> &vec) {
if (!vec.size())
return T{};
curr_rand_num = rand();
return vec[curr_rand_num % vec.size()];
}

View File

@ -33,9 +33,24 @@ public:
int exclude_middle(const int lower_bound, const int upper_bound, int exclude_middle(const int lower_bound, const int upper_bound,
const int excluded); const int excluded);
template<class T> T rand_exclude(std::vector<T> &vec, T &target); template<class T> T rand_exclude(std::vector<T> &vec, T &target) {
std::size_t idx = 0;
template<class T> T get_rand_in_vector(std::vector<T> &vec); for (; idx < vec.size(); ++idx)
if (vec[idx] == target)
break;
return vec[exclude_middle(0, vec.size(), idx)];
}
template<class T> T get_rand_in_vector(std::vector<T> &vec) {
if (!vec.size())
return T{};
curr_rand_num = rand();
return vec[curr_rand_num % vec.size()];
}
}; };
#endif #endif

View File

@ -1 +0,0 @@
#include "room.h"

View File

@ -1,6 +0,0 @@
#ifndef __ROOM_H__
#define __ROOM_H__
#endif