コード例 #1
0
ファイル: combat.cpp プロジェクト: jkoppel/project-ironfist
/*
* What happens when a hero wins a battle using Pandora's Box, but loses their
* main army? They walk around with stacks of 0 creatures, of course! 
* 0-creature stacks are still useful in combat though, since all attacks do at least 1 damage.
*
* On a related note, in the original game, what happens when a hero wins a battle
* using temporarily-resurrected creatures, but has no army left at the end? They
* walk around with no creatures, and instantly lose their next battle.
*
* Winning a battle with nothing but summoned elementals remaining works, however.
*
* TL, DR: There is a bug when winning a battle with nothing but temporary creatures left,
* but it's also present in the original game.
*/
void combatManager::HandlePandoraBox(int side) {
  if(this->heroes[side] && this->heroes[side]->HasArtifact(ARTIFACT_PANDORA_BOX)) {

    //The HoMM II code appears to lack a definition of creature tier. This deserves investigation.
    //We temporarily hardcode the tier-1 creatures
    int creatChoices[] = {
      CREATURE_PEASANT, CREATURE_SPRITE,CREATURE_HALFLING, CREATURE_GOBLIN,
      CREATURE_SKELETON, CREATURE_CENTAUR, CREATURE_ROGUE, CREATURE_BLOODSUCKER
    };
    int creat = creatChoices[SRandom(0, ELEMENTS_IN(creatChoices)-1)];

    int hex = -1;
    int poss = ELEMENTS_IN(squaresAroundCaster[side]);
    int tryFirst = SRandom(0, poss-1);
    for(int i = 0; i < poss; i++) {
      int square = squaresAroundCaster[side][(i+tryFirst)%poss];
      if(gMonsterDatabase[creat].creature_flags & TWO_HEXER) {
        int dir = side == 0 ? 1 : -1;
        if(this->combatGrid[square+dir].unitOwner != -1)
          continue;
      }
      if(this->combatGrid[square].unitOwner == -1)
        hex = square;
    }

    if(hex==-1)
      return;

    int amt = gpGame->GetRandomNumTroops(creat);
    AddArmy(side, creat, amt, hex, 0x8000, 0);

    hexcell* cell = &this->combatGrid[hex];
    this->creatures[cell->unitOwner][cell->stackIdx].temporaryQty = amt;
  }
}
コード例 #2
0
ファイル: test_board.c プロジェクト: 0x65/manul
/*
    Tests `make_move` and `undo_move` by making and undoing every single move for
    a set of fen positions, then making sure the resulting board is the same as the
    original board.
*/
int test_make_undo_move() {
    static const char* fen_positions[] = { "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
        "1B4n1/5k2/5P2/4p2N/P2QR3/p2pb2K/3Pb2R/8 w - - 0 1", "3b4/N2P1p2/1kP4p/p4n1K/2p5/1PPp2P1/1p6/8 w - - 0 1",
        "8/4p3/3R4/2P4R/P3Pp2/6kp/8/K7 w - - 0 1", "8/8/p3K3/k1N2B2/3P4/6Pp/5P1p/4R3 w - - 0 1",
        "K7/8/1P3r2/1P2b1p1/8/5p2/1Q2q2n/7k b - - 0 1", "1q1rr3/P1RN1P1p/Kp3p2/2P2p2/b4pP1/n4kb1/8/3Rn3 b - - 0 1",
        "8/2P5/Bp4Kn/q7/5P2/k7/8/B7 b - - 0 1", "8/8/1B6/8/P1b4K/8/8/1k6 b - - 0 1",
        "8/P2kp3/7B/1R3r2/1bK4p/Q4pp1/P6N/8 b - - 0 1" };

    board_t board[ELEMENTS_IN(fen_positions)], board_original[ELEMENTS_IN(fen_positions)];
    move_t move_list[256];

    for (int i = 0; i < ELEMENTS_IN(fen_positions); i++) {
        set_board_from_fen_string(&board[i], fen_positions[i]);
        memcpy(&board_original[i], &board[i], sizeof(board_t));
    }

    for (int i = 0; i < ELEMENTS_IN(fen_positions); i++) {
        move_t* end_of_list = generate_pseudolegal_moves(&board[i], move_list);

        for (int j = 0; move_list[j] != *end_of_list; j++) {
            make_move(&board[i], move_list[j]);
            undo_move(&board[i], move_list[j]);

            if (!compare_boards(&board[i], &board_original[i])) {
                fprintf(stderr, "test_make_undo_move -- Test \"%s\" failed: move %d.\n", fen_positions[i], j);
                return TEST_ERROR;
            }
        }
    }

    return TEST_SUCCESS;
}
コード例 #3
0
//===============================================================================================
// FUNCTION: ReadFileInfo
// PURPOSE:  Reads the file info from the data file.
//
BOOL CABF2ProtocolReader::ReadFileInfo()
{
   MEMBERASSERT();

   BOOL bOK = TRUE;

   short nMajor = MAJOR( m_FileInfo.uFileVersionNumber );
   short nMinor = MINOR( m_FileInfo.uFileVersionNumber );
   m_pFH->fFileVersionNumber     = nMajor + nMinor/100.0F;
   m_pFH->fHeaderVersionNumber   = ABF_CURRENTVERSION;
   m_pFH->nFileType              = m_FileInfo.nFileType;
   m_pFH->nDataFormat            = m_FileInfo.nDataFormat;
   m_pFH->nSimultaneousScan      = m_FileInfo.nSimultaneousScan;
   m_pFH->FileGUID               = m_FileInfo.FileGUID;
   m_pFH->ulFileCRC              = m_FileInfo.uFileCRC;
   m_pFH->nCRCEnable             = m_FileInfo.nCRCEnable;
   m_pFH->nCreatorMajorVersion   = MAJOR ( m_FileInfo.uCreatorVersion );
   m_pFH->nCreatorMinorVersion   = MINOR ( m_FileInfo.uCreatorVersion );
   m_pFH->nCreatorBugfixVersion  = BUGFIX( m_FileInfo.uCreatorVersion );
   m_pFH->nCreatorBuildVersion   = BUILD ( m_FileInfo.uCreatorVersion );
   bOK &= GetString( m_FileInfo.uCreatorNameIndex,  m_pFH->sCreatorInfo,  ELEMENTS_IN( m_pFH->sCreatorInfo ) );

   m_pFH->nModifierMajorVersion  = MAJOR ( m_FileInfo.uModifierVersion );
   m_pFH->nModifierMinorVersion  = MINOR ( m_FileInfo.uModifierVersion );
   m_pFH->nModifierBugfixVersion = BUGFIX( m_FileInfo.uModifierVersion );
   m_pFH->nModifierBuildVersion  = BUILD ( m_FileInfo.uModifierVersion );
   bOK &= GetString( m_FileInfo.uModifierNameIndex, m_pFH->sModifierInfo, ELEMENTS_IN( m_pFH->sModifierInfo ) );

   m_pFH->nNumPointsIgnored      = 0;
   m_pFH->uFileStartDate         = m_FileInfo.uFileStartDate;
   m_pFH->uFileStartTimeMS       = m_FileInfo.uFileStartTimeMS;
   m_pFH->lStopwatchTime         = m_FileInfo.uStopwatchTime;

   m_pFH->lActualEpisodes        = m_FileInfo.uActualEpisodes;
   m_pFH->lActualAcqLength       = m_FileInfo.DataSection.GetNumEntries();
   m_pFH->lDataSectionPtr        = m_FileInfo.DataSection.uBlockIndex;

   m_pFH->lScopeConfigPtr        = m_FileInfo.ScopeSection.uBlockIndex;
   m_pFH->lNumScopes             = m_FileInfo.ScopeSection.GetNumEntries();
   m_pFH->lStatisticsConfigPtr   = m_FileInfo.StatsSection.uBlockIndex;
   m_pFH->lTagSectionPtr         = m_FileInfo.TagSection.uBlockIndex;
   m_pFH->lNumTagEntries         = m_FileInfo.TagSection.GetNumEntries();
   m_pFH->lDeltaArrayPtr         = m_FileInfo.DeltaSection.uBlockIndex;
   m_pFH->lNumDeltas             = m_FileInfo.DeltaSection.GetNumEntries();
   m_pFH->lVoiceTagPtr           = m_FileInfo.VoiceTagSection.uBlockIndex;
   m_pFH->lVoiceTagEntries       = m_FileInfo.VoiceTagSection.GetNumEntries();
   m_pFH->lSynchArrayPtr         = m_FileInfo.SynchArraySection.uBlockIndex;
   m_pFH->lSynchArraySize        = m_FileInfo.SynchArraySection.GetNumEntries();
   m_pFH->lAnnotationSectionPtr  = m_FileInfo.AnnotationSection.uBlockIndex;
   m_pFH->lNumAnnotations        = m_FileInfo.AnnotationSection.GetNumEntries();
   
   bOK &= GetString( m_FileInfo.uProtocolPathIndex, m_pFH->sProtocolPath,  ELEMENTS_IN( m_pFH->sProtocolPath ) );

   return bOK;
}
コード例 #4
0
static ULONG FindNumberOfParameters(tCommandId id)
{
    int i;
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
        if (commands[i].cmd == id) return NumberOfParameters(commands[i]);
    return MAX_PARAMS;
}
コード例 #5
0
void tScriptState::ParseCommand(CString& s, tCommand& cmd, ULONG step, bool& bSilent)
{
    size_t len = 0;
    int i, selected = -1;
    const char *token;
    tCommandId cmdId = cmdInvalid;
    cmd.step =  step;
    cmd.line = currentLine;
    cmd.lineDot = ++currentDot;
    s.MakeLower();
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
    {
        if (s.Find(commands[i].token) == 0 && len < strlen(commands[i].token))
        {
            cmdId = commands[i].cmd;
            len = strlen(commands[i].token);
            token = commands[i].token;
            selected = i;
        }
    }
    cmd.cmdId = cmdId;
    if (cmdId != cmdInvalid)
    {
        s.Delete(0, len);
        // get parameters
        if (FillParameters(s, cmd, commands[selected]))
        {
            if (!bSilent)
            {
                s.Format("%04d.%d(%04d) Command %s", cmd.line, cmd.lineDot, cmd.step, (LPCSTR)cmd.Description());
                LogTestFlow("%s\n", (LPCSTR)s);
            }
        }
    }
}
コード例 #6
0
static const char *FindDescription(tCommandId id)
{
    int i;
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
        if (commands[i].cmd == id) return (commands[i].description) ? commands[i].description : commands[i].token;
    return NULL;
}
コード例 #7
0
static const char *FindToken(tCommandId id)
{
    int i;
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
        if (commands[i].cmd == id) return (commands[i].token);
    return NULL;
}
コード例 #8
0
static ULONG NumberOfParameters(const _tCommandDecs& cmdDesc)
{
    ULONG n = 0, i, nMax = 0;
    for (i = 0; i < ELEMENTS_IN(cmdDesc.types); ++i)
    {
        if (cmdDesc.types[i] != ptNone) nMax = i + 1;
    }
    return nMax;
}
コード例 #9
0
ファイル: ComDateTime.cpp プロジェクト: yamad/libabf
LPCSTR CComDateTime::Format(DWORD dwFlags, LCID lcid) const
{
	USES_CONVERSION;

	// If null, return empty string
	if (GetStatus() == null)
		return NULL;

	// If invalid, return DateTime resource string
	if (GetStatus() == invalid)
		return NULL;

	CComVariant var;
	// Don't need to trap error. Should not fail due to type mismatch
	COM_VERIFY(VarBstrFromDate(m_dt, lcid, dwFlags, &V_BSTR(&var)));
	var.vt = VT_BSTR;

   strncpy(s_strDate, OLE2CT(V_BSTR(&var)), ELEMENTS_IN(s_strDate));
   s_strDate[ELEMENTS_IN(s_strDate)-1] = '\0';
	return s_strDate;
}
コード例 #10
0
ファイル: ProtocolWriterABF2.cpp プロジェクト: yamad/libabf
//===============================================================================================
// FUNCTION: GetVersion
// PURPOSE:  Builds a Version number as a packed UINT from a float (used by ABF 1.x version numbers).
//
static UINT GetVersion( float fVersion )
{
   char szVersion[16] = { 0 };
   char szMajor[16]   = { 0 };
   char szMinor[16]   = { 0 };
   AXU_sprintf( szVersion, ELEMENTS_IN( szVersion ), "%1.2f", fVersion );     // 1.83
   AXU_strncpyz( szMajor, &szVersion[0], 2 );                                  // "1"
   AXU_strncpyz( szMinor, &szVersion[2], 3 );                                  // "83"


   UINT uMajor = atoi( szMajor );
   UINT uMinor = atoi( szMinor );
   WORD wHigh    = MAKEWORD( uMinor, uMajor );
   UINT uVersion = MAKELONG( 0, wHigh );

   return uVersion;
}
コード例 #11
0
ファイル: Median.hpp プロジェクト: yamad/libabf
int main(int argc, char* argv[])
{
#ifdef TIMING_TEST
   static WORD awRand[1000001];
   for (int i=0; i<ELEMENTS_IN(awRand); i++)
      awRand[i] = rand();
#else
   WORD awRand[] = { 8,6,4,2 };
#endif

   WORD awMedians[3];
   static WORD awLists[ELEMENTS_IN(awMedians)][ELEMENTS_IN(awRand)];

#ifdef TIMING_TEST
   for (i=10001; i<ELEMENTS_IN(awRand); i+=10000)
#else
   int i=ELEMENTS_IN(awRand);
#endif
   {
      for (int j=0; j<ELEMENTS_IN(awMedians); j++)
         memcpy(awLists[j], awRand, i*sizeof(awRand[0]));

      UINT uTime0 = GetTickCount();
      awMedians[0] = MedianSelect(awLists[0], i);

      UINT uTime1 = GetTickCount();
      awMedians[1] = MedianNthElement(awLists[1], i);

      UINT uTime2 = GetTickCount();
      awMedians[2] = MedianSort(awLists[2], i);

      UINT uTime3 = GetTickCount();

      UINT uDelta1 = uTime1 - uTime0;
      UINT uDelta2 = uTime2 - uTime1;
      UINT uDelta3 = uTime3 - uTime2;

      printf("\n%d:\t%d\t%d\t%d", i, uDelta1, uDelta2, uDelta3);
      printf("\n\t%d\t%d\t%d", awMedians[0], awMedians[1], awMedians[2]);
   }

   printf("\n");
	return 0;
}
コード例 #12
0
int game::SaveGame(char *saveFile, int autosave, signed char baseGame) {
	void* extraMemory = ALLOC(50000);
	memset(extraMemory, 0, 50000u);
	baseGame = 0;
	gpAdvManager->DemobilizeCurrHero();
	char path[100];
	char v9[100];
	if(autosave) {
		if(!xIsExpansionMap || baseGame) {
			sprintf(path, "%s.GM1", saveFile);
		} else {
			sprintf(path, "%s.GX1", saveFile);
		}
	} else {
		sprintf(path, saveFile);
	}
	sprintf(v9, "%s%s", ".\\GAMES\\", &path);
	if(strnicmp(path, "AUTOSAVE", 8) && strnicmp(path, "PLYREXIT", 8))
		strcpy(gpGame->lastSaveFile, saveFile);

	int fd = open(tmpFileName, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, S_IWRITE);
	if ( fd == -1 )
		FileError("tmp");

	_write(fd, &this->map.width, 4);
	_write(fd, &this->map.height, 4);
	_write(fd, &this->mapHeader, 420);
	_write(fd, &this->field_44D, 65);
	_write(fd, this, 2);
	_write(fd, &giMonthType, 1);
	_write(fd, &giMonthTypeExtra, 1);
	_write(fd, &giWeekType, 1);
	_write(fd, &giWeekTypeExtra, 1);
	_write(fd, cPlayerNames, 126);

	char buf[100];

	gpAdvManager->PurgeMapChangeQueue();
	_write(fd, &giMapChangeCtr, 4);
	GenerateStandardFileName(this->lastSaveFile, buf);
	_write(fd, &this->numPlayers, 1);
	int v14 = giCurPlayer;
	_write(fd, &v14, 1);
	_write(fd, &this->couldBeNumDefeatedPlayers, 1);
	_write(fd, this->playerDead, 6);
	char playerAlive[6];
	for (int i = 0; i < 6; ++i)
	{
		playerAlive[i] = gbHumanPlayer[i];
		if(this->playerDead[i])
			playerAlive[i] = 0;
	}
	_write(fd, playerAlive, 6);
	_write(fd, &this->day, 2);
	_write(fd, &this->week, 2);
	_write(fd, &this->month, 2);
	for(int i = 0; i < 6; ++i )
		this->players[i].Write(fd);
	_write(fd, &this->numObelisks, 1);
	_write(fd, this->relatedToHeroForHireStatus, 54);
	_write(fd, this->castles, 7200);
	_write(fd, this->field_2773, 72);
	_write(fd, this->field_27BB, 9);
	_write(fd, this->mines, 1008);
	_write(fd, this->field_60A6, 144);
	_write(fd, this->artifactGeneratedRandomly, 103);
	_write(fd, this->boats, 384);
	_write(fd, this->boatBuilt, 48);
	_write(fd, this->obeliskVisitedMasks, 48);
	_write(fd, &this->field_6395, 1);
	_write(fd, &this->field_6396, 1);
	_write(fd, &this->field_6397, 1);
	_write(fd, this->currentRumor, 301);
	_write(fd, this->field_637D, 24);
	_write(fd, &this->numRumors, 4);
	_write(fd, this->rumorIndices, 2 * this->numRumors);
	_write(fd, &this->numEvents, 4);
	_write(fd, this->eventIndices, 2 * this->numEvents);
	_write(fd, &this->field_657B, 4);
	_write(fd, this->_D, 2 * this->field_657B);
	_write(fd, &iMaxMapExtra, 4);
	for(int i = 1; i < iMaxMapExtra; ++i) {
		_write(fd, &pwSizeOfMapExtra[i], 2);
		if(ppMapExtra[i])
			_write(fd, ppMapExtra[i], pwSizeOfMapExtra[i]);
		else
			_write(fd, extraMemory, pwSizeOfMapExtra[i]);
	}
	_write(fd, mapRevealed, MAP_HEIGHT * MAP_WIDTH);
	this->map.Write(fd);
	_close(fd);
	FREE(extraMemory);


	unsigned char dat[1000000];
	fd = _open(tmpFileName, O_BINARY);
	lseek(fd, 0, SEEK_END);
	int sz = tell(fd);
	lseek(fd, 0, SEEK_SET);
	read(fd, dat, sz);
	close(fd);
	remove(tmpFileName);

	const xml_schema::base64_binary datbin(dat, sz);

	std::ofstream os(v9);

	ironfist_map::map_t m(datbin);

	for(int i = 0; i < ELEMENTS_IN(this->heroes); i++) {
		m.hero().push_back(WriteHeroXML(&this->heroes[i]));
	}

	m.script(GetScriptContents());
	WriteMapVariablesXML(m);

	xml_schema::namespace_infomap infomap;
	infomap[""].name = "ironfist_map";
	infomap[""].schema = "map_xml.xsd";

	ironfist_map::map(os, m, infomap);

	return 1;
}
コード例 #13
0
ironfist_map::hero_t WriteHeroXML(hero* hro) {

	ironfist_map::army_t arm;

	for(int i = 0; i < ELEMENTS_IN(hro->army.creatureTypes); i++) {
		ironfist_map::slot_t sl;
		sl.id(hro->army.creatureTypes[i]);
		sl.quantity(hro->army.quantities[i]);
		
		arm.slot().push_back(sl);
	}

	ironfist_map::hero_t hx(
		hro->spellpoints,
		hro->idx,
		hro->ownerIdx,
		hro->field_4,
		hro->field_5,
		hro->field_6,
		hro->field_7,
		hro->field_8,
		hro->field_9,
		hro->name,
		hro->factionID,
		hro->heroID,
		hro->x,
		hro->y,
		hro->field_21,
		hro->field_23,
		hro->field_25,
		hro->field_27,
		hro->field_29,
		hro->field_2B,
		hro->occupiedObjType,
		hro->occupiedObjVal,
		hro->mobility,
		hro->remainingMobility,
		hro->experience,
		hro->oldLevel,
		hro->primarySkills[PRIMARY_SKILL_ATTACK],
		hro->primarySkills[PRIMARY_SKILL_DEFENSE],
		hro->primarySkills[PRIMARY_SKILL_SPELLPOWER],
		hro->primarySkills[PRIMARY_SKILL_KNOWLEDGE],
		hro->field_43,
		hro->tempMoraleBonuses,
		hro->tempLuckBonuses,
		hro->field_46,
		hro->gazeboesVisited,
		hro->fortsVisited,
		hro->witchDoctorHutsVisited,
		hro->mercenaryCampsVisited,
		hro->standingStonesVisited,
		hro->treesOfKnowledgeVisited,
		hro->xanadusVisited,
		hro->randomSeed,
		hro->wisdomLastOffered,
		arm,
		hro->flags,
		hro->isCaptain,
		hro->field_E8);

	for(int i = 0; i < ELEMENTS_IN(hro->secondarySkillLevel); i++) {
		ironfist_map::secondarySkill sk;
		sk.id(i);
		sk.level(hro->secondarySkillLevel[i]);
		sk.idx(hro->skillIndex[i]);
		hx.secondarySkill().push_back(sk);
	}

	for(int i = 0; i < NUM_SPELLS; i++) {
		if(hro->spellsLearned[i])
			hx.spell().push_back(i);
	}

	for(int i = 0; i < ELEMENTS_IN(hro->artifacts); i++) {
		hx.artifact().push_back(ironfist_map::hero_t::artifact_type(hro->artifacts[i]));
	}

	return hx;
}
コード例 #14
0
//===============================================================================================
// FUNCTION: ReadProtocolInfo
// PURPOSE:  Reads the protocol info from the data file.
//
BOOL CABF2ProtocolReader::ReadProtocolInfo()
{
   MEMBERASSERT();

   BOOL bOK = TRUE;
   ABF_ProtocolInfo Protocol;
   bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.ProtocolSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN );
   if( !bOK )
      return FALSE;

   bOK &= m_pFI->Read( &Protocol, sizeof( Protocol ) );
   ASSERT( bOK );

   m_pFH->nADCNumChannels          = short( m_FileInfo.ADCSection.llNumEntries );
   m_pFH->nOperationMode           = Protocol.nOperationMode;
   m_pFH->fADCSequenceInterval     = Protocol.fADCSequenceInterval;
   m_pFH->uFileCompressionRatio    = max( Protocol.uFileCompressionRatio, 1 );
   m_pFH->bEnableFileCompression   = Protocol.bEnableFileCompression;

   m_pFH->fSynchTimeUnit           = Protocol.fSynchTimeUnit;
   m_pFH->fSecondsPerRun           = Protocol.fSecondsPerRun;
   m_pFH->lNumSamplesPerEpisode    = Protocol.lNumSamplesPerEpisode;
   m_pFH->lPreTriggerSamples       = Protocol.lPreTriggerSamples;
   m_pFH->lEpisodesPerRun          = Protocol.lEpisodesPerRun;
   m_pFH->lRunsPerTrial            = Protocol.lRunsPerTrial;
   m_pFH->lNumberOfTrials          = Protocol.lNumberOfTrials;
   m_pFH->nAveragingMode           = Protocol.nAveragingMode;
   m_pFH->nUndoRunCount            = Protocol.nUndoRunCount;
   m_pFH->nFirstEpisodeInRun       = Protocol.nFirstEpisodeInRun;
   m_pFH->fTriggerThreshold        = Protocol.fTriggerThreshold;
   m_pFH->nTriggerSource           = Protocol.nTriggerSource;
   m_pFH->nTriggerAction           = Protocol.nTriggerAction;
   m_pFH->nTriggerPolarity         = Protocol.nTriggerPolarity;
   m_pFH->fScopeOutputInterval     = Protocol.fScopeOutputInterval;
   m_pFH->fEpisodeStartToStart     = Protocol.fEpisodeStartToStart;
   m_pFH->fRunStartToStart         = Protocol.fRunStartToStart;
   m_pFH->lAverageCount            = Protocol.lAverageCount;
   m_pFH->fTrialStartToStart       = Protocol.fTrialStartToStart;
   m_pFH->nAutoTriggerStrategy     = Protocol.nAutoTriggerStrategy;
   m_pFH->fFirstRunDelayS          = Protocol.fFirstRunDelayS;
   m_pFH->nChannelStatsStrategy    = Protocol.nChannelStatsStrategy;
   m_pFH->lSamplesPerTrace         = Protocol.lSamplesPerTrace;
   m_pFH->lStartDisplayNum         = Protocol.lStartDisplayNum;
   m_pFH->lFinishDisplayNum        = Protocol.lFinishDisplayNum;
   m_pFH->nShowPNRawData           = Protocol.nShowPNRawData;
   m_pFH->fStatisticsPeriod        = Protocol.fStatisticsPeriod;
   m_pFH->lStatisticsMeasurements  = Protocol.lStatisticsMeasurements;
   m_pFH->nStatisticsSaveStrategy  = Protocol.nStatisticsSaveStrategy;
   m_pFH->fADCRange                = Protocol.fADCRange;
   m_pFH->fDACRange                = Protocol.fDACRange;
   m_pFH->lADCResolution           = Protocol.lADCResolution;
   m_pFH->lDACResolution           = Protocol.lDACResolution;
   m_pFH->nDigitizerADCs           = Protocol.nDigitizerADCs;
   m_pFH->nDigitizerDACs           = Protocol.nDigitizerDACs;
   m_pFH->nDigitizerTotalDigitalOuts = Protocol.nDigitizerTotalDigitalOuts;
   m_pFH->nDigitizerSynchDigitalOuts = Protocol.nDigitizerSynchDigitalOuts;
   m_pFH->nDigitizerType           = Protocol.nDigitizerType;

   m_pFH->nExperimentType          = Protocol.nExperimentType;
   m_pFH->nManualInfoStrategy      = Protocol.nManualInfoStrategy;
   m_pFH->fCellID1                 = Protocol.fCellID[0];
   m_pFH->fCellID2                 = Protocol.fCellID[1];
   m_pFH->fCellID3                 = Protocol.fCellID[2];
   m_pFH->nCommentsEnable          = Protocol.nCommentsEnable;
   m_pFH->nAutoAnalyseEnable       = Protocol.nAutoAnalyseEnable;
   m_pFH->nSignalType              = Protocol.nSignalType;
   m_pFH->nDigitalEnable           = Protocol.nDigitalEnable;
   m_pFH->nActiveDACChannel        = Protocol.nActiveDACChannel;
   m_pFH->nDigitalHolding          = Protocol.nDigitalHolding;
   m_pFH->nDigitalInterEpisode     = Protocol.nDigitalInterEpisode;
   m_pFH->nDigitalDACChannel       = Protocol.nDigitalDACChannel;
   m_pFH->nDigitalTrainActiveLogic = Protocol.nDigitalTrainActiveLogic;
   m_pFH->nStatsEnable             = Protocol.nStatsEnable;
   m_pFH->nLevelHysteresis         = Protocol.nLevelHysteresis;
   m_pFH->lTimeHysteresis          = Protocol.lTimeHysteresis;
   m_pFH->nAllowExternalTags       = Protocol.nAllowExternalTags;
   m_pFH->nAverageAlgorithm        = Protocol.nAverageAlgorithm;
   m_pFH->fAverageWeighting        = Protocol.fAverageWeighting;
   m_pFH->nUndoPromptStrategy      = Protocol.nUndoPromptStrategy;
   m_pFH->nTrialTriggerSource      = Protocol.nTrialTriggerSource;
   m_pFH->nStatisticsDisplayStrategy = Protocol.nStatisticsDisplayStrategy;
   m_pFH->nExternalTagType         = Protocol.nExternalTagType;
   m_pFH->nStatisticsClearStrategy = Protocol.nStatisticsClearStrategy;
   m_pFH->nLTPType                 = Protocol.nLTPType;
   m_pFH->nScopeTriggerOut         = Protocol.nScopeTriggerOut;
   m_pFH->nAlternateDACOutputState = Protocol.nAlternateDACOutputState;
   m_pFH->nAlternateDigitalOutputState = Protocol.nAlternateDigitalOutputState;

   bOK &= GetString( Protocol.lFileCommentIndex,        m_pFH->sFileComment,        ELEMENTS_IN( m_pFH->sFileComment ) );

   return bOK;
}
コード例 #15
0
ファイル: funcs.cpp プロジェクト: jkoppel/project-ironfist
static int l_setHeroName(lua_State *L) {
  hero* hro = (hero*)GetPointerFromLuaClassTable(L, StackIndexOfArg(1, 2));
  lua_pushstring(L, hro->name);
  strncpy(hro->name, luaL_checkstring(L, 2), ELEMENTS_IN(hro->name));
  return 0;
}
コード例 #16
0
ファイル: SamplingIntervalList.hpp プロジェクト: yamad/libabf
inline
void  AX_sampling_interval_list::initialize(ENGN_DigitiserProperties const * pDP, CABFHeader const * pFH)
{
   MEMBERASSERT();

   RPTRASSERT(pDP);
   RPTRASSERT(pFH);
   
   // Get the clock ratio to convert from hardware units to user units
   double   clock_ratio    = AX_get_clock_ratio_hardware_to_user(pDP, pFH);
   
   // Get the hardware limits in user units
   m_minimum_interval  = float(pDP->fMinPeriod          * clock_ratio);
   m_maximum_interval  = float(pDP->fMaxPeriod          * clock_ratio);
   m_resolution        = float(pDP->fSamplingResolution * clock_ratio);
   
   // Limit the sampling interval per-channel to 1 second
   if (m_maximum_interval > c_sampling_interval_maximum_interval)
      m_maximum_interval = c_sampling_interval_maximum_interval;
   
   // Build the list of "nice" sample intervals.
   // (Note that we say we only have one channel)
   m_number_of_entries = ABFH_SetupSamplingList(1, m_minimum_interval, m_maximum_interval, m_list_entries, ELEMENTS_IN(m_list_entries));
}