BWAPI4 preparations

This commit is contained in:
vjurenka 2015-02-07 18:16:07 +01:00
parent d86336dad3
commit dc4e7bc97d
161 changed files with 6803 additions and 2483 deletions

19
BWTA_Result.h Normal file
View file

@ -0,0 +1,19 @@
#pragma once
#include <BWTA.h>
namespace BWTA
{
namespace BWTA_Result
{
extern std::set<Region*> regions;
extern std::set<Chokepoint*> chokepoints;
extern std::set<BaseLocation*> baselocations;
extern std::set<BaseLocation*> startlocations;
extern std::set<Polygon*> unwalkablePolygons;
extern RectangleArray<Region*> getRegion;
extern RectangleArray<Chokepoint*> getChokepoint;
extern RectangleArray<BaseLocation*> getBaseLocation;
extern RectangleArray<Chokepoint*> getChokepointW;
extern RectangleArray<BaseLocation*> getBaseLocationW;
extern RectangleArray<Polygon*> getUnwalkablePolygon;
};
}

View file

@ -1,4 +1,7 @@
#pragma once
#ifndef __BWAPI_H__
#define __BWAPI_H__
#include <BWAPI/InterfaceEvent.h>
#include <BWAPI/Interface.h>
#include <BWAPI/AIModule.h>
@ -40,8 +43,8 @@
#include <BWAPI/UnitSizeType.h>
#include <BWAPI/UnitType.h>
#include <BWAPI/UpgradeType.h>
#include <BWAPI/Vectorset.h>
#include <BWAPI/WeaponType.h>
#include <BWAPI/WindowsTypes.h>
namespace BWAPI
{
@ -61,3 +64,5 @@ namespace BWAPI
/// @threadsafe
bool BWAPI_isDebug();
}
#endif

View file

