Commit f9623601 authored by k20066's avatar k20066
Browse files

refactoring FBAllocator

parent a6504720
......@@ -159,25 +159,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
@Override
public FireTargetAllocator updateInfo(MessageManager messageManager) {
super.updateInfo(messageManager);
/*List<CommunicationMessage> mescivlist = messageManager.getReceivedMessageList(MessageCivilian.class);
for(CommunicationMessage mes : mescivlist){
MessageCivilian mesciv = (MessageCivilian) mes;
StandardMessagePriority level = mesciv.getSendingPriority();
//if(level != StandardMessagePriority.HIGH) continue;
MessageUtil.reflectMessage(this.worldInfo, mesciv);
//boolean mdc = (mesciv instanceof MessageDamageCivilian);
//if(!(mesciv instanceof MessageDamageCivilian)) continue;
EntityID civID = mesciv.getAgentID();
StandardEntity civ = this.worldInfo.getEntity(civID);
if(!this.isNeedRescueHuman(civ)) continue;
if(finishEntityIDs.contains(civID)) continue;
EntityID buildingID = mesciv.getPosition();
//int time = this.agentInfo.getTime();
//System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" civID:"+civID+" buildingID:"+buildingID+" size:"+mesciv.getByteArraySize()+" mdc:"+mdc);
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" civID:"+civID+" buildingID:"+buildingID+" size:"+mesciv.getByteArraySize()+" isNeedRescueHuman:"+this.isNeedRescueHuman(civ));
this.taskSet.add(civID);
}*/
Set<EntityID> recievetasks = messageManager.getReceivedMessageList(MessageCivilian.class).stream()
.map(e -> {
......@@ -203,17 +184,14 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
(mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime());
}
List<CommunicationMessage> reportlist = messageManager.getReceivedMessageList(MessageReport.class);
for(CommunicationMessage mes : reportlist){
MessageReport report = (MessageReport) mes;
EntityID targetID = report.getFromID();
//System.out.println("[FBCenter] report time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" fbID:"+senderID+" tagID:"+targetID);
boolean done = report.isDone();
if(done) {
this.finishEntityIDs.add(targetID);
this.taskSet.remove(targetID);
}
}
List<EntityID> reportlist = messageManager.getReceivedMessageList(MessageReport.class).stream()
.map(MessageReport.class::cast)
.filter(MessageReport::isDone)
.map(MessageReport::getFromID)
.collect(Collectors.toList());
this.finishEntityIDs.addAll(reportlist);
this.taskSet.removeAll(reportlist);
return this;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment