1 #pragma once
2 #ifndef CATA_SRC_ACTIVITY_TYPE_H
3 #define CATA_SRC_ACTIVITY_TYPE_H
4 
5 #include <iosfwd>
6 
7 #include "game_constants.h"
8 #include "string_id.h"
9 #include "translations.h"
10 
11 class JsonObject;
12 class activity_type;
13 class player;
14 class player_activity;
15 
16 using activity_id = string_id<activity_type>;
17 
18 /** @relates string_id */
19 template<>
20 const activity_type &string_id<activity_type>::obj() const;
21 
22 enum class based_on_type : int {
23     TIME = 0,
24     SPEED,
25     NEITHER
26 };
27 
28 /** A class that stores constant information that doesn't differ between activities of the same type */
29 class activity_type
30 {
31     private:
32         activity_id id_;
33         bool rooted_ = false;
34         translation verb_ = to_translation( "THIS IS A BUG" );
35         bool interruptable_ = true;
36         bool suspendable_ = true;
37         based_on_type based_on_ = based_on_type::SPEED;
38         bool no_resume_ = false;
39         bool multi_activity_ = false;
40         bool refuel_fires = false;
41         bool auto_needs = false;
42         float activity_level = NO_EXERCISE;
43 
44     public:
id()45         const activity_id &id() const {
46             return id_;
47         }
rooted()48         bool rooted() const {
49             return rooted_;
50         }
interruptable()51         bool interruptable() const {
52             return interruptable_;
53         }
suspendable()54         bool suspendable() const {
55             return suspendable_;
56         }
57         std::string stop_phrase() const;
verb()58         const translation &verb() const {
59             return verb_;
60         }
based_on()61         based_on_type based_on() const {
62             return based_on_;
63         }
no_resume()64         bool no_resume() const {
65             return no_resume_;
66         }
multi_activity()67         bool multi_activity() const {
68             return multi_activity_;
69         }
70         /**
71          * If true, player will refuel one adjacent fire if there is firewood spot adjacent.
72          */
will_refuel_fires()73         bool will_refuel_fires() const {
74             return refuel_fires;
75         }
76         /**
77          * If true, player will automatically consume from relevant auto-eat/drink zones during activity
78          */
valid_auto_needs()79         bool valid_auto_needs() const {
80             return auto_needs;
81         }
exertion_level()82         float exertion_level() const {
83             return activity_level;
84         }
85         void call_do_turn( player_activity *, player * ) const;
86         /** Returns whether it had a finish function or not */
87         bool call_finish( player_activity *, player * ) const;
88 
89         /** JSON stuff */
90         static void load( const JsonObject &jo );
91         static void check_consistency();
92         static void reset();
93 };
94 
95 #endif // CATA_SRC_ACTIVITY_TYPE_H
96