示例#1
0
AInventory *AWeapon::CreateTossable ()
{
	// Only drop the weapon that is meant to be placed in a level. That is,
	// only drop the weapon that normally gives you ammo.
	if (SisterWeapon != NULL && 
		((AWeapon*)GetDefault())->AmmoGive1 == 0 &&
		((AWeapon*)GetDefault())->AmmoGive2 == 0 &&
		(((AWeapon*)SisterWeapon->GetDefault())->AmmoGive1 > 0 ||
		 ((AWeapon*)SisterWeapon->GetDefault())->AmmoGive2 > 0))
	{
		return SisterWeapon->CreateTossable ();
	}
	AWeapon *copy = static_cast<AWeapon *> (Super::CreateTossable ());

	if (copy != NULL)
	{
		// If this weapon has a sister, remove it from the inventory too.
		if (SisterWeapon != NULL)
		{
			SisterWeapon->SisterWeapon = NULL;
			SisterWeapon->Destroy ();
		}
		// To avoid exploits, the tossed weapon must not have any ammo.
		copy->AmmoGive1 = 0;
		copy->AmmoGive2 = 0;
	}
	return copy;
}
示例#2
0
void WorkbenchPlugin::Log(const QString& message, const SmartPointer<IStatus>& status)
{
  //1FTUHE0: ITPCORE:ALL - API - Status & logging - loss of semantic info

  if (!message.isEmpty())
  {
    GetDefault()->GetLog()->Log(StatusUtil::NewStatus(IStatus::ERROR_TYPE, message, BERRY_STATUS_LOC));
  }

  GetDefault()->GetLog()->Log(status);
}
示例#3
0
void MySpinBox::paintEvent(QPaintEvent *event)
{
	QFont f = font();
	f.setBold(value() != GetDefault());
	setFont(f);
	QSpinBox::paintEvent(event);
}
示例#4
0
BOOL Printer::PrintDialog(Window *Obj,UINT Flags)
{
	pd.hwndOwner = Obj->hWnd;
	pd.Flags = Flags;

	while (PrintDlg(&pd)==0)
	{
		switch (CommDlgExtendedError())
		{
			case PDERR_DEFAULTDIFFERENT:
			{
				DEVNAMES *dn=(DEVNAMES*) GlobalLock(pd.hDevNames);
				dn->wDefault&=~DN_DEFAULTPRN;
				GlobalUnlock(pd.hDevNames);
				break;
			}
			case PDERR_PRINTERNOTFOUND:
				MessageBox(Obj->hWnd,"Printer not Found\r\nReverting to default printer","Error",MB_OK);
				GetDefault();
				pd.Flags = Flags; // reset flags as GetDefault changes them
				break;
			default:
				return FALSE;
		}
	}
	return TRUE;
}
示例#5
0
void MyLineEdit::paintEvent(QPaintEvent *event)
{
	QFont f = font();
	f.setBold(text() != GetDefault());
	setFont(f);
	QLineEdit::paintEvent(event);
}
void cMaterialSelector::paintEvent(QPaintEvent *event)
{
	QFont f = font();
	f.setBold(actualValue != GetDefault());
	setFont(f);
	QWidget::paintEvent(event);
}
示例#7
0
void AScriptedMarine::SetSprite (PClassActor *source)
{
	if (source == NULL)
	{ // A valid actor class wasn't passed, so use the standard sprite
		SpriteOverride = sprite = GetClass()->OwnedStates[0].sprite;
		// Copy the standard scaling
		scaleX = GetDefault()->scaleX;
		scaleY = GetDefault()->scaleY;
	}
	else
	{ // Use the same sprite and scaling the passed class spawns with
		SpriteOverride = sprite = GetDefaultByType (source)->SpawnState->sprite;
		scaleX = GetDefaultByType(source)->scaleX;
		scaleY = GetDefaultByType(source)->scaleY;
	}
}
示例#8
0
void CExtButton::_RenderImpl(
	CDC & dc,
	bool bTransparent // = false
	)
{
CRect rectClient;
	GetClientRect( &rectClient );
CString sWindowText( _T("") );
	GetWindowText( sWindowText );
bool bDrawFocusRect = (GetFocus() == this) ? true : false;
bool bDefault = GetDefault() ? true : false;
bool bPushed = (m_bPushed || GetCheck()) ? true : false;
bool bEnabled = IsWindowEnabled() ? true : false;
bool bFlat = GetFlat() ? true : false;
bool bHover =
		( m_bMouseOver
		&& !CExtPopupMenuWnd::IsMenuTracking() )
			? true : false;
HICON hIcon = (bHover) ? m_hIconIn : m_hIconOut;
	if( GetParent()->IsKindOf(RUNTIME_CLASS(CControlBar)) )
	{
		bDrawFocusRect = false;
		bFlat = true;
	}
	g_PaintManager->PaintPushButton(
		dc, true, rectClient, (LPCTSTR)sWindowText,
		hIcon, bFlat, bHover, bPushed,
		false, bEnabled,
		m_bDrawBorder ? true : false,
		bDrawFocusRect, bDefault, m_nAlign,
		NULL, _IsMenuAvail(), 0, bTransparent
		);
}
示例#9
0
void AAmmo::Serialize(FSerializer &arc)
{
	Super::Serialize (arc);
	auto def = (AAmmo*)GetDefault();
	arc("backpackamount", BackpackAmount, def->BackpackAmount)
		("backpackmaxamount", BackpackMaxAmount, def->BackpackMaxAmount);
}
示例#10
0
void AInventory::Tick ()
{
	if (Owner == NULL)
	{
		// AActor::Tick is only handling interaction with the world
		// and we don't want that for owned inventory items.
		Super::Tick ();
	}
	else if (tics != -1)	// ... but at least we have to advance the states
	{
		tics--;
				
		// you can cycle through multiple states in a tic
		// [RH] Use <= 0 instead of == 0 so that spawnstates
		// of 0 tics work as expected.
		if (tics <= 0)
		{
			assert (state != NULL);
			if (state == NULL)
			{
				Destroy();
				return;
			}
			if (!SetState (state->GetNextState()))
				return; 		// freed itself
		}
	}
	if (DropTime)
	{
		if (--DropTime == 0)
		{
			flags |= GetDefault()->flags & (MF_SPECIAL|MF_SOLID);
		}
	}
}
示例#11
0
TournamentOptions &TournamentConfig::GetOptions()
{
    if (!mLoaded)
    {
        mOptions = GetDefault();
    }
    return mOptions;
}
示例#12
0
void MyCheckBox::paintEvent(QPaintEvent *event)
{
	QFont f = font();
	// set bold, if current checked state is non default
	f.setBold(isChecked() != GetDefault());
	setFont(f);
	QCheckBox::paintEvent(event);
}
示例#13
0
Object* ObjectFactory::GetDefault(unsigned long typeId) {
	auto c = core::reflection::MetaGraph::Get().Get(typeId);
	if (c) {
		return GetDefault(c->GetName());
	}
	else {
		return nullptr;
	}
}
示例#14
0
Object* ObjectFactory::CreateNew(std::string name) {
	Object* original = GetDefault(name);
	if (original != nullptr) {
		return original->CreateSelf();
	}
	else {
		return NULL;
	}
}
示例#15
0
wxString pgType::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Type: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP TYPE ") + GetQuotedFullIdentifier() + wxT(";")
		      + wxT("\n\nCREATE TYPE ") + GetQuotedFullIdentifier();
		if (GetTypeClass() == TYPE_COMPOSITE)
		{
			sql += wxT(" AS\n   (");
			sql += GetQuotedTypesList();
		}
		else if (GetTypeClass() == TYPE_ENUM)
		{
			sql += wxT(" AS ENUM\n   (");
			sql += GetQuotedLabelList();
		}
		else
		{
			sql += wxT("\n   (INPUT=") + qtIdent(GetInputFunction())
			       + wxT(", OUTPUT=") + qtIdent(GetOutputFunction());
			AppendIfFilled(sql, wxT(", DEFAULT="), qtDbString(GetDefault()));
			if (!GetElement().IsNull())
			{
				sql += wxT(",\n       ELEMENT=") + GetElement()
				       + wxT(", DELIMITER='") + GetDelimiter() + wxT("'");
			}
			sql += wxT(",\n       INTERNALLENGTH=") + NumToStr(GetInternalLength())
			       + wxT(", ALIGNMENT=" + GetAlignment()
			             + wxT(", STORAGE=") + GetStorage());
			if (GetConnection()->BackendMinimumVersion(8, 3))
			{
				if (GetTypmodinFunction() != wxEmptyString && GetTypmodoutFunction() != wxEmptyString)
				{
					sql += wxT(",\n       TYPMOD_IN=") + GetTypmodinFunction()
					       + wxT(", TYPMOD_OUT=") + GetTypmodoutFunction();
				}
				else if (GetTypmodinFunction() != wxEmptyString)
					sql += wxT(",\n       TYPMOD_IN=") + GetTypmodinFunction();
				else if (GetTypmodoutFunction() != wxEmptyString)
					sql += wxT(",\n       TYPMOD_OUT=") + GetTypmodoutFunction();
			}
			if (GetConnection()->BackendMinimumVersion(9, 1) && GetCollatable())
			{
				sql += wxT(",\n       COLLATABLE=true");
			}
		}
		sql += wxT(");\n")
		       + GetOwnerSql(8, 0)
		       + GetCommentSql();

		if (GetConnection()->BackendMinimumVersion(9, 1))
			sql += GetSeqLabelsSql();
	}

	return sql;
}
示例#16
0
文件: pconf.c 项目: 4auka/cmusphinx
/* PPCONF
 *------------------------------------------------------------*
 */
