mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-03-05 23:20:32 +07:00
Created constants for invalid component and mode
These values will never be set internally and are used as return checks
This commit is contained in:
parent
6a904f7131
commit
f93b44fb9c
@ -51,6 +51,9 @@ public class Engine {
|
||||
return KEYFRAME_NAME[keyframe];
|
||||
}
|
||||
|
||||
public static final int INVALID_COMPONENT = -1;
|
||||
public static final int INVALID_MODE = -1;
|
||||
|
||||
public static final class Object {
|
||||
public static final int SUBCLASS_SHRINE = 1 << 0; // displays "<shrine_type> Shrine"
|
||||
public static final int SUBCLASS_OBELISH = 1 << 1; // does nothing
|
||||
|
@ -37,7 +37,7 @@ public class Actioneer extends PassiveSystem {
|
||||
final Class.Type type = mClass.get(entityId).type;
|
||||
byte mode = (byte) type.getMode(skill.anim);
|
||||
log.trace("mode: {}", mode);
|
||||
if (mode == -1) { // TODO: replace -1 with some const INVALID_SKILL
|
||||
if (mode == Engine.INVALID_MODE) {
|
||||
mode = (byte) type.getMode("SC");
|
||||
log.trace("mode changed to {} because it was invalid", mode);
|
||||
}
|
||||
|
@ -2,9 +2,12 @@ package com.riiablo.engine.server.component;
|
||||
|
||||
import com.artemis.Component;
|
||||
import com.artemis.annotations.PooledWeaver;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.codec.COFD2;
|
||||
import com.riiablo.engine.Engine;
|
||||
|
||||
@PooledWeaver
|
||||
public class Class extends Component {
|
||||
@ -86,7 +89,7 @@ public class Class extends Component {
|
||||
}
|
||||
|
||||
public int getMode(String mode) {
|
||||
return MODES.get(mode.toLowerCase(), -1);
|
||||
return MODES.get(mode.toLowerCase(), Engine.INVALID_MODE);
|
||||
}
|
||||
|
||||
public String getMode(byte mode) {
|
||||
@ -94,7 +97,7 @@ public class Class extends Component {
|
||||
}
|
||||
|
||||
public int getComponent(String comp) {
|
||||
return COMPS.get(comp.toLowerCase(), -1);
|
||||
return COMPS.get(comp.toLowerCase(), Engine.INVALID_COMPONENT);
|
||||
}
|
||||
|
||||
public static Type valueOf(int i) {
|
||||
|
Loading…
Reference in New Issue
Block a user