Скачиваний:
16
Добавлен:
01.05.2014
Размер:
1.67 Кб
Скачать
// WriteStates.cpp: implementation of the CWriteStates class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "WriteStates.h"
#include ".\Shot\ChainShot.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
LArc TT_WriteStates[] = {
	LArc("ws", "w0", "x1",	"y1"),	//
	LArc("w0", "w0", "^x2",	"y2"),	//
	LArc("w0", "00", "x2",	"y3"),	//
	LArc()
	};


CWriteStates::CWriteStates()
	:LFsaAppl(TT_WriteStates, "WriteStates")
{
	strNameFile = "ChainShot_States.txt";
	lCurrentSteps=0; 
	pCChainShot = NULL;

}

CWriteStates::~CWriteStates() { }

int CWriteStates::x1() { return pCChainShot!=NULL; }
int CWriteStates::x2() { return string(pCChainShot->pCOfficer->FGetState())=="сон"; }

void CWriteStates::y1() {
	ifbout.open(strNameFile.c_str(), ios::out|ios::binary); 
}

void CWriteStates::y2() { 
	lCurrentSteps++;
	strShot="";
	TIIteratorRifleman iterRifleman = pCChainShot->IArrayRifleman.begin(); 

	strShot = string(pCChainShot->pCOfficer->FGetState()) + ",";
	while (iterRifleman != pCChainShot->IArrayRifleman.end()) 
	{
		CRifleman *currentRifleman= *iterRifleman++;
		string str = string(currentRifleman->FGetState());
		strShot += str+","; 
	}
	ifbout<<setw(4)<<lCurrentSteps<<":"
		<<strShot
		<<"\r\n";
}

void CWriteStates::y3() { ifbout.close(); }


Соседние файлы в папке FClasses