Fixes
Acutally fix duplicate ".. entered battle" message bug. Fix potential crash bug.
This commit is contained in:
parent
967fed3164
commit
00961768b3
2 changed files with 61 additions and 18 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.seodisparate.TurnBasedMinecraft.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -165,6 +166,8 @@ public class BattleGui extends GuiScreen
|
|||
case ATTACK_TARGET:
|
||||
info = "Who will you attack?";
|
||||
int y = 30;
|
||||
try
|
||||
{
|
||||
for(Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle().getSideAEntrySet())
|
||||
{
|
||||
if(e.getValue().entity != null)
|
||||
|
@ -177,7 +180,13 @@ public class BattleGui extends GuiScreen
|
|||
}
|
||||
y += 20;
|
||||
}
|
||||
} catch (ConcurrentModificationException e)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
y = 30;
|
||||
try
|
||||
{
|
||||
for(Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle().getSideBEntrySet())
|
||||
{
|
||||
if(e.getValue().entity != null)
|
||||
|
@ -190,7 +199,11 @@ public class BattleGui extends GuiScreen
|
|||
}
|
||||
y += 20;
|
||||
}
|
||||
buttonList.add(new GuiButton(ButtonAction.CANCEL.getValue(), width/2 - 40, height - 120, 80, 20, "Cancel"));
|
||||
} catch (ConcurrentModificationException e)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
buttonList.add(new GuiButton(ButtonAction.CANCEL.getValue(), width/2 - 30, height - 120, 60, 20, "Cancel"));
|
||||
break;
|
||||
case ITEM_ACTION:
|
||||
info = "What will you do with an item?";
|
||||
|
|
|
@ -256,11 +256,41 @@ public class Battle
|
|||
|
||||
public boolean hasCombatant(int entityID)
|
||||
{
|
||||
synchronized(sideAEntryQueue)
|
||||
{
|
||||
for(Combatant c : sideAEntryQueue)
|
||||
{
|
||||
if(c.entity.getEntityId() == entityID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
synchronized(sideBEntryQueue)
|
||||
{
|
||||
for(Combatant c : sideBEntryQueue)
|
||||
{
|
||||
if(c.entity.getEntityId() == entityID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sideA.containsKey(entityID) || sideB.containsKey(entityID);
|
||||
}
|
||||
|
||||
public boolean hasCombatantInSideA(int entityID)
|
||||
{
|
||||
synchronized(sideAEntryQueue)
|
||||
{
|
||||
for(Combatant c : sideAEntryQueue)
|
||||
{
|
||||
if(c.entity.getEntityId() == entityID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sideA.containsKey(entityID);
|
||||
}
|
||||
|
||||
|
@ -775,7 +805,7 @@ public class Battle
|
|||
{
|
||||
turnOrderQueue.add(c);
|
||||
}
|
||||
update(0);
|
||||
return update(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue