diff --git a/3rdparty/bwapilib/BWAPI.cpp b/3rdparty/bwapilib/BWAPI.cpp new file mode 100644 index 0000000..c91a50a --- /dev/null +++ b/3rdparty/bwapilib/BWAPI.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include + +int BWAPI::BWAPI_getRevision() +{ + return SVN_REV; +} +bool BWAPI::BWAPI_isDebug() +{ + return BUILD_DEBUG == 1; +} + diff --git a/3rdparty/bwapilib/BWAPI.h b/3rdparty/bwapilib/BWAPI.h index 6e6a49d..5736e6f 100755 --- a/3rdparty/bwapilib/BWAPI.h +++ b/3rdparty/bwapilib/BWAPI.h @@ -71,7 +71,7 @@ namespace BWAPI /// /// @note This value is purposely high to avoid collisions with revision values. /// @since 4.2.0 - const int CLIENT_VERSION = 10002; + const int CLIENT_VERSION = 10003; } #endif diff --git a/3rdparty/bwapilib/BWAPI/Bullet.h b/3rdparty/bwapilib/BWAPI/Bullet.h index 5da0eae..73c0ed8 100755 --- a/3rdparty/bwapilib/BWAPI/Bullet.h +++ b/3rdparty/bwapilib/BWAPI/Bullet.h @@ -166,4 +166,4 @@ namespace BWAPI /// @retval false If the Bullet is not visible to the specified player. virtual bool isVisible(Player player = nullptr) const = 0; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/CommandTemp.h b/3rdparty/bwapilib/BWAPI/Client/CommandTemp.h new file mode 100644 index 0000000..3fb1e5f --- /dev/null +++ b/3rdparty/bwapilib/BWAPI/Client/CommandTemp.h @@ -0,0 +1,1004 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace BWAPI +{ + template + class CommandTemp + { + public: + CommandTemp(const UnitCommand& command) : command(command) { } + + void execute(); + void execute(bool isCurrentFrame); + + void insertIntoCommandBuffer(std::vector>> &buf) && { + const auto addToBuffer = [&buf](auto &&command, int frames) + { + command.execute(frames == 0); + + if (static_cast(buf.size()) < frames) + { + buf.resize(frames); // Will probably never trigger, since we resize + // the buffer in applyLatencyCompensation() + // but it's better to be safe. + } + + if(frames > 0) + buf[frames - 1].push_back(std::forward(command)); // Forward rvalue ref + }; + + auto orderEvent = makeEvent(EventType::Order); + auto finishEvent = makeEvent(EventType::Finish); + + switch (command.type) { + // RLF: Resource event + // RLF + 1: Order event + // RLF + 2: Finish event + case UnitCommandTypes::Cancel_Construction: + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + addToBuffer(std::move(orderEvent), Broodwar->getRemainingLatencyFrames() + 1); + addToBuffer(std::move(finishEvent), Broodwar->getRemainingLatencyFrames() + 2); + break; + + // RLF: Resource event + // RLF + 1: Order event + case UnitCommandTypes::Build_Addon: + case UnitCommandTypes::Cancel_Addon: + case UnitCommandTypes::Cancel_Research: + case UnitCommandTypes::Cancel_Upgrade: + case UnitCommandTypes::Morph: + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + addToBuffer(std::move(orderEvent), Broodwar->getRemainingLatencyFrames() + 1); + break; + + // RLF: Resource event + // RLF + 1: Order event (only for building -> building morphs) + // RLF + 13: Finish event (only for unit -> unit morphs) + // RLF + 15: Finish event (only for building -> building morphs) + case UnitCommandTypes::Cancel_Morph: + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + + if (auto unit = reinterpret_cast(command.unit); + unit && unit->getType().isBuilding()) + { + addToBuffer(std::move(orderEvent), Broodwar->getRemainingLatencyFrames() + 1); + addToBuffer(std::move(finishEvent), Broodwar->getRemainingLatencyFrames() + 15); + } + else + { + addToBuffer(std::move(finishEvent), Broodwar->getRemainingLatencyFrames() + 13); + } + break; + + // RLF: Resource event + // RLF + 1: Order event + // RLF + 3: Finish event + case UnitCommandTypes::Cancel_Train: + case UnitCommandTypes::Cancel_Train_Slot: + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + addToBuffer(std::move(orderEvent), Broodwar->getRemainingLatencyFrames() + 1); + addToBuffer(std::move(finishEvent), Broodwar->getRemainingLatencyFrames() + 3); + break; + + // RLF: Order event + // RLF + 1: Finish event + case UnitCommandTypes::Halt_Construction: + eventType = EventType::Order; + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + addToBuffer(finishEvent, Broodwar->getRemainingLatencyFrames() + 1); + break; + + default: + addToBuffer(std::move(*this), Broodwar->getRemainingLatencyFrames()); + break; + } + + } + + private: + enum struct EventType { Order, Resource, Finish }; + CommandTemp makeEvent(EventType type) + { + CommandTemp other{ command }; + other.eventType = type; + return other; + } + + static int getUnitID(Unit unit); + UnitCommand command; + EventType eventType = EventType::Resource; + int savedExtra = -1; + int savedExtra2 = -1; + + PlayerImpl* player = nullptr; + }; + + template + int CommandTemp::getUnitID(Unit unit) + { + if ( !unit ) + return -1; + return unit->getID(); + } + + template + void CommandTemp::execute() + { + switch(command.type) + { + case UnitCommandTypes::Halt_Construction: + eventType = EventType::Order; + [[fallthrough]]; + default: + execute(Broodwar->getRemainingLatencyFrames() == 0); + break; + } + } + + template + void CommandTemp::execute(const bool isCurrentFrame) + { + // Immediately return if latency compensation is disabled or if the command was queued + if (!Broodwar->isLatComEnabled() || command.isQueued()) return; + UnitImpl *unit = reinterpret_cast(command.unit); + UnitImpl *target = reinterpret_cast(command.target); + + if (isCurrentFrame) { + switch (command.type) // Commands which do things during the current frame + { + case UnitCommandTypes::Morph: // Morph, Build_Addon and Train orders may reserve resources or supply that + case UnitCommandTypes::Build_Addon: // SC does not take until the next frame to protect bots from overspending. + case UnitCommandTypes::Train: + if(eventType == EventType::Resource) + break; + return; + default: + return; + } + } + + // Get the player (usually the unit's owner) + if (!player) + player = static_cast(unit ? unit->getPlayer() : Broodwar->self()); + + // Existence test + if (!unit->self->exists) + return; + + // Move test + switch (command.type) + { + case UnitCommandTypes::Follow: + case UnitCommandTypes::Hold_Position: + case UnitCommandTypes::Move: + case UnitCommandTypes::Patrol: + case UnitCommandTypes::Right_Click_Position: + case UnitCommandTypes::Attack_Move: + if (!unit->getType().canMove()) + return; + break; + default: + break; + } + + // Apply command changes + switch(command.type) + { + // RLF + case UnitCommandTypes::Attack_Move: + unit->self->order = Orders::AttackMove; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + break; + + // RLF + case UnitCommandTypes::Attack_Unit: + if (!target || !target->self->exists || !unit->getType().canAttack()) + return; + unit->self->order = Orders::AttackUnit; + unit->self->target = getUnitID(target); + break; + + // RLF + case UnitCommandTypes::Build: + unit->self->order = Orders::PlaceBuilding; + unit->self->isConstructing = true; + unit->self->isIdle = false; + unit->self->buildType = command.extra; + break; + + // For building addons, SC takes minerals on RLF + 1. + // Latcom will do as with building->building morph and reserve these resources. + // RLF: Resource event + // RLF + 1: Order event + case UnitCommandTypes::Build_Addon: { + UnitType addonType{ command.extra }; + switch (eventType) + { + case EventType::Resource: + player->self->minerals -= static_cast(addonType.mineralPrice()); + player->self->gas -= static_cast(addonType.gasPrice()); + + if (!isCurrentFrame) // We will pretend the building is busy building, this doesn't + { + unit->self->isIdle = false; + unit->self->order = Orders::PlaceAddon; + } + break; + + case EventType::Order: + unit->self->isConstructing = true; + unit->self->order = Orders::Nothing; + unit->self->secondaryOrder = Orders::BuildAddon; + unit->self->buildType = command.extra; + break; + } + } + break; + + // RLF + case UnitCommandTypes::Burrow: + unit->self->order = Orders::Burrowing; + break; + + // RLF: Resource event + // RLF + 1: Order event + case UnitCommandTypes::Cancel_Addon: + switch(eventType) + { + case EventType::Resource: { + UnitType addonType{ unit->self->buildType }; + player->self->minerals += static_cast(addonType.mineralPrice() * 0.75); + player->self->gas += static_cast(addonType.gasPrice() * 0.75); + unit->self->buildType = UnitTypes::None; + } + break; + case EventType::Order: + unit->self->remainingBuildTime = 0; + unit->self->isConstructing = false; + unit->self->order = Orders::Nothing; + unit->self->isIdle = true; + unit->self->buildUnit = -1; + break; + } + + break; + + // RLF: Resource event + // RLF + 1: Order event + // RLF + 2: Finish event + case UnitCommandTypes::Cancel_Construction: + { + if (unit->getType().getRace() == Races::Terran) + { + if (auto builder = static_cast(Broodwar->getUnit(unit->self->buildUnit)); + builder && builder->exists()) + { + switch (eventType) + { + case EventType::Resource: + builder->self->buildType = UnitTypes::None; + break; + case EventType::Order: + builder->self->isConstructing = false; + builder->self->order = Orders::ResetCollision; + break; + case EventType::Finish: + builder->self->order = Orders::PlayerGuard; + break; + } + } + } + + if (eventType == EventType::Resource) + { + unit->self->buildUnit = -1; + player->self->minerals += static_cast(unit->getType().mineralPrice() * 0.75); + player->self->gas += static_cast(unit->getType().gasPrice() * 0.75); + unit->self->remainingBuildTime = 0; + } + + if (unit->getType().getRace() == Races::Zerg) + { + switch (eventType) + { + case EventType::Resource: + unit->self->type = unit->getType().whatBuilds().first; + unit->self->buildType = UnitTypes::None; + unit->self->isMorphing = false; + unit->self->order = Orders::ResetCollision; + unit->self->isConstructing = false; + + player->self->supplyUsed[unit->getType().getRace()] += unit->getType().supplyRequired(); + break; + + case EventType::Order: + unit->self->order = Orders::PlayerGuard; + unit->self->isIdle = true; + break; + } + } + + break; + } + + + // RLF: Resource event + // RLF + 1: Order event (only for builing -> building morphs) + // RLF + 13: Finish event (only for unit -> unit morphs) + // RLF + 15: Finish event (only for building -> building morphs) + case UnitCommandTypes::Cancel_Morph: + switch(eventType) + { + case EventType::Resource: + { + UnitType builtType{ unit->self->buildType }; + UnitType newType{ builtType.whatBuilds().first }; + + if (newType.isBuilding()) + { + player->self->minerals += static_cast(builtType.mineralPrice() * 0.75); + player->self->gas += static_cast(builtType.gasPrice() * 0.75); + } + else + { + player->self->minerals += builtType.mineralPrice(); + player->self->gas += builtType.gasPrice(); + } + + if (newType.isBuilding() && newType.producesCreep()) + { + unit->self->order = Orders::InitCreepGrowth; + } + + if (unit->self->type != UnitTypes::Zerg_Egg) { // Issue #781 + // https://github.com/bwapi/bwapi/issues/781 + unit->self->type = newType; + } + + unit->self->buildType = UnitTypes::None; + unit->self->isConstructing = false; + unit->self->isMorphing = false; + unit->self->isCompleted = true; + unit->self->remainingBuildTime = 0; + } + + break; + + case EventType::Order: + if (unit->getType().isBuilding()) // This event would hopefully not have been created + { // if this wasn't true (see event note above) + unit->self->isIdle = true; + unit->self->order = Orders::Nothing; + if(unit->self->type == UnitTypes::Zerg_Hatchery || unit->self->type == UnitTypes::Zerg_Lair) + { // Type should have updated during last event to the cancelled type + unit->self->secondaryOrder = Orders::SpreadCreep; + } + } + else + { + player->self->supplyUsed[unit->getType().getRace()] -= + unit->getType().supplyRequired() * (1 + static_cast(unit->getType().isTwoUnitsInOneEgg())); + + player->self->supplyUsed[unit->getType().getRace()] += // Could these races be different? Probably not. + // Should we handle it? Definetely. + unit->getType().whatBuilds().first.supplyRequired() * unit->getType().whatBuilds().second; + // Note: unit->getType().whatBuilds().second is always 1 but we + // might as well handle the general case, in case Blizzard + // all of a sudden allows you to cancel archon morphs + } + + break; + + case EventType::Finish: + if(unit->self->type == UnitTypes::Zerg_Hatchery || unit->self->type == UnitTypes::Zerg_Lair) + { + unit->self->secondaryOrder = Orders::SpawningLarva; + } + else if(!unit->getType().isBuilding()) + { + unit->self->order = Orders::PlayerGuard; + unit->self->isCompleted = true; + unit->self->isConstructing = false; + unit->self->isIdle = true; + unit->self->isMorphing = false; + } + break; + } + + break; + + // RLF: Resource event + // RLF + 1: Order update + case UnitCommandTypes::Cancel_Research: + { + switch(eventType) + { + case EventType::Resource: + { + TechType techType{ unit->self->tech }; + player->self->minerals += techType.mineralPrice(); + player->self->gas += techType.gasPrice(); + unit->self->remainingResearchTime = 0; + unit->self->tech = TechTypes::None; + } + break; + + case EventType::Order: + unit->self->order = Orders::Nothing; + unit->self->isIdle = true; + break; + } + } + + break; + + // RLF: Resource event + // RLF + 1: Order event + // RLF + 3: Finish event + case UnitCommandTypes::Cancel_Train_Slot: + if (command.extra != 0) + { + if (eventType == EventType::Resource) + { + UnitType unitType{ unit->self->trainingQueue[command.extra] }; + player->self->minerals += unitType.mineralPrice(); + player->self->gas += unitType.gasPrice(); + + // Shift training queue back one slot after the cancelled unit + for (int i = command.extra; i < 4; ++i) + { + unit->self->trainingQueue[i] = unit->self->trainingQueue[i + 1]; + } + + --unit->self->trainingQueueCount; + } + break; + } + + // If we're cancelling slot 0, we fall through to Cancel_Train. + [[fallthrough]]; + + // RLF: Resource event + // RLF + 1: Order event + // RLF + 3: Finish event + case UnitCommandTypes::Cancel_Train: { + switch(eventType) + { + case EventType::Resource: + { + UnitType unitType{ unit->self->trainingQueue[unit->self->trainingQueueCount - 1] }; + player->self->minerals += unitType.mineralPrice(); + player->self->gas += unitType.gasPrice(); + + unit->self->buildUnit = -1; + + if (unit->self->trainingQueueCount == 1) + { + unit->self->isIdle = false; + unit->self->isTraining = false; + } + break; + } + + case EventType::Order: + { + UnitType unitType{ unit->self->trainingQueue[--unit->self->trainingQueueCount] }; + player->self->supplyUsed[unitType.getRace()] -= unitType.supplyRequired(); + + if (unit->self->trainingQueueCount == 0) + { + unit->self->buildType = UnitTypes::None; + } + else + { + // Actual time decreases, but we'll let it be the buildTime until latency catches up. + unit->self->remainingTrainTime = + static_cast(unit->self->trainingQueue[unit->self->trainingQueueCount - 1]).buildTime(); + unit->self->buildType = unit->self->trainingQueue[unit->self->trainingQueueCount - 1]; + } + } + + break; + + case EventType::Finish: + if (unit->self->buildType == UnitTypes::None) + { + unit->self->order = Orders::Nothing; + } + break; + } + break; + } + + // RLF: Resource event + // RLF + 1: Order event + case UnitCommandTypes::Cancel_Upgrade: + switch(eventType) + { + case EventType::Resource: + { + UpgradeType upgradeType = unit->self->upgrade; + const int nextLevel = unit->getPlayer()->getUpgradeLevel(upgradeType) + 1; + + player->self->minerals += upgradeType.mineralPrice(nextLevel); + player->self->gas += upgradeType.gasPrice(nextLevel); + + unit->self->upgrade = UpgradeTypes::None; + unit->self->remainingUpgradeTime = 0; + } + break; + + case EventType::Order: + unit->self->order = Orders::Nothing; + unit->self->isIdle = true; + break; + } + + break; + + // RLF + case UnitCommandTypes::Cloak: + unit->self->order = Orders::Cloak; + unit->self->energy -= unit->getType().cloakingTech().energyCost(); + break; + + // RLF + case UnitCommandTypes::Decloak: + unit->self->order = Orders::Decloak; + break; + + // RLF + case UnitCommandTypes::Follow: + unit->self->order = Orders::Follow; + unit->self->target = getUnitID(target); + unit->self->isIdle = false; + unit->self->isMoving = true; + break; + + // RLF + case UnitCommandTypes::Gather: + unit->self->target = getUnitID(target); + unit->self->isIdle = false; + unit->self->isMoving = true; + unit->self->isGathering = true; + + // @TODO: Fully time and test this order + if (target->getType().isMineralField()) + unit->self->order = Orders::MoveToMinerals; + else if (target->getType().isRefinery()) + unit->self->order = Orders::MoveToGas; + + break; + + // RLF: Order event + // RLF + 1: Finish event + case UnitCommandTypes::Halt_Construction: + switch(eventType) + { + case EventType::Order: + if (auto building = reinterpret_cast(Broodwar->getUnit(unit->self->buildUnit)); + building) + { + building->self->buildUnit = -1; + } + unit->self->buildUnit = -1; + unit->self->order = Orders::ResetCollision; + unit->self->isConstructing = false; + unit->self->buildType = UnitTypes::None; + break; + + case EventType::Finish: + unit->self->order = Orders::PlayerGuard; + unit->self->isIdle = true; + break; + } + + break; + + // RLF + case UnitCommandTypes::Hold_Position: + unit->self->isMoving = false; + unit->self->isIdle = false; + unit->self->order = Orders::HoldPosition; + break; + + // RLF + case UnitCommandTypes::Land: + unit->self->order = Orders::BuildingLand; + unit->self->isIdle = false; + break; + + // RLF + case UnitCommandTypes::Lift: + unit->self->order = Orders::BuildingLiftOff; + unit->self->isIdle = false; + break; + + // RLF + case UnitCommandTypes::Load: + if (unit->getType() == UnitTypes::Terran_Bunker) + { + unit->self->order = Orders::PickupBunker; + unit->self->target = getUnitID(target); + } + else if (unit->getType().spaceProvided()) + { + unit->self->order = Orders::PickupTransport; + unit->self->target = getUnitID(target); + } + else if (target->getType().spaceProvided()) + { + unit->self->order = Orders::EnterTransport; + unit->self->target = getUnitID(target); + } + unit->self->isIdle = false; + + break; + + // For morph, SC takes minerals on RLF + 1 if morphing building->building. + // Latcom will do as with addons and reserve these resources. + // RLF: Resource event + // RLF + 1: Order event + case UnitCommandTypes::Morph: + { + UnitType morphType{ command.extra }; + + switch (eventType) + { + case EventType::Resource: + if(!isCurrentFrame) + { + unit->self->isCompleted = false; + unit->self->isIdle = false; + unit->self->isConstructing = true; + unit->self->isMorphing = true; + unit->self->buildType = morphType; + } + + if (unit->getType().isBuilding()) + { + if (!isCurrentFrame) + { // Actions that don't happen when we're reserving resources + unit->self->order = Orders::ZergBuildingMorph; + unit->self->type = morphType; + } + player->self->minerals -= morphType.mineralPrice(); + player->self->gas -= morphType.gasPrice(); + } + else + { + player->self->supplyUsed[morphType.getRace()] += morphType.supplyRequired() * + (1 + static_cast(morphType.isTwoUnitsInOneEgg())) - unit->getType().supplyRequired(); + + if(!isCurrentFrame) + { + unit->self->order = Orders::ZergUnitMorph; + + player->self->minerals -= morphType.mineralPrice(); + player->self->gas -= morphType.gasPrice(); + + switch(morphType) + { + case UnitTypes::Zerg_Lurker_Egg: + unit->self->type = UnitTypes::Zerg_Lurker_Egg; + break; + + case UnitTypes::Zerg_Devourer: + case UnitTypes::Zerg_Guardian: + unit->self->type = UnitTypes::Zerg_Cocoon; + break; + + default: + unit->self->type = UnitTypes::Zerg_Egg; + break; + } + + unit->self->trainingQueue[unit->self->trainingQueueCount++] = morphType; + } + } + break; + case EventType::Order: + if (unit->getType().isBuilding()) + { + unit->self->order = Orders::IncompleteBuilding; + } + break; + } + } + + break; + + // RLF + case UnitCommandTypes::Move: + unit->self->order = Orders::Move; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + unit->self->isMoving = true; + unit->self->isIdle = false; + break; + + // RLF + case UnitCommandTypes::Patrol: + unit->self->order = Orders::Patrol; + unit->self->isIdle = false; + unit->self->isMoving = true; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + break; + + // RLF + case UnitCommandTypes::Repair: + if (unit->getType() != UnitTypes::Terran_SCV) + { + return; + } + unit->self->order = Orders::Repair; + unit->self->target = getUnitID(target); + unit->self->isIdle = false; + break; + + // RLF + case UnitCommandTypes::Research: + { + TechType techType{ command.extra }; + unit->self->order = Orders::ResearchTech; + unit->self->tech = techType; + unit->self->isIdle = false; + unit->self->remainingResearchTime = techType.researchTime(); + + player->self->minerals -= techType.mineralPrice(); + player->self->gas -= techType.gasPrice(); + player->self->isResearching[techType] = true; + } + break; + + // RLF + case UnitCommandTypes::Return_Cargo: + if (!unit->self->carryResourceType) + return; + + unit->self->order = (unit->isCarryingGas() ? Orders::ReturnGas : Orders::ReturnMinerals); + unit->self->isGathering = true; + unit->self->isIdle = false; + + break; + + // RLF + case UnitCommandTypes::Right_Click_Position: + unit->self->order = Orders::Move; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + unit->self->isMoving = true; + unit->self->isIdle = false; + break; + + // RLF + case UnitCommandTypes::Right_Click_Unit: + unit->self->target = getUnitID(target); + unit->self->isIdle = false; + unit->self->isMoving = true; + + if (unit->getType().isWorker() && target->getType().isMineralField()) + { + unit->self->isGathering = true; + unit->self->order = Orders::MoveToMinerals; + } + else if (unit->getType().isWorker() && target->getType().isRefinery()) + { + unit->self->isGathering = true; + unit->self->order = Orders::MoveToGas; + } + else if (unit->getType().isWorker() && + target->getType().getRace() == Races::Terran && + target->getType().whatBuilds().first == unit->getType() && + !target->isCompleted()) + { + unit->self->order = Orders::ConstructingBuilding; + unit->self->buildUnit = getUnitID(target); + target->self->buildUnit = getUnitID(unit); + unit->self->isConstructing = true; + target->self->isConstructing = true; + } + else if (unit->getType().canAttack() && target->getPlayer() != unit->getPlayer() && !target->getType().isNeutral()) + { + unit->self->order = Orders::AttackUnit; + } + else if(unit->getType().canMove()) + { + unit->self->order = Orders::Follow; + } + + break; + + // RLF + case UnitCommandTypes::Set_Rally_Position: + if (!unit->getType().canProduce()) + return; + + unit->self->order = Orders::RallyPointTile; + unit->self->rallyPositionX = command.x; + unit->self->rallyPositionY = command.y; + unit->self->rallyUnit = -1; + + break; + + // RLF + case UnitCommandTypes::Set_Rally_Unit: + if (!unit->getType().canProduce()) + return; + if (!target || !target->self->exists) + return; + + unit->self->order = Orders::RallyPointUnit; + unit->self->rallyUnit = getUnitID(target); + + break; + + // RLF + case UnitCommandTypes::Siege: + unit->self->order = Orders::Sieging; + break; + + // RLF + case UnitCommandTypes::Stop: + unit->self->order = Orders::Stop; + unit->self->isIdle = true; + break; + + // With train, the game does not take the supply until RLF + 1. + // We just pretend that it happens on RLF. + case UnitCommandTypes::Train: + { + UnitType unitType = command.extra; + + if (!isCurrentFrame) + { + // Happens on RLF, we don't want to duplicate this. + player->self->minerals -= unitType.mineralPrice(); + player->self->gas -= unitType.gasPrice(); + } + + // Happens on RLF + 1, we want to pretend this happens on RLF. + unit->self->trainingQueue[unit->self->trainingQueueCount++] = unitType; + player->self->supplyUsed[unitType.getRace()] += unitType.supplyRequired(); + + // Happens on RLF or RLF + 1, doesn't matter if we do twice + unit->self->isTraining = true; + unit->self->isIdle = false; + unit->self->remainingTrainTime = unitType.buildTime(); + + if (unitType == UnitTypes::Terran_Nuclear_Missile) + { + unit->self->secondaryOrder = Orders::Train; + } + } + + break; + + // RLF + case UnitCommandTypes::Unburrow: + unit->self->order = Orders::Unburrowing; + break; + + // RLF + case UnitCommandTypes::Unload: + unit->self->order = Orders::Unload; + unit->self->target = getUnitID(target); + break; + + // RLF + case UnitCommandTypes::Unload_All: + if (unit->getType() == UnitTypes::Terran_Bunker) + { + unit->self->order = Orders::Unload; + } + else + { + unit->self->order = Orders::MoveUnload; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + } + + break; + + // RLF + case UnitCommandTypes::Unload_All_Position: + unit->self->order = Orders::MoveUnload; + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + break; + + // RLF + case UnitCommandTypes::Unsiege: + unit->self->order = Orders::Unsieging; + break; + + // RLF + case UnitCommandTypes::Upgrade: + { + UpgradeType upgradeType { command.extra }; + + unit->self->order = Orders::Upgrade; + unit->self->upgrade = upgradeType; + unit->self->isIdle = false; + + const int level = unit->getPlayer()->getUpgradeLevel(upgradeType); + unit->self->remainingUpgradeTime = upgradeType.upgradeTime(level + 1); + + player->self->minerals -= upgradeType.mineralPrice(level + 1); + player->self->gas -= upgradeType.gasPrice(level + 1); + + player->self->isUpgrading[upgradeType] = true; + } + break; + + // RLF + case UnitCommandTypes::Use_Tech: + if (static_cast(command.extra) == TechTypes::Stim_Packs + && unit->self->hitPoints > 10) + { + unit->self->hitPoints -= 10; + unit->self->stimTimer = 17; + } + break; + + // RLF + case UnitCommandTypes::Use_Tech_Position: + { + TechType techType{ command.extra }; + + if (!techType.targetsPosition()) + return; + + unit->self->order = techType.getOrder(); + unit->self->targetPositionX = command.x; + unit->self->targetPositionY = command.y; + unit->self->orderTargetPositionX = command.x; + unit->self->orderTargetPositionY = command.y; + } + + break; + + // RLF + case UnitCommandTypes::Use_Tech_Unit: + { + TechType techType{ command.extra }; + + if (!techType.targetsUnit()) + return; + + unit->self->order = techType.getOrder(); + unit->self->orderTarget = getUnitID(target); + + Position const targetPosition = target->getPosition(); + + unit->self->targetPositionX = targetPosition.x; + unit->self->targetPositionY = targetPosition.y; + unit->self->orderTargetPositionX = targetPosition.x; + unit->self->orderTargetPositionY = targetPosition.y; + + break; + } + } + } +}; diff --git a/3rdparty/bwapilib/BWAPI/Client/CommandType.h b/3rdparty/bwapilib/BWAPI/Client/CommandType.h index 329b2fe..07655b1 100755 --- a/3rdparty/bwapilib/BWAPI/Client/CommandType.h +++ b/3rdparty/bwapilib/BWAPI/Client/CommandType.h @@ -30,4 +30,4 @@ namespace BWAPIC SetRevealAll }; } -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/Event.h b/3rdparty/bwapilib/BWAPI/Client/Event.h index 5cc0f17..d722bcb 100755 --- a/3rdparty/bwapilib/BWAPI/Client/Event.h +++ b/3rdparty/bwapilib/BWAPI/Client/Event.h @@ -11,4 +11,4 @@ namespace BWAPIC int v1; int v2; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/ForceImpl.h b/3rdparty/bwapilib/BWAPI/Client/ForceImpl.h index a4c27a1..5b3b7ee 100755 --- a/3rdparty/bwapilib/BWAPI/Client/ForceImpl.h +++ b/3rdparty/bwapilib/BWAPI/Client/ForceImpl.h @@ -16,4 +16,4 @@ namespace BWAPI virtual std::string getName() const override; virtual Playerset getPlayers() const override; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/GameTable.h b/3rdparty/bwapilib/BWAPI/Client/GameTable.h index e75ff97..f73f508 100755 --- a/3rdparty/bwapilib/BWAPI/Client/GameTable.h +++ b/3rdparty/bwapilib/BWAPI/Client/GameTable.h @@ -27,4 +27,4 @@ namespace BWAPI static const int MAX_GAME_INSTANCES = 8; GameInstance gameInstances[MAX_GAME_INSTANCES]; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/ShapeType.h b/3rdparty/bwapilib/BWAPI/Client/ShapeType.h index 8817cae..7ea8b17 100755 --- a/3rdparty/bwapilib/BWAPI/Client/ShapeType.h +++ b/3rdparty/bwapilib/BWAPI/Client/ShapeType.h @@ -19,4 +19,4 @@ namespace BWAPIC Line }; } -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Client/UnitCommand.h b/3rdparty/bwapilib/BWAPI/Client/UnitCommand.h index 6257dbb..e93f21d 100755 --- a/3rdparty/bwapilib/BWAPI/Client/UnitCommand.h +++ b/3rdparty/bwapilib/BWAPI/Client/UnitCommand.h @@ -17,4 +17,4 @@ namespace BWAPIC int y; int extra; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Color.h b/3rdparty/bwapilib/BWAPI/Color.h index cbd249d..4e4e4ac 100755 --- a/3rdparty/bwapilib/BWAPI/Color.h +++ b/3rdparty/bwapilib/BWAPI/Color.h @@ -71,7 +71,7 @@ namespace BWAPI constexpr Color Purple{ 164 }; /// The default color for Player 5. - constexpr Color Orange{ 179 }; + constexpr Color Orange{ 156 }; /// The default color for Player 6. constexpr Color Brown{ 19 }; diff --git a/3rdparty/bwapilib/BWAPI/Event.h b/3rdparty/bwapilib/BWAPI/Event.h index 6c5c44d..b4534c9 100755 --- a/3rdparty/bwapilib/BWAPI/Event.h +++ b/3rdparty/bwapilib/BWAPI/Event.h @@ -61,4 +61,4 @@ namespace BWAPI EventType::Enum type = EventType::None; bool winner = false; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Input.h b/3rdparty/bwapilib/BWAPI/Input.h index 892cb8c..3312843 100755 --- a/3rdparty/bwapilib/BWAPI/Input.h +++ b/3rdparty/bwapilib/BWAPI/Input.h @@ -248,4 +248,4 @@ namespace BWAPI K_OEM_CLEAR, K_MAX }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/Player.h b/3rdparty/bwapilib/BWAPI/Player.h index 6b6be31..09ff37d 100644 --- a/3rdparty/bwapilib/BWAPI/Player.h +++ b/3rdparty/bwapilib/BWAPI/Player.h @@ -521,14 +521,14 @@ namespace BWAPI /// @returns Sight range of the provided unit type for this player. int sightRange(UnitType unit) const; - /// Retrieves the weapon cooldown of a unit type, taking the player's attack speed - /// upgrades into consideration. + /// Retrieves the ground weapon cooldown of a unit type, taking the player's attack + /// speed upgrades into consideration. /// /// - /// The UnitType to retrieve the damage cooldown for. + /// The UnitType to retrieve the ground damage cooldown for. /// /// - /// @returns Weapon cooldown of the provided unit type for this player. + /// @returns Ground weapon cooldown of the provided unit type for this player. int weaponDamageCooldown(UnitType unit) const; /// Calculates the armor that a given unit type will have, including upgrades. diff --git a/3rdparty/bwapilib/BWAPI/Position.h b/3rdparty/bwapilib/BWAPI/Position.h index f5f5366..7e42d00 100755 --- a/3rdparty/bwapilib/BWAPI/Position.h +++ b/3rdparty/bwapilib/BWAPI/Position.h @@ -66,10 +66,8 @@ namespace BWAPI /// The type being converted to type T. template Point(const Point &pt) : x( static_cast(pt.x) ), y( static_cast(pt.y) ) {} -#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable: 4723 ) -#endif /// A conversion copy constructor to convert positions of different scales to one /// another. /// @@ -80,9 +78,7 @@ namespace BWAPI template explicit Point(const Point &pt) : x(static_cast(FromScale > Scale ? pt.x*(FromScale / Scale) : pt.x / (Scale / FromScale))) , y(static_cast(FromScale > Scale ? pt.y*(FromScale / Scale) : pt.y / (Scale / FromScale))) { } -#ifdef _MSC_VER #pragma warning( pop ) -#endif // Operators /// A convenience for use with if statements to identify if a position is valid. @@ -90,8 +86,8 @@ namespace BWAPI explicit operator bool() const { return this->isValid(); }; bool operator == (const Point &pos) const - { - return std::tie(this->x, this->y) == std::tie(pos.x, pos.y); + { + return this->x == pos.x && this->y == pos.y; }; bool operator != (const Point &pos) const { @@ -102,7 +98,9 @@ namespace BWAPI /// Compares lexicographically the x position, followed by the y position. bool operator < (const Point &position) const { - return std::tie(this->x, this->y) < std::tie(position.x, position.y); + if(this->x == position.x) + return this->y < position.y; + return this->x < position.x; }; inline Point &operator += (const Point &p) @@ -305,12 +303,12 @@ namespace BWAPI /// @see getDistance int getApproxDistance(const Point &position) const { - unsigned int min = abs((int)(this->x - position.x)); - unsigned int max = abs((int)(this->y - position.y)); + unsigned int max = abs((int)(this->x - position.x)); + unsigned int min = abs((int)(this->y - position.y)); if ( max < min ) std::swap(min, max); - if ( min < (max >> 2) ) + if ( min <= (max >> 2) ) return max; unsigned int minCalc = (3*min) >> 3; diff --git a/3rdparty/bwapilib/BWAPI/Unit.h b/3rdparty/bwapilib/BWAPI/Unit.h index 560880a..cd75a29 100644 --- a/3rdparty/bwapilib/BWAPI/Unit.h +++ b/3rdparty/bwapilib/BWAPI/Unit.h @@ -161,8 +161,7 @@ namespace BWAPI /// /// Example /// @code - /// Unitset myUnits = Broodwar->self()->getUnits(); - /// for ( auto u = myUnits.begin(); u != myUnits.end(); ++u ) + /// for ( auto u : Broodwar->self()->getUnits() ) /// { /// if ( u->isFlying() && u->isUnderAttack() ) // implies exists and isCompleted /// { diff --git a/3rdparty/bwapilib/BWAPI/UnitCommand.h b/3rdparty/bwapilib/BWAPI/UnitCommand.h index 121cdcd..e0c93ed 100755 --- a/3rdparty/bwapilib/BWAPI/UnitCommand.h +++ b/3rdparty/bwapilib/BWAPI/UnitCommand.h @@ -95,4 +95,4 @@ namespace BWAPI #endif int extra = 0; }; -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/BWAPI/UnitType.h b/3rdparty/bwapilib/BWAPI/UnitType.h index 2c90c12..5cdf727 100755 --- a/3rdparty/bwapilib/BWAPI/UnitType.h +++ b/3rdparty/bwapilib/BWAPI/UnitType.h @@ -534,25 +534,23 @@ namespace BWAPI /// Retrieves the unit's acceleration amount. /// - /// @returns How fast the unit can accelerate to its top speed. - /// - /// @todo Figure out the units this quantity is measured in. + /// @returns If the value is 1: The unit has fixed or patterned velocity (for example, a + /// hopping Zergling). Otherwise, returns the unit's acceleration measured in N/256 pixels + /// per frame per frame. So a unit with 64 acceleration would take 4 frames to reach 1 + /// pixel per frame. int acceleration() const; - /// Retrieves the unit's halting distance. This determines how fast a unit - /// can stop moving. - /// - /// @returns A halting distance value. + /// Retrieves the unit's halting distance. This is the distance from + /// the unit's destination at which point the unit starts decelerating. /// - /// @todo Figure out the units this quantity is measured in. + /// @returns The unit's halting distance, in 1/256ths of a pixel. int haltDistance() const; - /// Retrieves a unit's turning radius. This determines how fast a unit can - /// turn. - /// - /// @returns A turn radius value. - /// - /// @todo Figure out the units this quantity is measured in. + /// Retrieves a unit's turning rate. This determines how far a unit can + /// rotate in one frame. + /// + /// @returns The units are N/256ths of a circle per frame. So a unit with a turnRadius of 64 + /// can turn a full circle in 4 frames. int turnRadius() const; /// Determines if a unit can train other units. For example, diff --git a/3rdparty/bwapilib/BWAPI/Unitset.h b/3rdparty/bwapilib/BWAPI/Unitset.h index 6a571ce..66f3082 100755 --- a/3rdparty/bwapilib/BWAPI/Unitset.h +++ b/3rdparty/bwapilib/BWAPI/Unitset.h @@ -23,8 +23,6 @@ namespace BWAPI /// return value for BWAPI interface functions that have encountered an error. static const Unitset none; - Unitset() : SetContainer>() {} - Unitset& operator = (const Unitset& other) { clear(); std::copy(other.begin(), other.end(), std::inserter(*this, begin())); diff --git a/3rdparty/bwapilib/BWAPI/WeaponType.h b/3rdparty/bwapilib/BWAPI/WeaponType.h index c81e60a..1202ad6 100755 --- a/3rdparty/bwapilib/BWAPI/WeaponType.h +++ b/3rdparty/bwapilib/BWAPI/WeaponType.h @@ -226,25 +226,22 @@ namespace BWAPI /// @returns Maximum attack range, in pixels. int maxRange() const; - /// Retrieves the inner radius used for splash damage calculations, in pixels. + /// Retrieves the inner radius used for splash damage calculations, in pixels. + /// Units in this area take 100% damage. /// /// @returns Radius of the inner splash area, in pixels. - /// - /// @todo Add damage calculation. int innerSplashRadius() const; - /// Retrieves the middle radius used for splash damage calculations, in pixels. + /// Retrieves the middle radius used for splash damage calculations, in pixels. + /// Units in this area take 50% damage. /// /// @returns Radius of the middle splash area, in pixels. - /// - /// @todo Add damage calculation. int medianSplashRadius() const; /// Retrieves the outer radius used for splash damage calculations, in pixels. + /// Units in this area take 25% damage. /// /// @returns Radius of the outer splash area, in pixels. - /// - /// @todo Add damage calculation. int outerSplashRadius() const; /// Checks if this weapon type can target air units. diff --git a/3rdparty/bwapilib/BulletType.cpp b/3rdparty/bwapilib/BulletType.cpp index 242c9b1..396c391 100755 --- a/3rdparty/bwapilib/BulletType.cpp +++ b/3rdparty/bwapilib/BulletType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Color.cpp b/3rdparty/bwapilib/Color.cpp index 890974c..a86e8b3 100755 --- a/3rdparty/bwapilib/Color.cpp +++ b/3rdparty/bwapilib/Color.cpp @@ -1,6 +1,8 @@ #include #include +#include + typedef unsigned char BYTE; typedef struct tagRGBQUAD { BYTE rgbRed; diff --git a/3rdparty/bwapilib/DamageType.cpp b/3rdparty/bwapilib/DamageType.cpp index a78435f..7aaf237 100755 --- a/3rdparty/bwapilib/DamageType.cpp +++ b/3rdparty/bwapilib/DamageType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Debug.h b/3rdparty/bwapilib/Debug.h new file mode 100644 index 0000000..d21673d --- /dev/null +++ b/3rdparty/bwapilib/Debug.h @@ -0,0 +1,12 @@ +#pragma once +#ifdef _DEBUG +#define _CRTDBG_MAP_ALLOC +#include +#include + +#ifndef DEBUG_NEW +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#define new DEBUG_NEW +#endif +#endif + diff --git a/3rdparty/bwapilib/Error.cpp b/3rdparty/bwapilib/Error.cpp index 0c28718..484cc11 100755 --- a/3rdparty/bwapilib/Error.cpp +++ b/3rdparty/bwapilib/Error.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Event.cpp b/3rdparty/bwapilib/Event.cpp index df18352..33ecbab 100755 --- a/3rdparty/bwapilib/Event.cpp +++ b/3rdparty/bwapilib/Event.cpp @@ -2,6 +2,8 @@ #include #include +#include + namespace BWAPI { namespace { std::string emptyString; } @@ -272,4 +274,4 @@ namespace BWAPI this->winner = isWinner; return *this; } -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/ExplosionType.cpp b/3rdparty/bwapilib/ExplosionType.cpp index 0a59107..61d5ff5 100755 --- a/3rdparty/bwapilib/ExplosionType.cpp +++ b/3rdparty/bwapilib/ExplosionType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/GameType.cpp b/3rdparty/bwapilib/GameType.cpp index bd685f3..72dd218 100755 --- a/3rdparty/bwapilib/GameType.cpp +++ b/3rdparty/bwapilib/GameType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Order.cpp b/3rdparty/bwapilib/Order.cpp index d2ccd3e..cf4f549 100755 --- a/3rdparty/bwapilib/Order.cpp +++ b/3rdparty/bwapilib/Order.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Player.cpp b/3rdparty/bwapilib/Player.cpp index 4045718..0603a17 100755 --- a/3rdparty/bwapilib/Player.cpp +++ b/3rdparty/bwapilib/Player.cpp @@ -115,23 +115,23 @@ char PlayerInterface::getTextColor() const { switch ( this->getColor() ) { - case 111: // red + case Colors::Red: return Text::BrightRed; - case 165: // blue + case Colors::Blue: return Text::Blue; - case 159: // teal + case Colors::Teal: return Text::Teal; - case 164: // purp + case Colors::Purple: return Text::Purple; - case 179: // oj + case Colors::Orange: return Text::Orange; - case 19: // brown + case Colors::Brown: return Text::Brown; - case 84: // white + case Colors::White: return Text::PlayerWhite; - case 135: // yellow + case Colors::Yellow: return Text::PlayerYellow; - case 185: // green p9 + case Colors::Green: return Text::DarkGreen; case 136: // p10 return Text::LightYellow; @@ -160,4 +160,4 @@ bool PlayerInterface::hasUnitTypeRequirement(UnitType unit, int amount) const default: return completedUnitCount(unit) >= amount; } -} +} \ No newline at end of file diff --git a/3rdparty/bwapilib/PlayerType.cpp b/3rdparty/bwapilib/PlayerType.cpp index df36629..edfcd6e 100755 --- a/3rdparty/bwapilib/PlayerType.cpp +++ b/3rdparty/bwapilib/PlayerType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/Race.cpp b/3rdparty/bwapilib/Race.cpp index 7fbad58..c1d94b6 100755 --- a/3rdparty/bwapilib/Race.cpp +++ b/3rdparty/bwapilib/Race.cpp @@ -2,6 +2,8 @@ #include #include +#include + namespace BWAPI { // NAMES diff --git a/3rdparty/bwapilib/TechType.cpp b/3rdparty/bwapilib/TechType.cpp index 39342e1..8b7d558 100755 --- a/3rdparty/bwapilib/TechType.cpp +++ b/3rdparty/bwapilib/TechType.cpp @@ -5,6 +5,8 @@ #include #include +#include + namespace BWAPI { // NAMES diff --git a/3rdparty/bwapilib/Unit.cpp b/3rdparty/bwapilib/Unit.cpp index 338d97b..1c2d4d8 100755 --- a/3rdparty/bwapilib/Unit.cpp +++ b/3rdparty/bwapilib/Unit.cpp @@ -94,27 +94,20 @@ namespace BWAPI return std::numeric_limits::max(); /////// Compute distance - - // retrieve left/top/right/bottom values for calculations - int left = target.x - 1; - int top = target.y - 1; - int right = target.x + 1; - int bottom = target.y + 1; - // compute x distance - int xDist = this->getLeft() - right; + int xDist = this->getLeft() - target.x; if (xDist < 0) { - xDist = left - this->getRight(); + xDist = target.x - (this->getRight() + 1); if (xDist < 0) xDist = 0; } // compute y distance - int yDist = this->getTop() - bottom; + int yDist = this->getTop() - target.y; if (yDist < 0) { - yDist = top - this->getBottom(); + yDist = target.y - (this->getBottom() + 1); if (yDist < 0) yDist = 0; } diff --git a/3rdparty/bwapilib/UnitCommand.cpp b/3rdparty/bwapilib/UnitCommand.cpp index 814d4ef..038e8c0 100755 --- a/3rdparty/bwapilib/UnitCommand.cpp +++ b/3rdparty/bwapilib/UnitCommand.cpp @@ -4,6 +4,8 @@ #include #include +#include + namespace BWAPI { UnitCommand::UnitCommand(Unit _unit, UnitCommandType _type, Unit _target, int _x, int _y, int _extra) diff --git a/3rdparty/bwapilib/UnitCommandType.cpp b/3rdparty/bwapilib/UnitCommandType.cpp index 1f9164d..d2c15ea 100755 --- a/3rdparty/bwapilib/UnitCommandType.cpp +++ b/3rdparty/bwapilib/UnitCommandType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/UnitSizeType.cpp b/3rdparty/bwapilib/UnitSizeType.cpp index 5861051..ea5cc97 100755 --- a/3rdparty/bwapilib/UnitSizeType.cpp +++ b/3rdparty/bwapilib/UnitSizeType.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/UnitType.cpp b/3rdparty/bwapilib/UnitType.cpp index 21be5e3..84d7ca2 100755 --- a/3rdparty/bwapilib/UnitType.cpp +++ b/3rdparty/bwapilib/UnitType.cpp @@ -10,6 +10,8 @@ #include #include +#include + namespace BWAPI { // NAMES diff --git a/3rdparty/bwapilib/UpgradeType.cpp b/3rdparty/bwapilib/UpgradeType.cpp index 06e688f..5a49267 100755 --- a/3rdparty/bwapilib/UpgradeType.cpp +++ b/3rdparty/bwapilib/UpgradeType.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace BWAPI { template <> diff --git a/3rdparty/bwapilib/WeaponType.cpp b/3rdparty/bwapilib/WeaponType.cpp index 5a00f36..aaa2e04 100755 --- a/3rdparty/bwapilib/WeaponType.cpp +++ b/3rdparty/bwapilib/WeaponType.cpp @@ -6,6 +6,8 @@ #include #include +#include + namespace BWAPI { // NAMES diff --git a/3rdparty/bwapilib/starcraftver.h b/3rdparty/bwapilib/starcraftver.h new file mode 100644 index 0000000..39e4740 --- /dev/null +++ b/3rdparty/bwapilib/starcraftver.h @@ -0,0 +1,21 @@ +#ifndef STARCRAFT_VER +#define STARCRAFT_VER "1.16.1" + +#define SC_VER_1 1 +#define SC_VER_2 16 +#define SC_VER_3 1 +#define SC_VER_4 1 + +// NOTE: SC_VER_4 is variable, depending on where the user obtained Starcraft (i.e. digital download vs CD) + +#ifdef _DEBUG + #define BUILD_STR "DEBUG" + #define BUILD_DEBUG 1 +#else + #define BUILD_STR "RELEASE" + #define BUILD_DEBUG 0 +#endif + +#define BWAPI_VER "4.4.0" +#define BWAPI_HOME_URL "http://bwapi.github.io/" +#endif diff --git a/3rdparty/bwapilib/svnrev.h b/3rdparty/bwapilib/svnrev.h new file mode 100644 index 0000000..fb76d09 --- /dev/null +++ b/3rdparty/bwapilib/svnrev.h @@ -0,0 +1,5 @@ +#pragma once +static const int SVN_REV = 5016; + +#include "starcraftver.h" +