forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
explosion_queue.h
73 lines (57 loc) · 1.6 KB
/
explosion_queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#ifndef CATA_SRC_EXPLOSION_QUEUE_H
#define CATA_SRC_EXPLOSION_QUEUE_H
#include "explosion.h"
#include "point.h"
#include <string>
#include <deque>
namespace explosion_handler
{
enum class ExplosionType {
Regular,
Flashbang,
ResonanceCascade,
Shockwave
};
struct queued_explosion {
queued_explosion() = default;
queued_explosion( const tripoint &pos, ExplosionType type,
Creature *source ) : pos( pos ), type( type ), source( source ) {}
/** Origin */
tripoint pos;
/** Explosion type */
ExplosionType type = ExplosionType::Regular;
/** Data for Regular explosion */
explosion_data exp_data;
/** Data for Shockwave explosion */
shockwave_data swave_data;
/** Graphical name for the explosion */
std::string graphics_name;
/** Whether it affects player */
bool affects_player = false;
/** Who's responsible of the explosion */
Creature *source;
};
namespace explosion_funcs
{
void regular( const queued_explosion &qe );
void flashbang( const queued_explosion &qe );
void resonance_cascade( const queued_explosion &qe );
void shockwave( const queued_explosion &qe );
} // namespace explosion_funcs
class explosion_queue
{
private:
std::deque<queued_explosion> elems;
public:
inline void add( queued_explosion &&exp ) {
elems.push_back( std::move( exp ) );
}
void execute();
inline void clear() {
elems.clear();
}
};
explosion_queue &get_explosion_queue();
} // namespace explosion_handler
#endif // CATA_SRC_EXPLOSION_QUEUE_H