Aw init

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


int aw_init (int build)

Description

Initializes the SDK.

Callback

None (returns immediately)

Notes

This method or aw_init_bind must be called once before any other methods in the API. It will do an implicit aw_term if the SDK has already been successfully initialized. Thus, there is no need to call aw_term for each additional call to this method, as there is no reference count.

If successful then the tick count returned by aw_tick is reset to 0 and the pseudo-random number generator used by aw_random is seeded.

Arguments

build
AW_BUILD in Aw.h defines the build of Aw.dll (or libaw_sdk.so for Linux) it was distributed with and should be passed as the value of this argument.

Argument attributes

None

Return values

RC_SUCCESS
RC_VERSION_MISMATCH
Aw.h and Aw.dll (or libaw_sdk.so for Linux) are from different builds of the SDK.

Returned attributes

None

Usage

#include "Aw.h"
#include "Reason.h"

int main (int argc, char *argv[])
{
  if (aw_init (AW_BUILD) != RC_SUCCESS)
  {
    printf ("Build #%d of Aw.dll is required to run this bot.\n", AW_BUILD);
    return 1;
  }
  
  /* ... */
  
  aw_term ();
  return 0;
}

See also