Gate radio intel behind configurable site discovery; record Workshop 0.0.119
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -17,7 +17,7 @@ def cpp(s):
|
||||
s=s.replace('OnTick().Remove(ERR_FlushDiscoveryFeedback);','OnTick().Remove(0);')
|
||||
s=s.replace('string.Format(', 'Format(')
|
||||
return s
|
||||
methods='\n'.join(cpp(body(P,s)) for s in ('protected void ERR_QueueDiscoveryFeedback(', 'protected void ERR_FlushDiscoveryFeedback(', 'protected void ERR_ReceiveDiscoveryFeedback(', 'protected void ERR_StopDiscoveryFeedback(', 'void ERR_IntelExhausted('))
|
||||
methods='\n'.join(cpp(body(P,s)) for s in ('protected void ERR_QueueDiscoveryFeedback(', 'protected void ERR_FlushDiscoveryFeedback(', 'protected void ERR_ReceiveDiscoveryFeedback(', 'protected void ERR_StopDiscoveryFeedback(', 'void ERR_IntelExhausted(', 'void ERR_RadioIntelWaiting('))
|
||||
run(r'''
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
@@ -44,7 +44,7 @@ struct ERR_GameMode {
|
||||
static ERR_GameMode* current;static ERR_GameMode* Get(){return current;}
|
||||
bool active=true;int phase=ERR_Phase::RADIO_SEARCH;bool Active(){return active;}int Phase(){return phase;}World* GetWorld(){return &world;}
|
||||
Map<ERR_LocationComponent*,int> m_ERRIntelSeen,m_ERRIntelPending;
|
||||
float m_ERRIntelMessageAt=0,m_ERRIntelExhaustedAt=0;bool m_ERRIntelFeedbackStopped=false,m_ERRIntelDuplicateReported=false,m_ERRIntelExhaustionReported=false;int m_ERRIntelMessageSequence=0,m_ERRIntelReceivedSequence=0;
|
||||
float m_ERRIntelMessageAt=0,m_ERRIntelExhaustedAt=0;bool m_ERRRadioIntelWaitingReported=false,m_ERRIntelFeedbackStopped=false,m_ERRIntelDuplicateReported=false,m_ERRIntelExhaustionReported=false;int m_ERRIntelMessageSequence=0,m_ERRIntelReceivedSequence=0;
|
||||
Events discovered,tick;Events& OnLocationDiscovered(){return discovered;}Events& OnTick(){return tick;}
|
||||
int rpcCount=0;void Rpc(int sequence,string message){rpcCount++;ERR_ReceiveDiscoveryFeedback(sequence,message);}
|
||||
'''+methods+r'''
|
||||
@@ -99,6 +99,12 @@ int main(){
|
||||
surplus.ERR_StopDiscoveryFeedback();surplus.ERR_IntelExhausted();assert(surplus.rpcCount==3);
|
||||
ERR_GameMode freshRound;ERR_GameMode::current=&freshRound;world.time=0;freshRound.ERR_IntelExhausted();assert(freshRound.rpcCount==1);
|
||||
|
||||
// Fixed-document waiting feedback is once per round, regardless of scan count.
|
||||
ERR_GameMode held;ERR_GameMode::current=&held;
|
||||
for(int i=0;i<100;i++)held.ERR_RadioIntelWaiting();
|
||||
assert(held.rpcCount==1&&held.m_ERRIntelMessageSequence==1);
|
||||
ERR_GameMode stopped;ERR_GameMode::current=&stopped;stopped.ERR_StopDiscoveryFeedback();stopped.ERR_RadioIntelWaiting();assert(stopped.rpcCount==0);
|
||||
ERR_GameMode client;ERR_GameMode::current=&client;Replication::server=false;client.ERR_RadioIntelWaiting();assert(client.rpcCount==0);
|
||||
}
|
||||
''')
|
||||
for required in ('OnLocationDiscovered().Insert(ERR_QueueDiscoveryFeedback)', 'OnTick().Insert(ERR_FlushDiscoveryFeedback)', 'OnStop().Insert(ERR_StopDiscoveryFeedback)', '[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]'):
|
||||
|
||||
Reference in New Issue
Block a user