-2

Am I going crazy or something, or do I need more sleep... can annyone offer a second set of eyes please?

boolean slotTypeMatch = false;
System.out.println("waiType: " + waiType);
if (waiType.equals("W")){

} else if(waiType.equals("A")){
    itemFilename = MyServer.armorMap.get(waiId).getFilename();
    System.out.println("endContainerSlot: " + endContainerSlot + ", getSlot: " + MyServer.weaponMap.get(waiId).getSlot());
    if (endContainerSlot == MyServer.armorMap.get(waiId).getSlot()){
        System.out.println("WHY DONT I MAKE IT HERE!!!!");
        slotTypeMatch = true;
    }
}
System.out.println("itemFilename: " + itemFilename);
System.out.println("slotTypeMatch: " + slotTypeMatch);
if (slotTypeMatch){
    //not making it here, I must be going insane

And here is my console output... I can't figure this out for the life of me...

waiType: A 
endContainerSlot: 1, getSlot: 1
itemFilename: images/armor/armor_tunic.png 
slotTypeMatch: false

Edit they are both int

int endContainerSlot - com.jayavon.game.server.MyCommandHandler.run()
int com.jayavon.game.actualgame.Armor.getSlot()
4

3 回答 3

6

你输出MyServer.weaponMap,但你正在endContainerSlot比较MyServer.armorMap。我认为您想进行比较,weaponMap或者您正在进行正确的比较,但在输出中查看了错误的地图。

于 2013-04-29T04:50:45.953 回答
3

MyServer.armorMap & MyServer.weaponMap is different. I think you should update your code and get some sleep. :)

if (endContainerSlot == MyServer.weaponMap.get(waiId).getSlot()){...}
于 2013-04-29T04:52:21.617 回答
3
System.out.println("endContainerSlot: " + endContainerSlot + ", getSlot: " + MyServer.weaponMap.get(waiId).getSlot());
if (endContainerSlot == MyServer.armorMap.get(waiId).getSlot()){
    System.out.println("WHY DONT I MAKE IT HERE!!!!");
    slotTypeMatch = true;
}

你在这里比较不同的地图,armorMap vs WeaponMap,我认为这是你的问题......

于 2013-04-29T04:51:11.867 回答