Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnitTypes in training queues are not matching static unit types #26

Open
Bytekeeper opened this issue May 22, 2016 · 0 comments
Open

UnitTypes in training queues are not matching static unit types #26

Bytekeeper opened this issue May 22, 2016 · 0 comments
Assignees
Labels

Comments

@Bytekeeper
Copy link

This simple example for Protoss builds a probe and checks if the unit type in the training queue is actually a probe. It's toString() returns probe but it is another object:

import bwapi.*;

public class UnitTypeBug extends DefaultBWListener {
    private Mirror mirror = new Mirror();
    private Game game;
    private Player self;

    public void run() {
        mirror.getModule().setEventListener(this);
        mirror.startGame();
    }

    @Override
    public void onStart() {
        game = mirror.getGame();
        self = game.self();
    }

    @Override
    public void onFrame() {
        for (Unit u: self.getUnits()) {
            if (!u.getTrainingQueue().isEmpty()) {
                if (u.getTrainingQueue().get(0) != UnitType.Protoss_Probe) {
                    System.err.println("Unit type mismatch");
                }
            }
            if (!u.isTraining() || u.canTrain(UnitType.Protoss_Probe)) {
                u.train(UnitType.Protoss_Probe);
            }
        }
    }

    public static void main(String[] args) {
        new UnitTypeBug().run();
    }
}

It should not print "Unit type mismatch", but it does,

@vjurenka vjurenka self-assigned this Nov 19, 2017
@vjurenka vjurenka added the bug label Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants