Crossfire Server  1.75.0
Quests.cpp File Reference
#include "Quests.h"

Go to the source code of this file.

Functions

template<>
quest_definitionasset_create (const std::string &name)
 
template<>
void asset_destroy (quest_definition *quest)
 
void quest_clear (quest_definition *quest)
 
int quest_condition_from_string (quest_condition *condition, const char *buffer)
 Parse a single step condition. More...
 
quest_definitionquest_create (const char *name)
 
quest_conditionquest_create_condition (void)
 Allocate a quest_condition, will call fatal() if out of memory. More...
 
quest_step_definitionquest_create_step (void)
 Allocate a quest_step_definition, will call fatal() if out of memory. More...
 
void quest_destroy (quest_definition *quest)
 
void quest_destroy_condition (quest_condition *condition)
 
void quest_destroy_step (quest_step_definition *step)
 
void quest_write_condition (char *buf, size_t len, const quest_condition *cond)
 Write a step condition to a buffer. More...
 

Function Documentation

◆ asset_create()

template<>
quest_definition* asset_create ( const std::string &  name)

Definition at line 16 of file Quests.cpp.

References quest_create().

◆ asset_destroy()

template<>
void asset_destroy ( quest_definition quest)

Definition at line 21 of file Quests.cpp.

References quest_destroy().

◆ quest_clear()

◆ 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 100 of file Quests.cpp.

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

Referenced by QuestLoader::load().

◆ quest_create()

quest_definition* quest_create ( const char *  name)

Definition at line 63 of file Quests.cpp.

References add_string(), and quest_definition::quest_code.

Referenced by asset_create(), and QuestLoader::load().

◆ 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 56 of file Quests.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by QuestLoader::load().

◆ 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 49 of file Quests.cpp.

References fatal(), and OUT_OF_MEMORY.

Referenced by QuestLoader::load().

◆ quest_destroy()

void quest_destroy ( quest_definition quest)

Definition at line 95 of file Quests.cpp.

References quest_clear().

Referenced by asset_destroy().

◆ quest_destroy_condition()

void quest_destroy_condition ( quest_condition condition)

Definition at line 69 of file Quests.cpp.

References free_string(), and quest_condition::quest_code.

Referenced by quest_destroy_step().

◆ quest_destroy_step()

◆ 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 130 of file Quests.cpp.

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

Referenced by QuestWriter::write().