Example usage for com.badlogic.gdx.utils ObjectIntMap entries

List of usage examples for com.badlogic.gdx.utils ObjectIntMap entries

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils ObjectIntMap entries.

Prototype

public Entries<K> entries() 

Source Link

Document

Returns an iterator for the entries in the map.

Usage

From source file:com.vlaaad.dice.achievements.conditions.imp.MaxUsedDice.java

License:Open Source License

@Override
protected boolean satisfied(EndLevelEvent event) {
    ObjectSet<Creature> creatures = event.result().viewer.creatures;
    if (maxCount != -1) {
        return creatures.size <= maxCount;
    }/*w  w w . ja v  a 2s.c o m*/
    ObjectIntMap<ProfessionDescription> used = tmp;
    for (Creature c : creatures) {
        used.getAndIncrement(c.profession, 0, 1);
    }
    for (ObjectIntMap.Entry<ProfessionDescription> entry : used.entries()) {
        ProfessionDescription profession = entry.key;
        int count = entry.value;
        int maxCount = maxes.get(profession, 0);
        if (count > maxCount) {
            tmp.clear();
            return false;
        }
    }
    tmp.clear();
    return true;
}