Browse Source

Bitvectors use int not long for mb

combat-2
MagicBot 7 months ago
parent
commit
79079e200a
  1. 4
      src/engine/mbEnums.java
  2. 4
      src/engine/objects/ItemTemplate.java
  3. 4
      src/engine/objects/Mob.java
  4. 6
      src/engine/objects/MobBase.java

4
src/engine/mbEnums.java

@ -44,7 +44,7 @@ public class mbEnums { @@ -44,7 +44,7 @@ public class mbEnums {
return bitvector;
}
public static <E extends java.lang.Enum<E>> EnumSet<E> fromLong(long bitVector, Class<E> enumClass) {
public static <E extends java.lang.Enum<E>> EnumSet<E> fromInt(int bitVector, Class<E> enumClass) {
// Bitvector -> EnumSet without the EnumBitvector dependency
@ -56,7 +56,7 @@ public class mbEnums { @@ -56,7 +56,7 @@ public class mbEnums {
return enumSet;
for (E enumValue : enumClass.getEnumConstants()) {
if ((bitVector & (1L << enumValue.ordinal())) != 0) {
if ((bitVector & (1 << enumValue.ordinal())) != 0) {
enumSet.add(enumValue);
}
}

4
src/engine/objects/ItemTemplate.java

@ -502,11 +502,11 @@ public class ItemTemplate { @@ -502,11 +502,11 @@ public class ItemTemplate {
int group_tactics_bitvector = jsonObject.getInt("rune_group_tactics");
rune_group_tactics.addAll(mbEnums.fromLong(group_tactics_bitvector, mbEnums.MobBehaviourType.class));
rune_group_tactics.addAll(mbEnums.fromInt(group_tactics_bitvector, mbEnums.MobBehaviourType.class));
int group_role_bitvector = jsonObject.getInt("rune_group_role_set");
rune_group_role_set.addAll(mbEnums.fromLong(group_role_bitvector, mbEnums.MobBehaviourType.class));
rune_group_role_set.addAll(mbEnums.fromInt(group_role_bitvector, mbEnums.MobBehaviourType.class));
JSONArray enemy_types_json = jsonObject.getJSONArray("rune_enemy_monster_types");

4
src/engine/objects/Mob.java

@ -143,8 +143,8 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { @@ -143,8 +143,8 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
this.runeSet = rs.getInt("runeSet");
this.bootySet = rs.getInt("bootySet");
this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class);
this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class);
this.notEnemy = mbEnums.fromInt(rs.getInt("notEnemy"), mbEnums.MonsterType.class);
this.enemy = mbEnums.fromInt(rs.getInt("enemy"), mbEnums.MonsterType.class);
this.firstName = rs.getString("mob_name");
if (rs.getString("fsm").length() > 1)

6
src/engine/objects/MobBase.java

@ -77,9 +77,9 @@ public class MobBase extends AbstractGameObject { @@ -77,9 +77,9 @@ public class MobBase extends AbstractGameObject {
this.fsm = mbEnums.MobBehaviourType.valueOf(rs.getString("fsm"));
this.flags = mbEnums.fromLong(rs.getLong("flags"), mbEnums.MobFlagType.class);
this.notEnemy = mbEnums.fromLong(rs.getLong("notEnemy"), mbEnums.MonsterType.class);
this.enemy = mbEnums.fromLong(rs.getLong("enemy"), mbEnums.MonsterType.class);
this.flags = mbEnums.fromInt(rs.getInt("flags"), mbEnums.MobFlagType.class);
this.notEnemy = mbEnums.fromInt(rs.getInt("notEnemy"), mbEnums.MonsterType.class);
this.enemy = mbEnums.fromInt(rs.getInt("enemy"), mbEnums.MonsterType.class);
this.seeInvis = rs.getInt("seeInvis");
this.scale = rs.getFloat("scale");

Loading…
Cancel
Save