Crossfire Server, Trunk
quest.h File Reference
#include "global.h"
+ Include dependency graph for quest.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  quest_condition
 
struct  quest_definition
 
struct  quest_step_definition
 

Typedefs

typedef struct quest_condition quest_condition
 
typedef struct quest_definition quest_definition
 
typedef void(* quest_op) (const quest_definition *, void *)
 
typedef struct quest_step_definition quest_step_definition
 

Functions

void quest_clear (quest_definition *quest)
 
int quest_condition_from_string (quest_condition *condition, const char *buffer)
 
quest_definitionquest_create (const char *name)
 
quest_conditionquest_create_condition (void)
 
quest_step_definitionquest_create_step (void)
 
void quest_destroy (quest_definition *quest)
 
void quest_destroy_condition (quest_condition *condition)
 
void quest_destroy_step (quest_step_definition *step)
 
void quest_destroy_steps (quest_step_definition *step)
 
void quest_for_each (quest_op op, void *user)
 
void quest_write_condition (char *buf, size_t len, const quest_condition *condition)
 

Typedef Documentation

◆ quest_condition

One condition to automatically move to a quest step.

◆ quest_definition

Definition of an in-game quest.

◆ quest_op

typedef void(* quest_op) (const quest_definition *, void *)

Definition at line 55 of file quest.h.

◆ quest_step_definition

One step of a quest.

Function Documentation

◆ quest_clear()

void quest_clear ( quest_definition quest)

Definition at line 91 of file Quests.cpp.

References FREE_AND_CLEAR_STR_IF, free_string(), and quest_destroy_steps().

Referenced by quest_destroy(), and Quests::replace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_condition_from_string()

int quest_condition_from_string ( quest_condition condition,
const char *  buffer 
)

Parse a single step condition. This may be expressed as one of the following:

  • questcode 20 (the quest questcode must be at step 20)
  • questcode <=20 (the quest questcode must not be beyond step 20)
  • questcode 10-20 (the quest questcode must be between steps 10 and 20)
  • questcode finished (the quest questcode must have been completed)
Parameters
conditioncondition to fill.
bufferwhere to read from.
Returns
1 if the condition was parsed, 0 else.

Definition at line 104 of file Quests.cpp.

References add_string(), quest_condition::maxstep, quest_condition::minstep, and quest_condition::quest_code.

Referenced by QuestLoader::load(), and QuestStepWrapper::setConditions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_create()

quest_definition* quest_create ( const char *  name)

Definition at line 61 of file Quests.cpp.

References add_string(), and give::name.

Referenced by CREResourcesWindow::addQuest(), Quests::create(), and QuestLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_create_condition()

quest_condition* quest_create_condition ( void  )

Allocate a quest_condition, will call fatal() if out of memory.

Returns
new structure.

Definition at line 54 of file Quests.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by QuestLoader::load(), and QuestStepWrapper::setConditions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_create_step()

quest_step_definition* quest_create_step ( void  )

Allocate a quest_step_definition, will call fatal() if out of memory.

Returns
new structure.

Definition at line 47 of file Quests.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by QuestWrapper::addStep(), and QuestLoader::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_destroy()

void quest_destroy ( quest_definition quest)

Definition at line 99 of file Quests.cpp.

References quest_clear().

Referenced by Quests::destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_destroy_condition()

void quest_destroy_condition ( quest_condition condition)

Definition at line 67 of file Quests.cpp.

References free_string(), and quest_condition::quest_code.

Referenced by quest_destroy_step(), and QuestStepWrapper::setConditions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_destroy_step()

void quest_destroy_step ( quest_step_definition step)

Definition at line 72 of file Quests.cpp.

References quest_step_definition::conditions, FREE_AND_CLEAR_STR_IF, quest_condition::next, quest_destroy_condition(), and quest_step_definition::step_description.

Referenced by quest_destroy_steps(), and QuestWrapper::removeChild().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_destroy_steps()

void quest_destroy_steps ( quest_step_definition step)

Definition at line 83 of file Quests.cpp.

References quest_step_definition::next, and quest_destroy_step().

Referenced by quest_clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_for_each()

void quest_for_each ( quest_op  op,
void *  user 
)

Iterate over all quests.

Parameters
opfunction to call for each quest.
userextra parameter to give the function.

Definition at line 709 of file assets.cpp.

References AssetsCollection< T, Key >::each(), manager, give::op, item::q, and AssetsManager::quests().

Referenced by dump_quests(), main(), output_quests(), and update_quests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quest_write_condition()

void quest_write_condition ( char *  buf,
size_t  len,
const quest_condition condition 
)

Write a step condition to a buffer. If the buffer is too small, the line is truncated.

Parameters
bufwhere to write.
lenlength of buf.
conditionitem to write, must not be NULL.

Definition at line 134 of file Quests.cpp.

References buf, quest_condition::maxstep, quest_condition::minstep, and quest_condition::quest_code.

Referenced by QuestWriter::write().

+ Here is the caller graph for this function: