Atrinik Server  4.0
Data Structures | Enumerations | Functions | Variables
sound_ambient.c File Reference
#include <global.h>
#include <toolkit/string.h>
#include <object.h>
#include <object_methods.h>
#include <sound_ambient.h>

Go to the source code of this file.

Data Structures

struct  sound_ambient_match
 

Enumerations

enum  { SA_OPER_TYPE_HOUR, SA_OPER_TYPE_MINUTE }
 
enum  {
  SA_OPER_NONE, SA_OPER_ADD, SA_OPER_SUB, SA_OPER_MUL,
  SA_OPER_DIV, SA_OPER_MOD
}
 
enum  {
  SA_OPER2_EQ, SA_OPER2_LT, SA_OPER2_GT, SA_OPER2_LE,
  SA_OPER2_GE
}
 

Functions

struct sound_ambient_match __attribute__ ((packed))
 
static void init_func (object *op)
 
static void deinit_func (object *op)
 
 OBJECT_TYPE_INIT_DEFINE (sound_ambient)
 
static void sound_ambient_match_print_rec (sound_ambient_match_t *match, char *buf, size_t size)
 
static bool sound_ambient_match_rec (sound_ambient_match_t *match)
 
const char * sound_ambient_match_str (object *op)
 
bool sound_ambient_match (object *op)
 
void sound_ambient_match_parse (object *op, const char *str)
 

Variables

struct sound_ambient_matchnext
 Next match rule in a linked list.
 
union {
   struct sound_ambient_match *   group
 Group of rules.
 
   struct {
      uint8_t   type
 One of operation types.
 
      uint8_t   operation
 One of basic operations.
 
      uint16_t   num
 Arbitrary number for basic operations.
 
      uint8_t   operation2
 One of test operations.
 
      uint16_t   num2
 Arbitrary number for test operations.
 
   }   operation
 
data
 Data about the rule.
 
int is_group
 Whether the data union points to a group of rules.
 
int is_and
 Whether this is an AND rule.
 

Detailed Description

Handles ambient sound effect objects.

Author
Alex Tokar

Definition in file sound_ambient.c.

Enumeration Type Documentation

anonymous enum

Rule types.

Enumerator
SA_OPER_TYPE_HOUR 

In-game hours.

SA_OPER_TYPE_MINUTE 

In-game minutes.

Definition at line 43 of file sound_ambient.c.

anonymous enum

Basic rule operations.

Enumerator
SA_OPER_NONE 

No operation.

SA_OPER_ADD 

Addition.

SA_OPER_SUB 

Subtraction.

SA_OPER_MUL 

Multiplication.

SA_OPER_DIV 

Division.

SA_OPER_MOD 

Modulo.

Definition at line 53 of file sound_ambient.c.

anonymous enum

Test rule operations.

Enumerator
SA_OPER2_EQ 

Test for equality.

SA_OPER2_LT 

Test for less than.

SA_OPER2_GT 

Test for greater than.

SA_OPER2_LE 

Test for less than or equal to.

SA_OPER2_GE 

Test for greater than or equal to.

Definition at line 67 of file sound_ambient.c.

Function Documentation

struct sound_ambient_match __attribute__ ( (packed)  )

Structure used to represent the rules of an ambient sound object. Frees the specified ambient sound match structure.

Parameters
matchStructure to free.

Definition at line 100 of file sound_ambient.c.

static void deinit_func ( object op)
static

De-initializes an object.

Parameters
opThe object to de-initialize.

Definition at line 153 of file sound_ambient.c.

static void init_func ( object op)
static

Initializes an object.

Parameters
opThe object to initialize.

Definition at line 126 of file sound_ambient.c.

OBJECT_TYPE_INIT_DEFINE ( sound_ambient  )

Initialize the ambient sound type object methods.

Definition at line 167 of file sound_ambient.c.

bool sound_ambient_match ( object op)

Check if all the rules specified in the ambient sound object are met.

Parameters
opAmbient sound object.
Returns
True if all the rules are met, false otherwise.

Definition at line 398 of file sound_ambient.c.

void sound_ambient_match_parse ( object op,
const char *  str 
)

Parse string representation of ambient sound rules into the specified object.

Parameters
opAmbient sound object.
strThe string to parse.

Definition at line 414 of file sound_ambient.c.

static void sound_ambient_match_print_rec ( sound_ambient_match_t *  match,
char *  buf,
size_t  size 
)
static

Used by sound_ambient_match_str() to create a string representation of the ambient sound match structure.

Parameters
matchThe match to create a string representation of. Can be NULL.
bufWhere to store the string. Must be NUL-terminated.
sizeMaximum size of 'buf'.

Definition at line 185 of file sound_ambient.c.

static bool sound_ambient_match_rec ( sound_ambient_match_t *  match)
static

Match the rules in the specified ambient sound match structure.

Parameters
matchThe sound match structure. Can be NULL.
Returns
True if the rules match, false otherwise.

Definition at line 280 of file sound_ambient.c.

const char* sound_ambient_match_str ( object op)

Acquire a string representation of the specified ambient sound object matching rules.

Parameters
opAmbient sound object.
Returns
String representation.

Definition at line 378 of file sound_ambient.c.