- Various little fixes to the TAS software
- Added a sync command for synchronizing a simulation server with the master server.
This commit is contained in:
20
simcter.c
20
simcter.c
@@ -50,7 +50,7 @@
|
||||
A SIMCOUNTER HAS a BUILT IN FAILURE RATE OF 10% FOR TESTING ERROR HANDLING
|
||||
CODE. A negative failure rate means absolute success.
|
||||
*/
|
||||
#define FAILRATE 0.05
|
||||
static float FAILRATE;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static float SimRandom(void)
|
||||
{
|
||||
@@ -147,6 +147,11 @@
|
||||
pSim->lEnd = 0;
|
||||
}
|
||||
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
@@ -195,6 +200,11 @@
|
||||
|
||||
pSim->iPause = 0;
|
||||
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
@@ -212,6 +222,11 @@
|
||||
pSim = (SimSt *)self->pData;
|
||||
assert(pSim);
|
||||
|
||||
if(FAILRATE < .0)
|
||||
{
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
if(SimRandom() < FAILRATE)
|
||||
{
|
||||
return HWFault;
|
||||
@@ -295,7 +310,7 @@
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
pCounterDriver NewSIMCounter(char *name)
|
||||
pCounterDriver NewSIMCounter(char *name, float fFail)
|
||||
{
|
||||
pCounterDriver pRes = NULL;
|
||||
SimSt *pData = NULL;
|
||||
@@ -335,6 +350,7 @@
|
||||
pRes->Get = SIMGet;
|
||||
pRes->Send = SIMSend;
|
||||
|
||||
FAILRATE = fFail;
|
||||
return pRes;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user