int
ppconf (int argc, char *argv[], config_t *config_p,
	char **display, char **geometry,
	char * (*GetDefault)(char const *, char const *),
	char last)
{
    int32 i, parsed;
    int32 bad_usage = FALSE;
    char *str_p;
    Config_t *cp;

    if (GetDefault) {
	for (cp = (Config_t *)config_p; cp->arg_type != NOTYPE; cp++) {
		if ((str_p = GetDefault (argv[0], cp->LongName))) {
		    bad_usage |= SetVal (cp, str_p);
	    }
	}
    }

    for (i = 1; i < argc; i++) {
	/* argument has been processed already */
	if (argv[i][0] == '\0') continue;

	for (parsed = FALSE, cp = (Config_t *)config_p;
	     cp->arg_type != NOTYPE; cp++) {
	    if (mystrcasecmp (argv[i], cp->swtch) == 0) {
		parsed = TRUE;
		/* remove this switch from consideration */
		argv[i][0] = '\0';
		if (++i < argc) {
		    bad_usage |= SetVal (cp, argv[i]);
		    argv[i][0] = '\0';
		}
		else bad_usage = TRUE;
	    }
	}

	if (parsed || !last) continue;

	if (geometry && (*argv[i] == '=')) {
	    *geometry = argv[i];
	    continue;
	}

	if (display && (strchr (argv[i], ':') != 0)) {
	    *display = argv[i];
	    continue;
	}

	if ((mystrcasecmp ("-?", argv[i]) == 0) ||
	    (mystrcasecmp ("-help", argv[i]) == 0))
	    pusage (argv[0], (Config_t *) config_p);
	printf ("%s: Unrecognized argument, %s\n", argv[0], argv[i]);
	bad_usage = TRUE;
    }
    return (bad_usage);
}
示例#17
0
void APowerup::Serialize(FSerializer &arc)
{
	Super::Serialize (arc);
	auto def = (APowerup*)GetDefault();
	arc("effecttics", EffectTics, def->EffectTics)
		("blendcolor", BlendColor, def->BlendColor)
		("mode", Mode, def->Mode)
		("strength", Strength, def->Strength);
}
示例#18
0
ItemAttributeMgr::real_t ItemAttributeMgr::GetReal(Attr attr) const {
    real_t v;
    if(!_Get(attr, v))
        if(!m_item.type().attributes._Get(attr, v)) // try the type attributes
            v = GetDefault(attr);

    _CalcTauCap(attr, v);

    return v;
}
示例#19
0
wxString pgDomain::GetSql(ctlTree *browser)
{
    if (sql.IsNull())
    {
        sql = wxT("-- Domain: ") + GetQuotedFullIdentifier() + wxT("\n\n")
              + wxT("-- DROP DOMAIN ") + GetQuotedFullIdentifier() + wxT(";")
              + wxT("\n\nCREATE DOMAIN ") + GetQuotedFullIdentifier()
              + wxT("\n  AS ") + GetQuotedBasetype();
        if (GetCollationOid() > 0)
            sql += wxT("\n  COLLATE ") + GetQuotedCollation();
        AppendIfFilled(sql, wxT("\n  DEFAULT "), GetDefault());
        // CONSTRAINT Name Dont know where it's stored, may be omitted anyway
        if (notNull)
            sql += wxT("\n  NOT NULL");

        // Get a count of the constraints.
        int consCount = 0;
        pgCollection *constraints = browser->FindCollection(checkFactory, GetId());
        if (constraints)
        {
            constraints->ShowTreeDetail(browser);
            treeObjectIterator consIt(browser, constraints);

            pgObject *data;

            while ((data = consIt.GetNextObject()) != 0)
            {
                data->ShowTreeDetail(browser);

                sql += wxT("\n  CONSTRAINT ") + data->GetQuotedIdentifier()
                       + wxT(" ") + data->GetTypeName().Upper()
                       + wxT(" ") ;

                switch (data->GetMetaType())
                {
                case PGM_CHECK:
                    sql += wxT("(") + ((pgCheck *)data)->GetDefinition() + wxT(")");
                    if (GetDatabase()->BackendMinimumVersion(9, 2) && !((pgCheck *)data)->GetValid())
                        sql += wxT(" NOT VALID");
                    break;
                }
            }
        }

        sql += wxT(";\n")
               + GetOwnerSql(7, 4)
               + GetCommentSql();

        if (GetConnection()->BackendMinimumVersion(9, 1))
            sql += GetSeqLabelsSql();
    }

    return sql;
}
示例#20
0
 void DiShaderParameter::AddParameter(ParamType type, const DiString& name)
 {
     DI_ASSERT(type < NUM_VARIABLE_TYPES);
     auto it = mShaderParams[type].find(name);
     if (it != mShaderParams[type].end())
     {
         DI_WARNING("The parameter with name %s has already existed.", name.c_str());
         return;
     }
     mShaderParams[type][name] = GetDefault(type);
 }
