Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
Macros | Functions
Functions that Allocate Memory

Macros

#define THROW_ERROR(code, msg)
 
#define ERROR_MSG(msg)
 
#define REQUIRE(condition)
 
#define REQUIRE_FLT_EQ(L, R, tol)   REQUIRE(APPROX_ZERO((L) - (R), tol))
 
#define END_TEST
 

Functions

void addLogic (AI *ai, const Logic *logic)
 Add single logic rule to AI. More...
 
void addMove (AI *ai, const Move *move)
 Tell AI to execute a move. More...
 
void addInputToQueue (InputQueue *queue, const RawInput input)
 Add single input to queue. More...
 
void addMoveToQueue (InputQueue *queue, const Move *move)
 Add entire move to queue. More...
 
bool initVector (Vector *vec, size_t size)
 Initialize a Vector. More...
 
bool initMatrix (Matrix *mat, size_t numRows, size_t numCols)
 Initialize a matrix. More...
 
void print (const char *str)
 print a string to the output streamThis function prints a string to an output stream displayed on the designated window (tournament mode - replaces debug menu). More...
 
void error (const char *errMessage)
 print error messagePrint an error message More...
 

Detailed Description

These functions may call malloc, calloc, or realloc

Macro Definition Documentation

#define THROW_ERROR (   code,
  msg 
)
Value:
do { \
error(__FILE__ ":" TOSTRING(__LINE__) ": " msg); \
} while (0)
void error(const char *errMessage)
print error messagePrint an error message
Definition: print.c:131
u32 _errorState
Definition: error.c:3

send error state and display error message

#define ERROR_MSG (   msg)
Value:
error(__FILE__ ":" TOSTRING(__LINE__) \
": " msg)
void error(const char *errMessage)
print error messagePrint an error message
Definition: print.c:131

display error message

#define REQUIRE (   condition)
Value:
do { \
if (!(condition)) \
{ \
print(ASSERT_MSG); \
_tests_passed = false; \
} \
} while (0)
void print(const char *str)
print a string to the output streamThis function prints a string to an output stream displayed on the...
Definition: print.c:52

Require condition to be true

#define REQUIRE_FLT_EQ (   L,
  R,
  tol 
)    REQUIRE(APPROX_ZERO((L) - (R), tol))

Require L and R to be within tol of each other

#define END_TEST
Value:
do { \
if (_tests_passed) \
{ \
print("all tests passed!"); \
} \
} while (0)
void print(const char *str)
print a string to the output streamThis function prints a string to an output stream displayed on the...
Definition: print.c:52

Macro placed in a function after all tests have been run

Function Documentation

void addLogic ( AI ai,
const Logic logic 
)

Add single logic rule to AI.

Parameters
ai- Pointer to AI struct
logic- Point to Logic struct
Returns
none
void addMove ( AI ai,
const Move move 
)

Tell AI to execute a move.

Parameters
ai- Pointer to AI struct
move- Pointer to Move struct
Returns
none
void addInputToQueue ( InputQueue queue,
const RawInput  input 
)

Add single input to queue.

Parameters
queue- Pointer to InputQueue struct
input- Pointer to RawInput struct
Returns
none
void addMoveToQueue ( InputQueue queue,
const Move move 
)

Add entire move to queue.

Parameters
queue- Pointer to InputQueue struct
move- Pointer to Move struct
Returns
none
bool initVector ( Vector vec,
size_t  size 
)

Initialize a Vector.

Parameters
vec- pointer to a Vector struct
size- number of values in the vector
Returns
false if memory allocation fails, true otherwise
bool initMatrix ( Matrix mat,
size_t  numRows,
size_t  numCols 
)

Initialize a matrix.

Parameters
mat- pointer to a Matrix struct
numRows- number of rows in the matrix
numCols- number of columns in the matrix
Returns
false if memory allocation fails, true otherwise
void print ( const char *  str)

print a string to the output streamThis function prints a string to an output stream displayed on the designated window (tournament mode - replaces debug menu).

Parameters
str- string to output
Returns
none
void error ( const char *  errMessage)

print error messagePrint an error message

Parameters
errMessage- error message to print
Returns
none
Note
this will still print the error if the print stream has failed to allocate memory