removed room.* (unused)
This commit is contained in:
17
src/gold.h
17
src/gold.h
@ -13,21 +13,6 @@ struct gold {
|
||||
|
||||
typedef std::vector<gold> gold_list;
|
||||
|
||||
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;
|
||||
}
|
||||
int rand_gold_pile(RNG *rng);
|
||||
|
||||
#endif
|
||||
|
@ -5,10 +5,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "display.h"
|
||||
#include "gold.h"
|
||||
#include "enemies.h"
|
||||
#include "potions.h"
|
||||
#include "constants.h"
|
||||
#include "gold.h"
|
||||
#include "map.h"
|
||||
|
||||
class level {
|
||||
|
19
src/rng.cc
19
src/rng.cc
@ -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));
|
||||
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()];
|
||||
}
|
||||
|
19
src/rng.h
19
src/rng.h
@ -33,9 +33,24 @@ public:
|
||||
int exclude_middle(const int lower_bound, const int upper_bound,
|
||||
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
|
||||
|
@ -1 +0,0 @@
|
||||
#include "room.h"
|
@ -1,6 +0,0 @@
|
||||
#ifndef __ROOM_H__
|
||||
#define __ROOM_H__
|
||||
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user