samp_sdk/omp/generated/player_dialogs.rs
1//! `IPlayerDialogData` — generated by `cargo xtask gen-omp` from `Server/Components/Dialogs/dialogs.hpp`.
2//! Implemented by `PlayerDialogData` in the server's `Dialogs`.
3//!
4//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
5//! regenerate. Slots are clang's layout of the header for each ABI, checked
6//! against the official binaries by `cargo xtask check-abi --generated`.
7
8#![allow(unused_imports)]
9
10use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
11use crate::omp::types::{
12 Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
13 UID, Vector2, Vector3, Vector4, WorldTimePoint,
14};
15use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
16use crate::omp::*;
17
18opaque! {
19 /// Opaque handle for `IPlayerDialogData*`.
20 pub IPlayerDialogData;
21}
22
23/// `DialogData_UID` in `Server/Components/Dialogs/dialogs.hpp`.
24pub const PLAYER_DIALOGS_UID: UID = 0xbc03376aa3591a11;
25
26/// The player's `IPlayerDialogData`, or null when the component providing it is not loaded.
27///
28/// Found by walking the player's extension map for `PLAYER_DIALOGS_UID` — the
29/// virtual `getExtension` does not consult that map. `IExtension`
30/// is `IPlayerDialogData`'s first base, so the extension pointer is the interface pointer.
31///
32/// # Safety
33/// `player` must be a live `IPlayer`.
34#[must_use]
35pub unsafe fn player_dialogs(player: *mut IPlayer) -> *mut IPlayerDialogData {
36 unsafe { extension(player.cast::<u8>(), PLAYER_DIALOGS_UID) }.cast::<IPlayerDialogData>()
37}
38
39slots! {
40 /// `void IPlayerDialogData::hide(IPlayer &)`
41 SLOT_HIDE: usize = 3, 3;
42 /// `void IPlayerDialogData::show(IPlayer &, int, DialogStyle, StringView, StringView, StringView, StringView)`
43 SLOT_SHOW: usize = 4, 4;
44 /// `void IPlayerDialogData::get(int &, DialogStyle &, StringView &, StringView &, StringView &, StringView &)`
45 SLOT_GET: usize = 5, 5;
46 /// `int IPlayerDialogData::getActiveID()`
47 SLOT_GET_ACTIVE_ID: usize = 6, 6;
48}
49
50virtual_fns! {
51 /// `void IPlayerDialogData::hide(IPlayer &)`.
52 ///
53 /// # Safety
54 /// `data` must be a live `IPlayerDialogData`.
55 pub fn player_dialogs_hide(data: IPlayerDialogData, player: *mut IPlayer) = [0, SLOT_HIDE];
56
57 /// `void IPlayerDialogData::show(IPlayer &, int, DialogStyle, StringView, StringView, StringView, StringView)`.
58 ///
59 /// # Safety
60 /// `data` must be a live `IPlayerDialogData`.
61 pub fn player_dialogs_show(
62 data: IPlayerDialogData,
63 player: *mut IPlayer,
64 id: i32,
65 style: i32,
66 title: StringView,
67 body: StringView,
68 button1: StringView,
69 button2: StringView,
70 ) = [0, SLOT_SHOW];
71
72 /// `void IPlayerDialogData::get(int &, DialogStyle &, StringView &, StringView &, StringView &, StringView &)`.
73 ///
74 /// # Safety
75 /// `data` must be a live `IPlayerDialogData`.
76 pub fn player_dialogs_get(
77 data: IPlayerDialogData,
78 id: &mut i32,
79 style: &mut i32,
80 title: &mut StringView,
81 body: &mut StringView,
82 button1: &mut StringView,
83 button2: &mut StringView,
84 ) = [0, SLOT_GET];
85
86 /// `int IPlayerDialogData::getActiveID()`.
87 ///
88 /// # Safety
89 /// `data` must be a live `IPlayerDialogData`.
90 #[must_use]
91 pub fn player_dialogs_active_id(data: IPlayerDialogData) -> i32 = [0, SLOT_GET_ACTIVE_ID] or 0;
92}