Exemplo n.º 1
0
void MemoryCardManager::Update()
{
	vector<UsbStorageDevice> vOld;
	
	vOld = m_vStorageDevices;	// copy
	if( !g_pWorker->StorageDevicesChanged( m_vStorageDevices ) )
		return;

	UpdateAssignments();

	MESSAGEMAN->Broadcast( Message_StorageDevicesChanged );
}
void BipartiteWeightedMatchingBinding::bindFunctUnitInState(raw_ostream &out,
        State* state, std::string funcUnitType, int numFuncUnitsAvail,
        AssignmentInfo &assigned) {
    // create a numFuncUnitsAvail x numFuncUnitsAvail matrix of integer weights
    // and assignments for solving the bipartite weighted matching problem
    Table weights(numFuncUnitsAvail, std::vector<int>(numFuncUnitsAvail));
    Table assignments(numFuncUnitsAvail, std::vector<int>(numFuncUnitsAvail));

    std::string tmp;
    raw_string_ostream weights_stream(tmp);

    // loop over all operations in this state
    int operationIdx = 0;
    for (State::iterator instr = state->begin(), ie = state->end();
            instr != ie; ++instr) {

        Instruction *I = *instr;
        if (shareInstructionWithFU(I, funcUnitType)) {
            constructWeights(weights_stream, I, operationIdx, funcUnitType,
                    numFuncUnitsAvail, assigned, weights);
            opInstr[operationIdx] = I;
            operationIdx++;
        }
    }

    // only share if there is more than one operation using
    // this functional unit
    int numOperationsToShare = operationIdx;
    if (numOperationsToShare >= 1) {
        out << "State: " << state->getName() << "\n";
        out << "Binding functional unit type: " << funcUnitType << "\n";
        out << "Weight matrix for operation/function unit matching:\n";
        weights_stream.flush();
        out << weights_stream.str();
        printTable(out, funcUnitType, numOperationsToShare, numFuncUnitsAvail,
                weights);

        out << "Solving Bipartite Weighted Matching (minimize weights)...\n";
        solveBipartiteWeightedMatching(weights, assignments);
        out << "Assignment matrix after operation/function unit matching:\n";
        printTable(out, funcUnitType, numOperationsToShare, numFuncUnitsAvail,
                assignments);

        out << "Checking that every operator was assigned to a functional unit...";
        CheckAllWereAssigned(numOperationsToShare, numFuncUnitsAvail,
                assignments);
        out << "yes\n";

        out << "Binding operator -> functional unit assignments:\n";
        UpdateAssignments(out, numOperationsToShare, funcUnitType,
                numFuncUnitsAvail, assigned, assignments);
    }
}
Exemplo n.º 3
0
void HandleHourlyUpdate()
{
	//if the game hasnt even started yet ( we havent arrived in the sector ) dont process this
	if ( DidGameJustStart() )
		return;

	// hourly update of town loyalty	
	HandleTownLoyalty();

	// hourly update of team assignments
	UpdateAssignments();

	#ifndef JA2DEMO
	// hourly update of hated/liked mercs
	UpdateBuddyAndHatedCounters();
	#endif

	// update morale!
	HourlyMoraleUpdate();

	// degrade camouflage
	HourlyCamouflageUpdate();

	// check mines for monster infestation/extermination
	HourlyMinesUpdate();

	// check how well the player is doing right now
	HourlyProgressUpdate();

	// do any quest stuff necessary
	HourlyQuestUpdate();

	HourlyLarryUpdate();

	HourlyCheckIfSlayAloneSoHeCanLeave();

	PayOffSkyriderDebtIfAny();


	if ( GetWorldHour() % 6 == 0 ) // 4 times a day
	{
		UpdateRegenCounters();
	}
}