forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamemode.h
38 lines (31 loc) · 1013 Bytes
/
gamemode.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
#pragma once
#ifndef CATA_SRC_GAMEMODE_H
#define CATA_SRC_GAMEMODE_H
#include <iosfwd>
#include <string>
#include <memory>
#include "enums.h"
enum action_id : int;
struct special_game;
std::string special_game_name( special_game_type id );
std::unique_ptr<special_game> get_special_game( special_game_type id );
struct special_game {
virtual ~special_game() = default;
virtual special_game_type id() {
return special_game_type::NONE;
}
// Run when the game begins
virtual bool init() {
return true;
}
// Run every turn--before any player actions
virtual void per_turn() { }
// Run after a keypress, but before the game handles the action
// It may modify the action, e.g. to cancel it
virtual void pre_action( action_id & ) { }
// Run after the game handles the action
virtual void post_action( action_id ) { }
// Run when the player dies (or the game otherwise ends)
virtual void game_over() { }
};
#endif // CATA_SRC_GAMEMODE_H