Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
autumn_rrs
autumn_agent_2023
Commits
f9623601
Commit
f9623601
authored
Nov 03, 2023
by
k20066
Browse files
refactoring FBAllocator
parent
a6504720
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/autumn_2023/module/complex/CentralizedControlFBAllocator.java
View file @
f9623601
...
...
@@ -160,25 +160,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
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
->
{
MessageCivilian
mesciv
=
(
MessageCivilian
)
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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment