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 "container_types.hpp"
5
6namespace diplomatic_message {
7
8constexpr inline int32_t expiration_in_days = 15;
9
10enum class type_t : uint8_t {
11 none = 0,
17 peace_offer = 6,
21};
22
23struct message {
24 union dtype {
25 dcon::war_id war; //2
26 dcon::peace_offer_id peace; //2
28 dcon::state_definition_id state; //2
30 memset(this, 0, sizeof(*this));
31 }
32 } data; //10
34 dcon::nation_id from; //2
35 dcon::nation_id to; //2
38
40};
41static_assert(sizeof(message) ==
42 sizeof(message::from)
43 + sizeof(message::to)
44 + sizeof(message::when)
45 + sizeof(message::data)
46 + sizeof(message::type)
47 + sizeof(message::padding));
48
49using type = type_t;
50
51bool can_accept_crisis_offer(sys::state& state, dcon::nation_id from, dcon::nation_id to, sys::crisis_join_offer const& offer);
52bool can_accept_crisis_peace_offer(sys::state& state, dcon::nation_id from, dcon::nation_id to, dcon::peace_offer_id peace);
53
54bool ai_will_accept(sys::state& state, message const& m);
55
56void decline(sys::state& state, message const& m);
57void accept(sys::state& state, message const& m);
58bool can_accept(sys::state& state, message const& m);
59
60void post(sys::state& state, message const& m);
61void update_pending(sys::state& state);
62
63} // 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)
bool can_accept_crisis_offer(sys::state &state, dcon::nation_id from, dcon::nation_id to, sys::crisis_join_offer const &offer)
void post(sys::state &state, message const &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)
uchar uint8_t
union diplomatic_message::message::dtype data