@ -72,49 +72,46 @@ namespace BWAPI
/// Retrieves the set of all the BulletTypes.
///
/// @returns Set of BulletTypes.
const BulletType::const_set& allBulletTypes();
const BulletType::set& allBulletTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const BulletType x
BWAPI_DECL(Melee);
BWAPI_DECL(Fusion_Cutter_Hit);
BWAPI_DECL(Gauss_Rifle_Hit);
BWAPI_DECL(C_10_Canister_Rifle_Hit);
BWAPI_DECL(Gemini_Missiles);
BWAPI_DECL(Fragmentation_Grenade);
BWAPI_DECL(Longbolt_Missile);
BWAPI_DECL(ATS_ATA_Laser_Battery);
BWAPI_DECL(Burst_Lasers);
BWAPI_DECL(Arclite_Shock_Cannon_Hit);
BWAPI_DECL(EMP_Missile);
BWAPI_DECL(Dual_Photon_Blasters_Hit);
BWAPI_DECL(Particle_Beam_Hit);
BWAPI_DECL(Anti_Matter_Missile);
BWAPI_DECL(Pulse_Cannon);
BWAPI_DECL(Psionic_Shockwave_Hit);
BWAPI_DECL(Psionic_Storm);
BWAPI_DECL(Yamato_Gun);
BWAPI_DECL(Phase_Disruptor);
BWAPI_DECL(STA_STS_Cannon_Overlay);
BWAPI_DECL(Sunken_Colony_Tentacle);
BWAPI_DECL(Acid_Spore);
BWAPI_DECL(Glave_Wurm);
BWAPI_DECL(Seeker_Spores);
BWAPI_DECL(Queen_Spell_Carrier);
BWAPI_DECL(Plague_Cloud);
BWAPI_DECL(Consume);
BWAPI_DECL(Ensnare);
BWAPI_DECL(Needle_Spine_Hit);
BWAPI_DECL(Invisible);
BWAPI_DECL(Optical_Flare_Grenade);
BWAPI_DECL(Halo_Rockets);
BWAPI_DECL(Subterranean_Spines);
BWAPI_DECL(Corrosive_Acid_Shot);
BWAPI_DECL(Neutron_Flare);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const BulletType Melee;
extern const BulletType Fusion_Cutter_Hit;
extern const BulletType Gauss_Rifle_Hit;
extern const BulletType C_10_Canister_Rifle_Hit;
extern const BulletType Gemini_Missiles;
extern const BulletType Fragmentation_Grenade;
extern const BulletType Longbolt_Missile;
extern const BulletType ATS_ATA_Laser_Battery;
extern const BulletType Burst_Lasers;
extern const BulletType Arclite_Shock_Cannon_Hit;
extern const BulletType EMP_Missile;
extern const BulletType Dual_Photon_Blasters_Hit;
extern const BulletType Particle_Beam_Hit;
extern const BulletType Anti_Matter_Missile;
extern const BulletType Pulse_Cannon;
extern const BulletType Psionic_Shockwave_Hit;
extern const BulletType Psionic_Storm;
extern const BulletType Yamato_Gun;
extern const BulletType Phase_Disruptor;
extern const BulletType STA_STS_Cannon_Overlay;
extern const BulletType Sunken_Colony_Tentacle;
extern const BulletType Acid_Spore;
extern const BulletType Glave_Wurm;
extern const BulletType Seeker_Spores;
extern const BulletType Queen_Spell_Carrier;
extern const BulletType Plague_Cloud;
extern const BulletType Consume;
extern const BulletType Ensnare;
extern const BulletType Needle_Spine_Hit;
extern const BulletType Invisible;
extern const BulletType Optical_Flare_Grenade;
extern const BulletType Halo_Rockets;
extern const BulletType Subterranean_Spines;
extern const BulletType Corrosive_Acid_Shot;
extern const BulletType Neutron_Flare;
extern const BulletType None;
extern const BulletType Unknown;
};
static_assert(sizeof(BulletType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <BWAPI/Vectorset.h>
#include "SetContainer.h"
namespace BWAPI
{
@ -7,12 +7,9 @@ namespace BWAPI
class BulletInterface;
typedef BulletInterface *Bullet;
class Bulletset : public Vectorset<BWAPI::Bullet>
class Bulletset : public SetContainer<Bullet, std::hash<void*>>
{
public:
Bulletset(size_t initialSize = 16);
Bulletset(const Bulletset &other);
Bulletset(Bulletset &&other);
};
}

View file

@ -14,4 +14,4 @@
#include <BWAPI/Client/ShapeType.h>
#include <BWAPI/Client/UnitCommand.h>
#include <BWAPI/Client/UnitData.h>
#include <BWAPI/Client/UnitImpl.h>
#include <BWAPI/Client/UnitImpl.h>

View file

@ -1,5 +1,4 @@
#pragma once
#include <windows.h>
#include "GameData.h"
#include "GameImpl.h"
#include "ForceImpl.h"
@ -7,6 +6,8 @@
#include "UnitImpl.h"
#include "GameTable.h"
#include "../WindowsTypes.h"
namespace BWAPI
{
@ -16,7 +17,7 @@ namespace BWAPI
Client();
~Client();
bool isConnected();
bool isConnected() const;
bool connect();
void disconnect();
void update();

View file

@ -5,10 +5,6 @@
namespace BWAPI
{
class Game;
class PlayerInterface;
typedef PlayerInterface *Player;
class ForceImpl : public ForceInterface
{
private:

View file

@ -144,7 +144,7 @@ namespace BWAPI
//strings (used in shapes and commands)
int stringCount;
char strings[MAX_STRINGS][256];
char strings[MAX_STRINGS][1024];
//shapes, commands, unitCommands, from client to server
int shapeCount;

View file

@ -1,5 +1,6 @@
#pragma once
#include <BWAPI.h>
#include "GameData.h"
#include "Client.h"
#include "Shape.h"
@ -10,15 +11,10 @@
#include "RegionImpl.h"
#include "UnitImpl.h"
#include "BulletImpl.h"
#include <list>
#include <vector>
#include <BWAPI/Unitset.h>
#include <BWAPI/Bulletset.h>
#include <BWAPI/Playerset.h>
#include <BWAPI/Forceset.h>
#include <BWAPI/Regionset.h>
namespace BWAPI
{
class ForceInterface;
@ -54,12 +50,12 @@ namespace BWAPI
Unitset staticGeysers;
Unitset staticNeutralUnits;
Bulletset bullets;
Position::set nukeDots;
Position::list nukeDots;
Unitset selectedUnits;
Unitset pylons;
Regionset regionsList;
TilePosition::set startLocations;
TilePosition::list startLocations;
std::list< Event > events;
bool flagEnabled[2];
Player thePlayer;
@ -94,7 +90,7 @@ namespace BWAPI
virtual const Unitset& getStaticNeutralUnits() const override;
virtual const Bulletset& getBullets() const override;
virtual const Position::set& getNukeDots() const override;
virtual const Position::list& getNukeDots() const override;
virtual const std::list< Event>& getEvents() const override;
virtual Force getForce(int forceID) const override;
@ -143,7 +139,7 @@ namespace BWAPI
virtual bool canMake(UnitType type, Unit builder = nullptr) const override;
virtual bool canResearch(TechType type, Unit unit = nullptr, bool checkCanIssueCommandType = true) override;
virtual bool canUpgrade(UpgradeType type, Unit unit = nullptr, bool checkCanIssueCommandType = true) override;
virtual const TilePosition::set& getStartLocations() const override;
virtual const TilePosition::list& getStartLocations() const override;
virtual void vPrintf(const char* format, va_list arg) override;
virtual void vSendTextEx(bool toAllies, const char *format, va_list arg) override;
@ -191,7 +187,6 @@ namespace BWAPI
virtual int getAPM(bool includeSelects = false) const override;
virtual bool setMap(const char *mapFileName) override;
virtual void setFrameSkip(int frameSkip) override;
virtual bool hasPath(Position source, Position destination) const override;
virtual bool setAlliance(BWAPI::Player player, bool allied = true, bool alliedVictory = true) override;
virtual bool setVision(BWAPI::Player player, bool enabled = true) override;
virtual int elapsedTime() const override;

View file

@ -25,8 +25,8 @@ namespace BWAPI
virtual Race getRace() const override;
virtual PlayerType getType() const override;
virtual Force getForce() const override;
virtual bool isAlly(Player player) const override;
virtual bool isEnemy(Player player) const override;
virtual bool isAlly(const Player player) const override;
virtual bool isEnemy(const Player player) const override;
virtual bool isNeutral() const override;
virtual TilePosition getStartLocation() const override;
virtual bool isVictorious() const override;

View file

@ -74,7 +74,7 @@ namespace BWAPI
virtual int getStimTimer() const override;
virtual UnitType getBuildType() const override;
virtual UnitType::set getTrainingQueue() const override;
virtual UnitType::list getTrainingQueue() const override;
virtual TechType getTech() const override;
virtual UpgradeType getUpgrade() const override;
virtual int getRemainingBuildTime() const override;

View file

@ -66,7 +66,7 @@ namespace BWAPI
/// The default color for Player 6.
extern const Color Brown;
/// The default color for Player 7.
/// A bright white. Note that this is lighter than Player 7's white.
extern const Color White;
/// The default color for Player 8.
@ -206,4 +206,6 @@ namespace BWAPI
/// @returns Reference to the \p out parameter that was passed in.
std::ostream &operator << (std::ostream &out, const Text::Enum &t);
}
static_assert(sizeof(Color) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -28,25 +28,26 @@ namespace BWAPI
/// @copydoc Type::Type(int)
DamageType(int id = DamageTypes::Enum::None);
};
/// Namespace containing damage types
/// Namespace containing damage types.
///
/// [View on Liquipedia](http://wiki.teamliquid.net/starcraft/Damage_Type)<br>
/// [View on Starcraft Campendium (Official Website)](http://classic.battle.net/scc/gs/damage.shtml)<br>
/// [View on Starcraft Wikia](http://starcraft.wikia.com/wiki/Damage_types)<br>
namespace DamageTypes
{
/// Retrieves the set of all the DamageTypes.
///
/// @returns Set of DamageTypes.
const DamageType::const_set& allDamageTypes();
const DamageType::set& allDamageTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const DamageType x
BWAPI_DECL(Independent);
BWAPI_DECL(Explosive);
BWAPI_DECL(Concussive);
BWAPI_DECL(Normal);
BWAPI_DECL(Ignore_Armor);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const DamageType Independent;
extern const DamageType Explosive;
extern const DamageType Concussive;
extern const DamageType Normal;
extern const DamageType Ignore_Armor;
extern const DamageType None;
extern const DamageType Unknown;
}
static_assert(sizeof(DamageType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -64,40 +64,37 @@ namespace BWAPI
/// Retrieves the set of all the error codes.
///
/// @returns Set of error types.
const Error::const_set& allErrors();
const Error::set& allErrors();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const Error x
BWAPI_DECL(Unit_Does_Not_Exist);
BWAPI_DECL(Unit_Not_Visible);
BWAPI_DECL(Unit_Not_Owned);
BWAPI_DECL(Unit_Busy);
BWAPI_DECL(Incompatible_UnitType);
BWAPI_DECL(Incompatible_TechType);
BWAPI_DECL(Incompatible_State);
BWAPI_DECL(Already_Researched);
BWAPI_DECL(Fully_Upgraded);
BWAPI_DECL(Currently_Researching);
BWAPI_DECL(Currently_Upgrading);
BWAPI_DECL(Insufficient_Minerals);
BWAPI_DECL(Insufficient_Gas);
BWAPI_DECL(Insufficient_Supply);
BWAPI_DECL(Insufficient_Energy);
BWAPI_DECL(Insufficient_Tech);
BWAPI_DECL(Insufficient_Ammo);
BWAPI_DECL(Insufficient_Space);
BWAPI_DECL(Invalid_Tile_Position);
BWAPI_DECL(Unbuildable_Location);
BWAPI_DECL(Unreachable_Location);
BWAPI_DECL(Out_Of_Range);
BWAPI_DECL(Unable_To_Hit);
BWAPI_DECL(Access_Denied);
BWAPI_DECL(File_Not_Found);
BWAPI_DECL(Invalid_Parameter);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const Error Unit_Does_Not_Exist;
extern const Error Unit_Not_Visible;
extern const Error Unit_Not_Owned;
extern const Error Unit_Busy;
extern const Error Incompatible_UnitType;
extern const Error Incompatible_TechType;
extern const Error Incompatible_State;
extern const Error Already_Researched;
extern const Error Fully_Upgraded;
extern const Error Currently_Researching;
extern const Error Currently_Upgrading;
extern const Error Insufficient_Minerals;
extern const Error Insufficient_Gas;
extern const Error Insufficient_Supply;
extern const Error Insufficient_Energy;
extern const Error Insufficient_Tech;
extern const Error Insufficient_Ammo;
extern const Error Insufficient_Space;
extern const Error Invalid_Tile_Position;
extern const Error Unbuildable_Location;
extern const Error Unreachable_Location;
extern const Error Out_Of_Range;
extern const Error Unable_To_Hit;
extern const Error Access_Denied;
extern const Error File_Not_Found;
extern const Error Invalid_Parameter;
extern const Error None;
extern const Error Unknown;
}
static_assert(sizeof(Error) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -53,37 +53,34 @@ namespace BWAPI
/// Retrieves the set of all ExplosionTypes.
///
/// @returns Set of ExplosionTypes.
const ExplosionType::const_set& allExplosionTypes();
const ExplosionType::set& allExplosionTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const ExplosionType x
BWAPI_DECL(None);
BWAPI_DECL(Normal);
BWAPI_DECL(Radial_Splash);
BWAPI_DECL(Enemy_Splash);
BWAPI_DECL(Lockdown);
BWAPI_DECL(Nuclear_Missile);
BWAPI_DECL(Parasite);
BWAPI_DECL(Broodlings);
BWAPI_DECL(EMP_Shockwave);
BWAPI_DECL(Irradiate);
BWAPI_DECL(Ensnare);
BWAPI_DECL(Plague);
BWAPI_DECL(Stasis_Field);
BWAPI_DECL(Dark_Swarm);
BWAPI_DECL(Consume);
BWAPI_DECL(Yamato_Gun);
BWAPI_DECL(Restoration);
BWAPI_DECL(Disruption_Web);
BWAPI_DECL(Corrosive_Acid);
BWAPI_DECL(Mind_Control);
BWAPI_DECL(Feedback);
BWAPI_DECL(Optical_Flare);
BWAPI_DECL(Maelstrom);
BWAPI_DECL(Air_Splash);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const ExplosionType None;
extern const ExplosionType Normal;
extern const ExplosionType Radial_Splash;
extern const ExplosionType Enemy_Splash;
extern const ExplosionType Lockdown;
extern const ExplosionType Nuclear_Missile;
extern const ExplosionType Parasite;
extern const ExplosionType Broodlings;
extern const ExplosionType EMP_Shockwave;
extern const ExplosionType Irradiate;
extern const ExplosionType Ensnare;
extern const ExplosionType Plague;
extern const ExplosionType Stasis_Field;
extern const ExplosionType Dark_Swarm;
extern const ExplosionType Consume;
extern const ExplosionType Yamato_Gun;
extern const ExplosionType Restoration;
extern const ExplosionType Disruption_Web;
extern const ExplosionType Corrosive_Acid;
extern const ExplosionType Mind_Control;
extern const ExplosionType Feedback;
extern const ExplosionType Optical_Flare;
extern const ExplosionType Maelstrom;
extern const ExplosionType Air_Splash;
extern const ExplosionType Unknown;
}
static_assert(sizeof(ExplosionType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -25,169 +25,448 @@ namespace BWAPI
namespace Filter
{
// presets
/// A unary filter that checks if the unit type is a transport (has capacity).
extern const PtrUnitFilter IsTransport;
/// @see BWAPI::UnitType::canProduce
extern const PtrUnitFilter CanProduce;
/// @see BWAPI::UnitType::canAttack
extern const PtrUnitFilter CanAttack;
/// @see BWAPI::UnitType::canMove
extern const PtrUnitFilter CanMove;
/// @see BWAPI::UnitType::isFlying
extern const PtrUnitFilter IsFlyer;
/// @see BWAPI::UnitInterface::IsFlying
extern const PtrUnitFilter IsFlying;
/// @see BWAPI::UnitType::regeneratesHP
extern const PtrUnitFilter RegeneratesHP;
/// @see BWAPI::UnitType::isSpellcaster
extern const PtrUnitFilter IsSpellcaster;
/// @see BWAPI::UnitType::hasPermanentCloak
extern const PtrUnitFilter HasPermanentCloak;
/// @see BWAPI::UnitType::isOrganic
extern const PtrUnitFilter IsOrganic;
/// @see BWAPI::UnitType::isMechanical
extern const PtrUnitFilter IsMechanical;
/// @see BWAPI::UnitType::isRobotic
extern const PtrUnitFilter IsRobotic;
/// @see BWAPI::UnitType::isDetector
extern const PtrUnitFilter IsDetector;
/// @see BWAPI::UnitType::isResourceContainer
extern const PtrUnitFilter IsResourceContainer;
/// @see BWAPI::UnitType::isResourceDepot
extern const PtrUnitFilter IsResourceDepot;
/// @see BWAPI::UnitType::isRefinery
extern const PtrUnitFilter IsRefinery;
/// @see BWAPI::UnitType::isWorker
extern const PtrUnitFilter IsWorker;
/// @see BWAPI::UnitType::requiresPsi
extern const PtrUnitFilter RequiresPsi;
/// @see BWAPI::UnitType::requiresCreep
extern const PtrUnitFilter RequiresCreep;
/// @see BWAPI::UnitType::isBurrowable
extern const PtrUnitFilter IsBurrowable;
/// @see BWAPI::UnitType::isCloakable
extern const PtrUnitFilter IsCloakable;
/// @see BWAPI::UnitType::isBuilding
extern const PtrUnitFilter IsBuilding;
/// @see BWAPI::UnitType::isAddon
extern const PtrUnitFilter IsAddon;
/// @see BWAPI::UnitType::isFlyingBuilding
extern const PtrUnitFilter IsFlyingBuilding;
/// @see BWAPI::UnitType::isNeutral
extern const PtrUnitFilter IsNeutral;
/// @see BWAPI::UnitType::isHero
extern const PtrUnitFilter IsHero;
/// @see BWAPI::UnitType::isPowerup
extern const PtrUnitFilter IsPowerup;
/// @see BWAPI::UnitType::isBeacon
extern const PtrUnitFilter IsBeacon;
/// @see BWAPI::UnitType::isFlagBeacon
extern const PtrUnitFilter IsFlagBeacon;
/// @see BWAPI::UnitType::isSpecialBuilding
extern const PtrUnitFilter IsSpecialBuilding;
/// @see BWAPI::UnitType::isSpell
extern const PtrUnitFilter IsSpell;
/// @see BWAPI::UnitType::producesLarva
extern const PtrUnitFilter ProducesLarva;
/// @see BWAPI::UnitType::isMineralField
extern const PtrUnitFilter IsMineralField;
/// @see BWAPI::UnitType::isCritter
extern const PtrUnitFilter IsCritter;
/// @see BWAPI::UnitType::canBuildAddon
extern const PtrUnitFilter CanBuildAddon;
/// @see BWAPI::UnitInterface::getHitPoints
extern const PtrIntCompareUnitFilter HP;
/// @see BWAPI::UnitType::maxHitPoints
extern const PtrIntCompareUnitFilter MaxHP;
/// A comparison filter that retrieves the unit's HP percentage. The formula is HP*100/MaxHP.
extern const PtrIntCompareUnitFilter HP_Percent;
/// @see BWAPI::UnitInterface::getShields
extern const PtrIntCompareUnitFilter Shields;
/// @see BWAPI::UnitType::maxShields
extern const PtrIntCompareUnitFilter MaxShields;
/// A comparison filter that retrieves the unit's shields percentage. The formula is Shields*100/MaxShields.
extern const PtrIntCompareUnitFilter Shields_Percent;
/// @see BWAPI::UnitInterface::getEnergy
extern const PtrIntCompareUnitFilter Energy;
/// @see BWAPI::PlayerInterface::maxEnergy
extern const PtrIntCompareUnitFilter MaxEnergy;
/// A comparison filter that retrieves the unit's energy percentage. The formula is Energy*100/MaxEnergy.
extern const PtrIntCompareUnitFilter Energy_Percent;
/// @see BWAPI::PlayerInterface::armor
extern const PtrIntCompareUnitFilter Armor;
/// @see BWAPI::UnitType::armorUpgrade
extern const CompareFilter<Unit ,UpgradeType,UpgradeType (*)(Unit )> ArmorUpgrade;
/// @see BWAPI::UnitType::mineralPrice
extern const PtrIntCompareUnitFilter MineralPrice;
/// @see BWAPI::UnitType::gasPrice
extern const PtrIntCompareUnitFilter GasPrice;
/// @see BWAPI::UnitType::buildTime
extern const PtrIntCompareUnitFilter BuildTime;
/// @see BWAPI::UnitType::supplyRequired
extern const PtrIntCompareUnitFilter SupplyRequired;
/// @see BWAPI::UnitType::supplyProvided
extern const PtrIntCompareUnitFilter SupplyProvided;
/// @see BWAPI::UnitType::spaceRequired
extern const PtrIntCompareUnitFilter SpaceRequired;
/// @see BWAPI::UnitInterface::getSpaceRemaining
extern const PtrIntCompareUnitFilter SpaceRemaining;
/// @see BWAPI::UnitType::spaceProvided
extern const PtrIntCompareUnitFilter SpaceProvided;
/// @see BWAPI::UnitType::buildScore
extern const PtrIntCompareUnitFilter BuildScore;
/// @see BWAPI::UnitType::destroyScore
extern const PtrIntCompareUnitFilter DestroyScore;
/// @see BWAPI::PlayerInterface::topSpeed
extern const CompareFilter<Unit ,double,double (*)(Unit )> TopSpeed;
/// @see BWAPI::PlayerInterface::sightRange
extern const PtrIntCompareUnitFilter SightRange;
/// @see BWAPI::PlayerInterface::weaponDamageCooldown
extern const PtrIntCompareUnitFilter WeaponCooldown;
/// @see BWAPI::UnitType::size
extern const CompareFilter<Unit ,UnitSizeType,UnitSizeType (*)(Unit )> SizeType;
/// @see BWAPI::UnitType::groundWeapon
extern const CompareFilter<Unit ,WeaponType,WeaponType (*)(Unit )> GroundWeapon;
/// @see BWAPI::UnitType::airWeapon
extern const CompareFilter<Unit ,WeaponType,WeaponType (*)(Unit )> AirWeapon;
/// @see BWAPI::UnitInterface::getType
extern const CompareFilter<Unit ,UnitType,UnitType (*)(Unit )> GetType;
/// @see BWAPI::UnitType::getRace
extern const CompareFilter<Unit ,Race,Race (*)(Unit )> GetRace;
/// @see BWAPI::UnitInterface::getPlayer
extern const CompareFilter<Unit ,Player,Player (*)(Unit )> GetPlayer;
/// @see BWAPI::UnitInterface::getResources
extern const PtrIntCompareUnitFilter Resources;
/// @see BWAPI::UnitInterface::getResourceGroup
extern const PtrIntCompareUnitFilter ResourceGroup;
/// @see BWAPI::UnitInterface::getAcidSporeCount
extern const PtrIntCompareUnitFilter AcidSporeCount;
/// @see BWAPI::UnitInterface::getInterceptorCount
extern const PtrIntCompareUnitFilter InterceptorCount;
/// @see BWAPI::UnitInterface::getScarabCount
extern const PtrIntCompareUnitFilter ScarabCount;
/// @see BWAPI::UnitInterface::getSpiderMineCount
extern const PtrIntCompareUnitFilter SpiderMineCount;
/// @see BWAPI::UnitInterface::getGroundWeaponCooldown
extern const PtrIntCompareUnitFilter MaxWeaponCooldown;
/// @see BWAPI::UnitInterface::getSpellCooldown
extern const PtrIntCompareUnitFilter SpellCooldown;
/// @see BWAPI::UnitInterface::getDefenseMatrixPoints
extern const PtrIntCompareUnitFilter DefenseMatrixPoints;
/// @see BWAPI::UnitInterface::getDefenseMatrixTimer
extern const PtrIntCompareUnitFilter DefenseMatrixTime;
/// @see BWAPI::UnitInterface::getEnsnareTimer
extern const PtrIntCompareUnitFilter EnsnareTime;
/// @see BWAPI::UnitInterface::getIrradiateTimer
extern const PtrIntCompareUnitFilter IrradiateTime;
/// @see BWAPI::UnitInterface::getLockdownTimer
extern const PtrIntCompareUnitFilter LockdownTime;
/// @see BWAPI::UnitInterface::getMaelstromTimer
extern const PtrIntCompareUnitFilter MaelstromTime;
/// @see BWAPI::UnitInterface::getOrderTimer
extern const PtrIntCompareUnitFilter OrderTime;
/// @see BWAPI::UnitInterface::getPlagueTimer
extern const PtrIntCompareUnitFilter PlagueTimer;
/// @see BWAPI::UnitInterface::getRemoveTimer
extern const PtrIntCompareUnitFilter RemoveTime;
/// @see BWAPI::UnitInterface::getStasisTimer
extern const PtrIntCompareUnitFilter StasisTime;
/// @see BWAPI::UnitInterface::getStimTimer
extern const PtrIntCompareUnitFilter StimTime;
/// @see BWAPI::UnitInterface::getBuildType
extern const CompareFilter<Unit ,UnitType,UnitType (*)(Unit )> BuildType;
/// @see BWAPI::UnitInterface::getRemainingBuildTime
extern const PtrIntCompareUnitFilter RemainingBuildTime;
/// @see BWAPI::UnitInterface::getRemainingTrainTime
extern const PtrIntCompareUnitFilter RemainingTrainTime;
/// @see BWAPI::UnitInterface::getTarget
extern const CompareFilter<Unit ,Unit ,Unit (*)(Unit )> Target;
/// @see BWAPI::UnitInterface::getOrder
extern const CompareFilter<Unit ,Order,Order (*)(Unit )> CurrentOrder;
/// @see BWAPI::UnitInterface::getSecondaryOrder
extern const CompareFilter<Unit ,Order,Order (*)(Unit )> SecondaryOrder;
/// @see BWAPI::UnitInterface::getOrderTarget
extern const CompareFilter<Unit ,Unit ,Unit (*)(Unit )> OrderTarget;
/// @see BWAPI::UnitInterface::getLeft
extern const PtrIntCompareUnitFilter GetLeft;
/// @see BWAPI::UnitInterface::getTop
extern const PtrIntCompareUnitFilter GetTop;
/// @see BWAPI::UnitInterface::getRight
extern const PtrIntCompareUnitFilter GetRight;
/// @see BWAPI::UnitInterface::getBottom
extern const PtrIntCompareUnitFilter GetBottom;
/// @see BWAPI::UnitInterface::exists
extern const PtrUnitFilter Exists;
/// @see BWAPI::UnitInterface::isAttacking
extern const PtrUnitFilter IsAttacking;
/// @see BWAPI::UnitInterface::isBeingConstructed
extern const PtrUnitFilter IsBeingConstructed;
/// @see BWAPI::UnitInterface::isBeingGathered
extern const PtrUnitFilter IsBeingGathered;
/// @see BWAPI::UnitInterface::isBeingHealed
extern const PtrUnitFilter IsBeingHealed;
/// @see BWAPI::UnitInterface::isBlind
extern const PtrUnitFilter IsBlind;
/// @see BWAPI::UnitInterface::isBraking
extern const PtrUnitFilter IsBraking;
/// @see BWAPI::UnitInterface::isBurrowed
extern const PtrUnitFilter IsBurrowed;
/// @see BWAPI::UnitInterface::isCarryingGas
extern const PtrUnitFilter IsCarryingGas;
/// @see BWAPI::UnitInterface::isCarryingMinerals
extern const PtrUnitFilter IsCarryingMinerals;
/// A unary filter that checks if IsCarryingGas or IsCarryingMinerals return true.
extern const PtrUnitFilter IsCarryingSomething;
/// @see BWAPI::UnitInterface::isCloaked
extern const PtrUnitFilter IsCloaked;
/// @see BWAPI::UnitInterface::isCompleted
extern const PtrUnitFilter IsCompleted;
/// @see BWAPI::UnitInterface::isConstructing
extern const PtrUnitFilter IsConstructing;
/// @see BWAPI::UnitInterface::isDefenseMatrixed
extern const PtrUnitFilter IsDefenseMatrixed;
/// @see BWAPI::UnitInterface::isDetected
extern const PtrUnitFilter IsDetected;
/// @see BWAPI::UnitInterface::isEnsnared
extern const PtrUnitFilter IsEnsnared;
/// @see BWAPI::UnitInterface::isFollowing
extern const PtrUnitFilter IsFollowing;
/// @see BWAPI::UnitInterface::isGatheringGas
extern const PtrUnitFilter IsGatheringGas;
/// @see BWAPI::UnitInterface::isGatheringMinerals
extern const PtrUnitFilter IsGatheringMinerals;
/// @see BWAPI::UnitInterface::isHallucination
extern const PtrUnitFilter IsHallucination;
/// @see BWAPI::UnitInterface::isHoldingPosition
extern const PtrUnitFilter IsHoldingPosition;
/// @see BWAPI::UnitInterface::isIdle
extern const PtrUnitFilter IsIdle;
/// @see BWAPI::UnitInterface::isInterruptible
extern const PtrUnitFilter IsInterruptible;
/// @see BWAPI::UnitInterface::isInvincible
extern const PtrUnitFilter IsInvincible;
/// @see BWAPI::UnitInterface::isIrradiated
extern const PtrUnitFilter IsIrradiated;
/// @see BWAPI::UnitInterface::isLifted
extern const PtrUnitFilter IsLifted;
/// @see BWAPI::UnitInterface::isLoaded
extern const PtrUnitFilter IsLoaded;
/// @see BWAPI::UnitInterface::isLockedDown
extern const PtrUnitFilter IsLockedDown;
/// @see BWAPI::UnitInterface::isMaelstrommed
extern const PtrUnitFilter IsMaelstrommed;
/// @see BWAPI::UnitInterface::isMorphing
extern const PtrUnitFilter IsMorphing;
/// @see BWAPI::UnitInterface::isMoving
extern const PtrUnitFilter IsMoving;
/// @see BWAPI::UnitInterface::isParasited
extern const PtrUnitFilter IsParasited;
/// @see BWAPI::UnitInterface::isPatrolling
extern const PtrUnitFilter IsPatrolling;
/// @see BWAPI::UnitInterface::isPlagued
extern const PtrUnitFilter IsPlagued;
/// @see BWAPI::UnitInterface::isRepairing
extern const PtrUnitFilter IsRepairing;
/// @see BWAPI::UnitInterface::isResearching
extern const PtrUnitFilter IsResearching;
/// @see BWAPI::UnitInterface::isSieged
extern const PtrUnitFilter IsSieged;
/// @see BWAPI::UnitInterface::isStartingAttack
extern const PtrUnitFilter IsStartingAttack;
/// @see BWAPI::UnitInterface::isStasised
extern const PtrUnitFilter IsStasised;
/// @see BWAPI::UnitInterface::isStimmed
extern const PtrUnitFilter IsStimmed;
/// @see BWAPI::UnitInterface::isStuck
extern const PtrUnitFilter IsStuck;
/// @see BWAPI::UnitInterface::isTraining
extern const PtrUnitFilter IsTraining;
/// @see BWAPI::UnitInterface::isUnderAttack
extern const PtrUnitFilter IsUnderAttack;
/// @see BWAPI::UnitInterface::isUnderDarkSwarm
extern const PtrUnitFilter IsUnderDarkSwarm;
/// @see BWAPI::UnitInterface::isUnderDisruptionWeb
extern const PtrUnitFilter IsUnderDisruptionWeb;
/// @see BWAPI::UnitInterface::isUnderStorm
extern const PtrUnitFilter IsUnderStorm;
/// @see BWAPI::UnitInterface::isPowered
extern const PtrUnitFilter IsPowered;
/// @see BWAPI::UnitInterface::isVisible
extern const PtrUnitFilter IsVisible;
/// A unary filter that checks if the current unit is an enemy of the BWAPI player.
/// @note This will always be false when the BWAPI Player is unspecified, such as in a replay.
extern const PtrUnitFilter IsEnemy;
/// A unary filter that checks if the current unit is an ally of the BWAPI player.
/// @note This will always be false when the BWAPI Player is unspecified, such as in a replay.
extern const PtrUnitFilter IsAlly;
/// A unary filter that checks if the current unit is owned by the BWAPI player.
/// @note This will always be false when the BWAPI Player is unspecified, such as in a replay.
extern const PtrUnitFilter IsOwned;
}
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <BWAPI/Vectorset.h>
#include "SetContainer.h"
namespace BWAPI
{
@ -11,12 +11,9 @@ namespace BWAPI
/// A container that holds a group of Forces.
///
/// @see BWAPI::Force, BWAPI::Vectorset
class Forceset : public Vectorset<BWAPI::Force>
class Forceset : public SetContainer<BWAPI::Force, std::hash<void*>>
{
public:
Forceset(size_t initialSize = 5);
Forceset(const Forceset &other);
Forceset(Forceset &&other);
/// @copydoc ForceInterface::getPlayers
Playerset getPlayers() const;

View file

@ -1,6 +1,7 @@
#pragma once
#include <list>
#include <string>
#include <cstdarg>
#include <BWAPI/Interface.h>
#include <BWAPI/UnitType.h>
@ -114,7 +115,7 @@ namespace BWAPI
/// @note Nuke dots are the red dots painted by a @Ghost when using the nuclear strike ability.
///
/// @returns Set of Positions giving the coordinates of nuke locations.
virtual const Position::set& getNukeDots() const = 0;
virtual const Position::list& getNukeDots() const = 0;
/// Retrieves the list of all unhandled game events.
///
@ -605,6 +606,10 @@ namespace BWAPI
/// checks for creep, power, and resource distance requirements in addition to the tiles'
/// buildability and possible units obstructing the build location.
///
/// @note If the type is an addon and a builer is provided, then the location of the addon will
/// be placed 4 tiles to the right and 1 tile down from the given \p position. If the builder
/// is not given, then the check for the addon will be conducted at position.
///
/// @param position
/// Indicates the tile position that the top left corner of the structure is intended to go.
/// @param type
@ -671,10 +676,10 @@ namespace BWAPI
/// Retrieves the set of all starting locations for the current map. A starting location is
/// essentially a candidate for a player's spawn point.
///
/// @returns A TilePosition::set containing all the TilePosition objects that indicate a start
/// @returns A TilePosition::list containing all the TilePosition objects that indicate a start
/// location.
/// @see PlayerInterface::getStartLocation
virtual const TilePosition::set& getStartLocations() const = 0;
virtual const TilePosition::list& getStartLocations() const = 0;
/// Prints text to the screen as a notification. This function allows text formatting using
/// Text::Enum members. The behaviour of this function is the same as printf, located in
@ -1206,8 +1211,7 @@ namespace BWAPI
virtual void setGUI(bool enabled) = 0;
/// Retrieves the Starcraft instance number recorded by BWAPI to identify which Starcraft
/// instance an AI module belongs to. This only applies to users running multiple instances
/// of Starcraft.
/// instance an AI module belongs to. The very first instance should return 1.
///
/// @returns
/// An integer value representing the instance number.
@ -1243,6 +1247,8 @@ namespace BWAPI
/// @param frameSkip
/// Number of graphical frames per logical frame. If this value is 0 or less, then it will
/// default to 1.
///
/// @see setLocalSpeed
virtual void setFrameSkip(int frameSkip) = 0;
/// Checks if there is a path from source to destination. This only checks if the source
@ -1257,7 +1263,7 @@ namespace BWAPI
///
/// @retval true if there is a path between the two positions
/// @retval false if there is no path
virtual bool hasPath(Position source, Position destination) const = 0;
bool hasPath(Position source, Position destination) const;
/// Sets the alliance state of the current player with the target player.
///
@ -1511,14 +1517,14 @@ namespace BWAPI
/// Output stream operator for printing text to Broodwar. Using this operator invokes
/// Game::printf when a newline character is encountered.
template < class T >
GameWrapper &operator <<(const T &in)
inline GameWrapper &operator <<(const T &in)
{
// Pass whatever into the stream
ss << in;
return *this;
};
/// @overload
GameWrapper &operator <<( const ostream_manipulator &fn );
GameWrapper &operator <<(ostream_manipulator fn);
/// Flushes the Broodwar stream, printing all text in the stream to the screen.
void flush();

View file

@ -47,27 +47,24 @@ namespace BWAPI
/// Retrieves the set of all the valid GameTypes.
///
/// @returns Set of available GameTypes.
const GameType::const_set& allGameTypes();
const GameType::set& allGameTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const GameType x
BWAPI_DECL(Melee);
BWAPI_DECL(Free_For_All);
BWAPI_DECL(One_on_One);
BWAPI_DECL(Capture_The_Flag);
BWAPI_DECL(Greed);
BWAPI_DECL(Slaughter);
BWAPI_DECL(Sudden_Death);
BWAPI_DECL(Ladder);
BWAPI_DECL(Use_Map_Settings);
BWAPI_DECL(Team_Melee);
BWAPI_DECL(Team_Free_For_All);
BWAPI_DECL(Team_Capture_The_Flag);
BWAPI_DECL(Top_vs_Bottom);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const GameType Melee;
extern const GameType Free_For_All;
extern const GameType One_on_One;
extern const GameType Capture_The_Flag;
extern const GameType Greed;
extern const GameType Slaughter;
extern const GameType Sudden_Death;
extern const GameType Ladder;
extern const GameType Use_Map_Settings;
extern const GameType Team_Melee;
extern const GameType Team_Free_For_All;
extern const GameType Team_Capture_The_Flag;
extern const GameType Top_vs_Bottom;
extern const GameType None;
extern const GameType Unknown;
}
static_assert(sizeof(GameType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -11,8 +11,8 @@ namespace BWAPI
InterfaceEvent()
: condProc(nullptr)
, execProc(nullptr)
, runCount(0)
, runFreq(0)
, runCount(0)
, step(0)
{};
@ -61,7 +61,7 @@ namespace BWAPI
///
/// @retval true If the event has completed all runs and/or is marked for removal.
/// @retval false If the event should continue execution.
bool isFinished()
bool isFinished() const
{
return this->runCount == 0;
};

View file

@ -224,168 +224,165 @@ namespace BWAPI
/// Retrieves the set of all the Orders.
///
/// @returns Set of all Order types.
const Order::const_set& allOrders();
const Order::set& allOrders();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const Order x
BWAPI_DECL(Die);
BWAPI_DECL(Stop);
BWAPI_DECL(Guard);
BWAPI_DECL(PlayerGuard);
BWAPI_DECL(TurretGuard);
BWAPI_DECL(BunkerGuard);
BWAPI_DECL(Move);
BWAPI_DECL(AttackUnit);
BWAPI_DECL(AttackTile);
BWAPI_DECL(Hover);
BWAPI_DECL(AttackMove);
BWAPI_DECL(InfestedCommandCenter);
BWAPI_DECL(UnusedNothing);
BWAPI_DECL(UnusedPowerup);
BWAPI_DECL(TowerGuard);
BWAPI_DECL(VultureMine);
BWAPI_DECL(Nothing);
BWAPI_DECL(CastInfestation);
BWAPI_DECL(InfestingCommandCenter);
BWAPI_DECL(PlaceBuilding);
BWAPI_DECL(CreateProtossBuilding);
BWAPI_DECL(ConstructingBuilding);
BWAPI_DECL(Repair);
BWAPI_DECL(PlaceAddon);
BWAPI_DECL(BuildAddon);
BWAPI_DECL(Train);
BWAPI_DECL(RallyPointUnit);
BWAPI_DECL(RallyPointTile);
BWAPI_DECL(ZergBirth);
BWAPI_DECL(ZergUnitMorph);
BWAPI_DECL(ZergBuildingMorph);
BWAPI_DECL(IncompleteBuilding);
BWAPI_DECL(BuildNydusExit);
BWAPI_DECL(EnterNydusCanal);
BWAPI_DECL(Follow);
BWAPI_DECL(Carrier);
BWAPI_DECL(ReaverCarrierMove);
BWAPI_DECL(CarrierIgnore2);
BWAPI_DECL(Reaver);
BWAPI_DECL(TrainFighter);
BWAPI_DECL(InterceptorAttack);
BWAPI_DECL(ScarabAttack);
BWAPI_DECL(RechargeShieldsUnit);
BWAPI_DECL(RechargeShieldsBattery);
BWAPI_DECL(ShieldBattery);
BWAPI_DECL(InterceptorReturn);
BWAPI_DECL(BuildingLand);
BWAPI_DECL(BuildingLiftOff);
BWAPI_DECL(DroneLiftOff);
BWAPI_DECL(LiftingOff);
BWAPI_DECL(ResearchTech);
BWAPI_DECL(Upgrade);
BWAPI_DECL(Larva);
BWAPI_DECL(SpawningLarva);
BWAPI_DECL(Harvest1);
BWAPI_DECL(Harvest2);
BWAPI_DECL(MoveToGas);
BWAPI_DECL(WaitForGas);
BWAPI_DECL(HarvestGas);
BWAPI_DECL(ReturnGas);
BWAPI_DECL(MoveToMinerals);
BWAPI_DECL(WaitForMinerals);
BWAPI_DECL(MiningMinerals);
BWAPI_DECL(Harvest3);
BWAPI_DECL(Harvest4);
BWAPI_DECL(ReturnMinerals);
BWAPI_DECL(Interrupted);
BWAPI_DECL(EnterTransport);
BWAPI_DECL(PickupIdle);
BWAPI_DECL(PickupTransport);
BWAPI_DECL(PickupBunker);
BWAPI_DECL(Pickup4);
BWAPI_DECL(PowerupIdle);
BWAPI_DECL(Sieging);
BWAPI_DECL(Unsieging);
BWAPI_DECL(InitCreepGrowth);
BWAPI_DECL(SpreadCreep);
BWAPI_DECL(StoppingCreepGrowth);
BWAPI_DECL(GuardianAspect);
BWAPI_DECL(ArchonWarp);
BWAPI_DECL(CompletingArchonSummon);
BWAPI_DECL(HoldPosition);
BWAPI_DECL(Cloak);
BWAPI_DECL(Decloak);
BWAPI_DECL(Unload);
BWAPI_DECL(MoveUnload);
BWAPI_DECL(FireYamatoGun);
BWAPI_DECL(CastLockdown);
BWAPI_DECL(Burrowing);
BWAPI_DECL(Burrowed);
BWAPI_DECL(Unburrowing);
BWAPI_DECL(CastDarkSwarm);
BWAPI_DECL(CastParasite);
BWAPI_DECL(CastSpawnBroodlings);
BWAPI_DECL(CastEMPShockwave);
BWAPI_DECL(NukeWait);
BWAPI_DECL(NukeTrain);
BWAPI_DECL(NukeLaunch);
BWAPI_DECL(NukePaint);
BWAPI_DECL(NukeUnit);
BWAPI_DECL(CastNuclearStrike);
BWAPI_DECL(NukeTrack);
BWAPI_DECL(CloakNearbyUnits);
BWAPI_DECL(PlaceMine);
BWAPI_DECL(RightClickAction);
BWAPI_DECL(CastRecall);
BWAPI_DECL(Teleport);
BWAPI_DECL(CastScannerSweep);
BWAPI_DECL(Scanner);
BWAPI_DECL(CastDefensiveMatrix);
BWAPI_DECL(CastPsionicStorm);
BWAPI_DECL(CastIrradiate);
BWAPI_DECL(CastPlague);
BWAPI_DECL(CastConsume);
BWAPI_DECL(CastEnsnare);
BWAPI_DECL(CastStasisField);
BWAPI_DECL(CastHallucination);
BWAPI_DECL(Hallucination2);
BWAPI_DECL(ResetCollision);
BWAPI_DECL(Patrol);
BWAPI_DECL(CTFCOPInit);
BWAPI_DECL(CTFCOPStarted);
BWAPI_DECL(CTFCOP2);
BWAPI_DECL(ComputerAI);
BWAPI_DECL(AtkMoveEP);
BWAPI_DECL(HarassMove);
BWAPI_DECL(AIPatrol);
BWAPI_DECL(GuardPost);
BWAPI_DECL(RescuePassive);
BWAPI_DECL(Neutral);
BWAPI_DECL(ComputerReturn);
BWAPI_DECL(SelfDestructing);
BWAPI_DECL(Critter);
BWAPI_DECL(HiddenGun);
BWAPI_DECL(OpenDoor);
BWAPI_DECL(CloseDoor);
BWAPI_DECL(HideTrap);
BWAPI_DECL(RevealTrap);
BWAPI_DECL(EnableDoodad);
BWAPI_DECL(DisableDoodad);
BWAPI_DECL(WarpIn);
BWAPI_DECL(Medic);
BWAPI_DECL(MedicHeal);
BWAPI_DECL(HealMove);
BWAPI_DECL(MedicHealToIdle);
BWAPI_DECL(CastRestoration);
BWAPI_DECL(CastDisruptionWeb);
BWAPI_DECL(CastMindControl);
BWAPI_DECL(DarkArchonMeld);
BWAPI_DECL(CastFeedback);
BWAPI_DECL(CastOpticalFlare);
BWAPI_DECL(CastMaelstrom);
BWAPI_DECL(JunkYardDog);
BWAPI_DECL(Fatal);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const Order Die;
extern const Order Stop;
extern const Order Guard;
extern const Order PlayerGuard;
extern const Order TurretGuard;
extern const Order BunkerGuard;
extern const Order Move;
extern const Order AttackUnit;
extern const Order AttackTile;
extern const Order Hover;
extern const Order AttackMove;
extern const Order InfestedCommandCenter;
extern const Order UnusedNothing;
extern const Order UnusedPowerup;
extern const Order TowerGuard;
extern const Order VultureMine;
extern const Order Nothing;
extern const Order CastInfestation;
extern const Order InfestingCommandCenter;
extern const Order PlaceBuilding;
extern const Order CreateProtossBuilding;
extern const Order ConstructingBuilding;
extern const Order Repair;
extern const Order PlaceAddon;
extern const Order BuildAddon;
extern const Order Train;
extern const Order RallyPointUnit;
extern const Order RallyPointTile;
extern const Order ZergBirth;
extern const Order ZergUnitMorph;
extern const Order ZergBuildingMorph;
extern const Order IncompleteBuilding;
extern const Order BuildNydusExit;
extern const Order EnterNydusCanal;
extern const Order Follow;
extern const Order Carrier;
extern const Order ReaverCarrierMove;
extern const Order CarrierIgnore2;
extern const Order Reaver;
extern const Order TrainFighter;
extern const Order InterceptorAttack;
extern const Order ScarabAttack;
extern const Order RechargeShieldsUnit;
extern const Order RechargeShieldsBattery;
extern const Order ShieldBattery;
extern const Order InterceptorReturn;
extern const Order BuildingLand;
extern const Order BuildingLiftOff;
extern const Order DroneLiftOff;
extern const Order LiftingOff;
extern const Order ResearchTech;
extern const Order Upgrade;
extern const Order Larva;
extern const Order SpawningLarva;
extern const Order Harvest1;
extern const Order Harvest2;
extern const Order MoveToGas;
extern const Order WaitForGas;
extern const Order HarvestGas;
extern const Order ReturnGas;
extern const Order MoveToMinerals;
extern const Order WaitForMinerals;
extern const Order MiningMinerals;
extern const Order Harvest3;
extern const Order Harvest4;
extern const Order ReturnMinerals;
extern const Order Interrupted;
extern const Order EnterTransport;
extern const Order PickupIdle;
extern const Order PickupTransport;
extern const Order PickupBunker;
extern const Order Pickup4;
extern const Order PowerupIdle;
extern const Order Sieging;
extern const Order Unsieging;
extern const Order InitCreepGrowth;
extern const Order SpreadCreep;
extern const Order StoppingCreepGrowth;
extern const Order GuardianAspect;
extern const Order ArchonWarp;
extern const Order CompletingArchonSummon;
extern const Order HoldPosition;
extern const Order Cloak;
extern const Order Decloak;
extern const Order Unload;
extern const Order MoveUnload;
extern const Order FireYamatoGun;
extern const Order CastLockdown;
extern const Order Burrowing;
extern const Order Burrowed;
extern const Order Unburrowing;
extern const Order CastDarkSwarm;
extern const Order CastParasite;
extern const Order CastSpawnBroodlings;
extern const Order CastEMPShockwave;
extern const Order NukeWait;
extern const Order NukeTrain;
extern const Order NukeLaunch;
extern const Order NukePaint;
extern const Order NukeUnit;
extern const Order CastNuclearStrike;
extern const Order NukeTrack;
extern const Order CloakNearbyUnits;
extern const Order PlaceMine;
extern const Order RightClickAction;
extern const Order CastRecall;
extern const Order Teleport;
extern const Order CastScannerSweep;
extern const Order Scanner;
extern const Order CastDefensiveMatrix;
extern const Order CastPsionicStorm;
extern const Order CastIrradiate;
extern const Order CastPlague;
extern const Order CastConsume;
extern const Order CastEnsnare;
extern const Order CastStasisField;
extern const Order CastHallucination;
extern const Order Hallucination2;
extern const Order ResetCollision;
extern const Order Patrol;
extern const Order CTFCOPInit;
extern const Order CTFCOPStarted;
extern const Order CTFCOP2;
extern const Order ComputerAI;
extern const Order AtkMoveEP;
extern const Order HarassMove;
extern const Order AIPatrol;
extern const Order GuardPost;
extern const Order RescuePassive;
extern const Order Neutral;
extern const Order ComputerReturn;
extern const Order SelfDestructing;
extern const Order Critter;
extern const Order HiddenGun;
extern const Order OpenDoor;
extern const Order CloseDoor;
extern const Order HideTrap;
extern const Order RevealTrap;
extern const Order EnableDoodad;
extern const Order DisableDoodad;
extern const Order WarpIn;
extern const Order Medic;
extern const Order MedicHeal;
extern const Order HealMove;
extern const Order MedicHealToIdle;
extern const Order CastRestoration;
extern const Order CastDisruptionWeb;
extern const Order CastMindControl;
extern const Order DarkArchonMeld;
extern const Order CastFeedback;
extern const Order CastOpticalFlare;
extern const Order CastMaelstrom;
extern const Order JunkYardDog;
extern const Order Fatal;
extern const Order None;
extern const Order Unknown;
};
static_assert(sizeof(Order) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -130,7 +130,7 @@ namespace BWAPI
/// if \p player is neutral or an observer.
///
/// @see isEnemy
virtual bool isAlly(Player player) const = 0;
virtual bool isAlly(const Player player) const = 0;
/// Checks if this player is unallied to the specified player.
///
@ -144,7 +144,7 @@ namespace BWAPI
/// \p player is neutral or an observer.
///
/// @see isAlly
virtual bool isEnemy(Player player) const = 0;
virtual bool isEnemy(const Player player) const = 0;
/// Checks if this player is the neutral player.
///

View file

@ -43,23 +43,20 @@ namespace BWAPI
/// Retrieves the set of all the PlayerTypes.
///
/// @returns Set consisting of all valid PlayerTypes.
const PlayerType::const_set& allPlayerTypes();
const PlayerType::set& allPlayerTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const PlayerType x
BWAPI_DECL(None);
BWAPI_DECL(Computer);
BWAPI_DECL(Player);
BWAPI_DECL(RescuePassive);
BWAPI_DECL(EitherPreferComputer);
BWAPI_DECL(EitherPreferHuman);
BWAPI_DECL(Neutral);
BWAPI_DECL(Closed);
BWAPI_DECL(PlayerLeft);
BWAPI_DECL(ComputerLeft);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const PlayerType None;
extern const PlayerType Computer;
extern const PlayerType Player;
extern const PlayerType RescuePassive;
extern const PlayerType EitherPreferComputer;
extern const PlayerType EitherPreferHuman;
extern const PlayerType Neutral;
extern const PlayerType Closed;
extern const PlayerType PlayerLeft;
extern const PlayerType ComputerLeft;
extern const PlayerType Unknown;
}
static_assert(sizeof(PlayerType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <BWAPI/Vectorset.h>
#include "SetContainer.h"
#include <BWAPI/Race.h>
#include <BWAPI/Filters.h>
@ -11,12 +11,9 @@ namespace BWAPI
typedef PlayerInterface *Player;
class Unitset;
class Playerset : public Vectorset<BWAPI::Player>
class Playerset : public SetContainer<BWAPI::Player, std::hash<void*>>
{
public:
Playerset(size_t initialSize = 16);
Playerset(const Playerset &other);
Playerset(Playerset &&other);
/// Returns the set of all units that every
/// player in this set owns.

View file

@ -3,15 +3,12 @@
#include <algorithm>
#include <iosfwd>
#include <tuple>
#include <BWAPI/Vectorset.h>
#ifndef _MAKE_POSITION_TEMPLATE
#include <deque>
#ifdef SWIG
#define _MAKE_POSITION_TEMPLATE(_n,_t,_s) typedef BWAPI::Point<_t,_s> _n;
#define BWAPI_MAKE_POSITION_TEMPLATE(_n,T,_s) typedef BWAPI::Point<T,_s> _n;
#else
#define _MAKE_POSITION_TEMPLATE(_n,_t,_s) typedef BWAPI::Point<_t,_s> _n; \
#define BWAPI_MAKE_POSITION_TEMPLATE(_n,T,_s) typedef BWAPI::Point<T,_s> _n; \
namespace _n ## s \
{ const _n Invalid(32000/_s,32000/_s); \
const _n None(32000/_s,32032/_s); \
@ -20,90 +17,146 @@
}
#endif
#define _OPERATOR_OP_PT(op) Point operator op (const Point &pos) const \
{ return Point(this->x op pos.x, this->y op pos.y); }; \
Point &operator op ## = (const Point &pos) \
{ this->x op ## = pos.x; this->y op ## = pos.y; \
return *this; };
#define _OPERATOR_OP_VAL(op) Point operator op (const _T &val) const \
{ return Point(this->x op val, this->y op val); }; \
Point &operator op ## = (const _T &val) \
{ this->x op ## = val; this->y op ## = val; \
return *this; };
#define _OPERATOR_OP_VAL_CHK(op) Point operator op (const _T &val) const \
{ if ( val == 0 ) return Point(32000/__Scale,32000/__Scale); \
return Point(this->x op val, this->y op val); }; \
Point &operator op ## = (const _T &val) \
{ if ( val == 0 ) { this->x = 32000/__Scale; this->y = 32000/__Scale; } \
else { this->x op ## = val; this->y op ## = val; } \
return *this; };
#endif
namespace BWAPI
{
// Declaration
template<typename _T, int __Scale = 1>
template<typename T, int Scale = 1>
class Point;
// Restrictions (no division by 0 or types too small to contain map positions)
template<typename _T> class Point<_T, 0> {};
template<int __Scale> class Point<char, __Scale> {};
template<int __Scale> class Point<unsigned char, __Scale> {};
template<int __Scale> class Point<bool, __Scale> {};
template<typename T> class Point<T, 0> {};
template<int Scale> class Point<char, Scale> {};
template<int Scale> class Point<unsigned char, Scale> {};
template<int Scale> class Point<bool, Scale> {};
// ------------------------------------------------------ Point template ----------------
template<typename _T, int __Scale>
template<typename T, int Scale>
class Point
{
public:
typedef Vectorset< Point<_T,__Scale> > set;
typedef std::deque< Point<T,Scale> > list;
// Constructors
Point(_T _x = 0, _T _y = 0) : x(_x), y(_y) {};
template<typename _NT> Point(const Point<_NT, __Scale> &pt) : x( (_T)pt.x ), y( (_T)pt.y ) {};
Point() : x(T{}), y(T{}) {}
Point(T _x, T _y) : x(_x), y(_y) {}
template<typename _NT> Point(const Point<_NT, Scale> &pt) : x( (T)pt.x ), y( (T)pt.y ) {}
#pragma warning( push )
#pragma warning( disable: 4723 )
// Conversion constructor
template<typename _NT, int __NScale> explicit Point(const Point<_NT, __NScale> &pt)
: x( (_T)(__NScale > __Scale ? pt.x*(__NScale/__Scale) : pt.x/(__Scale/__NScale)) )
, y( (_T)(__NScale > __Scale ? pt.y*(__NScale/__Scale) : pt.y/(__Scale/__NScale)) ) { };
: x((T)(__NScale > Scale ? pt.x*(__NScale / Scale) : pt.x / (Scale / __NScale)))
, y((T)(__NScale > Scale ? pt.y*(__NScale / Scale) : pt.y / (Scale / __NScale))) { }
#pragma warning( pop )
// Conversion restriction constructor
template<typename _NT> Point(const Point<_NT, 0> &pt) : x(0), y(0) {};
// Operators
operator bool() const { return this->isValid(); };
explicit operator bool() const { return this->isValid(); };
bool operator == (const Point<_T,__Scale> &pos) const
bool operator == (const Point<T,Scale> &pos) const
{
return std::tie(this->x, this->y) == std::tie(pos.x, pos.y);
};
bool operator != (const Point<_T,__Scale> &pos) const
bool operator != (const Point<T,Scale> &pos) const
{
return !(*this == pos);
};
bool operator < (const Point<_T,__Scale> &position) const
bool operator < (const Point<T,Scale> &position) const
{
return std::tie(this->x, this->y) < std::tie(position.x, position.y);
};
_OPERATOR_OP_PT(+)
_OPERATOR_OP_PT(-)
inline Point<T, Scale> &operator += (const Point<T, Scale> &p)
{
x += p.x;
y += p.y;
return *this;
};
inline Point<T, Scale> operator + (const Point<T, Scale> &p) const
{
Point<T, Scale> r(*this);
return r += p;
};
inline Point<T, Scale> &operator -= (const Point<T, Scale> &p)
{
x -= p.x;
y -= p.y;
return *this;
};
inline Point<T, Scale> operator - (const Point<T, Scale> &p) const
{
Point<T, Scale> r(*this);
return r -= p;
};
_OPERATOR_OP_VAL(*)
_OPERATOR_OP_VAL(&)
_OPERATOR_OP_VAL(|)
_OPERATOR_OP_VAL(^)
inline Point<T, Scale> &operator *= (const T &v)
{
x *= v;
y *= v;
return *this;
};
inline Point<T, Scale> operator *(const T &v) const
{
Point<T, Scale> r(*this);
return r *= v;
};
inline Point<T, Scale> &operator |= (const T &v)
{
x |= v;
y |= v;
return *this;
};
inline Point<T, Scale> operator |(const T &v) const
{
Point<T, Scale> r(*this);
return r |= v;
};
inline Point<T, Scale> &operator &= (const T &v)
{
x &= v;
y &= v;
return *this;
};
inline Point<T, Scale> operator &(const T &v) const
{
Point<T, Scale> r(*this);
return r &= v;
};
inline Point<T, Scale> &operator ^= (const T &v)
{
x ^= v;
y ^= v;
return *this;
};
inline Point<T, Scale> operator ^(const T &v) const
{
Point<T, Scale> r(*this);
return r ^= v;
};
Point<T, Scale> operator / (const T &v) const
{
Point<T, Scale> result(*this);
return result /= v;
};
Point<T, Scale> &operator /= (const T &val)
{
if (val == 0) { x = 32000 / Scale; y = 32000 / Scale; }
else { x /= val; y /= val; }
return *this;
};
Point<T, Scale> operator %(const T &v) const
{
Point<T, Scale> result(*this);
return result %= v;
};
Point<T, Scale> &operator %= (const T &val)
{
if (val == 0) { x = 32000 / Scale; y = 32000 / Scale; }
else { x %= val; y %= val; }
return *this;
};
_OPERATOR_OP_VAL_CHK(/)
_OPERATOR_OP_VAL_CHK(%)
/// Ouput stream operator overload. Outputs the Point in the format "(x,y)" without
/// quotations.
///
@ -112,10 +165,14 @@ namespace BWAPI
/// @param pt
/// Point to output.
/// @returns Output stream \p out.
friend std::ostream &operator << (std::ostream &out, const Point<_T,__Scale> &pt)
friend std::ostream &operator << (std::ostream &out, const Point<T, Scale> &pt)
{
return out << '(' << pt.x << ',' << pt.y << ')';
};
friend std::wostream &operator << (std::wostream &out, const Point<T, Scale> &pt)
{
return out << L'(' << pt.x << L',' << pt.y << L')';
};
/// Input stream operator overload. Reads the input in the form "x y" without quotations.
/// The x and y values are read as type T(typically int or float) and stored into pt.
@ -125,7 +182,11 @@ namespace BWAPI
/// @param pt
/// The receiving variable.
/// @returns Input stream \p in.
friend std::istream &operator >> (std::istream &in, Point<_T,__Scale> &pt)
friend std::istream &operator >> (std::istream &in, Point<T, Scale> &pt)
{
return in >> pt.x >> pt.y;
};
friend std::wistream &operator >> (std::wistream &in, Point<T, Scale> &pt)
{
return in >> pt.x >> pt.y;
};
@ -160,7 +221,7 @@ namespace BWAPI
///
/// @returns A double representing the distance between this point and \p position.
/// @see getApproxDistance
double getDistance(const Point<_T,__Scale> &position) const
double getDistance(const Point<T,Scale> &position) const
{
return ((*this) - position).getLength();
};
@ -189,7 +250,7 @@ namespace BWAPI
///
/// @returns An integer representing the distance between this point and \p position.
/// @see getDistance
int getApproxDistance(const Point<_T,__Scale> &position) const
int getApproxDistance(const Point<T,Scale> &position) const
{
unsigned int min = abs((int)(this->x - position.x));
unsigned int max = abs((int)(this->y - position.y));
@ -213,7 +274,7 @@ namespace BWAPI
///
/// @returns A reference to itself.
/// @see setMin
Point &setMax(_T max_x, _T max_y)
Point &setMax(T max_x, T max_y)
{
if ( x > max_x )
x = max_x;
@ -222,7 +283,7 @@ namespace BWAPI
return *this;
};
/// @overload
Point &setMax(const Point<_T,__Scale> &max)
Point &setMax(const Point<T,Scale> &max)
{
this->setMax(max.x, max.y);
return *this;
@ -238,7 +299,7 @@ namespace BWAPI
///
/// @returns A reference to itself.
/// @see setMax
Point &setMin(_T min_x, _T min_y)
Point &setMin(T min_x, T min_y)
{
if ( x < min_x )
x = min_x;
@ -247,7 +308,7 @@ namespace BWAPI
return *this;
};
/// @overload
Point &setMin(const Point<_T,__Scale> &min)
Point &setMin(const Point<T,Scale> &min)
{
this->setMin(min.x, min.y);
return *this;
@ -256,11 +317,10 @@ namespace BWAPI
/// The x and y members for this class.
///
/// Simply reference these members when retrieving a position's x and y values.
_T x, y;
T x, y;
};
_MAKE_POSITION_TEMPLATE(WalkPosition,int,8)
_MAKE_POSITION_TEMPLATE(Position,int,1)
_MAKE_POSITION_TEMPLATE(TilePosition,int,32)
BWAPI_MAKE_POSITION_TEMPLATE(WalkPosition,int,8)
BWAPI_MAKE_POSITION_TEMPLATE(Position,int,1)
BWAPI_MAKE_POSITION_TEMPLATE(TilePosition,int,32)
}

View file

@ -87,18 +87,15 @@ namespace BWAPI
/// Retrieves the set of all races.
///
/// @returns Race::set containing all the Race types.
const Race::const_set& allRaces();
const Race::set& allRaces();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const Race x
BWAPI_DECL(Zerg);
BWAPI_DECL(Terran);
BWAPI_DECL(Protoss);
BWAPI_DECL(Random);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const Race Zerg;
extern const Race Terran;
extern const Race Protoss;
extern const Race Random;
extern const Race None;
extern const Race Unknown;
}
static_assert(sizeof(Race) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <BWAPI/Vectorset.h>
#include "SetContainer.h"
#include <BWAPI/Position.h>
#include <BWAPI/Filters.h>
@ -11,12 +11,9 @@ namespace BWAPI
class Unitset;
class Regionset : public Vectorset<BWAPI::Region>
class Regionset : public SetContainer<BWAPI::Region, std::hash<void*>>
{
public:
Regionset(size_t initialSize = 16);
Regionset(const Regionset &other);
Regionset(Regionset &&other);
/// @copydoc RegionInterface::getCenter
Position getCenter() const;

View file

@ -0,0 +1,52 @@
#pragma once
#include <unordered_set>
#include <set>
namespace BWAPI
{
template <class T, class HashT>
using SetContainerUnderlyingT = std::unordered_set < T, HashT >;
/// This container is used to wrap convenience functions for BWAPI and be used as a bridge with
/// a built-in set type.
///
/// @tparam T
/// Type that this set contains.
/// @tparam HashT
/// Hash type. Defaults to integral hashing for BWAPI usage.
template <class T, class HashT = std::hash<int>>
class SetContainer : public SetContainerUnderlyingT < T, HashT >
{
public:
SetContainer() : SetContainerUnderlyingT<T, HashT>() {}
SetContainer(SetContainer const &other) : SetContainerUnderlyingT<T, HashT>(other) {}
SetContainer(SetContainer &&other) : SetContainerUnderlyingT<T, HashT>(std::forward<SetContainer>(other)) {}
SetContainer(std::initializer_list<T> ilist) : SetContainerUnderlyingT<T, HashT>(ilist) {}
template <class IterT>
SetContainer(IterT _begin, IterT _end) : SetContainerUnderlyingT<T, HashT>(_begin, _end) {}
/// Iterates the set and erases each element x where pred(x) returns true.
///
/// @param pred
/// Predicate for removing elements.
template<class Pred>
void erase_if(const Pred& pred) {
auto it = this->begin();
while (it != this->end()) {
if (pred(*it)) it = this->erase(it);
else ++it;
}
};
/// Checks if this set contains a specific value.
///
/// @param value
/// Value to search for.
bool contains(T const &value) const
{
return count(value) != 0;
}
};
}

View file

@ -4,6 +4,7 @@
namespace BWAPI
{
class UnitType;
class WeaponType;
class Order;
class Race;
@ -125,7 +126,7 @@ namespace BWAPI
/// Retrieves the set of all UnitTypes that are capable of using this ability.
///
/// @returns Set of UnitTypes that can use this ability when researched.
const UnitType::const_set& whatUses() const;
const UnitType::set& whatUses() const;
/// Retrieves the Order that a Unit uses when using this ability.
///
@ -138,48 +139,45 @@ namespace BWAPI
/// Retrieves the set of all the TechTypes.
///
/// @returns Set of all available TechTypes.
const TechType::const_set& allTechTypes();
const TechType::set& allTechTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const TechType x
BWAPI_DECL(Stim_Packs);
BWAPI_DECL(Lockdown);
BWAPI_DECL(EMP_Shockwave);
BWAPI_DECL(Spider_Mines);
BWAPI_DECL(Scanner_Sweep);
BWAPI_DECL(Tank_Siege_Mode);
BWAPI_DECL(Defensive_Matrix);
BWAPI_DECL(Irradiate);
BWAPI_DECL(Yamato_Gun);
BWAPI_DECL(Cloaking_Field);
BWAPI_DECL(Personnel_Cloaking);
BWAPI_DECL(Burrowing);
BWAPI_DECL(Infestation);
BWAPI_DECL(Spawn_Broodlings);
BWAPI_DECL(Dark_Swarm);
BWAPI_DECL(Plague);
BWAPI_DECL(Consume);
BWAPI_DECL(Ensnare);
BWAPI_DECL(Parasite);
BWAPI_DECL(Psionic_Storm);
BWAPI_DECL(Hallucination);
BWAPI_DECL(Recall);
BWAPI_DECL(Stasis_Field);
BWAPI_DECL(Archon_Warp);
BWAPI_DECL(Restoration);
BWAPI_DECL(Disruption_Web);
BWAPI_DECL(Mind_Control);
BWAPI_DECL(Dark_Archon_Meld);
BWAPI_DECL(Feedback);
BWAPI_DECL(Optical_Flare);
BWAPI_DECL(Maelstrom);
BWAPI_DECL(Lurker_Aspect);
BWAPI_DECL(Healing);
BWAPI_DECL(None);
BWAPI_DECL(Nuclear_Strike);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const TechType Stim_Packs;
extern const TechType Lockdown;
extern const TechType EMP_Shockwave;
extern const TechType Spider_Mines;
extern const TechType Scanner_Sweep;
extern const TechType Tank_Siege_Mode;
extern const TechType Defensive_Matrix;
extern const TechType Irradiate;
extern const TechType Yamato_Gun;
extern const TechType Cloaking_Field;
extern const TechType Personnel_Cloaking;
extern const TechType Burrowing;
extern const TechType Infestation;
extern const TechType Spawn_Broodlings;
extern const TechType Dark_Swarm;
extern const TechType Plague;
extern const TechType Consume;
extern const TechType Ensnare;
extern const TechType Parasite;
extern const TechType Psionic_Storm;
extern const TechType Hallucination;
extern const TechType Recall;
extern const TechType Stasis_Field;
extern const TechType Archon_Warp;
extern const TechType Restoration;
extern const TechType Disruption_Web;
extern const TechType Mind_Control;
extern const TechType Dark_Archon_Meld;
extern const TechType Feedback;
extern const TechType Optical_Flare;
extern const TechType Maelstrom;
extern const TechType Lurker_Aspect;
extern const TechType Healing;
extern const TechType None;
extern const TechType Nuclear_Strike;
extern const TechType Unknown;
};
static_assert(sizeof(TechType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,52 +1,15 @@
#pragma once
#include <BWAPI/SetContainer.h>
#include <string>
#include <cctype>
#include <deque>
#include <unordered_map>
#include <algorithm>
#include <BWAPI/Vectorset.h>
namespace BWAPI
{
// @TODO Get rid of this eventually.
template<class T>
class Typeset : public Vectorset<T>
{
public:
// Constructors
Typeset() : Vectorset<T>() {};
// copy ctor
Typeset(const Typeset<T> &other) : Vectorset<T>( other ) {};
Typeset(const ConstVectorset<T> &other) : Vectorset<T>( other ) {};
// move ctor
Typeset(Typeset<T> &&other) : Vectorset<T>( std::forward< Typeset<T> >(other) ) {};
// type ctor
Typeset(const T &val) : Vectorset<T>() { this->push_back(val); };
// array ctor
Typeset(const T *pArray, size_t size) : Vectorset<T>(pArray, size) {};
Typeset(const int *pArray, size_t size) : Vectorset<T>((const T*)pArray, size) {};
~Typeset() {};
// Operators (adding elements)
Typeset operator |(const T &val) const
{
Typeset newset(*this);
newset.insert(val);
return newset;
};
Typeset &operator |=(const T &val)
{
this->insert(val);
return *this;
};
Typeset &operator |=(const Typeset<T> &val)
{
this->insert(val);
return *this;
};
};
template<class T, int UnknownId> class Type;
/// Base superclass for all BWAPI Types.
template<class T, int UnknownId>
@ -59,6 +22,7 @@ namespace BWAPI
/// Array of strings containing the type names.
static const std::string typeNames[UnknownId+1];
/// Type that maps names to their type values.
typedef std::unordered_map<std::string,T> typeMapT;
private:
@ -79,7 +43,6 @@ namespace BWAPI
}
return result;
}
public:
/// Expected type constructor. If the type is an invalid type, then it becomes Types::Unknown.
/// A type is invalid if its value is less than 0 or greater than Types::Unknown.
@ -90,11 +53,11 @@ namespace BWAPI
/// If it is omitted, then it becomes Types::None.
explicit Type(int id) : tid( id < 0 || id > UnknownId ? UnknownId : id ) {};
/// The set that contains the current type.
typedef Typeset<T> set;
/// A set type that contains the current type.
typedef SetContainer<T> set;
/// The constant set that contains the current type.
typedef ConstVectorset<T> const_set;
/// A list type that contains the current type.
typedef std::deque<T> list;
/// Conversion/convenience operator to convert this type to its primitive type.
inline operator int() const { return this->tid; };
@ -137,10 +100,15 @@ namespace BWAPI
/// Output stream operator overload. Allows printing of the type without calling
/// Type::getName.
friend inline std::ostream &operator << (std::ostream &out, const Type<T,UnknownId> &t)
friend inline std::ostream &operator << (std::ostream &out, const Type<T, UnknownId> &t)
{
return out << t.getName();
};
friend inline std::wostream &operator << (std::wostream &out, const Type<T, UnknownId> &t)
{
std::wstring wideName{ t.getName().begin(), t.getName().end() };
return out << wideName;
};
/// Searches for the type associated with the given string and returns it.
///

View file

@ -499,7 +499,7 @@ namespace BWAPI
/// @returns a UnitType::set containing all the types that are in this factory's training
/// queue.
/// @see train, cancelTrain, isTraining
virtual UnitType::set getTrainingQueue() const = 0;
virtual UnitType::list getTrainingQueue() const = 0;
/// Retrieves the technology that this unit is currently researching.
///
@ -903,7 +903,9 @@ namespace BWAPI
/// @see UnitInterface::stop
virtual bool isIdle() const = 0;
/** Returns true if the unit can be interrupted. */
/// Checks if the unit can be interrupted.
///
/// @returns true if this unit can be interrupted, or false if this unit is uninterruptable
virtual bool isInterruptible() const = 0;
/// Checks the invincibility state for this unit.
@ -1011,14 +1013,19 @@ namespace BWAPI
/// false if it is not
bool isRepairing() const;
/** Returns true if the unit is a building that is researching tech. See TechTypes for the complete list
* of available techs in Broodwar.
* \see UnitInterface::research, UnitInterface::cancelResearch, UnitInterface::getTech, UnitInterface::getRemainingResearchTime. */
/// Checks if this unit is a structure that is currently researching a technology.
/// See TechTypes for a complete list of technologies in Broodwar.
///
/// @returns true if this structure is researching a technology, false otherwise
/// @see research, cancelResearch, getTech, getRemainingResearchTime,
/// @implies exists(), isCompleted(), getType().isBuilding()
bool isResearching() const;
/** Returns true if the unit has been selected by the user via the starcraft GUI. Only available if you
* enable Flag::UserInput during AIModule::onStart.
* \see Game::getSelectedUnits. */
/// Checks if this unit has been selected in the user interface. This function is only available if
/// the flag Flag::UserInput is enabled.
///
/// @returns true if this unit is currently selected, and false if this unit is not selected
/// @see Game::getSelectedUnits
virtual bool isSelected() const = 0;
/// Checks if this unit is currently @sieged. This is only applicable to @Siege_Tanks.
@ -1032,8 +1039,6 @@ namespace BWAPI
* \see UnitInterface::attack, UnitInterface::getGroundWeaponCooldown, UnitInterface::getAirWeaponCooldown. */
virtual bool isStartingAttack() const = 0;
/** Returns true if the unit has been stasised by a Protoss Arbiter.
* \see UnitInterface::getStasisTimer. */
/// Checks if this unit is inflicted with @Stasis by an @Arbiter.
///
/// @returns true if this unit is locked in a @Stasis and is unable to move, and false if it
@ -1045,8 +1050,10 @@ namespace BWAPI
/// @see getStasisTimer
bool isStasised() const;
/** Returns true if the unit is currently stimmed.
* \see UnitInterface::getStimTimer. */
/// Checks if this unit is currently under the influence of a @Stim_Pack.
///
/// @returns true if this unit has used a stim pack, false otherwise
/// @see getStimTimer
bool isStimmed() const;
/// Checks if this unit is currently trying to resolve a collision by randomly moving around.
@ -1088,9 +1095,12 @@ namespace BWAPI
/// unpowered.
virtual bool isPowered() const = 0;
/** Returns true if the unit is a building that is upgrading. See UpgradeTypes for the complete list
* of available upgrades in Broodwar.
* \see UnitInterface::upgrade, UnitInterface::cancelUpgrade, UnitInterface::getUpgrade, UnitInterface::getRemainingUpgradeTime. */
/// Checks if this unit is a structure that is currently upgrading an upgrade.
/// See UpgradeTypes for a full list of upgrades in Broodwar.
///
/// @returns true if this structure is upgrading, false otherwise
/// @see upgrade, cancelUpgrade, getUpgrade, getRemainingUpgradeTime
/// @implies exists(), isCompleted(), getType().isBuilding()
bool isUpgrading() const;
/** Returns true if the unit is visible. If the CompleteMapInformation? cheat flag is enabled, existing

View file

@ -73,58 +73,55 @@ namespace BWAPI
/// Retrieves the set of all UnitCommandTypes.
///
/// @returns Set of UnitCommandTypes.
const UnitCommandType::const_set& allUnitCommandTypes();
const UnitCommandType::set& allUnitCommandTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const UnitCommandType x
BWAPI_DECL(Attack_Move);
BWAPI_DECL(Attack_Unit);
BWAPI_DECL(Build);
BWAPI_DECL(Build_Addon);
BWAPI_DECL(Train);
BWAPI_DECL(Morph);
BWAPI_DECL(Research);
BWAPI_DECL(Upgrade);
BWAPI_DECL(Set_Rally_Position);
BWAPI_DECL(Set_Rally_Unit);
BWAPI_DECL(Move);
BWAPI_DECL(Patrol);
BWAPI_DECL(Hold_Position);
BWAPI_DECL(Stop);
BWAPI_DECL(Follow);
BWAPI_DECL(Gather);
BWAPI_DECL(Return_Cargo);
BWAPI_DECL(Repair);
BWAPI_DECL(Burrow);
BWAPI_DECL(Unburrow);
BWAPI_DECL(Cloak);
BWAPI_DECL(Decloak);
BWAPI_DECL(Siege);
BWAPI_DECL(Unsiege);
BWAPI_DECL(Lift);
BWAPI_DECL(Land);
BWAPI_DECL(Load);
BWAPI_DECL(Unload);
BWAPI_DECL(Unload_All);
BWAPI_DECL(Unload_All_Position);
BWAPI_DECL(Right_Click_Position);
BWAPI_DECL(Right_Click_Unit);
BWAPI_DECL(Halt_Construction);
BWAPI_DECL(Cancel_Construction);
BWAPI_DECL(Cancel_Addon);
BWAPI_DECL(Cancel_Train);
BWAPI_DECL(Cancel_Train_Slot);
BWAPI_DECL(Cancel_Morph);
BWAPI_DECL(Cancel_Research);
BWAPI_DECL(Cancel_Upgrade);
BWAPI_DECL(Use_Tech);
BWAPI_DECL(Use_Tech_Position);
BWAPI_DECL(Use_Tech_Unit);
BWAPI_DECL(Place_COP);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const UnitCommandType Attack_Move;
extern const UnitCommandType Attack_Unit;
extern const UnitCommandType Build;
extern const UnitCommandType Build_Addon;
extern const UnitCommandType Train;
extern const UnitCommandType Morph;
extern const UnitCommandType Research;
extern const UnitCommandType Upgrade;
extern const UnitCommandType Set_Rally_Position;
extern const UnitCommandType Set_Rally_Unit;
extern const UnitCommandType Move;
extern const UnitCommandType Patrol;
extern const UnitCommandType Hold_Position;
extern const UnitCommandType Stop;
extern const UnitCommandType Follow;
extern const UnitCommandType Gather;
extern const UnitCommandType Return_Cargo;
extern const UnitCommandType Repair;
extern const UnitCommandType Burrow;
extern const UnitCommandType Unburrow;
extern const UnitCommandType Cloak;
extern const UnitCommandType Decloak;
extern const UnitCommandType Siege;
extern const UnitCommandType Unsiege;
extern const UnitCommandType Lift;
extern const UnitCommandType Land;
extern const UnitCommandType Load;
extern const UnitCommandType Unload;
extern const UnitCommandType Unload_All;
extern const UnitCommandType Unload_All_Position;
extern const UnitCommandType Right_Click_Position;
extern const UnitCommandType Right_Click_Unit;
extern const UnitCommandType Halt_Construction;
extern const UnitCommandType Cancel_Construction;
extern const UnitCommandType Cancel_Addon;
extern const UnitCommandType Cancel_Train;
extern const UnitCommandType Cancel_Train_Slot;
extern const UnitCommandType Cancel_Morph;
extern const UnitCommandType Cancel_Research;
extern const UnitCommandType Cancel_Upgrade;
extern const UnitCommandType Use_Tech;
extern const UnitCommandType Use_Tech_Position;
extern const UnitCommandType Use_Tech_Unit;
extern const UnitCommandType Place_COP;
extern const UnitCommandType None;
extern const UnitCommandType Unknown;
}
static_assert(sizeof(UnitCommandType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,8 +1,6 @@
#pragma once
#include <BWAPI/Type.h>
#define BWAPI_UNITSIZETYPEDEF(x) static const UnitSizeType x(Enum::x) /** ref x */
namespace BWAPI
{
namespace UnitSizeTypes
@ -30,23 +28,22 @@ namespace BWAPI
UnitSizeType(int id = UnitSizeTypes::Enum::None);
};
/// Namespace containing unit size types
///
/// [View on Starcraft Campendium (Official Website)](http://classic.battle.net/scc/gs/damage.shtml)<br>
namespace UnitSizeTypes
{
/// Retrieves the set of all UnitSizeTypes.
///
/// @returns Set of all UnitSizeTypes.
const UnitSizeType::const_set& allUnitSizeTypes();
const UnitSizeType::set& allUnitSizeTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const UnitSizeType x
BWAPI_DECL(Independent);
BWAPI_DECL(Small);
BWAPI_DECL(Medium);
BWAPI_DECL(Large);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const UnitSizeType Independent;
extern const UnitSizeType Small;
extern const UnitSizeType Medium;
extern const UnitSizeType Large;
extern const UnitSizeType None;
extern const UnitSizeType Unknown;
}
static_assert(sizeof(UnitSizeType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -312,12 +312,12 @@ namespace BWAPI
/// the game.
///
/// @returns Set of TechTypes containing ability information.
const ConstVectorset<TechType>& abilities() const;
const SetContainer<TechType>& abilities() const;
/// Retrieves the set of upgrades that this unit can use to enhance its fighting ability.
///
/// @return Set of UpgradeTypes containing upgrade types that will impact this unit type.
const ConstVectorset<UpgradeType>& upgrades() const;
const SetContainer<UpgradeType>& upgrades() const;
/// Retrieves the upgrade type used to increase the armor of this unit type. For each upgrade,
/// this unit type gains +1 additional armor.
@ -553,10 +553,10 @@ namespace BWAPI
* which can move once lifted. */
bool canMove() const;
/// Checks if this unit type is a flying unit. Flying units ignore ground pathing and
/// collisions.
///
/// @returns true if this unit type is in the air by default, and false otherwise
/// <summary>Checks if this unit type is a flying unit. Flying units ignore ground pathing and
/// collisions.</summary>
///
/// <returns>true if this unit type is in the air by default, and false otherwise</returns>
bool isFlyer() const;
/// Checks if this unit type can regenerate hit points. This generally applies to @Zerg units.
@ -621,7 +621,7 @@ namespace BWAPI
/// if ( BWAPI::Broodwar->self() )
/// {
/// BWAPI::Unitset myUnits = BWAPI::Broodwar->self()->getUnits();
/// for ( auto u = myUnits.begin(); u != myUnits.end(); ++u )
/// for ( auto u : myUnits )
/// {
/// if ( u->isIdle() && u->getType().isResourceDepot() )
/// u->train( u->getType().getRace().getWorker() );
@ -639,7 +639,7 @@ namespace BWAPI
/// if ( BWAPI::Broodwar->self() )
/// {
/// BWAPI::Unitset myUnits = BWAPI::Broodwar->self()->getUnits();
/// for ( auto u = myUnits.begin(); u != myUnits.end(); ++u )
/// for ( auto u : myUnits )
/// {
/// if ( u->getType().isRefinery() )
/// {
@ -650,10 +650,10 @@ namespace BWAPI
/// if ( pClosestIdleWorker )
/// {
/// // gather from the refinery (and check if successful)
/// if ( pClosestIdleWorker->gather(*u) )
/// if ( pClosestIdleWorker->gather(u) )
/// {
/// // set a back reference for when the unit is killed or re-assigned (code not provided)
/// pClosestIdleWorker->setClientInfo(*u, 'ref');
/// pClosestIdleWorker->setClientInfo(u, 'ref');
///
/// // Increment the number of workers assigned and associate it with the refinery
/// ++nWorkersAssigned;
@ -734,13 +734,13 @@ namespace BWAPI
/// @code
/// BWAPI::Position myBasePosition( BWAPI::Broodwar->self()->getStartLocation() );
/// BWAPI::UnitSet unitsAroundTheBase = BWAPI::Broodwar->getUnitsInRadius(myBasePosition, 1024, !BWAPI::Filter::IsOwned && !BWAPI::Filter::IsParasited);
/// for ( auto u = unitsAroundTheBase.begin(); u != unitsAroundTheBase.end(); ++u )
/// for ( auto u : unitsAroundTheBase )
/// {
/// if ( u->getType().isCritter() && !u->isInvincible() )
/// {
/// BWAPI::Unit myQueen = u->getClosestUnit(BWAPI::Filter::GetType == BWAPI::UnitTypes::Zerg_Queen && BWAPI::Filter::IsOwned);
/// if ( myQueen )
/// myQueen->useTech(BWAPI::TechTypes::Parasite, *u);
/// myQueen->useTech(BWAPI::TechTypes::Parasite, u);
/// }
/// }
/// @endcode
@ -755,6 +755,15 @@ namespace BWAPI
bool canBuildAddon() const;
};
/// The amount of shield points that a unit recovers over 256 frames. That is, 7/256 shields are regenerated per frame.
static const int SHIELD_REGEN_RATE = 7;
/// The amount of energy that a unit with special abilities recovers over 256 frames. That is, 8/256 energy is generated per frame.
static const int ENERGY_REGEN_RATE = 8;
/// The amount of life that a zerg unit recovers over 256 frames. That is, 4/256 life is regenerated per frame.
static const int LIFE_REGEN_RATE = 4;
/// Namespace containing unit types
namespace UnitTypes
{
@ -771,255 +780,251 @@ namespace BWAPI
/// Retrieves the set of all unit types.
///
/// @returns A constant set of all available unit types.
const UnitType::const_set& allUnitTypes();
const UnitType::set& allUnitTypes();
/// Retrieves the set of all macro unit types. A macro type is a fake unit type, used by some
/// functions. These include #AllUnits, #Men, #Buildings, and #Factories. The purpose of these
/// types are to match the same ones used in Broodwar, also seen in the StarEdit map editor.
///
/// @returns A constant set of all macro unit types.
const UnitType::const_set& allMacroTypes();
const UnitType::set& allMacroTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x.<br> @tl ## x @scc ## x @sen ## x @wik ## x */ extern const UnitType x
BWAPI_DECL(Terran_Marine);
BWAPI_DECL(Terran_Ghost);
BWAPI_DECL(Terran_Vulture);
BWAPI_DECL(Terran_Goliath);
extern const UnitType Terran_Marine;
extern const UnitType Terran_Ghost;
extern const UnitType Terran_Vulture;
extern const UnitType Terran_Goliath;
// goliath turret 4
BWAPI_DECL(Terran_Siege_Tank_Tank_Mode);
extern const UnitType Terran_Siege_Tank_Tank_Mode;
// siege tank turret 6
BWAPI_DECL(Terran_SCV);
BWAPI_DECL(Terran_Wraith);
BWAPI_DECL(Terran_Science_Vessel);
BWAPI_DECL(Hero_Gui_Montag);
BWAPI_DECL(Terran_Dropship);
BWAPI_DECL(Terran_Battlecruiser);
BWAPI_DECL(Terran_Vulture_Spider_Mine);
BWAPI_DECL(Terran_Nuclear_Missile);
BWAPI_DECL(Terran_Civilian);
BWAPI_DECL(Hero_Sarah_Kerrigan);
BWAPI_DECL(Hero_Alan_Schezar);
extern const UnitType Terran_SCV;
extern const UnitType Terran_Wraith;
extern const UnitType Terran_Science_Vessel;
extern const UnitType Hero_Gui_Montag;
extern const UnitType Terran_Dropship;
extern const UnitType Terran_Battlecruiser;
extern const UnitType Terran_Vulture_Spider_Mine;
extern const UnitType Terran_Nuclear_Missile;
extern const UnitType Terran_Civilian;
extern const UnitType Hero_Sarah_Kerrigan;
extern const UnitType Hero_Alan_Schezar;
// alan turret 18
BWAPI_DECL(Hero_Jim_Raynor_Vulture);
BWAPI_DECL(Hero_Jim_Raynor_Marine);
BWAPI_DECL(Hero_Tom_Kazansky);
BWAPI_DECL(Hero_Magellan);
BWAPI_DECL(Hero_Edmund_Duke_Tank_Mode);
extern const UnitType Hero_Jim_Raynor_Vulture;
extern const UnitType Hero_Jim_Raynor_Marine;
extern const UnitType Hero_Tom_Kazansky;
extern const UnitType Hero_Magellan;
extern const UnitType Hero_Edmund_Duke_Tank_Mode;
// edmund duke turret 24
BWAPI_DECL(Hero_Edmund_Duke_Siege_Mode);
extern const UnitType Hero_Edmund_Duke_Siege_Mode;
// edmund duke turret siege mode 26
BWAPI_DECL(Hero_Arcturus_Mengsk);
BWAPI_DECL(Hero_Hyperion);
BWAPI_DECL(Hero_Norad_II);
BWAPI_DECL(Terran_Siege_Tank_Siege_Mode);
extern const UnitType Hero_Arcturus_Mengsk;
extern const UnitType Hero_Hyperion;
extern const UnitType Hero_Norad_II;
extern const UnitType Terran_Siege_Tank_Siege_Mode;
// siege tank siege mode turret 31
BWAPI_DECL(Terran_Firebat);
BWAPI_DECL(Spell_Scanner_Sweep);
BWAPI_DECL(Terran_Medic);
BWAPI_DECL(Zerg_Larva);
BWAPI_DECL(Zerg_Egg);
BWAPI_DECL(Zerg_Zergling);
BWAPI_DECL(Zerg_Hydralisk);
BWAPI_DECL(Zerg_Ultralisk);
BWAPI_DECL(Zerg_Broodling);
BWAPI_DECL(Zerg_Drone);
BWAPI_DECL(Zerg_Overlord);
BWAPI_DECL(Zerg_Mutalisk);
BWAPI_DECL(Zerg_Guardian);
BWAPI_DECL(Zerg_Queen);
BWAPI_DECL(Zerg_Defiler);
BWAPI_DECL(Zerg_Scourge);
BWAPI_DECL(Hero_Torrasque);
BWAPI_DECL(Hero_Matriarch);
BWAPI_DECL(Zerg_Infested_Terran);
BWAPI_DECL(Hero_Infested_Kerrigan);
BWAPI_DECL(Hero_Unclean_One);
BWAPI_DECL(Hero_Hunter_Killer);
BWAPI_DECL(Hero_Devouring_One);
BWAPI_DECL(Hero_Kukulza_Mutalisk);
BWAPI_DECL(Hero_Kukulza_Guardian);
BWAPI_DECL(Hero_Yggdrasill);
BWAPI_DECL(Terran_Valkyrie);
BWAPI_DECL(Zerg_Cocoon);
BWAPI_DECL(Protoss_Corsair);
BWAPI_DECL(Protoss_Dark_Templar);
BWAPI_DECL(Zerg_Devourer);
BWAPI_DECL(Protoss_Dark_Archon);
BWAPI_DECL(Protoss_Probe);
BWAPI_DECL(Protoss_Zealot);
BWAPI_DECL(Protoss_Dragoon);
BWAPI_DECL(Protoss_High_Templar);
BWAPI_DECL(Protoss_Archon);
BWAPI_DECL(Protoss_Shuttle);
BWAPI_DECL(Protoss_Scout);
BWAPI_DECL(Protoss_Arbiter);
BWAPI_DECL(Protoss_Carrier);
BWAPI_DECL(Protoss_Interceptor);
BWAPI_DECL(Hero_Dark_Templar);
BWAPI_DECL(Hero_Zeratul);
BWAPI_DECL(Hero_Tassadar_Zeratul_Archon);
BWAPI_DECL(Hero_Fenix_Zealot);
BWAPI_DECL(Hero_Fenix_Dragoon);
BWAPI_DECL(Hero_Tassadar);
BWAPI_DECL(Hero_Mojo);
BWAPI_DECL(Hero_Warbringer);
BWAPI_DECL(Hero_Gantrithor);
BWAPI_DECL(Protoss_Reaver);
BWAPI_DECL(Protoss_Observer);
BWAPI_DECL(Protoss_Scarab);
BWAPI_DECL(Hero_Danimoth);
BWAPI_DECL(Hero_Aldaris);
BWAPI_DECL(Hero_Artanis);
BWAPI_DECL(Critter_Rhynadon);
BWAPI_DECL(Critter_Bengalaas);
BWAPI_DECL(Special_Cargo_Ship);
BWAPI_DECL(Special_Mercenary_Gunship);
BWAPI_DECL(Critter_Scantid);
BWAPI_DECL(Critter_Kakaru);
BWAPI_DECL(Critter_Ragnasaur);
BWAPI_DECL(Critter_Ursadon);
BWAPI_DECL(Zerg_Lurker_Egg);
BWAPI_DECL(Hero_Raszagal);
BWAPI_DECL(Hero_Samir_Duran);
BWAPI_DECL(Hero_Alexei_Stukov);
BWAPI_DECL(Special_Map_Revealer);
BWAPI_DECL(Hero_Gerard_DuGalle);
BWAPI_DECL(Zerg_Lurker);
BWAPI_DECL(Hero_Infested_Duran);
BWAPI_DECL(Spell_Disruption_Web);
BWAPI_DECL(Terran_Command_Center);
BWAPI_DECL(Terran_Comsat_Station);
BWAPI_DECL(Terran_Nuclear_Silo);
BWAPI_DECL(Terran_Supply_Depot);
BWAPI_DECL(Terran_Refinery);
BWAPI_DECL(Terran_Barracks);
BWAPI_DECL(Terran_Academy);
BWAPI_DECL(Terran_Factory);
BWAPI_DECL(Terran_Starport);
BWAPI_DECL(Terran_Control_Tower);
BWAPI_DECL(Terran_Science_Facility);
BWAPI_DECL(Terran_Covert_Ops);
BWAPI_DECL(Terran_Physics_Lab);
extern const UnitType Terran_Firebat;
extern const UnitType Spell_Scanner_Sweep;
extern const UnitType Terran_Medic;
extern const UnitType Zerg_Larva;
extern const UnitType Zerg_Egg;
extern const UnitType Zerg_Zergling;
extern const UnitType Zerg_Hydralisk;
extern const UnitType Zerg_Ultralisk;
extern const UnitType Zerg_Broodling;
extern const UnitType Zerg_Drone;
extern const UnitType Zerg_Overlord;
extern const UnitType Zerg_Mutalisk;
extern const UnitType Zerg_Guardian;
extern const UnitType Zerg_Queen;
extern const UnitType Zerg_Defiler;
extern const UnitType Zerg_Scourge;
extern const UnitType Hero_Torrasque;
extern const UnitType Hero_Matriarch;
extern const UnitType Zerg_Infested_Terran;
extern const UnitType Hero_Infested_Kerrigan;
extern const UnitType Hero_Unclean_One;
extern const UnitType Hero_Hunter_Killer;
extern const UnitType Hero_Devouring_One;
extern const UnitType Hero_Kukulza_Mutalisk;
extern const UnitType Hero_Kukulza_Guardian;
extern const UnitType Hero_Yggdrasill;
extern const UnitType Terran_Valkyrie;
extern const UnitType Zerg_Cocoon;
extern const UnitType Protoss_Corsair;
extern const UnitType Protoss_Dark_Templar;
extern const UnitType Zerg_Devourer;
extern const UnitType Protoss_Dark_Archon;
extern const UnitType Protoss_Probe;
extern const UnitType Protoss_Zealot;
extern const UnitType Protoss_Dragoon;
extern const UnitType Protoss_High_Templar;
extern const UnitType Protoss_Archon;
extern const UnitType Protoss_Shuttle;
extern const UnitType Protoss_Scout;
extern const UnitType Protoss_Arbiter;
extern const UnitType Protoss_Carrier;
extern const UnitType Protoss_Interceptor;
extern const UnitType Hero_Dark_Templar;
extern const UnitType Hero_Zeratul;
extern const UnitType Hero_Tassadar_Zeratul_Archon;
extern const UnitType Hero_Fenix_Zealot;
extern const UnitType Hero_Fenix_Dragoon;
extern const UnitType Hero_Tassadar;
extern const UnitType Hero_Mojo;
extern const UnitType Hero_Warbringer;
extern const UnitType Hero_Gantrithor;
extern const UnitType Protoss_Reaver;
extern const UnitType Protoss_Observer;
extern const UnitType Protoss_Scarab;
extern const UnitType Hero_Danimoth;
extern const UnitType Hero_Aldaris;
extern const UnitType Hero_Artanis;
extern const UnitType Critter_Rhynadon;
extern const UnitType Critter_Bengalaas;
extern const UnitType Special_Cargo_Ship;
extern const UnitType Special_Mercenary_Gunship;
extern const UnitType Critter_Scantid;
extern const UnitType Critter_Kakaru;
extern const UnitType Critter_Ragnasaur;
extern const UnitType Critter_Ursadon;
extern const UnitType Zerg_Lurker_Egg;
extern const UnitType Hero_Raszagal;
extern const UnitType Hero_Samir_Duran;
extern const UnitType Hero_Alexei_Stukov;
extern const UnitType Special_Map_Revealer;
extern const UnitType Hero_Gerard_DuGalle;
extern const UnitType Zerg_Lurker;
extern const UnitType Hero_Infested_Duran;
extern const UnitType Spell_Disruption_Web;
extern const UnitType Terran_Command_Center;
extern const UnitType Terran_Comsat_Station;
extern const UnitType Terran_Nuclear_Silo;
extern const UnitType Terran_Supply_Depot;
extern const UnitType Terran_Refinery;
extern const UnitType Terran_Barracks;
extern const UnitType Terran_Academy;
extern const UnitType Terran_Factory;
extern const UnitType Terran_Starport;
extern const UnitType Terran_Control_Tower;
extern const UnitType Terran_Science_Facility;
extern const UnitType Terran_Covert_Ops;
extern const UnitType Terran_Physics_Lab;
// starbase 119
BWAPI_DECL(Terran_Machine_Shop);
extern const UnitType Terran_Machine_Shop;
// repair bay 121
BWAPI_DECL(Terran_Engineering_Bay);
BWAPI_DECL(Terran_Armory);
BWAPI_DECL(Terran_Missile_Turret);
BWAPI_DECL(Terran_Bunker);
BWAPI_DECL(Special_Crashed_Norad_II);
BWAPI_DECL(Special_Ion_Cannon);
BWAPI_DECL(Powerup_Uraj_Crystal);
BWAPI_DECL(Powerup_Khalis_Crystal);
BWAPI_DECL(Zerg_Infested_Command_Center);
BWAPI_DECL(Zerg_Hatchery);
BWAPI_DECL(Zerg_Lair);
BWAPI_DECL(Zerg_Hive);
BWAPI_DECL(Zerg_Nydus_Canal);
BWAPI_DECL(Zerg_Hydralisk_Den);
BWAPI_DECL(Zerg_Defiler_Mound);
BWAPI_DECL(Zerg_Greater_Spire);
BWAPI_DECL(Zerg_Queens_Nest);
BWAPI_DECL(Zerg_Evolution_Chamber);
BWAPI_DECL(Zerg_Ultralisk_Cavern);
BWAPI_DECL(Zerg_Spire);
BWAPI_DECL(Zerg_Spawning_Pool);
BWAPI_DECL(Zerg_Creep_Colony);
BWAPI_DECL(Zerg_Spore_Colony);
extern const UnitType Terran_Engineering_Bay;
extern const UnitType Terran_Armory;
extern const UnitType Terran_Missile_Turret;
extern const UnitType Terran_Bunker;
extern const UnitType Special_Crashed_Norad_II;
extern const UnitType Special_Ion_Cannon;
extern const UnitType Powerup_Uraj_Crystal;
extern const UnitType Powerup_Khalis_Crystal;
extern const UnitType Zerg_Infested_Command_Center;
extern const UnitType Zerg_Hatchery;
extern const UnitType Zerg_Lair;
extern const UnitType Zerg_Hive;
extern const UnitType Zerg_Nydus_Canal;
extern const UnitType Zerg_Hydralisk_Den;
extern const UnitType Zerg_Defiler_Mound;
extern const UnitType Zerg_Greater_Spire;
extern const UnitType Zerg_Queens_Nest;
extern const UnitType Zerg_Evolution_Chamber;
extern const UnitType Zerg_Ultralisk_Cavern;
extern const UnitType Zerg_Spire;
extern const UnitType Zerg_Spawning_Pool;
extern const UnitType Zerg_Creep_Colony;
extern const UnitType Zerg_Spore_Colony;
// unused zerg 1 145
BWAPI_DECL(Zerg_Sunken_Colony);
BWAPI_DECL(Special_Overmind_With_Shell);
BWAPI_DECL(Special_Overmind);
BWAPI_DECL(Zerg_Extractor);
BWAPI_DECL(Special_Mature_Chrysalis);
BWAPI_DECL(Special_Cerebrate);
BWAPI_DECL(Special_Cerebrate_Daggoth);
extern const UnitType Zerg_Sunken_Colony;
extern const UnitType Special_Overmind_With_Shell;
extern const UnitType Special_Overmind;
extern const UnitType Zerg_Extractor;
extern const UnitType Special_Mature_Chrysalis;
extern const UnitType Special_Cerebrate;
extern const UnitType Special_Cerebrate_Daggoth;
// unused zerg 2 153
BWAPI_DECL(Protoss_Nexus);
BWAPI_DECL(Protoss_Robotics_Facility);
BWAPI_DECL(Protoss_Pylon);
BWAPI_DECL(Protoss_Assimilator);
extern const UnitType Protoss_Nexus;
extern const UnitType Protoss_Robotics_Facility;
extern const UnitType Protoss_Pylon;
extern const UnitType Protoss_Assimilator;
// unused protoss 1 158
BWAPI_DECL(Protoss_Observatory);
BWAPI_DECL(Protoss_Gateway);
extern const UnitType Protoss_Observatory;
extern const UnitType Protoss_Gateway;
// unused protoss 2 161
BWAPI_DECL(Protoss_Photon_Cannon);
BWAPI_DECL(Protoss_Citadel_of_Adun);
BWAPI_DECL(Protoss_Cybernetics_Core);
BWAPI_DECL(Protoss_Templar_Archives);
BWAPI_DECL(Protoss_Forge);
BWAPI_DECL(Protoss_Stargate);
BWAPI_DECL(Special_Stasis_Cell_Prison);
BWAPI_DECL(Protoss_Fleet_Beacon);
BWAPI_DECL(Protoss_Arbiter_Tribunal);
BWAPI_DECL(Protoss_Robotics_Support_Bay);
BWAPI_DECL(Protoss_Shield_Battery);
BWAPI_DECL(Special_Khaydarin_Crystal_Form);
BWAPI_DECL(Special_Protoss_Temple);
BWAPI_DECL(Special_XelNaga_Temple);
BWAPI_DECL(Resource_Mineral_Field);
BWAPI_DECL(Resource_Mineral_Field_Type_2);
BWAPI_DECL(Resource_Mineral_Field_Type_3);
extern const UnitType Protoss_Photon_Cannon;
extern const UnitType Protoss_Citadel_of_Adun;
extern const UnitType Protoss_Cybernetics_Core;
extern const UnitType Protoss_Templar_Archives;
extern const UnitType Protoss_Forge;
extern const UnitType Protoss_Stargate;
extern const UnitType Special_Stasis_Cell_Prison;
extern const UnitType Protoss_Fleet_Beacon;
extern const UnitType Protoss_Arbiter_Tribunal;
extern const UnitType Protoss_Robotics_Support_Bay;
extern const UnitType Protoss_Shield_Battery;
extern const UnitType Special_Khaydarin_Crystal_Form;
extern const UnitType Special_Protoss_Temple;
extern const UnitType Special_XelNaga_Temple;
extern const UnitType Resource_Mineral_Field;
extern const UnitType Resource_Mineral_Field_Type_2;
extern const UnitType Resource_Mineral_Field_Type_3;
// cave 179
// cave-in 180
// cantina 181
// mining platform 182
// independant command center 183
BWAPI_DECL(Special_Independant_Starport);
extern const UnitType Special_Independant_Starport;
// independant jump gate 185
// ruins 186
// unused khaydarin crystal formation 187
BWAPI_DECL(Resource_Vespene_Geyser);
BWAPI_DECL(Special_Warp_Gate);
BWAPI_DECL(Special_Psi_Disrupter);
extern const UnitType Resource_Vespene_Geyser;
extern const UnitType Special_Warp_Gate;
extern const UnitType Special_Psi_Disrupter;
// zerg marker 191
// terran marker 192
// protoss marker 193
BWAPI_DECL(Special_Zerg_Beacon);
BWAPI_DECL(Special_Terran_Beacon);
BWAPI_DECL(Special_Protoss_Beacon);
BWAPI_DECL(Special_Zerg_Flag_Beacon);
BWAPI_DECL(Special_Terran_Flag_Beacon);
BWAPI_DECL(Special_Protoss_Flag_Beacon);
BWAPI_DECL(Special_Power_Generator);
BWAPI_DECL(Special_Overmind_Cocoon);
BWAPI_DECL(Spell_Dark_Swarm);
BWAPI_DECL(Special_Floor_Missile_Trap);
BWAPI_DECL(Special_Floor_Hatch);
BWAPI_DECL(Special_Upper_Level_Door);
BWAPI_DECL(Special_Right_Upper_Level_Door);
BWAPI_DECL(Special_Pit_Door);
BWAPI_DECL(Special_Right_Pit_Door);
BWAPI_DECL(Special_Floor_Gun_Trap);
BWAPI_DECL(Special_Wall_Missile_Trap);
BWAPI_DECL(Special_Wall_Flame_Trap);
BWAPI_DECL(Special_Right_Wall_Missile_Trap);
BWAPI_DECL(Special_Right_Wall_Flame_Trap);
BWAPI_DECL(Special_Start_Location);
BWAPI_DECL(Powerup_Flag);
BWAPI_DECL(Powerup_Young_Chrysalis);
BWAPI_DECL(Powerup_Psi_Emitter);
BWAPI_DECL(Powerup_Data_Disk);
BWAPI_DECL(Powerup_Khaydarin_Crystal);
BWAPI_DECL(Powerup_Mineral_Cluster_Type_1);
BWAPI_DECL(Powerup_Mineral_Cluster_Type_2);
BWAPI_DECL(Powerup_Protoss_Gas_Orb_Type_1);
BWAPI_DECL(Powerup_Protoss_Gas_Orb_Type_2);
BWAPI_DECL(Powerup_Zerg_Gas_Sac_Type_1);
BWAPI_DECL(Powerup_Zerg_Gas_Sac_Type_2);
BWAPI_DECL(Powerup_Terran_Gas_Tank_Type_1);
BWAPI_DECL(Powerup_Terran_Gas_Tank_Type_2);
extern const UnitType Special_Zerg_Beacon;
extern const UnitType Special_Terran_Beacon;
extern const UnitType Special_Protoss_Beacon;
extern const UnitType Special_Zerg_Flag_Beacon;
extern const UnitType Special_Terran_Flag_Beacon;
extern const UnitType Special_Protoss_Flag_Beacon;
extern const UnitType Special_Power_Generator;
extern const UnitType Special_Overmind_Cocoon;
extern const UnitType Spell_Dark_Swarm;
extern const UnitType Special_Floor_Missile_Trap;
extern const UnitType Special_Floor_Hatch;
extern const UnitType Special_Upper_Level_Door;
extern const UnitType Special_Right_Upper_Level_Door;
extern const UnitType Special_Pit_Door;
extern const UnitType Special_Right_Pit_Door;
extern const UnitType Special_Floor_Gun_Trap;
extern const UnitType Special_Wall_Missile_Trap;
extern const UnitType Special_Wall_Flame_Trap;
extern const UnitType Special_Right_Wall_Missile_Trap;
extern const UnitType Special_Right_Wall_Flame_Trap;
extern const UnitType Special_Start_Location;
extern const UnitType Powerup_Flag;
extern const UnitType Powerup_Young_Chrysalis;
extern const UnitType Powerup_Psi_Emitter;
extern const UnitType Powerup_Data_Disk;
extern const UnitType Powerup_Khaydarin_Crystal;
extern const UnitType Powerup_Mineral_Cluster_Type_1;
extern const UnitType Powerup_Mineral_Cluster_Type_2;
extern const UnitType Powerup_Protoss_Gas_Orb_Type_1;
extern const UnitType Powerup_Protoss_Gas_Orb_Type_2;
extern const UnitType Powerup_Zerg_Gas_Sac_Type_1;
extern const UnitType Powerup_Zerg_Gas_Sac_Type_2;
extern const UnitType Powerup_Terran_Gas_Tank_Type_1;
extern const UnitType Powerup_Terran_Gas_Tank_Type_2;
BWAPI_DECL(None);
BWAPI_DECL(AllUnits);
BWAPI_DECL(Men);
BWAPI_DECL(Buildings);
BWAPI_DECL(Factories);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const UnitType None;
extern const UnitType AllUnits;
extern const UnitType Men;
extern const UnitType Buildings;
extern const UnitType Factories;
extern const UnitType Unknown;
}
static_assert(sizeof(UnitType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <BWAPI/Vectorset.h>
#include "SetContainer.h"
#include <BWAPI/Position.h>
#include <BWAPI/PositionUnit.h>
#include <BWAPI/Filters.h>
@ -19,28 +19,13 @@ namespace BWAPI
/// containers.
///
/// @see Unit, UnitType, UnitSizeType
class Unitset : public Vectorset<BWAPI::Unit >
class Unitset : public SetContainer<BWAPI::Unit, std::hash<void*>>
{
public:
/// A blank Unitset containing no elements. This is typically used as a return value for BWAPI
/// interface functions that have encountered an error.
static const Unitset none;
/// The Unitset constructor.
///
/// @param initialSize The initial maximum size of the Unitset before expanding it is
/// necessary.
Unitset(size_t initialSize = 16);
/// The copy constructor.
///
/// @param other The Unitset to construct this one from.
Unitset(const Unitset &other);
/// The move constructor.
///
/// @param other The Unitset to move its contents from.
Unitset(Unitset &&other);
/// Calculates the average of all valid Unit positions in this set.
///
@ -73,8 +58,12 @@ namespace BWAPI
/// Sets the client info for every unit in this set.
///
/// @param clientInfo A pointer to client information, managed by the AI module, or nullptr if
/// client information is to be cleared.
/// @param clientInfo [optional]
/// A pointer to client information, managed by the AI module, or nullptr if client
/// information is to be cleared.
/// @param index [optional]
/// An key value for the client info mapping so that more than one piece of data can be
/// mapped to the same unit.
///
/// @see UnitInterface::setClientInfo
void setClientInfo(void *clientInfo = nullptr, int index = 0) const;

View file

@ -114,70 +114,68 @@ namespace BWAPI
UnitType whatsRequired(int level = 1) const;
/** Returns the set of units that are affected by this upgrade. */
const UnitType::const_set& whatUses() const;
const UnitType::set& whatUses() const;
};
/// Namespace of upgrade types
namespace UpgradeTypes
{
/** Returns the set of all the UpgradeTypes. */
const UpgradeType::const_set& allUpgradeTypes();
const UpgradeType::set& allUpgradeTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const UpgradeType x
BWAPI_DECL(Terran_Infantry_Armor);
BWAPI_DECL(Terran_Vehicle_Plating);
BWAPI_DECL(Terran_Ship_Plating);
BWAPI_DECL(Zerg_Carapace);
BWAPI_DECL(Zerg_Flyer_Carapace);
BWAPI_DECL(Protoss_Ground_Armor);
BWAPI_DECL(Protoss_Air_Armor);
BWAPI_DECL(Terran_Infantry_Weapons);
BWAPI_DECL(Terran_Vehicle_Weapons);
BWAPI_DECL(Terran_Ship_Weapons);
BWAPI_DECL(Zerg_Melee_Attacks);
BWAPI_DECL(Zerg_Missile_Attacks);
BWAPI_DECL(Zerg_Flyer_Attacks);
BWAPI_DECL(Protoss_Ground_Weapons);
BWAPI_DECL(Protoss_Air_Weapons);
BWAPI_DECL(Protoss_Plasma_Shields);
BWAPI_DECL(U_238_Shells);
BWAPI_DECL(Ion_Thrusters);
BWAPI_DECL(Titan_Reactor);
BWAPI_DECL(Ocular_Implants);
BWAPI_DECL(Moebius_Reactor);
BWAPI_DECL(Apollo_Reactor);
BWAPI_DECL(Colossus_Reactor);
BWAPI_DECL(Ventral_Sacs);
BWAPI_DECL(Antennae);
BWAPI_DECL(Pneumatized_Carapace);
BWAPI_DECL(Metabolic_Boost);
BWAPI_DECL(Adrenal_Glands);
BWAPI_DECL(Muscular_Augments);
BWAPI_DECL(Grooved_Spines);
BWAPI_DECL(Gamete_Meiosis);
BWAPI_DECL(Metasynaptic_Node);
BWAPI_DECL(Singularity_Charge);
BWAPI_DECL(Leg_Enhancements);
BWAPI_DECL(Scarab_Damage);
BWAPI_DECL(Reaver_Capacity);
BWAPI_DECL(Gravitic_Drive);
BWAPI_DECL(Sensor_Array);
BWAPI_DECL(Gravitic_Boosters);
BWAPI_DECL(Khaydarin_Amulet);
BWAPI_DECL(Apial_Sensors);
BWAPI_DECL(Gravitic_Thrusters);
BWAPI_DECL(Carrier_Capacity);
BWAPI_DECL(Khaydarin_Core);
BWAPI_DECL(Argus_Jewel);
BWAPI_DECL(Argus_Talisman);
BWAPI_DECL(Caduceus_Reactor);
BWAPI_DECL(Chitinous_Plating);
BWAPI_DECL(Anabolic_Synthesis);
BWAPI_DECL(Charon_Boosters);
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const UpgradeType Terran_Infantry_Armor;
extern const UpgradeType Terran_Vehicle_Plating;
extern const UpgradeType Terran_Ship_Plating;
extern const UpgradeType Zerg_Carapace;
extern const UpgradeType Zerg_Flyer_Carapace;
extern const UpgradeType Protoss_Ground_Armor;
extern const UpgradeType Protoss_Air_Armor;
extern const UpgradeType Terran_Infantry_Weapons;
extern const UpgradeType Terran_Vehicle_Weapons;
extern const UpgradeType Terran_Ship_Weapons;
extern const UpgradeType Zerg_Melee_Attacks;
extern const UpgradeType Zerg_Missile_Attacks;
extern const UpgradeType Zerg_Flyer_Attacks;
extern const UpgradeType Protoss_Ground_Weapons;
extern const UpgradeType Protoss_Air_Weapons;
extern const UpgradeType Protoss_Plasma_Shields;
extern const UpgradeType U_238_Shells;
extern const UpgradeType Ion_Thrusters;
extern const UpgradeType Titan_Reactor;
extern const UpgradeType Ocular_Implants;
extern const UpgradeType Moebius_Reactor;
extern const UpgradeType Apollo_Reactor;
extern const UpgradeType Colossus_Reactor;
extern const UpgradeType Ventral_Sacs;
extern const UpgradeType Antennae;
extern const UpgradeType Pneumatized_Carapace;
extern const UpgradeType Metabolic_Boost;
extern const UpgradeType Adrenal_Glands;
extern const UpgradeType Muscular_Augments;
extern const UpgradeType Grooved_Spines;
extern const UpgradeType Gamete_Meiosis;
extern const UpgradeType Metasynaptic_Node;
extern const UpgradeType Singularity_Charge;
extern const UpgradeType Leg_Enhancements;
extern const UpgradeType Scarab_Damage;
extern const UpgradeType Reaver_Capacity;
extern const UpgradeType Gravitic_Drive;
extern const UpgradeType Sensor_Array;
extern const UpgradeType Gravitic_Boosters;
extern const UpgradeType Khaydarin_Amulet;
extern const UpgradeType Apial_Sensors;
extern const UpgradeType Gravitic_Thrusters;
extern const UpgradeType Carrier_Capacity;
extern const UpgradeType Khaydarin_Core;
extern const UpgradeType Argus_Jewel;
extern const UpgradeType Argus_Talisman;
extern const UpgradeType Caduceus_Reactor;
extern const UpgradeType Chitinous_Plating;
extern const UpgradeType Anabolic_Synthesis;
extern const UpgradeType Charon_Boosters;
extern const UpgradeType Upgrade_60;
extern const UpgradeType None;
extern const UpgradeType Unknown;
}
static_assert(sizeof(UpgradeType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -212,122 +212,119 @@ namespace BWAPI
/// not used for abilities.
///
/// @returns constant set consisting of all normal weapon types.
const WeaponType::const_set& normalWeaponTypes();
const WeaponType::set& normalWeaponTypes();
/// Retrieves the set of all special weapon types. This set contains all weapons that are
/// used exclusively for special unit abilities.
///
/// @returns constant set consisting of all special weapon types.
const WeaponType::const_set& specialWeaponTypes();
const WeaponType::set& specialWeaponTypes();
#ifdef BWAPI_DECL
#undef BWAPI_DECL
#endif
#define BWAPI_DECL(x) /** x */ extern const WeaponType x
BWAPI_DECL(Gauss_Rifle);
BWAPI_DECL(Gauss_Rifle_Jim_Raynor);
BWAPI_DECL(C_10_Canister_Rifle);
BWAPI_DECL(C_10_Canister_Rifle_Sarah_Kerrigan);
BWAPI_DECL(C_10_Canister_Rifle_Samir_Duran);
BWAPI_DECL(C_10_Canister_Rifle_Infested_Duran);
BWAPI_DECL(C_10_Canister_Rifle_Alexei_Stukov);
BWAPI_DECL(Fragmentation_Grenade);
BWAPI_DECL(Fragmentation_Grenade_Jim_Raynor);
BWAPI_DECL(Spider_Mines);
BWAPI_DECL(Twin_Autocannons);
BWAPI_DECL(Twin_Autocannons_Alan_Schezar);
BWAPI_DECL(Hellfire_Missile_Pack);
BWAPI_DECL(Hellfire_Missile_Pack_Alan_Schezar);
BWAPI_DECL(Arclite_Cannon);
BWAPI_DECL(Arclite_Cannon_Edmund_Duke);
BWAPI_DECL(Fusion_Cutter);
BWAPI_DECL(Gemini_Missiles);
BWAPI_DECL(Gemini_Missiles_Tom_Kazansky);
BWAPI_DECL(Burst_Lasers);
BWAPI_DECL(Burst_Lasers_Tom_Kazansky);
BWAPI_DECL(ATS_Laser_Battery);
BWAPI_DECL(ATS_Laser_Battery_Hero);
BWAPI_DECL(ATS_Laser_Battery_Hyperion);
BWAPI_DECL(ATA_Laser_Battery);
BWAPI_DECL(ATA_Laser_Battery_Hero);
BWAPI_DECL(ATA_Laser_Battery_Hyperion);
BWAPI_DECL(Flame_Thrower);
BWAPI_DECL(Flame_Thrower_Gui_Montag);
BWAPI_DECL(Arclite_Shock_Cannon);
BWAPI_DECL(Arclite_Shock_Cannon_Edmund_Duke);
BWAPI_DECL(Longbolt_Missile);
BWAPI_DECL(Claws);
BWAPI_DECL(Claws_Devouring_One);
BWAPI_DECL(Claws_Infested_Kerrigan);
BWAPI_DECL(Needle_Spines);
BWAPI_DECL(Needle_Spines_Hunter_Killer);
BWAPI_DECL(Kaiser_Blades);
BWAPI_DECL(Kaiser_Blades_Torrasque);
BWAPI_DECL(Toxic_Spores);
BWAPI_DECL(Spines);
BWAPI_DECL(Acid_Spore);
BWAPI_DECL(Acid_Spore_Kukulza);
BWAPI_DECL(Glave_Wurm);
BWAPI_DECL(Glave_Wurm_Kukulza);
BWAPI_DECL(Seeker_Spores);
BWAPI_DECL(Subterranean_Tentacle);
BWAPI_DECL(Suicide_Infested_Terran);
BWAPI_DECL(Suicide_Scourge);
BWAPI_DECL(Particle_Beam);
BWAPI_DECL(Psi_Blades);
BWAPI_DECL(Psi_Blades_Fenix);
BWAPI_DECL(Phase_Disruptor);
BWAPI_DECL(Phase_Disruptor_Fenix);
BWAPI_DECL(Psi_Assault);
BWAPI_DECL(Psionic_Shockwave);
BWAPI_DECL(Psionic_Shockwave_TZ_Archon);
BWAPI_DECL(Dual_Photon_Blasters);
BWAPI_DECL(Dual_Photon_Blasters_Mojo);
BWAPI_DECL(Dual_Photon_Blasters_Artanis);
BWAPI_DECL(Anti_Matter_Missiles);
BWAPI_DECL(Anti_Matter_Missiles_Mojo);
BWAPI_DECL(Anti_Matter_Missiles_Artanis);
BWAPI_DECL(Phase_Disruptor_Cannon);
BWAPI_DECL(Phase_Disruptor_Cannon_Danimoth);
BWAPI_DECL(Pulse_Cannon);
BWAPI_DECL(STS_Photon_Cannon);
BWAPI_DECL(STA_Photon_Cannon);
BWAPI_DECL(Scarab);
BWAPI_DECL(Neutron_Flare);
BWAPI_DECL(Halo_Rockets);
BWAPI_DECL(Corrosive_Acid);
BWAPI_DECL(Subterranean_Spines);
BWAPI_DECL(Warp_Blades);
BWAPI_DECL(Warp_Blades_Hero);
BWAPI_DECL(Warp_Blades_Zeratul);
BWAPI_DECL(Independant_Laser_Battery);
BWAPI_DECL(Twin_Autocannons_Floor_Trap);
BWAPI_DECL(Hellfire_Missile_Pack_Wall_Trap);
BWAPI_DECL(Flame_Thrower_Wall_Trap);
BWAPI_DECL(Hellfire_Missile_Pack_Floor_Trap);
extern const WeaponType Gauss_Rifle;
extern const WeaponType Gauss_Rifle_Jim_Raynor;
extern const WeaponType C_10_Canister_Rifle;
extern const WeaponType C_10_Canister_Rifle_Sarah_Kerrigan;
extern const WeaponType C_10_Canister_Rifle_Samir_Duran;
extern const WeaponType C_10_Canister_Rifle_Infested_Duran;
extern const WeaponType C_10_Canister_Rifle_Alexei_Stukov;
extern const WeaponType Fragmentation_Grenade;
extern const WeaponType Fragmentation_Grenade_Jim_Raynor;
extern const WeaponType Spider_Mines;
extern const WeaponType Twin_Autocannons;
extern const WeaponType Twin_Autocannons_Alan_Schezar;
extern const WeaponType Hellfire_Missile_Pack;
extern const WeaponType Hellfire_Missile_Pack_Alan_Schezar;
extern const WeaponType Arclite_Cannon;
extern const WeaponType Arclite_Cannon_Edmund_Duke;
extern const WeaponType Fusion_Cutter;
extern const WeaponType Gemini_Missiles;
extern const WeaponType Gemini_Missiles_Tom_Kazansky;
extern const WeaponType Burst_Lasers;
extern const WeaponType Burst_Lasers_Tom_Kazansky;
extern const WeaponType ATS_Laser_Battery;
extern const WeaponType ATS_Laser_Battery_Hero;
extern const WeaponType ATS_Laser_Battery_Hyperion;
extern const WeaponType ATA_Laser_Battery;
extern const WeaponType ATA_Laser_Battery_Hero;
extern const WeaponType ATA_Laser_Battery_Hyperion;
extern const WeaponType Flame_Thrower;
extern const WeaponType Flame_Thrower_Gui_Montag;
extern const WeaponType Arclite_Shock_Cannon;
extern const WeaponType Arclite_Shock_Cannon_Edmund_Duke;
extern const WeaponType Longbolt_Missile;
extern const WeaponType Claws;
extern const WeaponType Claws_Devouring_One;
extern const WeaponType Claws_Infested_Kerrigan;
extern const WeaponType Needle_Spines;
extern const WeaponType Needle_Spines_Hunter_Killer;
extern const WeaponType Kaiser_Blades;
extern const WeaponType Kaiser_Blades_Torrasque;
extern const WeaponType Toxic_Spores;
extern const WeaponType Spines;
extern const WeaponType Acid_Spore;
extern const WeaponType Acid_Spore_Kukulza;
extern const WeaponType Glave_Wurm;
extern const WeaponType Glave_Wurm_Kukulza;
extern const WeaponType Seeker_Spores;
extern const WeaponType Subterranean_Tentacle;
extern const WeaponType Suicide_Infested_Terran;
extern const WeaponType Suicide_Scourge;
extern const WeaponType Particle_Beam;
extern const WeaponType Psi_Blades;
extern const WeaponType Psi_Blades_Fenix;
extern const WeaponType Phase_Disruptor;
extern const WeaponType Phase_Disruptor_Fenix;
extern const WeaponType Psi_Assault;
extern const WeaponType Psionic_Shockwave;
extern const WeaponType Psionic_Shockwave_TZ_Archon;
extern const WeaponType Dual_Photon_Blasters;
extern const WeaponType Dual_Photon_Blasters_Mojo;
extern const WeaponType Dual_Photon_Blasters_Artanis;
extern const WeaponType Anti_Matter_Missiles;
extern const WeaponType Anti_Matter_Missiles_Mojo;
extern const WeaponType Anti_Matter_Missiles_Artanis;
extern const WeaponType Phase_Disruptor_Cannon;
extern const WeaponType Phase_Disruptor_Cannon_Danimoth;
extern const WeaponType Pulse_Cannon;
extern const WeaponType STS_Photon_Cannon;
extern const WeaponType STA_Photon_Cannon;
extern const WeaponType Scarab;
extern const WeaponType Neutron_Flare;
extern const WeaponType Halo_Rockets;
extern const WeaponType Corrosive_Acid;
extern const WeaponType Subterranean_Spines;
extern const WeaponType Warp_Blades;
extern const WeaponType Warp_Blades_Hero;
extern const WeaponType Warp_Blades_Zeratul;
extern const WeaponType Independant_Laser_Battery;
extern const WeaponType Twin_Autocannons_Floor_Trap;
extern const WeaponType Hellfire_Missile_Pack_Wall_Trap;
extern const WeaponType Flame_Thrower_Wall_Trap;
extern const WeaponType Hellfire_Missile_Pack_Floor_Trap;
BWAPI_DECL(Yamato_Gun);
BWAPI_DECL(Nuclear_Strike);
BWAPI_DECL(Lockdown);
BWAPI_DECL(EMP_Shockwave);
BWAPI_DECL(Irradiate);
BWAPI_DECL(Parasite);
BWAPI_DECL(Spawn_Broodlings);
BWAPI_DECL(Ensnare);
BWAPI_DECL(Dark_Swarm);
BWAPI_DECL(Plague);
BWAPI_DECL(Consume);
BWAPI_DECL(Stasis_Field);
BWAPI_DECL(Psionic_Storm);
BWAPI_DECL(Disruption_Web);
BWAPI_DECL(Restoration);
BWAPI_DECL(Mind_Control);
BWAPI_DECL(Feedback);
BWAPI_DECL(Optical_Flare);
BWAPI_DECL(Maelstrom);
extern const WeaponType Yamato_Gun;
extern const WeaponType Nuclear_Strike;
extern const WeaponType Lockdown;
extern const WeaponType EMP_Shockwave;
extern const WeaponType Irradiate;
extern const WeaponType Parasite;
extern const WeaponType Spawn_Broodlings;
extern const WeaponType Ensnare;
extern const WeaponType Dark_Swarm;
extern const WeaponType Plague;
extern const WeaponType Consume;
extern const WeaponType Stasis_Field;
extern const WeaponType Psionic_Storm;
extern const WeaponType Disruption_Web;
extern const WeaponType Restoration;
extern const WeaponType Mind_Control;
extern const WeaponType Feedback;
extern const WeaponType Optical_Flare;
extern const WeaponType Maelstrom;
BWAPI_DECL(None);
BWAPI_DECL(Unknown);
#undef BWAPI_DECL
extern const WeaponType None;
extern const WeaponType Unknown;
}
static_assert(sizeof(WeaponType) == sizeof(int), "Expected type to resolve to primitive size.");
}

View file

@ -0,0 +1,28 @@
#pragma once
typedef int BOOL;
typedef void* HANDLE;
typedef unsigned long DWORD;
typedef void* LPVOID;
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifndef APIENTRY
#define APIENTRY WINAPI
#endif
#ifndef DLL_PROCESS_ATTACH
#define DLL_PROCESS_ATTACH 1
#define DLL_THREAD_ATTACH 2
#define DLL_THREAD_DETACH 3
#define DLL_PROCESS_DETACH 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif

View file

@ -85,6 +85,9 @@ public class AIModule {
}
private static AIModule get(long pointer) {
if (pointer == 0 ) {
return null;
}
AIModule instance = instances.get(pointer);
if (instance == null ) {
instance = new AIModule(pointer);

30
bwapi4/AbstractPoint.java Normal file
View file

@ -0,0 +1,30 @@
package bwapi4;
/**
* Common ancestor for location based objects to simplify distance computation.
* This will be refactored into interface with default methods when java 8 becomes widely used.
*
* Idea by Rafa³ Poniatowski
*/
public abstract class AbstractPoint<T extends AbstractPoint> {
public abstract T getPoint();
public int getX(){
return getPoint().getX();
}
public int getY(){
return getPoint().getY();
}
public double distanceTo(AbstractPoint<T> otherPosition) {
return distanceTo(otherPosition.getX(), otherPosition.getY());
}
public double distanceTo(int x, int y) {
double dx = x - getX();
double dy = y - getY();
return Math.sqrt(dx * dx + dy * dy);
}
}

View file

@ -17,6 +17,9 @@ public class BestFilter {
}
private static BestFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
BestFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new BestFilter(pointer);

View file

@ -73,6 +73,9 @@ public class Bullet {
}
private static Bullet get(long pointer) {
if (pointer == 0 ) {
return null;
}
Bullet instance = instances.get(pointer);
if (instance == null ) {
instance = new Bullet(pointer);

View file

@ -9,6 +9,80 @@ import java.util.List;
public class BulletType {
public static BulletType Melee;
public static BulletType Fusion_Cutter_Hit;
public static BulletType Gauss_Rifle_Hit;
public static BulletType C_10_Canister_Rifle_Hit;
public static BulletType Gemini_Missiles;
public static BulletType Fragmentation_Grenade;
public static BulletType Longbolt_Missile;
public static BulletType ATS_ATA_Laser_Battery;
public static BulletType Burst_Lasers;
public static BulletType Arclite_Shock_Cannon_Hit;
public static BulletType EMP_Missile;
public static BulletType Dual_Photon_Blasters_Hit;
public static BulletType Particle_Beam_Hit;
public static BulletType Anti_Matter_Missile;
public static BulletType Pulse_Cannon;
public static BulletType Psionic_Shockwave_Hit;
public static BulletType Psionic_Storm;
public static BulletType Yamato_Gun;
public static BulletType Phase_Disruptor;
public static BulletType STA_STS_Cannon_Overlay;
public static BulletType Sunken_Colony_Tentacle;
public static BulletType Acid_Spore;
public static BulletType Glave_Wurm;
public static BulletType Seeker_Spores;
public static BulletType Queen_Spell_Carrier;
public static BulletType Plague_Cloud;
public static BulletType Consume;
public static BulletType Ensnare;
public static BulletType Needle_Spine_Hit;
public static BulletType Invisible;
public static BulletType Optical_Flare_Grenade;
public static BulletType Halo_Rockets;
public static BulletType Subterranean_Spines;
public static BulletType Corrosive_Acid_Shot;
public static BulletType Neutron_Flare;
public static BulletType None;
public static BulletType Unknown;
private static Map<Long, BulletType> instances = new HashMap<Long, BulletType>();
@ -17,6 +91,9 @@ public class BulletType {
}
private static BulletType get(long pointer) {
if (pointer == 0 ) {
return null;
}
BulletType instance = instances.get(pointer);
if (instance == null ) {
instance = new BulletType(pointer);

View file

@ -17,6 +17,9 @@ public class Bulletset {
}
private static Bulletset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Bulletset instance = instances.get(pointer);
if (instance == null ) {
instance = new Bulletset(pointer);

View file

@ -0,0 +1,15 @@
package bwapi4;
import bwapi4.Position;
/**
* Interrmediate class used to translate getPoint() calls to getCenter() calls.
*/
public abstract class CenteredObject extends AbstractPoint<Position> {
public Position getPoint(){
return getCenter();
}
public abstract Position getCenter();
}

View file

@ -33,6 +33,9 @@ public class Client {
}
private static Client get(long pointer) {
if (pointer == 0 ) {
return null;
}
Client instance = instances.get(pointer);
if (instance == null ) {
instance = new Client(pointer);

View file

@ -53,6 +53,9 @@ public class Color {
}
private static Color get(long pointer) {
if (pointer == 0 ) {
return null;
}
Color instance = instances.get(pointer);
if (instance == null ) {
instance = new Color(pointer);

View file

@ -17,6 +17,9 @@ public class CompareFilter {
}
private static CompareFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
CompareFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new CompareFilter(pointer);

View file

@ -9,6 +9,20 @@ import java.util.List;
public class DamageType {
public static DamageType Independent;
public static DamageType Explosive;
public static DamageType Concussive;
public static DamageType Normal;
public static DamageType Ignore_Armor;
public static DamageType None;
public static DamageType Unknown;
private static Map<Long, DamageType> instances = new HashMap<Long, DamageType>();
@ -17,6 +31,9 @@ public class DamageType {
}
private static DamageType get(long pointer) {
if (pointer == 0 ) {
return null;
}
DamageType instance = instances.get(pointer);
if (instance == null ) {
instance = new DamageType(pointer);

View file

@ -9,6 +9,62 @@ import java.util.List;
public class Error {
public static Error Unit_Does_Not_Exist;
public static Error Unit_Not_Visible;
public static Error Unit_Not_Owned;
public static Error Unit_Busy;
public static Error Incompatible_UnitType;
public static Error Incompatible_TechType;
public static Error Incompatible_State;
public static Error Already_Researched;
public static Error Fully_Upgraded;
public static Error Currently_Researching;
public static Error Currently_Upgrading;
public static Error Insufficient_Minerals;
public static Error Insufficient_Gas;
public static Error Insufficient_Supply;
public static Error Insufficient_Energy;
public static Error Insufficient_Tech;
public static Error Insufficient_Ammo;
public static Error Insufficient_Space;
public static Error Invalid_Tile_Position;
public static Error Unbuildable_Location;
public static Error Unreachable_Location;
public static Error Out_Of_Range;
public static Error Unable_To_Hit;
public static Error Access_Denied;
public static Error File_Not_Found;
public static Error Invalid_Parameter;
public static Error None;
public static Error Unknown;
private static Map<Long, Error> instances = new HashMap<Long, Error>();
@ -17,6 +73,9 @@ public class Error {
}
private static Error get(long pointer) {
if (pointer == 0 ) {
return null;
}
Error instance = instances.get(pointer);
if (instance == null ) {
instance = new Error(pointer);

View file

@ -37,6 +37,9 @@ public class Event {
}
private static Event get(long pointer) {
if (pointer == 0 ) {
return null;
}
Event instance = instances.get(pointer);
if (instance == null ) {
instance = new Event(pointer);

View file

@ -9,6 +9,56 @@ import java.util.List;
public class ExplosionType {
public static ExplosionType None;
public static ExplosionType Normal;
public static ExplosionType Radial_Splash;
public static ExplosionType Enemy_Splash;
public static ExplosionType Lockdown;
public static ExplosionType Nuclear_Missile;
public static ExplosionType Parasite;
public static ExplosionType Broodlings;
public static ExplosionType EMP_Shockwave;
public static ExplosionType Irradiate;
public static ExplosionType Ensnare;
public static ExplosionType Plague;
public static ExplosionType Stasis_Field;
public static ExplosionType Dark_Swarm;
public static ExplosionType Consume;
public static ExplosionType Yamato_Gun;
public static ExplosionType Restoration;
public static ExplosionType Disruption_Web;
public static ExplosionType Corrosive_Acid;
public static ExplosionType Mind_Control;
public static ExplosionType Feedback;
public static ExplosionType Optical_Flare;
public static ExplosionType Maelstrom;
public static ExplosionType Air_Splash;
public static ExplosionType Unknown;
private static Map<Long, ExplosionType> instances = new HashMap<Long, ExplosionType>();
@ -17,6 +67,9 @@ public class ExplosionType {
}
private static ExplosionType get(long pointer) {
if (pointer == 0 ) {
return null;
}
ExplosionType instance = instances.get(pointer);
if (instance == null ) {
instance = new ExplosionType(pointer);

View file

@ -17,7 +17,7 @@ public class Force {
return getName_native(pointer);
}
public Playerset getPlayers() {
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
@ -29,6 +29,9 @@ public class Force {
}
private static Force get(long pointer) {
if (pointer == 0 ) {
return null;
}
Force instance = instances.get(pointer);
if (instance == null ) {
instance = new Force(pointer);
@ -43,7 +46,7 @@ public class Force {
private native String getName_native(long pointer);
private native Playerset getPlayers_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
}

View file

@ -9,7 +9,7 @@ import java.util.List;
public class Forceset {
public Playerset getPlayers() {
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
@ -21,6 +21,9 @@ public class Forceset {
}
private static Forceset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Forceset instance = instances.get(pointer);
if (instance == null ) {
instance = new Forceset(pointer);
@ -31,7 +34,7 @@ public class Forceset {
private long pointer;
private native Playerset getPlayers_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
}

View file

@ -9,43 +9,43 @@ import java.util.List;
public class Game {
public Forceset getForces() {
public List<Force> getForces() {
return getForces_native(pointer);
}
public Playerset getPlayers() {
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
public Unitset getAllUnits() {
public List<Unit> getAllUnits() {
return getAllUnits_native(pointer);
}
public Unitset getMinerals() {
public List<Unit> getMinerals() {
return getMinerals_native(pointer);
}
public Unitset getGeysers() {
public List<Unit> getGeysers() {
return getGeysers_native(pointer);
}
public Unitset getNeutralUnits() {
public List<Unit> getNeutralUnits() {
return getNeutralUnits_native(pointer);
}
public Unitset getStaticMinerals() {
public List<Unit> getStaticMinerals() {
return getStaticMinerals_native(pointer);
}
public Unitset getStaticGeysers() {
public List<Unit> getStaticGeysers() {
return getStaticGeysers_native(pointer);
}
public Unitset getStaticNeutralUnits() {
public List<Unit> getStaticNeutralUnits() {
return getStaticNeutralUnits_native(pointer);
}
public Bulletset getBullets() {
public List<Bullet> getBullets() {
return getBullets_native(pointer);
}
@ -133,27 +133,27 @@ public class Game {
enableFlag_native(pointer, flag);
}
public Unitset getUnitsOnTile(int tileX, int tileY, UnitFilter pred) {
public List<Unit> getUnitsOnTile(int tileX, int tileY, UnitFilter pred) {
return getUnitsOnTile_native(pointer, tileX, tileY, pred);
}
public Unitset getUnitsOnTile(TilePosition tile, UnitFilter pred) {
public List<Unit> getUnitsOnTile(TilePosition tile, UnitFilter pred) {
return getUnitsOnTile_native(pointer, tile, pred);
}
public Unitset getUnitsInRectangle(int left, int top, int right, int bottom, UnitFilter pred) {
public List<Unit> getUnitsInRectangle(int left, int top, int right, int bottom, UnitFilter pred) {
return getUnitsInRectangle_native(pointer, left, top, right, bottom, pred);
}
public Unitset getUnitsInRectangle(Position topLeft, Position bottomRight, UnitFilter pred) {
public List<Unit> getUnitsInRectangle(Position topLeft, Position bottomRight, UnitFilter pred) {
return getUnitsInRectangle_native(pointer, topLeft, bottomRight, pred);
}
public Unitset getUnitsInRadius(int x, int y, int radius, UnitFilter pred) {
public List<Unit> getUnitsInRadius(int x, int y, int radius, UnitFilter pred) {
return getUnitsInRadius_native(pointer, x, y, radius, pred);
}
public Unitset getUnitsInRadius(Position center, int radius, UnitFilter pred) {
public List<Unit> getUnitsInRadius(Position center, int radius, UnitFilter pred) {
return getUnitsInRadius_native(pointer, center, radius, pred);
}
@ -373,14 +373,26 @@ public class Game {
return canUpgrade_native(pointer, type, unit, checkCanIssueCommandType);
}
public void printf(String cstr_format) {
printf_native(pointer, cstr_format);
}
public void vPrintf(String cstr_format, Object ... args) {
vPrintf_native(pointer, cstr_format, args);
}
public void sendText(String cstr_format) {
sendText_native(pointer, cstr_format);
}
public void vSendText(String cstr_format, Object ... args) {
vSendText_native(pointer, cstr_format, args);
}
public void sendTextEx(boolean toAllies, String cstr_format) {
sendTextEx_native(pointer, toAllies, cstr_format);
}
public void vSendTextEx(boolean toAllies, String cstr_format, Object ... args) {
vSendTextEx_native(pointer, toAllies, cstr_format, args);
}
@ -425,11 +437,11 @@ public class Game {
setLocalSpeed_native(pointer, speed);
}
public boolean issueCommand(Unitset units, UnitCommand command) {
public boolean issueCommand(List<Unit> units, UnitCommand command) {
return issueCommand_native(pointer, units, command);
}
public Unitset getSelectedUnits() {
public List<Unit> getSelectedUnits() {
return getSelectedUnits_native(pointer);
}
@ -445,15 +457,15 @@ public class Game {
return neutral_native(pointer);
}
public Playerset allies() {
public List<Player> allies() {
return allies_native(pointer);
}
public Playerset enemies() {
public List<Player> enemies() {
return enemies_native(pointer);
}
public Playerset observers() {
public List<Player> observers() {
return observers_native(pointer);
}
@ -469,6 +481,34 @@ public class Game {
vDrawText_native(pointer, ctype, x, y, cstr_format, arg);
}
public void drawText(bwapi4.CoordinateType.Enum ctype, int x, int y, String cstr_format) {
drawText_native(pointer, ctype, x, y, cstr_format);
}
public void drawTextMap(int x, int y, String cstr_format) {
drawTextMap_native(pointer, x, y, cstr_format);
}
public void drawTextMap(Position p, String cstr_format) {
drawTextMap_native(pointer, p, cstr_format);
}
public void drawTextMouse(int x, int y, String cstr_format) {
drawTextMouse_native(pointer, x, y, cstr_format);
}
public void drawTextMouse(Position p, String cstr_format) {
drawTextMouse_native(pointer, p, cstr_format);
}
public void drawTextScreen(int x, int y, String cstr_format) {
drawTextScreen_native(pointer, x, y, cstr_format);
}
public void drawTextScreen(Position p, String cstr_format) {
drawTextScreen_native(pointer, p, cstr_format);
}
public void drawBox(bwapi4.CoordinateType.Enum ctype, int left, int top, int right, int bottom, Color color) {
drawBox_native(pointer, ctype, left, top, right, bottom, color);
}
@ -905,6 +945,9 @@ public class Game {
}
private static Game get(long pointer) {
if (pointer == 0 ) {
return null;
}
Game instance = instances.get(pointer);
if (instance == null ) {
instance = new Game(pointer);
@ -915,25 +958,25 @@ public class Game {
private long pointer;
private native Forceset getForces_native(long pointer);
private native List<Force> getForces_native(long pointer);
private native Playerset getPlayers_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
private native Unitset getAllUnits_native(long pointer);
private native List<Unit> getAllUnits_native(long pointer);
private native Unitset getMinerals_native(long pointer);
private native List<Unit> getMinerals_native(long pointer);
private native Unitset getGeysers_native(long pointer);
private native List<Unit> getGeysers_native(long pointer);
private native Unitset getNeutralUnits_native(long pointer);
private native List<Unit> getNeutralUnits_native(long pointer);
private native Unitset getStaticMinerals_native(long pointer);
private native List<Unit> getStaticMinerals_native(long pointer);
private native Unitset getStaticGeysers_native(long pointer);
private native List<Unit> getStaticGeysers_native(long pointer);
private native Unitset getStaticNeutralUnits_native(long pointer);
private native List<Unit> getStaticNeutralUnits_native(long pointer);
private native Bulletset getBullets_native(long pointer);
private native List<Bullet> getBullets_native(long pointer);
private native Force getForce_native(long pointer, int forceID);
@ -977,17 +1020,17 @@ public class Game {
private native void enableFlag_native(long pointer, int flag);
private native Unitset getUnitsOnTile_native(long pointer, int tileX, int tileY, UnitFilter pred);
private native List<Unit> getUnitsOnTile_native(long pointer, int tileX, int tileY, UnitFilter pred);
private native Unitset getUnitsOnTile_native(long pointer, TilePosition tile, UnitFilter pred);
private native List<Unit> getUnitsOnTile_native(long pointer, TilePosition tile, UnitFilter pred);
private native Unitset getUnitsInRectangle_native(long pointer, int left, int top, int right, int bottom, UnitFilter pred);
private native List<Unit> getUnitsInRectangle_native(long pointer, int left, int top, int right, int bottom, UnitFilter pred);
private native Unitset getUnitsInRectangle_native(long pointer, Position topLeft, Position bottomRight, UnitFilter pred);
private native List<Unit> getUnitsInRectangle_native(long pointer, Position topLeft, Position bottomRight, UnitFilter pred);
private native Unitset getUnitsInRadius_native(long pointer, int x, int y, int radius, UnitFilter pred);
private native List<Unit> getUnitsInRadius_native(long pointer, int x, int y, int radius, UnitFilter pred);
private native Unitset getUnitsInRadius_native(long pointer, Position center, int radius, UnitFilter pred);
private native List<Unit> getUnitsInRadius_native(long pointer, Position center, int radius, UnitFilter pred);
private native Unit getClosestUnit_native(long pointer, Position center, UnitFilter pred);
@ -1097,10 +1140,16 @@ public class Game {
private native boolean canUpgrade_native(long pointer, UpgradeType type, Unit unit, boolean checkCanIssueCommandType);
private native void printf_native(long pointer, String cstr_format);
private native void vPrintf_native(long pointer, String cstr_format, Object ... args);
private native void sendText_native(long pointer, String cstr_format);
private native void vSendText_native(long pointer, String cstr_format, Object ... args);
private native void sendTextEx_native(long pointer, boolean toAllies, String cstr_format);
private native void vSendTextEx_native(long pointer, boolean toAllies, String cstr_format, Object ... args);
private native boolean isInGame_native(long pointer);
@ -1123,9 +1172,9 @@ public class Game {
private native void setLocalSpeed_native(long pointer, int speed);
private native boolean issueCommand_native(long pointer, Unitset units, UnitCommand command);
private native boolean issueCommand_native(long pointer, List<Unit> units, UnitCommand command);
private native Unitset getSelectedUnits_native(long pointer);
private native List<Unit> getSelectedUnits_native(long pointer);
private native Player self_native(long pointer);
@ -1133,11 +1182,11 @@ public class Game {
private native Player neutral_native(long pointer);
private native Playerset allies_native(long pointer);
private native List<Player> allies_native(long pointer);
private native Playerset enemies_native(long pointer);
private native List<Player> enemies_native(long pointer);
private native Playerset observers_native(long pointer);
private native List<Player> observers_native(long pointer);
private native void setTextSize_native(long pointer);
@ -1145,6 +1194,20 @@ public class Game {
private native void vDrawText_native(long pointer, bwapi4.CoordinateType.Enum ctype, int x, int y, String cstr_format, Object ... arg);
private native void drawText_native(long pointer, bwapi4.CoordinateType.Enum ctype, int x, int y, String cstr_format);
private native void drawTextMap_native(long pointer, int x, int y, String cstr_format);
private native void drawTextMap_native(long pointer, Position p, String cstr_format);
private native void drawTextMouse_native(long pointer, int x, int y, String cstr_format);
private native void drawTextMouse_native(long pointer, Position p, String cstr_format);
private native void drawTextScreen_native(long pointer, int x, int y, String cstr_format);
private native void drawTextScreen_native(long pointer, Position p, String cstr_format);
private native void drawBox_native(long pointer, bwapi4.CoordinateType.Enum ctype, int left, int top, int right, int bottom, Color color);
private native void drawBox_native(long pointer, bwapi4.CoordinateType.Enum ctype, int left, int top, int right, int bottom, Color color, boolean isSolid);

View file

@ -9,6 +9,36 @@ import java.util.List;
public class GameType {
public static GameType Melee;
public static GameType Free_For_All;
public static GameType One_on_One;
public static GameType Capture_The_Flag;
public static GameType Greed;
public static GameType Slaughter;
public static GameType Sudden_Death;
public static GameType Ladder;
public static GameType Use_Map_Settings;
public static GameType Team_Melee;
public static GameType Team_Free_For_All;
public static GameType Team_Capture_The_Flag;
public static GameType Top_vs_Bottom;
public static GameType None;
public static GameType Unknown;
private static Map<Long, GameType> instances = new HashMap<Long, GameType>();
@ -17,6 +47,9 @@ public class GameType {
}
private static GameType get(long pointer) {
if (pointer == 0 ) {
return null;
}
GameType instance = instances.get(pointer);
if (instance == null ) {
instance = new GameType(pointer);

View file

@ -21,6 +21,9 @@ public class GameWrapper {
}
private static GameWrapper get(long pointer) {
if (pointer == 0 ) {
return null;
}
GameWrapper instance = instances.get(pointer);
if (instance == null ) {
instance = new GameWrapper(pointer);

View file

@ -9,6 +9,318 @@ import java.util.List;
public class Order {
public static Order Die;
public static Order Stop;
public static Order Guard;
public static Order PlayerGuard;
public static Order TurretGuard;
public static Order BunkerGuard;
public static Order Move;
public static Order AttackUnit;
public static Order AttackTile;
public static Order Hover;
public static Order AttackMove;
public static Order InfestedCommandCenter;
public static Order UnusedNothing;
public static Order UnusedPowerup;
public static Order TowerGuard;
public static Order VultureMine;
public static Order Nothing;
public static Order CastInfestation;
public static Order InfestingCommandCenter;
public static Order PlaceBuilding;
public static Order CreateProtossBuilding;
public static Order ConstructingBuilding;
public static Order Repair;
public static Order PlaceAddon;
public static Order BuildAddon;
public static Order Train;
public static Order RallyPointUnit;
public static Order RallyPointTile;
public static Order ZergBirth;
public static Order ZergUnitMorph;
public static Order ZergBuildingMorph;
public static Order IncompleteBuilding;
public static Order BuildNydusExit;
public static Order EnterNydusCanal;
public static Order Follow;
public static Order Carrier;
public static Order ReaverCarrierMove;
public static Order CarrierIgnore2;
public static Order Reaver;
public static Order TrainFighter;
public static Order InterceptorAttack;
public static Order ScarabAttack;
public static Order RechargeShieldsUnit;
public static Order RechargeShieldsBattery;
public static Order ShieldBattery;
public static Order InterceptorReturn;
public static Order BuildingLand;
public static Order BuildingLiftOff;
public static Order DroneLiftOff;
public static Order LiftingOff;
public static Order ResearchTech;
public static Order Upgrade;
public static Order Larva;
public static Order SpawningLarva;
public static Order Harvest1;
public static Order Harvest2;
public static Order MoveToGas;
public static Order WaitForGas;
public static Order HarvestGas;
public static Order ReturnGas;
public static Order MoveToMinerals;
public static Order WaitForMinerals;
public static Order MiningMinerals;
public static Order Harvest3;
public static Order Harvest4;
public static Order ReturnMinerals;
public static Order Interrupted;
public static Order EnterTransport;
public static Order PickupIdle;
public static Order PickupTransport;
public static Order PickupBunker;
public static Order Pickup4;
public static Order PowerupIdle;
public static Order Sieging;
public static Order Unsieging;
public static Order InitCreepGrowth;
public static Order SpreadCreep;
public static Order StoppingCreepGrowth;
public static Order GuardianAspect;
public static Order ArchonWarp;
public static Order CompletingArchonSummon;
public static Order HoldPosition;
public static Order Cloak;
public static Order Decloak;
public static Order Unload;
public static Order MoveUnload;
public static Order FireYamatoGun;
public static Order CastLockdown;
public static Order Burrowing;
public static Order Burrowed;
public static Order Unburrowing;
public static Order CastDarkSwarm;
public static Order CastParasite;
public static Order CastSpawnBroodlings;
public static Order CastEMPShockwave;
public static Order NukeWait;
public static Order NukeTrain;
public static Order NukeLaunch;
public static Order NukePaint;
public static Order NukeUnit;
public static Order CastNuclearStrike;
public static Order NukeTrack;
public static Order CloakNearbyUnits;
public static Order PlaceMine;
public static Order RightClickAction;
public static Order CastRecall;
public static Order Teleport;
public static Order CastScannerSweep;
public static Order Scanner;
public static Order CastDefensiveMatrix;
public static Order CastPsionicStorm;
public static Order CastIrradiate;
public static Order CastPlague;
public static Order CastConsume;
public static Order CastEnsnare;
public static Order CastStasisField;
public static Order CastHallucination;
public static Order Hallucination2;
public static Order ResetCollision;
public static Order Patrol;
public static Order CTFCOPInit;
public static Order CTFCOPStarted;
public static Order CTFCOP2;
public static Order ComputerAI;
public static Order AtkMoveEP;
public static Order HarassMove;
public static Order AIPatrol;
public static Order GuardPost;
public static Order RescuePassive;
public static Order Neutral;
public static Order ComputerReturn;
public static Order SelfDestructing;
public static Order Critter;
public static Order HiddenGun;
public static Order OpenDoor;
public static Order CloseDoor;
public static Order HideTrap;
public static Order RevealTrap;
public static Order EnableDoodad;
public static Order DisableDoodad;
public static Order WarpIn;
public static Order Medic;
public static Order MedicHeal;
public static Order HealMove;
public static Order MedicHealToIdle;
public static Order CastRestoration;
public static Order CastDisruptionWeb;
public static Order CastMindControl;
public static Order DarkArchonMeld;
public static Order CastFeedback;
public static Order CastOpticalFlare;
public static Order CastMaelstrom;
public static Order JunkYardDog;
public static Order Fatal;
public static Order None;
public static Order Unknown;
private static Map<Long, Order> instances = new HashMap<Long, Order>();
@ -17,6 +329,9 @@ public class Order {
}
private static Order get(long pointer) {
if (pointer == 0 ) {
return null;
}
Order instance = instances.get(pointer);
if (instance == null ) {
instance = new Order(pointer);

View file

@ -257,6 +257,9 @@ public class Player {
}
private static Player get(long pointer) {
if (pointer == 0 ) {
return null;
}
Player instance = instances.get(pointer);
if (instance == null ) {
instance = new Player(pointer);

View file

@ -9,6 +9,28 @@ import java.util.List;
public class PlayerType {
public static PlayerType None;
public static PlayerType Computer;
public static PlayerType Player;
public static PlayerType RescuePassive;
public static PlayerType EitherPreferComputer;
public static PlayerType EitherPreferHuman;
public static PlayerType Neutral;
public static PlayerType Closed;
public static PlayerType PlayerLeft;
public static PlayerType ComputerLeft;
public static PlayerType Unknown;
private static Map<Long, PlayerType> instances = new HashMap<Long, PlayerType>();
@ -17,6 +39,9 @@ public class PlayerType {
}
private static PlayerType get(long pointer) {
if (pointer == 0 ) {
return null;
}
PlayerType instance = instances.get(pointer);
if (instance == null ) {
instance = new PlayerType(pointer);

View file

@ -9,7 +9,7 @@ import java.util.List;
public class Playerset {
public Unitset getUnits() {
public List<Unit> getUnits() {
return getUnits_native(pointer);
}
@ -33,6 +33,9 @@ public class Playerset {
}
private static Playerset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Playerset instance = instances.get(pointer);
if (instance == null ) {
instance = new Playerset(pointer);
@ -43,7 +46,7 @@ public class Playerset {
private long pointer;
private native Unitset getUnits_native(long pointer);
private native List<Unit> getUnits_native(long pointer);
private native void setAlliance_native(long pointer, boolean allies);

View file

@ -25,6 +25,9 @@ public class Point {
}
private static Point get(long pointer) {
if (pointer == 0 ) {
return null;
}
Point instance = instances.get(pointer);
if (instance == null ) {
instance = new Point(pointer);

View file

@ -7,7 +7,7 @@ import java.util.Map;
/**
* Positions are measured in pixels and are the highest resolution.
*/
public class Position {
public class Position extends AbstractPoint<Position>{
private int x, y;
@ -83,4 +83,8 @@ public class Position {
}
private long pointer;
public Position getPoint(){
return this;
}
}

View file

@ -33,6 +33,9 @@ public class PositionOrUnit {
}
private static PositionOrUnit get(long pointer) {
if (pointer == 0 ) {
return null;
}
PositionOrUnit instance = instances.get(pointer);
if (instance == null ) {
instance = new PositionOrUnit(pointer);

View file

@ -0,0 +1,15 @@
package bwapi4;
import bwapi4.Position;
/**
* Interrmediate class used to translate getPoint() calls to getPosition() calls.
*/
public abstract class PositionedObject extends AbstractPoint<Position> {
public Position getPoint(){
return getPosition();
}
public abstract Position getPosition();
}

View file

@ -9,6 +9,18 @@ import java.util.List;
public class Race {
public static Race Zerg;
public static Race Terran;
public static Race Protoss;
public static Race Random;
public static Race None;
public static Race Unknown;
private static Map<Long, Race> instances = new HashMap<Long, Race>();
@ -17,6 +29,9 @@ public class Race {
}
private static Race get(long pointer) {
if (pointer == 0 ) {
return null;
}
Race instance = instances.get(pointer);
if (instance == null ) {
instance = new Race(pointer);

View file

@ -6,8 +6,10 @@ import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
import bwapi4.CenteredObject;
public class Region {
public class Region extends CenteredObject
{
public int getID() {
return getID_native(pointer);
@ -61,7 +63,7 @@ public class Region {
return getDistance_native(pointer, other);
}
public Unitset getUnits(UnitFilter pred) {
public List<Unit> getUnits(UnitFilter pred) {
return getUnits_native(pointer, pred);
}
@ -73,6 +75,9 @@ public class Region {
}
private static Region get(long pointer) {
if (pointer == 0 ) {
return null;
}
Region instance = instances.get(pointer);
if (instance == null ) {
instance = new Region(pointer);
@ -109,7 +114,7 @@ public class Region {
private native int getDistance_native(long pointer, Region other);
private native Unitset getUnits_native(long pointer, UnitFilter pred);
private native List<Unit> getUnits_native(long pointer, UnitFilter pred);
}

View file

@ -13,7 +13,7 @@ public class Regionset {
return getCenter_native(pointer);
}
public Unitset getUnits(UnitFilter pred) {
public List<Unit> getUnits(UnitFilter pred) {
return getUnits_native(pointer, pred);
}
@ -25,6 +25,9 @@ public class Regionset {
}
private static Regionset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Regionset instance = instances.get(pointer);
if (instance == null ) {
instance = new Regionset(pointer);
@ -37,7 +40,7 @@ public class Regionset {
private native Position getCenter_native(long pointer);
private native Unitset getUnits_native(long pointer, UnitFilter pred);
private native List<Unit> getUnits_native(long pointer, UnitFilter pred);
}

View file

@ -9,6 +9,78 @@ import java.util.List;
public class TechType {
public static TechType Stim_Packs;
public static TechType Lockdown;
public static TechType EMP_Shockwave;
public static TechType Spider_Mines;
public static TechType Scanner_Sweep;
public static TechType Tank_Siege_Mode;
public static TechType Defensive_Matrix;
public static TechType Irradiate;
public static TechType Yamato_Gun;
public static TechType Cloaking_Field;
public static TechType Personnel_Cloaking;
public static TechType Burrowing;
public static TechType Infestation;
public static TechType Spawn_Broodlings;
public static TechType Dark_Swarm;
public static TechType Plague;
public static TechType Consume;
public static TechType Ensnare;
public static TechType Parasite;
public static TechType Psionic_Storm;
public static TechType Hallucination;
public static TechType Recall;
public static TechType Stasis_Field;
public static TechType Archon_Warp;
public static TechType Restoration;
public static TechType Disruption_Web;
public static TechType Mind_Control;
public static TechType Dark_Archon_Meld;
public static TechType Feedback;
public static TechType Optical_Flare;
public static TechType Maelstrom;
public static TechType Lurker_Aspect;
public static TechType Healing;
public static TechType None;
public static TechType Nuclear_Strike;
public static TechType Unknown;
private static Map<Long, TechType> instances = new HashMap<Long, TechType>();
@ -17,6 +89,9 @@ public class TechType {
}
private static TechType get(long pointer) {
if (pointer == 0 ) {
return null;
}
TechType instance = instances.get(pointer);
if (instance == null ) {
instance = new TechType(pointer);

View file

@ -17,6 +17,9 @@ public class UnaryFilter {
}
private static UnaryFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnaryFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new UnaryFilter(pointer);

View file

@ -6,8 +6,10 @@ import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
import bwapi4.PositionedObject;
public class Unit {
public class Unit extends PositionedObject
{
public int getID() {
return getID_native(pointer);
@ -281,7 +283,7 @@ public class Unit {
return getTransport_native(pointer);
}
public Unitset getLoadedUnits() {
public List<Unit> getLoadedUnits() {
return getLoadedUnits_native(pointer);
}
@ -293,7 +295,7 @@ public class Unit {
return getCarrier_native(pointer);
}
public Unitset getInterceptors() {
public List<Unit> getInterceptors() {
return getInterceptors_native(pointer);
}
@ -301,15 +303,15 @@ public class Unit {
return getHatchery_native(pointer);
}
public Unitset getLarva() {
public List<Unit> getLarva() {
return getLarva_native(pointer);
}
public Unitset getUnitsInRadius(int radius, UnitFilter pred) {
public List<Unit> getUnitsInRadius(int radius, UnitFilter pred) {
return getUnitsInRadius_native(pointer, radius, pred);
}
public Unitset getUnitsInWeaponRange(WeaponType weapon, UnitFilter pred) {
public List<Unit> getUnitsInWeaponRange(WeaponType weapon, UnitFilter pred) {
return getUnitsInWeaponRange_native(pointer, weapon, pred);
}
@ -1845,6 +1847,9 @@ public class Unit {
}
private static Unit get(long pointer) {
if (pointer == 0 ) {
return null;
}
Unit instance = instances.get(pointer);
if (instance == null ) {
instance = new Unit(pointer);
@ -1991,21 +1996,21 @@ public class Unit {
private native Unit getTransport_native(long pointer);
private native Unitset getLoadedUnits_native(long pointer);
private native List<Unit> getLoadedUnits_native(long pointer);
private native int getSpaceRemaining_native(long pointer);
private native Unit getCarrier_native(long pointer);
private native Unitset getInterceptors_native(long pointer);
private native List<Unit> getInterceptors_native(long pointer);
private native Unit getHatchery_native(long pointer);
private native Unitset getLarva_native(long pointer);
private native List<Unit> getLarva_native(long pointer);
private native Unitset getUnitsInRadius_native(long pointer, int radius, UnitFilter pred);
private native List<Unit> getUnitsInRadius_native(long pointer, int radius, UnitFilter pred);
private native Unitset getUnitsInWeaponRange_native(long pointer, WeaponType weapon, UnitFilter pred);
private native List<Unit> getUnitsInWeaponRange_native(long pointer, WeaponType weapon, UnitFilter pred);
private native Unit getClosestUnit_native(long pointer, UnitFilter pred);

View file

@ -21,6 +21,9 @@ public class UnitCommand {
}
private static UnitCommand get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitCommand instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitCommand(pointer);

View file

@ -9,6 +9,98 @@ import java.util.List;
public class UnitCommandType {
public static UnitCommandType Attack_Move;
public static UnitCommandType Attack_Unit;
public static UnitCommandType Build;
public static UnitCommandType Build_Addon;
public static UnitCommandType Train;
public static UnitCommandType Morph;
public static UnitCommandType Research;
public static UnitCommandType Upgrade;
public static UnitCommandType Set_Rally_Position;
public static UnitCommandType Set_Rally_Unit;
public static UnitCommandType Move;
public static UnitCommandType Patrol;
public static UnitCommandType Hold_Position;
public static UnitCommandType Stop;
public static UnitCommandType Follow;
public static UnitCommandType Gather;
public static UnitCommandType Return_Cargo;
public static UnitCommandType Repair;
public static UnitCommandType Burrow;
public static UnitCommandType Unburrow;
public static UnitCommandType Cloak;
public static UnitCommandType Decloak;
public static UnitCommandType Siege;
public static UnitCommandType Unsiege;
public static UnitCommandType Lift;
public static UnitCommandType Land;
public static UnitCommandType Load;
public static UnitCommandType Unload;
public static UnitCommandType Unload_All;
public static UnitCommandType Unload_All_Position;
public static UnitCommandType Right_Click_Position;
public static UnitCommandType Right_Click_Unit;
public static UnitCommandType Halt_Construction;
public static UnitCommandType Cancel_Construction;
public static UnitCommandType Cancel_Addon;
public static UnitCommandType Cancel_Train;
public static UnitCommandType Cancel_Train_Slot;
public static UnitCommandType Cancel_Morph;
public static UnitCommandType Cancel_Research;
public static UnitCommandType Cancel_Upgrade;
public static UnitCommandType Use_Tech;
public static UnitCommandType Use_Tech_Position;
public static UnitCommandType Use_Tech_Unit;
public static UnitCommandType Place_COP;
public static UnitCommandType None;
public static UnitCommandType Unknown;
private static Map<Long, UnitCommandType> instances = new HashMap<Long, UnitCommandType>();
@ -17,6 +109,9 @@ public class UnitCommandType {
}
private static UnitCommandType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitCommandType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitCommandType(pointer);

View file

@ -9,6 +9,18 @@ import java.util.List;
public class UnitSizeType {
public static UnitSizeType Independent;
public static UnitSizeType Small;
public static UnitSizeType Medium;
public static UnitSizeType Large;
public static UnitSizeType None;
public static UnitSizeType Unknown;
private static Map<Long, UnitSizeType> instances = new HashMap<Long, UnitSizeType>();
@ -17,6 +29,9 @@ public class UnitSizeType {
}
private static UnitSizeType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitSizeType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitSizeType(pointer);

View file

@ -9,6 +9,428 @@ import java.util.List;
public class UnitType {
public static UnitType Terran_Marine;
public static UnitType Terran_Ghost;
public static UnitType Terran_Vulture;
public static UnitType Terran_Goliath;
public static UnitType Terran_Siege_Tank_Tank_Mode;
public static UnitType Terran_SCV;
public static UnitType Terran_Wraith;
public static UnitType Terran_Science_Vessel;
public static UnitType Hero_Gui_Montag;
public static UnitType Terran_Dropship;
public static UnitType Terran_Battlecruiser;
public static UnitType Terran_Vulture_Spider_Mine;
public static UnitType Terran_Nuclear_Missile;
public static UnitType Terran_Civilian;
public static UnitType Hero_Sarah_Kerrigan;
public static UnitType Hero_Alan_Schezar;
public static UnitType Hero_Jim_Raynor_Vulture;
public static UnitType Hero_Jim_Raynor_Marine;
public static UnitType Hero_Tom_Kazansky;
public static UnitType Hero_Magellan;
public static UnitType Hero_Edmund_Duke_Tank_Mode;
public static UnitType Hero_Edmund_Duke_Siege_Mode;
public static UnitType Hero_Arcturus_Mengsk;
public static UnitType Hero_Hyperion;
public static UnitType Hero_Norad_II;
public static UnitType Terran_Siege_Tank_Siege_Mode;
public static UnitType Terran_Firebat;
public static UnitType Spell_Scanner_Sweep;
public static UnitType Terran_Medic;
public static UnitType Zerg_Larva;
public static UnitType Zerg_Egg;
public static UnitType Zerg_Zergling;
public static UnitType Zerg_Hydralisk;
public static UnitType Zerg_Ultralisk;
public static UnitType Zerg_Broodling;
public static UnitType Zerg_Drone;
public static UnitType Zerg_Overlord;
public static UnitType Zerg_Mutalisk;
public static UnitType Zerg_Guardian;
public static UnitType Zerg_Queen;
public static UnitType Zerg_Defiler;
public static UnitType Zerg_Scourge;
public static UnitType Hero_Torrasque;
public static UnitType Hero_Matriarch;
public static UnitType Zerg_Infested_Terran;
public static UnitType Hero_Infested_Kerrigan;
public static UnitType Hero_Unclean_One;
public static UnitType Hero_Hunter_Killer;
public static UnitType Hero_Devouring_One;
public static UnitType Hero_Kukulza_Mutalisk;
public static UnitType Hero_Kukulza_Guardian;
public static UnitType Hero_Yggdrasill;
public static UnitType Terran_Valkyrie;
public static UnitType Zerg_Cocoon;
public static UnitType Protoss_Corsair;
public static UnitType Protoss_Dark_Templar;
public static UnitType Zerg_Devourer;
public static UnitType Protoss_Dark_Archon;
public static UnitType Protoss_Probe;
public static UnitType Protoss_Zealot;
public static UnitType Protoss_Dragoon;
public static UnitType Protoss_High_Templar;
public static UnitType Protoss_Archon;
public static UnitType Protoss_Shuttle;
public static UnitType Protoss_Scout;
public static UnitType Protoss_Arbiter;
public static UnitType Protoss_Carrier;
public static UnitType Protoss_Interceptor;
public static UnitType Hero_Dark_Templar;
public static UnitType Hero_Zeratul;
public static UnitType Hero_Tassadar_Zeratul_Archon;
public static UnitType Hero_Fenix_Zealot;
public static UnitType Hero_Fenix_Dragoon;
public static UnitType Hero_Tassadar;
public static UnitType Hero_Mojo;
public static UnitType Hero_Warbringer;
public static UnitType Hero_Gantrithor;
public static UnitType Protoss_Reaver;
public static UnitType Protoss_Observer;
public static UnitType Protoss_Scarab;
public static UnitType Hero_Danimoth;
public static UnitType Hero_Aldaris;
public static UnitType Hero_Artanis;
public static UnitType Critter_Rhynadon;
public static UnitType Critter_Bengalaas;
public static UnitType Special_Cargo_Ship;
public static UnitType Special_Mercenary_Gunship;
public static UnitType Critter_Scantid;
public static UnitType Critter_Kakaru;
public static UnitType Critter_Ragnasaur;
public static UnitType Critter_Ursadon;
public static UnitType Zerg_Lurker_Egg;
public static UnitType Hero_Raszagal;
public static UnitType Hero_Samir_Duran;
public static UnitType Hero_Alexei_Stukov;
public static UnitType Special_Map_Revealer;
public static UnitType Hero_Gerard_DuGalle;
public static UnitType Zerg_Lurker;
public static UnitType Hero_Infested_Duran;
public static UnitType Spell_Disruption_Web;
public static UnitType Terran_Command_Center;
public static UnitType Terran_Comsat_Station;
public static UnitType Terran_Nuclear_Silo;
public static UnitType Terran_Supply_Depot;
public static UnitType Terran_Refinery;
public static UnitType Terran_Barracks;
public static UnitType Terran_Academy;
public static UnitType Terran_Factory;
public static UnitType Terran_Starport;
public static UnitType Terran_Control_Tower;
public static UnitType Terran_Science_Facility;
public static UnitType Terran_Covert_Ops;
public static UnitType Terran_Physics_Lab;
public static UnitType Terran_Machine_Shop;
public static UnitType Terran_Engineering_Bay;
public static UnitType Terran_Armory;
public static UnitType Terran_Missile_Turret;
public static UnitType Terran_Bunker;
public static UnitType Special_Crashed_Norad_II;
public static UnitType Special_Ion_Cannon;
public static UnitType Powerup_Uraj_Crystal;
public static UnitType Powerup_Khalis_Crystal;
public static UnitType Zerg_Infested_Command_Center;
public static UnitType Zerg_Hatchery;
public static UnitType Zerg_Lair;
public static UnitType Zerg_Hive;
public static UnitType Zerg_Nydus_Canal;
public static UnitType Zerg_Hydralisk_Den;
public static UnitType Zerg_Defiler_Mound;
public static UnitType Zerg_Greater_Spire;
public static UnitType Zerg_Queens_Nest;
public static UnitType Zerg_Evolution_Chamber;
public static UnitType Zerg_Ultralisk_Cavern;
public static UnitType Zerg_Spire;
public static UnitType Zerg_Spawning_Pool;
public static UnitType Zerg_Creep_Colony;
public static UnitType Zerg_Spore_Colony;
public static UnitType Zerg_Sunken_Colony;
public static UnitType Special_Overmind_With_Shell;
public static UnitType Special_Overmind;
public static UnitType Zerg_Extractor;
public static UnitType Special_Mature_Chrysalis;
public static UnitType Special_Cerebrate;
public static UnitType Special_Cerebrate_Daggoth;
public static UnitType Protoss_Nexus;
public static UnitType Protoss_Robotics_Facility;
public static UnitType Protoss_Pylon;
public static UnitType Protoss_Assimilator;
public static UnitType Protoss_Observatory;
public static UnitType Protoss_Gateway;
public static UnitType Protoss_Photon_Cannon;
public static UnitType Protoss_Citadel_of_Adun;
public static UnitType Protoss_Cybernetics_Core;
public static UnitType Protoss_Templar_Archives;
public static UnitType Protoss_Forge;
public static UnitType Protoss_Stargate;
public static UnitType Special_Stasis_Cell_Prison;
public static UnitType Protoss_Fleet_Beacon;
public static UnitType Protoss_Arbiter_Tribunal;
public static UnitType Protoss_Robotics_Support_Bay;
public static UnitType Protoss_Shield_Battery;
public static UnitType Special_Khaydarin_Crystal_Form;
public static UnitType Special_Protoss_Temple;
public static UnitType Special_XelNaga_Temple;
public static UnitType Resource_Mineral_Field;
public static UnitType Resource_Mineral_Field_Type_2;
public static UnitType Resource_Mineral_Field_Type_3;
public static UnitType Special_Independant_Starport;
public static UnitType Resource_Vespene_Geyser;
public static UnitType Special_Warp_Gate;
public static UnitType Special_Psi_Disrupter;
public static UnitType Special_Zerg_Beacon;
public static UnitType Special_Terran_Beacon;
public static UnitType Special_Protoss_Beacon;
public static UnitType Special_Zerg_Flag_Beacon;
public static UnitType Special_Terran_Flag_Beacon;
public static UnitType Special_Protoss_Flag_Beacon;
public static UnitType Special_Power_Generator;
public static UnitType Special_Overmind_Cocoon;
public static UnitType Spell_Dark_Swarm;
public static UnitType Special_Floor_Missile_Trap;
public static UnitType Special_Floor_Hatch;
public static UnitType Special_Upper_Level_Door;
public static UnitType Special_Right_Upper_Level_Door;
public static UnitType Special_Pit_Door;
public static UnitType Special_Right_Pit_Door;
public static UnitType Special_Floor_Gun_Trap;
public static UnitType Special_Wall_Missile_Trap;
public static UnitType Special_Wall_Flame_Trap;
public static UnitType Special_Right_Wall_Missile_Trap;
public static UnitType Special_Right_Wall_Flame_Trap;
public static UnitType Special_Start_Location;
public static UnitType Powerup_Flag;
public static UnitType Powerup_Young_Chrysalis;
public static UnitType Powerup_Psi_Emitter;
public static UnitType Powerup_Data_Disk;
public static UnitType Powerup_Khaydarin_Crystal;
public static UnitType Powerup_Mineral_Cluster_Type_1;
public static UnitType Powerup_Mineral_Cluster_Type_2;
public static UnitType Powerup_Protoss_Gas_Orb_Type_1;
public static UnitType Powerup_Protoss_Gas_Orb_Type_2;
public static UnitType Powerup_Zerg_Gas_Sac_Type_1;
public static UnitType Powerup_Zerg_Gas_Sac_Type_2;
public static UnitType Powerup_Terran_Gas_Tank_Type_1;
public static UnitType Powerup_Terran_Gas_Tank_Type_2;
public static UnitType None;
public static UnitType AllUnits;
public static UnitType Men;
public static UnitType Buildings;
public static UnitType Factories;
public static UnitType Unknown;
private static Map<Long, UnitType> instances = new HashMap<Long, UnitType>();
@ -17,6 +439,9 @@ public class UnitType {
}
private static UnitType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitType(pointer);

View file

@ -13,15 +13,15 @@ public class Unitset {
return getPosition_native(pointer);
}
public Unitset getLoadedUnits() {
public List<Unit> getLoadedUnits() {
return getLoadedUnits_native(pointer);
}
public Unitset getInterceptors() {
public List<Unit> getInterceptors() {
return getInterceptors_native(pointer);
}
public Unitset getLarva() {
public List<Unit> getLarva() {
return getLarva_native(pointer);
}
@ -37,7 +37,7 @@ public class Unitset {
setClientInfo_native(pointer, clientInfo, index);
}
public Unitset getUnitsInRadius(int radius, UnitFilter pred) {
public List<Unit> getUnitsInRadius(int radius, UnitFilter pred) {
return getUnitsInRadius_native(pointer, radius, pred);
}
@ -257,6 +257,9 @@ public class Unitset {
}
private static Unitset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Unitset instance = instances.get(pointer);
if (instance == null ) {
instance = new Unitset(pointer);
@ -269,11 +272,11 @@ public class Unitset {
private native Position getPosition_native(long pointer);
private native Unitset getLoadedUnits_native(long pointer);
private native List<Unit> getLoadedUnits_native(long pointer);
private native Unitset getInterceptors_native(long pointer);
private native List<Unit> getInterceptors_native(long pointer);
private native Unitset getLarva_native(long pointer);
private native List<Unit> getLarva_native(long pointer);
private native void setClientInfo_native(long pointer, int clientInfo);
@ -281,7 +284,7 @@ public class Unitset {
private native void setClientInfo_native(long pointer, int clientInfo, int index);
private native Unitset getUnitsInRadius_native(long pointer, int radius, UnitFilter pred);
private native List<Unit> getUnitsInRadius_native(long pointer, int radius, UnitFilter pred);
private native Unit getClosestUnit_native(long pointer, UnitFilter pred);

View file

@ -9,6 +9,112 @@ import java.util.List;
public class UpgradeType {
public static UpgradeType Terran_Infantry_Armor;
public static UpgradeType Terran_Vehicle_Plating;
public static UpgradeType Terran_Ship_Plating;
public static UpgradeType Zerg_Carapace;
public static UpgradeType Zerg_Flyer_Carapace;
public static UpgradeType Protoss_Ground_Armor;
public static UpgradeType Protoss_Air_Armor;
public static UpgradeType Terran_Infantry_Weapons;
public static UpgradeType Terran_Vehicle_Weapons;
public static UpgradeType Terran_Ship_Weapons;
public static UpgradeType Zerg_Melee_Attacks;
public static UpgradeType Zerg_Missile_Attacks;
public static UpgradeType Zerg_Flyer_Attacks;
public static UpgradeType Protoss_Ground_Weapons;
public static UpgradeType Protoss_Air_Weapons;
public static UpgradeType Protoss_Plasma_Shields;
public static UpgradeType U_238_Shells;
public static UpgradeType Ion_Thrusters;
public static UpgradeType Titan_Reactor;
public static UpgradeType Ocular_Implants;
public static UpgradeType Moebius_Reactor;
public static UpgradeType Apollo_Reactor;
public static UpgradeType Colossus_Reactor;
public static UpgradeType Ventral_Sacs;
public static UpgradeType Antennae;
public static UpgradeType Pneumatized_Carapace;
public static UpgradeType Metabolic_Boost;
public static UpgradeType Adrenal_Glands;
public static UpgradeType Muscular_Augments;
public static UpgradeType Grooved_Spines;
public static UpgradeType Gamete_Meiosis;
public static UpgradeType Metasynaptic_Node;
public static UpgradeType Singularity_Charge;
public static UpgradeType Leg_Enhancements;
public static UpgradeType Scarab_Damage;
public static UpgradeType Reaver_Capacity;
public static UpgradeType Gravitic_Drive;
public static UpgradeType Sensor_Array;
public static UpgradeType Gravitic_Boosters;
public static UpgradeType Khaydarin_Amulet;
public static UpgradeType Apial_Sensors;
public static UpgradeType Gravitic_Thrusters;
public static UpgradeType Carrier_Capacity;
public static UpgradeType Khaydarin_Core;
public static UpgradeType Argus_Jewel;
public static UpgradeType Argus_Talisman;
public static UpgradeType Caduceus_Reactor;
public static UpgradeType Chitinous_Plating;
public static UpgradeType Anabolic_Synthesis;
public static UpgradeType Charon_Boosters;
public static UpgradeType Upgrade_60;
public static UpgradeType None;
public static UpgradeType Unknown;
private static Map<Long, UpgradeType> instances = new HashMap<Long, UpgradeType>();
@ -17,6 +123,9 @@ public class UpgradeType {
}
private static UpgradeType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UpgradeType instance = instances.get(pointer);
if (instance == null ) {
instance = new UpgradeType(pointer);

View file

@ -9,6 +9,210 @@ import java.util.List;
public class WeaponType {
public static WeaponType Gauss_Rifle;
public static WeaponType Gauss_Rifle_Jim_Raynor;
public static WeaponType C_10_Canister_Rifle;
public static WeaponType C_10_Canister_Rifle_Sarah_Kerrigan;
public static WeaponType C_10_Canister_Rifle_Samir_Duran;
public static WeaponType C_10_Canister_Rifle_Infested_Duran;
public static WeaponType C_10_Canister_Rifle_Alexei_Stukov;
public static WeaponType Fragmentation_Grenade;
public static WeaponType Fragmentation_Grenade_Jim_Raynor;
public static WeaponType Spider_Mines;
public static WeaponType Twin_Autocannons;
public static WeaponType Twin_Autocannons_Alan_Schezar;
public static WeaponType Hellfire_Missile_Pack;
public static WeaponType Hellfire_Missile_Pack_Alan_Schezar;
public static WeaponType Arclite_Cannon;
public static WeaponType Arclite_Cannon_Edmund_Duke;
public static WeaponType Fusion_Cutter;
public static WeaponType Gemini_Missiles;
public static WeaponType Gemini_Missiles_Tom_Kazansky;
public static WeaponType Burst_Lasers;
public static WeaponType Burst_Lasers_Tom_Kazansky;
public static WeaponType ATS_Laser_Battery;
public static WeaponType ATS_Laser_Battery_Hero;
public static WeaponType ATS_Laser_Battery_Hyperion;
public static WeaponType ATA_Laser_Battery;
public static WeaponType ATA_Laser_Battery_Hero;
public static WeaponType ATA_Laser_Battery_Hyperion;
public static WeaponType Flame_Thrower;
public static WeaponType Flame_Thrower_Gui_Montag;
public static WeaponType Arclite_Shock_Cannon;
public static WeaponType Arclite_Shock_Cannon_Edmund_Duke;
public static WeaponType Longbolt_Missile;
public static WeaponType Claws;
public static WeaponType Claws_Devouring_One;
public static WeaponType Claws_Infested_Kerrigan;
public static WeaponType Needle_Spines;
public static WeaponType Needle_Spines_Hunter_Killer;
public static WeaponType Kaiser_Blades;
public static WeaponType Kaiser_Blades_Torrasque;
public static WeaponType Toxic_Spores;
public static WeaponType Spines;
public static WeaponType Acid_Spore;
public static WeaponType Acid_Spore_Kukulza;
public static WeaponType Glave_Wurm;
public static WeaponType Glave_Wurm_Kukulza;
public static WeaponType Seeker_Spores;
public static WeaponType Subterranean_Tentacle;
public static WeaponType Suicide_Infested_Terran;
public static WeaponType Suicide_Scourge;
public static WeaponType Particle_Beam;
public static WeaponType Psi_Blades;
public static WeaponType Psi_Blades_Fenix;
public static WeaponType Phase_Disruptor;
public static WeaponType Phase_Disruptor_Fenix;
public static WeaponType Psi_Assault;
public static WeaponType Psionic_Shockwave;
public static WeaponType Psionic_Shockwave_TZ_Archon;
public static WeaponType Dual_Photon_Blasters;
public static WeaponType Dual_Photon_Blasters_Mojo;
public static WeaponType Dual_Photon_Blasters_Artanis;
public static WeaponType Anti_Matter_Missiles;
public static WeaponType Anti_Matter_Missiles_Mojo;
public static WeaponType Anti_Matter_Missiles_Artanis;
public static WeaponType Phase_Disruptor_Cannon;
public static WeaponType Phase_Disruptor_Cannon_Danimoth;
public static WeaponType Pulse_Cannon;
public static WeaponType STS_Photon_Cannon;
public static WeaponType STA_Photon_Cannon;
public static WeaponType Scarab;
public static WeaponType Neutron_Flare;
public static WeaponType Halo_Rockets;
public static WeaponType Corrosive_Acid;
public static WeaponType Subterranean_Spines;
public static WeaponType Warp_Blades;
public static WeaponType Warp_Blades_Hero;
public static WeaponType Warp_Blades_Zeratul;
public static WeaponType Independant_Laser_Battery;
public static WeaponType Twin_Autocannons_Floor_Trap;
public static WeaponType Hellfire_Missile_Pack_Wall_Trap;
public static WeaponType Flame_Thrower_Wall_Trap;
public static WeaponType Hellfire_Missile_Pack_Floor_Trap;
public static WeaponType Yamato_Gun;
public static WeaponType Nuclear_Strike;
public static WeaponType Lockdown;
public static WeaponType EMP_Shockwave;
public static WeaponType Irradiate;
public static WeaponType Parasite;
public static WeaponType Spawn_Broodlings;
public static WeaponType Ensnare;
public static WeaponType Dark_Swarm;
public static WeaponType Plague;
public static WeaponType Consume;
public static WeaponType Stasis_Field;
public static WeaponType Psionic_Storm;
public static WeaponType Disruption_Web;
public static WeaponType Restoration;
public static WeaponType Mind_Control;
public static WeaponType Feedback;
public static WeaponType Optical_Flare;
public static WeaponType Maelstrom;
public static WeaponType None;
public static WeaponType Unknown;
private static Map<Long, WeaponType> instances = new HashMap<Long, WeaponType>();
@ -17,6 +221,9 @@ public class WeaponType {
}
private static WeaponType get(long pointer) {
if (pointer == 0 ) {
return null;
}
WeaponType instance = instances.get(pointer);
if (instance == null ) {
instance = new WeaponType(pointer);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -4,6 +4,7 @@
#include <BWTA.h>
#include <jni.h>
#include <cstring>
#include "../BWTA_Result.h"
using namespace BWAPI;
@ -5295,6 +5296,14 @@ println("Connecting to Broodwar...");
{
switch (it->getType()) {
case EventType::MatchStart:
BWTA::BWTA_Result::regions.clear();
BWTA::BWTA_Result::baselocations.clear();
BWTA::BWTA_Result::startlocations.clear();
BWTA::BWTA_Result::chokepoints.clear();
BWTA::BWTA_Result::unwalkablePolygons.clear();
env->CallVoidMethod(moduleObj, matchStartCallback);
break;
case EventType::MatchEnd:

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more