示例#21
0
PolarInfo
PolarGlue::LoadFromProfile()
{
  PolarInfo polar;
  if (!LoadFromProfile(polar) || !polar.IsValid()) {
    if (Profile::Exists(ProfileKeys::Polar) || Profile::Exists(ProfileKeys::PolarID))
      ShowMessageBox(_("Polar has invalid coefficients.\nUsing LS8 polar instead!"),
                  _("Warning"), MB_OK);
    polar = GetDefault();
  }

  return polar;
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
	CCreateContext* pContext)
{


	if (!m_wndSplitter.Create(this, VSPLITTER | FIXED0 | VIEW3D ))
		return FALSE;

	m_wndSplitter.CreateView(RUNTIME_CLASS(CShortCutView), 1, pContext);
	m_wndSplitter.CreateView(RUNTIME_CLASS(CBiSplitterWnd), 2, VSPLITTER | FIXED0 | VIEW3D);

	if(!m_wndSplitter.CreatePane(0, THIN_BORDER | THIN_CAPTIONBORDER | FLAT_BUTTON | GRIPBTN|SMCAPTION|CLOSEBTN , _T("Shortcuts")
			, m_wndSplitter.GetView(1))
		||
		!m_wndSplitter.CreatePane(1, FLAT_BUTTON , NULL, m_wndSplitter.GetView(2))	
	  )
	{
		m_wndSplitter.DestroyWindow();
		return FALSE;
	}

	pSplitterWnd2 = (CBiSplitterWnd *)m_wndSplitter.GetPaneView(1);
	pSplitterWnd2->CreateView(RUNTIME_CLASS(CFvmDirView), 11, pContext);
	pSplitterWnd2->CreateView(RUNTIME_CLASS(CFvmFileView), 12, pContext);

	if(!pSplitterWnd2->CreatePane(0, THIN_BORDER | THIN_CAPTIONBORDER | FLAT_BUTTON | GRIPBTN |SMCAPTION| CLOSEBTN , _T("Folders")
			, pSplitterWnd2->GetView(11))
		||
		!pSplitterWnd2->CreatePane(1, THIN_BORDER| THIN_CAPTIONBORDER | FLAT_BUTTON | GRIPBTN , NULL, pSplitterWnd2->GetView(12))	
	  )
	{
		pSplitterWnd2->DestroyWindow();
		return FALSE;
	}

	m_wndSplitter.SetSplitterPos(200);
	m_wndSplitter.SetSplitterGap(6);
	pSplitterWnd2->SetSplitterPos(200);
	pSplitterWnd2->SetSplitterGap(6);



	GetDirView()->m_pOwner=this;
	GetFileView()->m_pOwner=this;
	GetShortcutView()->m_pOwner = this;
	pSplitterWnd2->HidePane(BSW_FIRST_PANE);

	GetDefault();
	return TRUE;
}
示例#23
0
文件: pconf.c 项目: 4auka/cmusphinx
/* PCONF
 *------------------------------------------------------------*
 */
