Project Alice
Loading...
Searching...
No Matches
diplomatic_messages.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "dcon_generated.hpp"
4#include "system_state.hpp"
5#include "container_types.hpp"
6
7namespace diplomatic_message {
8
9constexpr inline int32_t expiration_in_days = 15;
10
11enum class type_t : uint8_t {
12 none = 0,
18 peace_offer = 6,
22};
23
27struct message {
28 union dtype {
29 dcon::war_id war; //2
30 dcon::peace_offer_id peace; //2
32 dcon::state_definition_id state; //2
34 memset(this, 0, sizeof(*this));
35 }
36 } data; //10
38 dcon::nation_id from; //2
39 dcon::nation_id to; //2
42
44};
45static_assert(sizeof(message) ==
46 sizeof(message::from)
47 + sizeof(message::to)
48 + sizeof(message::when)
49 + sizeof(message::data)
50 + sizeof(message::type)
51 + sizeof(message::padding));
52
53using type = type_t;
54
55bool can_accept_crisis_offer(sys::state& state, dcon::nation_id from, dcon::nation_id to, sys::full_wg offer);
56bool can_accept_crisis_peace_offer(sys::state& state, dcon::nation_id from, dcon::nation_id to, dcon::peace_offer_id peace);
57
58bool ai_will_accept(sys::state& state, message const& m);
59
60void decline(sys::state& state, message const& m);
61void accept(sys::state& state, message const& m);
62bool can_accept(sys::state& state, message const& m);
63
64void post(sys::state& state, message const& m);
65void update_pending(sys::state& state);
66
67} // namespace diplomatic_message
constexpr int32_t expiration_in_days
bool can_accept(sys::state &state, message const &m)
void decline(sys::state &state, message const &m)
void update_pending(sys::state &state)
void accept(sys::state &state, message const &m)
void post(sys::state &state, message const &m)
Pushes a diplomatic message to the list of pending diplomatic requests for the specified recipient (m...
bool can_accept_crisis_peace_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, dcon::peace_offer_id peace)
bool ai_will_accept(sys::state &state, message const &m)
Returns the appropriate acceptance evaluation for a given diplomatic message. It is required to defin...
bool can_accept_crisis_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, sys::full_wg offer)
uchar uint8_t
Holds data regarding a diplomatic message between two specified nations at a certain date,...
union diplomatic_message::message::dtype data
Holds important data about the game world, state, and other data regarding windowing,...