BWAPI  4.1.2
An API for interacting with Starcraft: Broodwar (1.16.1)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules
Public Member Functions | List of all members
BWAPI::TournamentModule Class Reference

Public Member Functions

 TournamentModule ()
 
virtual bool onAction (BWAPI::Tournament::ActionID actionType, void *parameter=nullptr)
 
virtual void onFirstAdvertisement ()
 

Detailed Description

TournamentModule is a virtual class that is intended to be implemented or inherited by a custom Tournament class.

Like AIModule, the Broodwar interface is guaranteed to be initialized if any of these predefined interface functions are invoked by BWAPI.

Note
The TournamentModule is to be implemented by Tournament Modules ONLY. A standard AI module should never implement it. The Tournament Module is invoked only if it is explicitly defined in the configuration file. Tournament Modules also contain an AI Module interface so that it can monitor the time an AI module spent during its calls using Game::getLastEventTime.

Constructor & Destructor Documentation

BWAPI::TournamentModule::TournamentModule ( )

Member Function Documentation

virtual bool BWAPI::TournamentModule::onAction ( BWAPI::Tournament::ActionID  actionType,
void *  parameter = nullptr 
)
virtual

This function regulates the functions involving game settings that an AI module is allowed to execute.

For example, if the tournament forbids the enabling of Flag::CompleteMapInformation, then this function can deny the request.

Parameters
actionTypeAn ActionID containing the action that the AI module is requesting.
Parameters
parameterAn optional parameter that pertains to certain action requests. For example, if actionType is Tournament::ActionID::SendText, then parameter is a pointer to a null-terminated character array containing the message. If actionType is Tournament::ActionID::SetLocalSpeed, then parameter is a pointer to an integer.
See also
BWAPI::Tournament::ActionID
virtual void BWAPI::TournamentModule::onFirstAdvertisement ( )
virtual

This function is called if the current player is chosen to advertise the BWAPI revision.

When tournament mode is enabled, to reduce spam, only one bot sends the revision message. The bot that is chosen depends on its player ID. Only one of the bots can call this function during a tournament game.