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
Hide whitespace changes
Inline
Side-by-side
src/main/java/autumn_2023/module/complex/CentralizedControlFBAllocator.java
View file @
f9623601
...
@@ -159,25 +159,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
...
@@ -159,25 +159,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
@Override
@Override
public
FireTargetAllocator
updateInfo
(
MessageManager
messageManager
)
{
public
FireTargetAllocator
updateInfo
(
MessageManager
messageManager
)
{
super
.
updateInfo
(
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
()
Set
<
EntityID
>
recievetasks
=
messageManager
.
getReceivedMessageList
(
MessageCivilian
.
class
).
stream
()
.
map
(
e
->
{
.
map
(
e
->
{
...
@@ -203,17 +184,14 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
...
@@ -203,17 +184,14 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
(
mesfb
.
getAction
()
==
MessageFireBrigade
.
ACTION_RESCUE
)
?
false
:
true
,
this
.
agentInfo
.
getTime
());
(
mesfb
.
getAction
()
==
MessageFireBrigade
.
ACTION_RESCUE
)
?
false
:
true
,
this
.
agentInfo
.
getTime
());
}
}
List
<
CommunicationMessage
>
reportlist
=
messageManager
.
getReceivedMessageList
(
MessageReport
.
class
);
List
<
EntityID
>
reportlist
=
messageManager
.
getReceivedMessageList
(
MessageReport
.
class
).
stream
()
for
(
CommunicationMessage
mes
:
reportlist
){
.
map
(
MessageReport
.
class
::
cast
)
MessageReport
report
=
(
MessageReport
)
mes
;
.
filter
(
MessageReport:
:
isDone
)
EntityID
targetID
=
report
.
getFromID
();
.
map
(
MessageReport:
:
getFromID
)
//System.out.println("[FBCenter] report time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" fbID:"+senderID+" tagID:"+targetID);
.
collect
(
Collectors
.
toList
());
boolean
done
=
report
.
isDone
();
if
(
done
)
{
this
.
finishEntityIDs
.
addAll
(
reportlist
);
this
.
finishEntityIDs
.
add
(
targetID
);
this
.
taskSet
.
removeAll
(
reportlist
);
this
.
taskSet
.
remove
(
targetID
);
}
}
return
this
;
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