forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
computer_session.h
145 lines (133 loc) · 4.97 KB
/
computer_session.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#pragma once
#ifndef CATA_SRC_COMPUTER_SESSION_H
#define CATA_SRC_COMPUTER_SESSION_H
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "computer.h"
#include "cursesdef.h"
class player;
class computer_session
{
public:
computer_session( computer &comp );
/** Handles player use of a computer */
void use();
private:
computer ∁
// Output window. This class assumes win's size does not change.
catacurses::window win;
const int left;
const int top;
const int width;
const int height;
std::vector<std::pair<int, std::string>> lines;
/** Returns true if the player successfully hacks the computer. Security = -1 defaults to
* the main system security. */
bool hack_attempt( player &p, int Security = -1 );
// Called by use()
void activate_function( computer_action action );
// ...but we can also choose a specific failure.
void activate_failure( computer_failure_type fail );
// Generally called when we fail a hack attempt
void activate_random_failure();
// Reset to a blank terminal (e.g. at start of usage loop)
void reset_terminal();
// Actually displaying the terminal window
void refresh();
// Move the cursor to the beginning of the next line
void print_newline();
// Do the actual printing
template<typename ...Args>
void print_indented_line( int indent, int text_width, const std::string &text, Args &&... args );
// Prints code-looking gibberish
void print_gibberish_line();
// Prints a line to the terminal (with printf flags)
template<typename ...Args>
void print_line( const std::string &text, Args &&... args );
// For now, the same as print_line but in red ( TODO: change this?)
template<typename ...Args>
void print_error( const std::string &text, Args &&... args );
// Wraps and prints a block of text with a 1-space indent
template<typename ...Args>
void print_text( const std::string &text, Args &&... args );
// Prints a line and waits for Y/N/Q
enum class ynq {
yes,
no,
quit,
};
template<typename ...Args>
ynq query_ynq( const std::string &text, Args &&... args );
// Same as query_ynq, but returns true for y or Y
template<typename ...Args>
bool query_bool( const std::string &text, Args &&... args );
// Simply wait for any key, returns True
template<typename ...Args>
bool query_any( const std::string &text, Args &&... args );
// Wait for any key without new output
bool query_any();
void action_amigara_log();
void action_amigara_start();
void action_blood_anal();
void action_cascade();
void action_complete_disable_external_power();
void action_conveyor();
void action_data_anal();
void action_deactivate_shock_vent();
void action_disconnect();
void action_download_software();
void action_elevator_on();
void action_emerg_mess();
void action_emerg_ref_center();
void action_extract_rad_source();
void action_geiger();
void action_irradiator();
void action_list_bionics();
void action_lock();
void action_map_sewer();
void action_map_subway();
void action_maps();
void action_miss_disarm();
void action_open();
void action_open_disarm();
void action_portal();
void action_radio_archive();
void action_release();
void action_release_bionics();
void action_release_disarm();
void action_repeater_mod();
void action_research();
void action_sample();
void action_shutters();
void action_sr1_mess();
void action_sr2_mess();
void action_sr3_mess();
void action_sr4_mess();
void action_srcf_1_mess();
void action_srcf_2_mess();
void action_srcf_3_mess();
void action_srcf_elevator();
void action_srcf_seal();
void action_srcf_seal_order();
void action_terminate();
void action_toll();
void action_tower_unresponsive();
void action_unlock();
void action_unlock_disarm();
static const std::map<computer_action, void( computer_session::* )()> computer_action_functions;
void failure_alarm();
void failure_amigara();
void failure_damage();
void failure_destroy_blood();
void failure_destroy_data();
void failure_manhacks();
void failure_pump_explode();
void failure_pump_leak();
void failure_secubots();
void failure_shutdown();
static const std::map<computer_failure_type, void( computer_session::* )()>
computer_failure_functions;
};
#endif // CATA_SRC_COMPUTER_SESSION_H