Moving to a 'less constructors' style.
This commit is contained in:
parent
ea791270b3
commit
56b4580466
2 changed files with 8 additions and 13 deletions
|
|
@ -12,7 +12,6 @@ namespace ai {
|
||||||
using AIProfile = std::unordered_map<std::string, int>;
|
using AIProfile = std::unordered_map<std::string, int>;
|
||||||
|
|
||||||
constexpr const int SCORE_MAX = std::numeric_limits<int>::max() / 2;
|
constexpr const int SCORE_MAX = std::numeric_limits<int>::max() / 2;
|
||||||
|
|
||||||
constexpr const size_t STATE_MAX = 32;
|
constexpr const size_t STATE_MAX = 32;
|
||||||
|
|
||||||
using State = std::bitset<STATE_MAX>;
|
using State = std::bitset<STATE_MAX>;
|
||||||
|
|
@ -21,19 +20,14 @@ namespace ai {
|
||||||
const State ALL_ONES = ~ALL_ZERO;
|
const State ALL_ONES = ~ALL_ZERO;
|
||||||
|
|
||||||
struct Action {
|
struct Action {
|
||||||
std::string name;
|
std::string name="";
|
||||||
int cost = 0;
|
int cost = 0;
|
||||||
|
|
||||||
State $positive_preconds;
|
State $positive_preconds=ALL_ZERO;
|
||||||
State $negative_preconds;
|
State $negative_preconds=ALL_ZERO;
|
||||||
|
|
||||||
State $positive_effects;
|
State $positive_effects=ALL_ZERO;
|
||||||
State $negative_effects;
|
State $negative_effects=ALL_ZERO;
|
||||||
|
|
||||||
Action() {}
|
|
||||||
|
|
||||||
Action(std::string name, int cost) :
|
|
||||||
name(name), cost(cost) { }
|
|
||||||
|
|
||||||
void needs(int name, bool val);
|
void needs(int name, bool val);
|
||||||
void effect(int name, bool val);
|
void effect(int name, bool val);
|
||||||
|
|
@ -47,9 +41,9 @@ namespace ai {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using Script = std::deque<Action>;
|
|
||||||
|
|
||||||
const Action FINAL_ACTION("END", SCORE_MAX);
|
using Script = std::deque<Action>;
|
||||||
|
const Action FINAL_ACTION{"END", SCORE_MAX};
|
||||||
|
|
||||||
struct ActionState {
|
struct ActionState {
|
||||||
Action action;
|
Action action;
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ void Raycaster::apply_sprite_effect(shared_ptr<sf::Shader> effect, float width,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<sf::Shader> Raycaster::apply_lighting_effect(components::Position& sprite_pos, matrix::Matrix &lights) {
|
std::shared_ptr<sf::Shader> Raycaster::apply_lighting_effect(components::Position& sprite_pos, matrix::Matrix &lights) {
|
||||||
|
// BUG: this is applying it to all sprites, put bottle far away then another close to see
|
||||||
auto effect = $brightness;
|
auto effect = $brightness;
|
||||||
float level = lights[sprite_pos.location.y][sprite_pos.location.x] * PERCENT;
|
float level = lights[sprite_pos.location.y][sprite_pos.location.x] * PERCENT;
|
||||||
// this boosts the brightness of anything we're aiming at
|
// this boosts the brightness of anything we're aiming at
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue