![]() |
Crossfire Server, Trunk
1.75.0
|
#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "define.h"
#include "object.h"
#include "dialog.h"
Go to the source code of this file.
Functions | |
void | dialog_preparse (object *op) |
void | free_dialog_information (object *op) |
Frees obj::dialog_information. More... | |
int | get_dialog_message (object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply) |
Tries to find a message matching the said text. More... | |
static bool | is_cfdialog (const char *msg) |
Return true if the given message is detected as CFDialog JSON. More... | |
static int | matches (const char *exp, const char *text) |
Does the text match the expression? More... | |
static void | parse_dialog_information (object *op) |
Parse the dialog information for op, and fills in obj::dialog_information. More... | |
Variables | |
const char * | NPC_DIALOG_ARCH = "npc_dialog" |
Structures and functions used for the dialog system.
Definition in file dialog.cpp.
void dialog_preparse | ( | object * | op | ) |
Definition at line 110 of file dialog.cpp.
References BITMASK_VALID, create_archetype(), object::event_bitmask, is_cfdialog(), object::msg, NPC_DIALOG_ARCH, object_find_by_arch_name(), and object_insert_in_ob().
Referenced by monster_talk_to_npc().
void free_dialog_information | ( | object * | op | ) |
Frees obj::dialog_information.
op | what to clean for. |
Definition at line 34 of file dialog.cpp.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, CLEAR_FLAG, object::dialog_information, FLAG_DIALOG_PARSED, struct_dialog_message::match, struct_dialog_reply::message, struct_dialog_message::message, struct_dialog_reply::next, struct_dialog_message::next, QUERY_FLAG, struct_dialog_message::replies, and struct_dialog_reply::reply.
Referenced by copy_message(), object_clear(), object_copy_no_speed(), and object_free().
int get_dialog_message | ( | object * | op, |
const char * | text, | ||
struct_dialog_message ** | message, | ||
struct_dialog_reply ** | reply | ||
) |
Tries to find a message matching the said text.
op | who is being talked to. | |
text | what is being said. | |
[out] | message | what op should say. Won't be NULL if return is 1. |
[out] | reply | text the one talking should say based on the text. Can be NULL. |
Definition at line 233 of file dialog.cpp.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, object::dialog_information, FLAG_DIALOG_PARSED, matches(), message, struct_dialog_reply::next, player::next, parse_dialog_information(), QUERY_FLAG, and text.
Referenced by monster_do_talk_npc().
|
static |
Return true if the given message is detected as CFDialog JSON.
Definition at line 106 of file dialog.cpp.
Referenced by dialog_preparse(), and parse_dialog_information().
|
static |
Does the text match the expression?
exp | expression to try to match. |
text | what to test. |
Definition at line 81 of file dialog.cpp.
References re_cmp(), and text.
Referenced by command_find(), get_dialog_message(), and re_cmp_step().
|
static |
Parse the dialog information for op, and fills in obj::dialog_information.
Can be called safely multiple times (will just ignore the other calls).
op | object to parse the obj::msg field. |
Definition at line 127 of file dialog.cpp.
References struct_dialog_information::all_messages, struct_dialog_information::all_replies, object::dialog_information, FALSE, fatal(), FLAG_DIALOG_PARSED, is_cfdialog(), llevDebug, LOG(), struct_dialog_reply::message, message, object::msg, object::name, struct_dialog_reply::next, player::next, OUT_OF_MEMORY, QUERY_FLAG, struct_dialog_reply::reply, rt_question, rt_reply, SET_FLAG, TRUE, and struct_dialog_reply::type.
Referenced by get_dialog_message().
const char* NPC_DIALOG_ARCH = "npc_dialog" |
Definition at line 28 of file dialog.cpp.
Referenced by annotate_ob(), and dialog_preparse().