Git Product home page Git Product logo

Comments (7)

dgant avatar dgant commented on July 30, 2024 2

If you need a handy ID -> type lookup while debugging you can use https://docs.google.com/spreadsheets/d/1jlYDkXW2pQey1oGJlQRBiGjdMs0kfrdHAwzVI2zAjrU/edit

from bwapi.

Diamondemon avatar Diamondemon commented on July 30, 2024 1

It's good to know for anyone using the debugger to find the reason of their bug.

I found the actual problem in my recruitment process elsewhere, so yeah, I was misled.

I'm closing this since the issue is not relevant for the BWAPI. Thanks for your dedication.

from bwapi.

dgant avatar dgant commented on July 30, 2024

You can not "train" a Barracks. You can only "build" a Barracks because it is a building.
Expected values:

someSCV->canTrain(Terran_Barracks) == false
someSCV->canBuild(Terran_Barracks) == true
someBarracks->canTrain(Terran_Marine) == true
someBarracks->canBuild(Terran_Marine) == false

from bwapi.

Diamondemon avatar Diamondemon commented on July 30, 2024

Wait, I may have been not specific enough on my question:

This is what I have so far with my tests:

someBarracks->canTrain(Terran_Marine) == true
someBarracks->canTrain() == false
someCommandCenter->canTrain(Terran_Marine) == true

Is that normal?

Otherwise @dgant that is how I understood it so far, yes

from bwapi.

dgant avatar dgant commented on July 30, 2024

canTrain() can return false depending on the state of the unit at the time you invoke it. For example, incomplete or floating Barracks can not train units. You can't train a Marine if you have no minerals. See

static inline bool canTrain(Unit thisUnit, bool checkCommandibility = true)
for the full considerations.

As for your Command Center, I suspect the most likely cause is the variable you think is referring to a Command Center actually referring to a Barracks. A bug of this nature seems very unlikely. I would double check the identity of the unit to be sure.

from bwapi.

Diamondemon avatar Diamondemon commented on July 30, 2024

I'm surprised myself, to be honest.

Here is what my debugger says, when the onUnitComplete(BWAPI::Unit unit) event is called (so all following tests are done in the same scope)

unit->getType() == 106
unit->canTrain(BWAPI::UnitTypes::Terran_Marine, true, true) == true
unit->canTrain(true) == false

I think unit with id 106 is the Terran_Command_Center, am I wrong?

from bwapi.

Diamondemon avatar Diamondemon commented on July 30, 2024

I get two different outputs when evaluating the functions in the debugger or in the code itself.

The output of my debugger is still the same, however here is what is done in my code:

std::cout << "Unit of type " << unit->getType() << "; can train Marine? " << unit->canTrain(BWAPI::UnitTypes::Terran_Marine) << "; can train? " << unit->canTrain() << std::endl;

Outputs

Unit of type Terran_Command_Center; can train Marine? 0; can train? 1

from bwapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.