Пример #1
0
LRESULT CDlgPublishHtml::OnRefresh(WPARAM wParam, LPARAM lParam)
{
	// Get the target path
	CWinFile::GetPathFromFileName( m_sMain, m_szPath );
	
	// Get filename
	char fname[ CWF_STRSIZE ];
	CWinFile::GetFileNameFromPath( m_sMain, fname );

	// Get filename
	m_sFilename = CFG().GetSz( "Settings", "HtmlPubFilename" );
	if ( m_sFilename.IsEmpty() ) m_sFilename = fname;

//	m_sFilename = fname;

	// Add a few choice filenames
	m_comboFilename.AddString( "Index.htm" );
	m_comboFilename.AddString( fname );
	if ( strcmpi( m_sFilename, fname ) && strcmpi( m_sFilename, "Index.htm" ) )
		m_comboFilename.AddString( m_sFilename );

	// Initialize folder
	m_sDir = CFG().GetSz( "Settings", "HtmlPubDir" );

	UpdateData( FALSE );

	FillCombo();

	DoEnable();

	return 1;
}
Пример #2
0
zbar_image_scanner_t *zbar_image_scanner_create ()
{
    zbar_image_scanner_t *iscn = calloc(1, sizeof(zbar_image_scanner_t));
    if(!iscn)
        return(NULL);
    iscn->dcode = zbar_decoder_create();
    iscn->scn = zbar_scanner_create(iscn->dcode);
    if(!iscn->dcode || !iscn->scn) {
        zbar_image_scanner_destroy(iscn);
        return(NULL);
    }
    zbar_decoder_set_userdata(iscn->dcode, iscn);
    zbar_decoder_set_handler(iscn->dcode, symbol_handler);

#ifdef ENABLE_QRCODE
    iscn->qr = _zbar_qr_create();
#endif

    /* apply default configuration */
    CFG(iscn, ZBAR_CFG_X_DENSITY) = 1;
    CFG(iscn, ZBAR_CFG_Y_DENSITY) = 1;
    zbar_image_scanner_set_config(iscn, 0, ZBAR_CFG_POSITION, 1);
    zbar_image_scanner_set_config(iscn, 0, ZBAR_CFG_UNCERTAINTY, 2);
    zbar_image_scanner_set_config(iscn, ZBAR_QRCODE, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE128, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE93, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODE39, ZBAR_CFG_UNCERTAINTY, 0);
    zbar_image_scanner_set_config(iscn, ZBAR_CODABAR, ZBAR_CFG_UNCERTAINTY, 1);
    zbar_image_scanner_set_config(iscn, ZBAR_COMPOSITE, ZBAR_CFG_UNCERTAINTY, 0);
    return(iscn);
}
Пример #3
0
static inline int decoder_set_config_int (zbar_decoder_t *dcode,
                                          zbar_symbol_type_t sym,
                                          zbar_config_t cfg,
                                          int val)
{
    switch(sym) {

#ifdef ENABLE_I25
    case ZBAR_I25:
        CFG(dcode->i25, cfg) = val;
        break;
#endif
#ifdef ENABLE_CODE39
    case ZBAR_CODE39:
        CFG(dcode->code39, cfg) = val;
        break;
#endif
#ifdef ENABLE_CODE128
    case ZBAR_CODE128:
        CFG(dcode->code128, cfg) = val;
        break;
#endif
#ifdef ENABLE_PDF417
    case ZBAR_PDF417:
        CFG(dcode->pdf417, cfg) = val;
        break;
#endif

    default:
        return(1);
    }
    return(0);
}
Пример #4
0
void
influxdb_put(const char *id, double value)
{
  char url[1024];
  cfg_root(root);

  const char *urlprefix = cfg_get_str(root, CFG("influxdb", "url"), NULL);
  const char *db        = cfg_get_str(root, CFG("influxdb", "db"), NULL);
  const char *username  = cfg_get_str(root, CFG("influxdb", "username"), NULL);
  const char *password  = cfg_get_str(root, CFG("influxdb", "password"), NULL);
  if(urlprefix == NULL || db == NULL || username == NULL || password == NULL)
    return;

  snprintf(url, sizeof(url), "%s/db/%s/series?u=%s&p=%s",
           urlprefix, db, username, password);

  htsmsg_t *doc = htsmsg_create_list();
  htsmsg_t *item = htsmsg_create_map();

  htsmsg_add_str(item, "name", id);

  htsmsg_t *columns = htsmsg_create_list();
  htsmsg_add_str(columns, NULL, "value");
  htsmsg_add_msg(item, "columns", columns);

  htsmsg_t *points = htsmsg_create_list();
  htsmsg_t *point = htsmsg_create_list();
  htsmsg_add_dbl(point, NULL, value);
  htsmsg_add_msg(points, NULL, point);
  htsmsg_add_msg(item, "points", points);

  htsmsg_add_msg(doc, NULL, item);

  char *data = htsmsg_json_serialize_to_str(doc, 0);
  htsmsg_destroy(doc);

  size_t len = strlen(data);

  FILE *f = fmemopen(data, len, "r");

  CURL *curl = curl_easy_init();
  curl_easy_setopt(curl, CURLOPT_URL, url);
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &libsvc_curl_waste_output);
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
  curl_easy_setopt(curl, CURLOPT_READDATA, (void *)f);
  curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)len);

  CURLcode result = curl_easy_perform(curl);

  curl_easy_cleanup(curl);

  if(result)
    trace(LOG_ERR, "CURL Failed %s error %d", url, result);
  fclose(f);
  free(data);
}
Пример #5
0
static int l_engine_set_video_resolution(lua_State *l)
{
	const int width = luaL_checkinteger(l, 1);
	const int height = luaL_checkinteger(l, 2);
	CFG()->SetInt("ScrWidth", width);
	CFG()->SetInt("ScrHeight", height);
	return 0;
}
Пример #6
0
zbar_decoder_t *zbar_decoder_create ()
{
    zbar_decoder_t *dcode = calloc(1, sizeof(zbar_decoder_t));
    dcode->buf_alloc = BUFFER_MIN;
    dcode->buf = malloc(dcode->buf_alloc);

    /* initialize default configs */
#ifdef ENABLE_EAN
    dcode->ean.enable = 1;
    dcode->ean.ean13_config = ((1 << ZBAR_CFG_ENABLE) |
                               (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->ean.ean8_config = ((1 << ZBAR_CFG_ENABLE) |
                              (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->ean.upca_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.upce_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.isbn10_config = 1 << ZBAR_CFG_EMIT_CHECK;
    dcode->ean.isbn13_config = 1 << ZBAR_CFG_EMIT_CHECK;
# ifdef FIXME_ADDON_SYNC
    dcode->ean.ean2_config = 1 << ZBAR_CFG_ENABLE;
    dcode->ean.ean5_config = 1 << ZBAR_CFG_ENABLE;
# endif
#endif
#ifdef ENABLE_I25
    dcode->i25.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->i25, ZBAR_CFG_MIN_LEN) = 6;
#endif
#ifdef ENABLE_DATABAR
    dcode->databar.config = ((1 << ZBAR_CFG_ENABLE) |
                             (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->databar.config_exp = ((1 << ZBAR_CFG_ENABLE) |
                                 (1 << ZBAR_CFG_EMIT_CHECK));
    dcode->databar.csegs = 4;
    dcode->databar.segs = calloc(4, sizeof(*dcode->databar.segs));
#endif
#ifdef ENABLE_CODABAR
    dcode->codabar.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->codabar, ZBAR_CFG_MIN_LEN) = 4;
#endif
#ifdef ENABLE_CODE39
    dcode->code39.config = 1 << ZBAR_CFG_ENABLE;
    CFG(dcode->code39, ZBAR_CFG_MIN_LEN) = 1;
#endif
#ifdef ENABLE_CODE93
    dcode->code93.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_CODE128
    dcode->code128.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_PDF417
    dcode->pdf417.config = 1 << ZBAR_CFG_ENABLE;
#endif
#ifdef ENABLE_QRCODE
    dcode->qrf.config = 1 << ZBAR_CFG_ENABLE;
#endif

    zbar_decoder_reset(dcode);
    return(dcode);
}
Пример #7
0
void Timer<ID>::init(void) {
  // Set Waveform Generator Mode to Normal
  // Set Prescaler to 0
  REG(timer<ID>::control) = 
    CFG(timer<ID>::control::wgm::normal) |
      CFG(timer<ID>::control::prescaler::template value<1>);
  
  // Set Counter to 0
  REG(timer<ID>::counter) = VAL(timer<ID>::counter, 0);
}
Пример #8
0
static void *
lisp_merge_config (apr_pool_t * pool, void * base_cfg, void * add_cfg)
{
  return
    ((SERVER_SPECIFIED_P (CFG (add_cfg)))
          ? (copy_lisp_cfg (pool, add_cfg))
	       : (SERVER_SPECIFIED_P (CFG (base_cfg)))
	            ? (copy_lisp_cfg (pool, base_cfg))
		         : (default_lisp_cfg (pool)));
}
Пример #9
0
void CGameControllerOpenFNG::HandleMelt(int Melter, int Meltee)
{
	CCharacter *pMeltee = CHAR(Meltee);
	if (!pMeltee) //due to HandleFreeze, i suspect this COULD also possibly happen. 
	{
		D("no pMeltee in HandleMelt(%d, %d)", Melter, Meltee);
		return;
	}

	int MeltTeam = pMeltee->GetPlayer()->GetTeam()&1;
	m_aTeamscore[MeltTeam] += CFG(MeltTeamscore);

	if (CFG(MeltTeamscore) && CFG(MeltBroadcast))
	{
		char aBuf[64];
		str_format(aBuf, sizeof aBuf, "%s melted (%+d)", GetTeamName(MeltTeam), CFG(MeltTeamscore));
		m_Broadcast.Update(-1, aBuf, CFG(BroadcastTime) * TS);
	}

	CPlayer *pPlMelter = TPLAYER(Melter);

	if (!pPlMelter)
		return;

	pPlMelter->m_Score += CFG(MeltScore);
	SendFreezeKill(Melter, Meltee, WEAPON_HAMMER);

	if (pPlMelter->GetCharacter() && CFG(MeltLoltext) && CFG(MeltScore))
	{
		char aBuf[64];
		str_format(aBuf, sizeof aBuf, "%+d", CFG(MeltScore));
		GS->CreateLolText(pPlMelter->GetCharacter(), false, vec2(0.f, -50.f), vec2(0.f, 0.f), 50, aBuf);
	}
}
Пример #10
0
void CDlgSimpleSettings::OnOK() 
{
	UpdateData( TRUE );

	CFG().SetValue( "CMSettings", "EmailBtn", (DWORD)( m_bEmail ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "PrintBtn", (DWORD)( m_bPrint ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "FtpBtn", (DWORD)( m_bFtp ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "SaveBtn", (DWORD)( m_bFtp ? 1 : 0 ) );
	CFG().SetValue( "CMSettings", "SetupBtn", (DWORD)( m_bSetup ? 1 : 0 ) );

	CFG().SetValue( "CMSettings", "XMax", (DWORD)strtoul( m_xMax, NULL, 10 ) );
	CFG().SetValue( "CMSettings", "YMax", (DWORD)strtoul( m_yMax, NULL, 10 ) );

	int sel = m_comboImage.GetCurSel();
	if ( sel != -1 )
	{	DWORD driver = m_comboImage.GetItemData( sel );
		CFG().SetValue( "CMSettings", "Driver", driver );
	} // end if

	sel = m_comboFtpServer.GetCurSel();
	if ( sel != -1 )
	{	char txt[ CWF_STRSIZE ];
		m_comboFtpServer.GetLBText( sel, txt );
		CFG().SetValue( "CMSettings", "FtpServer", txt );	
	} // end if

	CDialog::OnOK();
}
Пример #11
0
void CGameControllerOpenFNG::DoBroadcasts(bool ForceSend)
{
	if (m_GameOverTick != -1)
		return;

	if (max(m_aTeamscore[0], m_aTeamscore[1]) + CFG(AllYourBase) >= CFG(Scorelimit))
		m_Broadcast.Update(-1, CFG(AllYourBaseMsg), -1);

	m_Broadcast.SetDef(CFG(DefBroadcast));

	m_Broadcast.Operate();
}
Пример #12
0
void CGameControllerBoomFNG::DoBroadcasts(bool ForceSend)
{
	if (m_GameOverTick != -1)
		return;

	if (max(m_aTeamscore[0], m_aTeamscore[1]) + CFG(AllYourBase) >= CFG(Scorelimit))
		m_Broadcast.Update(-1, "ALL YOUR BASE ARE BELONG TO US.", -1);

	m_Broadcast.SetDef(CFG(DefBroadcast));

	m_Broadcast.Operate();
}
Пример #13
0
void CGameControllerSoloFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			
			if (!pVic || (/*pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && */pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
			
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = /*SameTeam ? -1 : */ i;
			}
		}

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			if (pHam)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = /*SameTeam ? -1 : */ HammeredBy;
				if (/* !SameTeam &&*/ CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0)
				{
					pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}
Пример #14
0
BOOL CDlgSimpleSettings::OnInitDialog() 
{
	CDialog::OnInitDialog();

	// Update flags
	m_bEmail = CFG().GetDword( "CMSettings", "EmailBtn", (DWORD)1 ) != 0;
	m_bPrint = CFG().GetDword( "CMSettings", "PrintBtn", (DWORD)1 ) != 0;
	m_bFtp = CFG().GetDword( "CMSettings", "FtpBtn", (DWORD)1 ) != 0;
	m_bSave = CFG().GetDword( "CMSettings", "SaveBtn", (DWORD)1 ) != 0;
	m_bSetup = CFG().GetDword( "CMSettings", "SetupBtn", (DWORD)1 ) != 0;
	m_sFtpFilename = CFG().GetSz( "CMSettings", "FtpFilename", "webcam.jpg" );
	m_xMax = CFG().GetSz( "CMSettings", "XMax", "800" );
	m_yMax = CFG().GetSz( "CMSettings", "YMax", "600" );

	UpdateData( FALSE );

	FillImageCombo();
	FillFtpCombo();

	DoEnable();


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #15
0
static inline signed char i25_decode_end (zbar_decoder_t *dcode)
{
    i25_decoder_t *dcode25 = &dcode->i25;

    /* check trailing quiet zone */
    unsigned quiet = get_width(dcode, 0);
    if((quiet && quiet < dcode25->width * 3 / 8) ||
            decode_e(get_width(dcode, 1), dcode25->width, 45) > 2 ||
            decode_e(get_width(dcode, 2), dcode25->width, 45) > 2) {
        dprintf(3, " s=%d q=%d [invalid qz]\n", dcode25->width, quiet);
        return(ZBAR_NONE);
    }

    /* check exit condition */
    unsigned char E = decode_e(get_width(dcode, 3), dcode25->width, 45);
    if((!dcode25->direction)
            ? E - 3 > 4
            : (E > 2 ||
               decode_e(get_width(dcode, 4), dcode25->width, 45) > 2))
        return(ZBAR_NONE);

    if(dcode25->direction) {
        /* reverse buffer */
        dprintf(2, " (rev)");
        int i;
        for(i = 0; i < dcode25->character / 2; i++) {
            unsigned j = dcode25->character - 1 - i;
            char c = dcode->buf[i];
            dcode->buf[i] = dcode->buf[j];
            dcode->buf[j] = c;
        }
    }

    if(dcode25->character < CFG(*dcode25, ZBAR_CFG_MIN_LEN) ||
            (CFG(*dcode25, ZBAR_CFG_MAX_LEN) > 0 &&
             dcode25->character > CFG(*dcode25, ZBAR_CFG_MAX_LEN))) {
        dprintf(2, " [invalid len]\n");
        dcode->lock = 0;
        dcode25->character = -1;
        return(ZBAR_NONE);
    }

    dcode->buflen = dcode25->character;
    dcode->buf[dcode25->character] = '\0';
    dprintf(2, " [valid end]\n");
    dcode25->character = -1;
    return(ZBAR_I25);
}
Пример #16
0
void CDlgPublishHtml::OnChangeDir() 
{
	UpdateData( TRUE );

	// Save publish folder
	CFG().SetValue( "Settings", "HtmlPubDir", (LPCTSTR)m_sDir );	
}
Пример #17
0
  static void recv(T& ret) {
    // Wait for data to be received
    while( ! (REG(uart<ID>::control) & CFG(uart<ID>::control::flag::recvend)));

    // Get and return received data from buffer
    ret = (T)REG(uart<ID>::data);
  }
Пример #18
0
void CDlgSimpleSettings::FillImageCombo()
{
	m_comboImage.ResetContent();

	CCapture	cap;
	DWORD		drivers = cap.GetNumDrivers();

	// For each driver
	for ( DWORD i = 0; i < drivers; i++ )
	{
		char				show[ CWF_STRSIZE ];
		CAPTUREDRIVERINFO	ci;

		if ( cap.GetDriverInfo( i, &ci ) )
		{
			sprintf( show, "%s (%s)", ci.szName, ci.szVer );

			int index = m_comboImage.AddString( show );
			if ( index != LB_ERR ) m_comboImage.SetItemData( index, ci.index );
		} // end if

	} // end for

	// Select first driver
	m_comboImage.SetCurSel( CFG().GetDword( "CMSettings", "Driver", (DWORD)0 ) );
}
Пример #19
0
void mainUI::on_tool_config_clicked(){
  QString ds = getSelectedDS();
  if(ds.isEmpty()){ return; }
  LPConfig CFG(this);
  CFG.loadDataset(ds, RLIST.contains(ds));
  CFG.exec();
  //Now check for return values and update appropriately
  bool change = false;
  if(CFG.localChanged){
    LPBackend::setupDataset(ds, CFG.localSchedule, CFG.localSnapshots);
    change = true;
  }
  if(CFG.remoteChanged){
    change = true;
    if(CFG.isReplicated){
      LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
      QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
    }else{
      LPBackend::removeReplication(ds);
    }
  }
  //Now update the UI if appropriate
  if(change){
    setupUI();
  }
}
Пример #20
0
bool ContextPrivate::unload( const QString &pFileName )
{
	if( !QFile( pFileName ).exists() )
	{
		qWarning() << pFileName << "doesn't exist";

		return( false );
	}

	QSettings										 CFG( pFileName, QSettings::IniFormat );
//	int												 VER = 1;
//	bool											 RET = false;

	if( CFG.status() != QSettings::NoError )
	{
		qWarning() << pFileName << "can't load";

		return( false );
	}

	if( CFG.format() != QSettings::IniFormat )
	{
		qWarning() << pFileName << "bad format";

		return( false );
	}

	mActive = false;

	mActive = true;

	return( true );
}
Пример #21
0
void LPMain::openConfigGUI(){
  qDebug() << "Open Configuration UI";
  QString ds = ui->combo_pools->currentText();
  if(ds.isEmpty()){ return; }
  LPConfig CFG(this);
  CFG.loadDataset(ds, LPBackend::listReplicationTargets().contains(ds));
  CFG.exec();
  //Now check for return values and update appropriately
  bool change = false;
  if(CFG.localChanged){
    ui->statusbar->showMessage(QString(tr("Configuring dataset: %1")).arg(ds),0);
    qDebug() << "Settings up local snapshots:" << ds << "Frequency:" << CFG.localSchedule;
    LPBackend::setupDataset(ds, CFG.localSchedule, CFG.localSnapshots);
    ui->statusbar->clearMessage();
    change = true;
  }
  if(CFG.remoteChanged){
    change = true;
    if(CFG.isReplicated){
      ui->statusbar->showMessage(QString(tr("Configuring replication: %1")).arg(ds),0);
      qDebug() << "Setting up Replication:" << ds << " Frequency:" << CFG.remoteFreq;
      LPBackend::setupReplication(ds, CFG.remoteHost, CFG.remoteUser, CFG.remotePort, CFG.remoteDataset, CFG.remoteFreq);
      QMessageBox::information(this,tr("Reminder"),tr("Don't forget to save your SSH key to a USB stick so that you can restore your system from the remote host later!!"));
    }else{
      ui->statusbar->showMessage(QString(tr("Removing replication: %1")).arg(ds),0);
      qDebug() << "Removing Replication:" << ds;
      LPBackend::removeReplication(ds);
    }
    ui->statusbar->clearMessage();
  }
  //Now update the UI if appropriate
  if(change){
    updateTabs();
  }	
}
Пример #22
0
int zbar_image_scanner_set_config (zbar_image_scanner_t *iscn,
								   zbar_symbol_type_t sym,
								   zbar_config_t cfg,
								   int val)
{
	if(cfg < ZBAR_CFG_POSITION)
		return(zbar_decoder_set_config(iscn->dcode, sym, cfg, val));

	if(sym > ZBAR_PARTIAL)
		return(1);

	if(cfg >= ZBAR_CFG_X_DENSITY && cfg <= ZBAR_CFG_Y_DENSITY) {

		CFG(iscn, cfg) = val;
		return(0);
	}

	if(cfg > ZBAR_CFG_POSITION)
		return(1);
	cfg -= ZBAR_CFG_POSITION;

	if(!val)
		iscn->config &= ~(1 << cfg);
	else if(val == 1)
		iscn->config |= (1 << cfg);
	else
		return(1);

	return(0);
}
Пример #23
0
void CGameControllerOpenFNG::HandleFreeze(int Killer, int Victim)
{
	CCharacter *pVictim = CHAR(Victim);
	if (!pVictim) // for odd reasons, this can happen (confirmed by segfault). didn't yet track down why 
	{
		D("no pVictim in HandleFreeze(%d, %d)", Killer, Victim);
		return;
	}

	if (CFG(BleedOnFreeze))
	{
		pVictim->Bleed(1);
		GS->CreateSound(pVictim->m_Pos, SOUND_CTF_RETURN);
	}

	int FailTeam = pVictim->GetPlayer()->GetTeam() & 1;
	m_aTeamscore[1 - FailTeam] += CFG(FreezeTeamscore);

	if (CFG(FreezeTeamscore) && CFG(FreezeBroadcast)) //probably of no real use but for completeness...
	{
		char aBuf[64];
		str_format(aBuf, sizeof aBuf, "%s froze (%+d)", GetTeamName(1-FailTeam), CFG(FreezeTeamscore));
		m_Broadcast.Update(-1, aBuf, CFG(BroadcastTime) * TS);
	}

	CPlayer *pPlKiller = TPLAYER(Killer);

	if (!pPlKiller)
		return;

	//freezing counts as a hostile interaction
	m_aLastInteraction[pVictim->GetPlayer()->GetCID()] = pPlKiller->GetCID();

	pPlKiller->m_Score += CFG(FreezeScore);
	SendFreezeKill(Killer, Victim, WEAPON_RIFLE);

	if (pPlKiller->GetCharacter())
	{
		GS->CreateSound(pPlKiller->GetCharacter()->m_Pos, SOUND_HIT, (1<<pPlKiller->GetCID()));
		if (CFG(FreezeLoltext) && CFG(FreezeScore))
		{
			char aBuf[64];
			str_format(aBuf, sizeof aBuf, "%+d", CFG(FreezeScore));
			GS->CreateLolText(pPlKiller->GetCharacter(), false, vec2(0.f, -50.f), vec2(0.f, 0.f), 50, aBuf);
		}
	}
}
Пример #24
0
zbar_image_scanner_t *zbar_image_scanner_create ()
{
    zbar_image_scanner_t *iscn = calloc(1, sizeof(zbar_image_scanner_t));
    if(!iscn)
        return(NULL);
    iscn->dcode = zbar_decoder_create();
    iscn->scn = zbar_scanner_create(iscn->dcode);
    if(!iscn->dcode || !iscn->scn) {
        zbar_image_scanner_destroy(iscn);
        return(NULL);
    }

    /* apply default configuration */
    CFG(iscn, ZBAR_CFG_X_DENSITY) = 16;
    CFG(iscn, ZBAR_CFG_Y_DENSITY) = 16;
    return(iscn);
}
Пример #25
0
static int l_engine_set_fullscreen(lua_State *l)
{
	if (lua_isnone(l, 1))
		return luaL_error(l, "SetFullscreen takes one boolean argument");
	const bool fullscreen = lua_toboolean(l, 1);
	CFG()->SetInt("StartFullscreen", (fullscreen ? 1 : 0));
	return 0;
}
Пример #26
0
static int l_engine_set_vsync_enabled(lua_State *l)
{
	if (lua_isnone(l, 1))
		return luaL_error(l, "SetVSyncEnabled takes one boolean argument");
	const bool vsync = lua_toboolean(l, 1);
	CFG()->SetInt("VSync", (vsync ? 1 : 0));
	return 0;
}
Пример #27
0
static int l_engine_set_texture_compression_enabled(lua_State *l)
{
	if (lua_isnone(l, 1))
		return luaL_error(l, "SetTextureCompressionEnabled takes one boolean argument");
	const bool enabled = lua_toboolean(l, 1);
	CFG()->SetInt("UseTextureCompression", (enabled ? 1 : 0));
	return 0;
}
Пример #28
0
void CDlgImgView::Shutdown()
{
	char txt[ 64 ];
	if ( GetWindowText( txt, sizeof( txt ) ) )
		CFG().SaveWindowPos( GetSafeHwnd(), "RemoteVideoPos", txt, TRUE );

	DestroyWindow();
}
Пример #29
0
BOOL CDlgImgView::RestorePosition()
{
	char txt[ 64 ];
	if ( GetWindowText( txt, sizeof( txt ) ) )
		return CFG().RestoreWindowPos( GetSafeHwnd(), "RemoteVideoPos", txt, 
										FALSE, TRUE, TRUE, TRUE );
	return FALSE;
}
Пример #30
0
  static void send(T val) {
    // Wait for empty transmit buffer
    while( ! (REG(uart<ID>::control) & CFG(uart<ID>::control::flag::empty)));

    // Put data into buffer
    REG(uart<ID>::data) =
      VAL(uart<ID>::data, val);
  }