Ejemplo n.º 1
0
void TeamManager::sendScores()
{
    TeamScoreSync score_Sync;
    for (TeamID team_id = 0; team_id < max_Teams; ++team_id )
    {
        score_Sync.set(team_id, getKills(team_id), getLosses(team_id));
        SERVER->broadcastMessage(&score_Sync, sizeof(TeamScoreSync));
    }
}
Ejemplo n.º 2
0
Snapshot::Snapshot(AiInterface * aiInterface , FILE * logs)
{
	this->logs = logs;
    this->aiInterface = aiInterface;
    beingAttacked = 0 ;
    readyForAttack = 0;
    damagedUnitCount = 0;
    noOfWorkers = 0;
    noOfWarriors = 0;
    noOfBuildings = 0;
    for( int i = 0; i < NUM_OF_RESOURCES; i++ ) {
	resourcesAmount[ i ] = 0;
    }
    /*
    resourcesType[ 0 ] = "gold";
    resourcesType[ 1 ] = "wood";
    resourcesType[ 2 ] = "stone";
    resourcesType[ 3 ] = "food";
    resourcesType[ 4 ] = "energy";
    resourcesType[ 5 ] = "housing";*/
    upgradeCount = 0;
    noOfKills = 0;

	Field field ;
	Vec2i  pos;
	getUpgradeCount();
	CheckIfBeingAttacked(pos, field);
	CheckIfStableBase();
	countDamagedUnits( );
	getKills();
	setNumOfDeaths();
	noOfWorkers = getCountOfClass(ucWorker);
	noOfWarriors = getCountOfClass(ucWarrior);
	noOfBuildings = getCountOfClass(ucBuilding);
	getResourceStatus();

	fprintf(logs, "out of Snapshot constructor\n");
	fflush(logs);
}