int
pconf (int argc, char *argv[], config_t *config_p,
       char **display, char **geometry,
       char * (*GetDefault)(char const *, char const *))
{
    int32 i, parsed;
    int32 bad_usage = FALSE;
    char *str_p;
    Config_t *cp;

    if (GetDefault) {
	for (cp = (Config_t *) config_p; cp->arg_type != NOTYPE; cp++) {
	    if ((str_p = GetDefault (argv[0], cp->LongName))) {
		bad_usage |= SetVal (cp, str_p);
	    }
	}
    }

    for (i = 1; i < argc; i++) {
	for (parsed = FALSE, cp = (Config_t *) config_p;
	     cp->arg_type != NOTYPE; cp++) {
	    /* FIXME: do we *really* need our own strcasecmp? */
	    if (mystrcasecmp (argv[i], cp->swtch) == 0) {
		parsed = TRUE;
		if (++i < argc)
		    bad_usage |= SetVal (cp, argv[i]);
		else
		    bad_usage = TRUE;
	    }
	}

	if (parsed)
	    continue;
	if (geometry && (*argv[i] == '=')) {
	    *geometry = argv[i];
	    continue;
	}
	if (display && (strchr (argv[i], ':') != 0)) {
	    *display = argv[i];
	    continue;
	}
	if ((mystrcasecmp ("-?", argv[i]) == 0) ||
	    (mystrcasecmp ("-help", argv[i]) == 0))
	    pusage (argv[0], (Config_t *) config_p);
	bad_usage = TRUE;
    }
    return (bad_usage);
}
示例#24
0
void MySpinBox::paintEvent(QPaintEvent *event)
{
	if (value() != GetDefault())
	{
		QFont f = font();
		f.setBold(true);
		setFont(f);
	}
	else
	{
		QFont f = font();
		f.setBold(false);
		setFont(f);
	}
	QSpinBox::paintEvent(event);
}
示例#25
0
void AInventory::Serialize(FSerializer &arc)
{
	Super::Serialize (arc);

	auto def = (AInventory*)GetDefault();
	arc("owner", Owner)
		("amount", Amount, def->Amount)
		("maxamount", MaxAmount, def->MaxAmount)
		("interhubamount", InterHubAmount, def->InterHubAmount)
		("respawntics", RespawnTics, def->RespawnTics)
		("itemflags", ItemFlags, def->ItemFlags)
		("icon", Icon, def->Icon)
		("pickupsound", PickupSound, def->PickupSound)
		("spawnpointclass", SpawnPointClass, def->SpawnPointClass)
		("droptime", DropTime, def->DropTime);
}
示例#26
0
void MyLineEdit::paintEvent(QPaintEvent *event)
{
	if (text() != GetDefault())
	{
		QFont f = font();
		f.setBold(true);
		setFont(f);
	}
	else
	{
		QFont f = font();
		f.setBold(false);
		setFont(f);
	}
	QLineEdit::paintEvent(event);
}
示例#27
0
void MyColorButton::UpdateColor()
{
	GetDefault();
	QColor color(currentValue.R / 256, currentValue.G / 256, currentValue.B / 256);
	painter->fillRect(QRect(0, 0, w, h), color);
	painter->drawRect(0,0,w-1,h-1);

	if(!(defaultValue.R / 256 == currentValue.R / 256 && defaultValue.G / 256 == currentValue.G / 256 && defaultValue.B / 256 == currentValue.B / 256))
	{
		// not (almost) default color -> make border thicker to indicate non default value
		painter->drawRect(1,1,w-3,h-3);
	}

	QIcon icon(*pix);
	setIcon(icon);
	setIconSize(QSize(w, h));
}
示例#28
0
void AInventory::BecomePickup ()
{
	if (Owner != NULL)
	{
		Owner->RemoveInventory (this);
	}
	if (flags & (MF_NOBLOCKMAP|MF_NOSECTOR))
	{
		UnlinkFromWorld ();
		flags &= ~(MF_NOBLOCKMAP|MF_NOSECTOR);
		LinkToWorld ();
		P_FindFloorCeiling (this);
	}
	flags = (GetDefault()->flags | MF_DROPPED) & ~MF_COUNTITEM;
	renderflags &= ~RF_INVISIBLE;
	SetState (SpawnState);
}
示例#29
0
void pgDomain::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids = true;

        browser->RemoveDummyChild(this);

        // Log
        wxLogInfo(wxT("Adding child object to domain %s"), GetIdentifier().c_str());
        if (GetConnection()->BackendMinimumVersion(7, 4))
            browser->AppendCollection(this, constraintFactory);
    }

    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("OID"), GetOid());
        properties->AppendItem(_("Owner"), GetOwner());
        properties->AppendItem(_("Base type"), GetBasetype());
        if (GetDimensions())
            properties->AppendItem(_("Dimensions"), GetDimensions());
        if (GetCollationOid() > 0)
            properties->AppendItem(_("Collation"), GetQuotedCollation());
        properties->AppendItem(_("Default"), GetDefault());
        properties->AppendYesNoItem(_("Not NULL?"), GetNotNull());
        properties->AppendYesNoItem(_("System domain?"), GetSystemObject());
        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

        if (!GetLabels().IsEmpty())
        {
            wxArrayString seclabels = GetProviderLabelArray();
            if (seclabels.GetCount() > 0)
            {
                for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2)
                {
                    properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1));
                }
            }
        }
    }
}
charconv* CharConvOpen(const tchar_t* From, const tchar_t* To)
{
    iconv_t CC;

    GetDefault();

    if (!From || !From[0])
        From = Current;

    if (!To || !To[0])
        To = Current;

    if (tcsicmp(To,From)==0)
        return NULL;

    CC = iconv_open(To,From);
    if (CC == (iconv_t)-1)
        return NULL;

    return (charconv*)CC;
}