bool MQuestItem::Create( const unsigned long int nItemID, const int nCount, MQuestItemDesc* pDesc, bool bKnown ) { m_nItemID = nItemID; m_pDesc = pDesc; return SetCount( nCount, bKnown ); }
scContUnit::scContUnit( TypeSpec& spec, scContUnit* prevPara, long count ) : fFirstline( 0 ), fParaCount( 0 ), fSpecRun( spec ), defspec_( spec ) #ifdef _RUBI_SUPPORT , fRubiArray( 0 ) #endif { #if SCDEBUG > 1 fReformatEvent = 0; #endif try { SetCount( count ); Mark( scRETABULATE ); if ( prevPara ) prevPara->SetNext( this ); SetPrev( prevPara ); } catch( ... ) { delete this; throw; } }
PathListWin::PathListWin(Win* parent, PathList& dataList) : VListWin(Win::WT_CHILD, WH_TABFOCUS | WH_CLICKFOCUS, 0, parent, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0), m_dataList(dataList) { wal::GC gc(this); gc.Set(GetFont()); cpoint ts = gc.GetTextExtents(ABCString); const int fontH = ts.y + 2; this->SetItemSize((fontH > 16 ? fontH : 16) + 1, 100); LSize ls; ls.x.maximal = 10000; ls.x.ideal = 1000; ls.x.minimal = 600; ls.y.maximal = 10000; ls.y.ideal = 600; ls.y.minimal = 400; SetLSize(ls); if (m_dataList.GetCount() > 0) { SetCount(m_dataList.GetCount()); SetCurrent(0); } }
void TextList::Append( const unicode_t* txt, int i, void* p ) { TLNode node( txt, i, p ); list.append( node ); valid = false; SetCount( list.count() ); }
bool ON_Polyline::CreateStarPolygon( const ON_Circle& circle, double other_radius, int side_count ) { bool rc = ( circle.IsValid() && side_count >= 3 && other_radius >= 0.0 ) ? true : false; if ( rc ) { SetCapacity(2*side_count+1); SetCount(2*side_count+1); double half_a = ON_PI/side_count; int i; ON_Circle other_circle = circle; other_circle.radius = other_radius; for ( i = 0; i < side_count; i++ ) { m_a[i*2] = circle.PointAt(half_a*2*i); m_a[i*2+1] = other_circle.PointAt(half_a*(1+2*i)); } m_a[side_count*2] = m_a[0]; } else Destroy(); return rc; }
CDataFactory::LPDATAITEM CDataFactory::_AddNew() { if(m_dwCountOfDataItems == 0 || m_lpDataItems == NULL) { // 如果当前数据为空,则初始化一个新的。 SetCount(1000); m_dwCurUsedDataItemCount = 1; return &m_lpDataItems[0]; } // 当前数据不为空,在后面添加 m_dwCurUsedDataItemCount ++; if(m_dwCurUsedDataItemCount <= m_dwCountOfDataItems) { return &m_lpDataItems[m_dwCurUsedDataItemCount - 1]; } else { LPDATAITEM pNewDataItem = new DATAITEM; if(pNewDataItem == NULL) { m_dwCurUsedDataItemCount --; ASSERT(FALSE); return NULL; } m_cExtDataItemArray.Add((DWORD)pNewDataItem); return pNewDataItem; } }
void Plantable::Plant(ItemPtr sourceItem) { auto x = Player::Get().GetPositionX(); auto y = Player::Get().GetPositionY(); auto currentLandmark = GameState::Get().GetCurrentLandmark(); auto currentTile = currentLandmark->GetTile(x, y); if (currentTile.TileType != TileType::Tilled) { GameState::Get().AddLogMessage("You can only plant on tilled land!"); return; } auto item = currentLandmark->GetItem(x, y); if (item != nullptr) { GameState::Get().AddLogMessageFmt("Cannot plant, %s is on the ground here.", item->GetName().c_str()); return; } auto crop = GameState::Get().GetItemFromItemDatabase(this->Crop); crop->SetCount(1); currentLandmark->AddItem(x, y, crop); auto growableInterface = crop->GetInterface<Growable>(ItemInterfaceType::Growable); if (growableInterface != nullptr) { growableInterface->StartGrowing(crop); } sourceItem->RemoveOne(); }
void CWndGuildVote::SelChange(CGuild* pGuild, int nIndex) { GUILD_VOTE_SELECT guildvotesel[4]; CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1); list <CGuildVote*>::iterator it = pGuild->m_votes.begin(); for ( ; it != pGuild->m_votes.end() ; ++it ) { if( (*it)->GetID() == pCombo->GetItemData(nIndex) ) { guildvotesel[0] = (*it)->GetVoteSelect(0); guildvotesel[1] = (*it)->GetVoteSelect(1); guildvotesel[2] = (*it)->GetVoteSelect(2); guildvotesel[3] = (*it)->GetVoteSelect(3); SetQuestion( (*it)->GetQuestion() ); break; } } SetszString( guildvotesel[0].szString, guildvotesel[1].szString, guildvotesel[2].szString, guildvotesel[3].szString ); SetCount( guildvotesel[0].cbCount, guildvotesel[1].cbCount, guildvotesel[2].cbCount, guildvotesel[3].cbCount ); }
bool SetValue(const void *src_ptr, std::size_t src_count) { bool ptr_changed_flag = SetCount(src_count, false); memcpy(buffer_sptr_.get(), src_ptr, src_count); return(ptr_changed_flag); }
__fastcall TPolyline::TPolyline(TPolyline *Poly,__int32 id) { FId=id; FCount=FCapacity=0; FPoints=NULL; SetCount(Poly->Count); for (int i=0;i<FCount;i++) FPoints[i]=(*Poly)[i]; }
void VectorBase::Erase( char* address, SizeType elementSize ) { char* startAddress = address + elementSize; const char* endAddress = reinterpret_cast< char* >( mData ) + Count() * elementSize; SizeType numberOfBytes = endAddress - startAddress; // addresses overlap so use memmove memmove( address, startAddress, numberOfBytes ); SetCount( Count() - 1 ); }
MP4BytesProperty::MP4BytesProperty(char* name, u_int32_t valueSize, u_int32_t defaultValueSize) : MP4Property(name) { SetCount(1); m_values[0] = (u_int8_t*)MP4Calloc(valueSize); m_valueSizes[0] = valueSize; m_fixedValueSize = 0; m_defaultValueSize = defaultValueSize; }
void __fastcall TPolyline::AddLine(bool b,int L1, int L2, int X) { if (L1<=L2) // Прочие участки не обрабатываются { if (FCount==0) { SetCount(2); Points[0].L=L1; Points[0].X=X; Points[1].L=L2; Points[1].X=X; } else if (Points[FCount-1].L==L1) { int add; if (L2>L1) add=2; else add=1; if (FCount>1) if (Points[FCount-2].L==L1) // Уже есть 2 точки на отрезке add--; SetCount(FCount+add); Points[FCount-1].L=L2; Points[FCount-1].X=X; if ((add)&&(L2!=L1)) { Points[FCount-2].L=L1; Points[FCount-2].X=X; } } else if (Points[FCount-1].L<L1) { if (!b) AddLine(b,Points[FCount-1].L,L1,0); SetCount(FCount+2); Points[FCount-2].L=L1; Points[FCount-2].X=X; Points[FCount-1].L=L2; Points[FCount-1].X=X; } } }
void __fastcall TPolyline::InsertPoint(TRoadPoint& pt,int n) { if (n<=FCount) { SetCount(FCount+1); for (int i=FCount-1;i>n;i--) FPoints[i]=FPoints[i-1]; FPoints[n]=pt; } }
HsvFeatures::HsvFeatures(const Config &conf) { int num_bins = kNumH * kNumS + kNumV; SetCount(num_bins); std::cout<< "hsv histogram bins: "<< GetCount() << std::endl; m_h_step = 180.0 / kNumH; m_s_step = 256.0 / kNumS; m_v_step = 256.0 / kNumV; }
flag CActuator::ValidateData(ValidateDataBlk & VDB) { if (m_DataBlk.GetSize()<1) SetCount(1); if (SortRqd()) { Sort(); FixIOTags(); } return FlwNode::ValidateData(VDB); }
MP4StringProperty::MP4StringProperty(char* name, bool useCountedFormat, bool useUnicode) : MP4Property(name) { SetCount(1); m_values[0] = NULL; m_useCountedFormat = useCountedFormat; m_useExpandedCount = false; m_useUnicode = useUnicode; m_fixedLength = 0; // length not fixed }
//////////////////////////////////////////////////////////////// // どこでもLOAD //////////////////////////////////////////////////////////////// bool cP6T::DokoLoad( cIni *Ini ) { int st; if( !Ini ) return false; Ini->GetInt( "P6T", "Counter", &st, 0 ); SetCount( st ); Ini->GetInt( "P6T", "swait", &swait, swait ); Ini->GetInt( "P6T", "pwait", &pwait, pwait ); return true; }
void plVarDescriptor::CopyFrom(const plVarDescriptor* other) { SetName(other->GetName()); SetDefault(other->GetDefault()); SetCount(other->GetCount()); SetDisplayOptions(other->GetDisplayOptions()); delete [] fTypeString; fTypeString=hsStrcpy(other->GetTypeString()); fType = other->GetType(); fFlags = other->fFlags; }
void Container::SplitItem(ItemPtr item) { auto itemLocation = std::find(this->Contents.begin(), this->Contents.end(), item); if (itemLocation == this->Contents.end()) { return; } auto newItem = Item::Clone(item); auto splitSize = item->GetCount() / 2; auto difference = (item->GetCount() - splitSize); // We don't want rounding issues item->SetCount(splitSize); newItem->SetCount(difference); this->Contents.insert(itemLocation + 1, newItem); }
bool ON_3dPointArray::Create( int point_dimension, int bRational, int point_count, int point_stride, const float* points ) { bool rc = false; if ( point_dimension >= 2 && point_dimension <= 3 && point_count>0 && points && point_stride >= bRational?(point_dimension+1):point_dimension ) { rc = true; int i; ON_3dPoint q(0.0,0.0,0.0); ON_4dPoint h(0.0,0.0,0.0,1.0); m_count = 0; SetCapacity(point_count); SetCount(point_count); if ( bRational ) { for ( i = 0; i < point_count; i++ ) { h.x = points[0]; h.y = points[1]; if ( point_dimension == 3 ) h.z = points[2]; h.w = points[point_dimension]; m_a[i] = h; points += point_stride; } } else { for ( i = 0; i < point_count; i++ ) { q.x = points[0]; q.y = points[1]; if ( point_dimension == 3 ) q.z = points[2]; m_a[i] = q; points += point_stride; } } } else Destroy(); return rc; }
// Constructor adapted for use as a wrapper around that other Request Parameter // thing (the one outside of the OgcFramework) since that bad boy is case // sensitive, and we don't want it to be. // We adapt this from the NameValueCollection class that came from the OgcFramework. MgHttpRequestParameters::MgHttpRequestParameters(MgHttpRequestParam* pParams) : m_pParams(pParams) { MgStringPropertyCollection* p = m_pParams->GetParameters(); SetCount(p->GetCount()); for(int i=0; i< Count(); i++) { STRING sName = p->GetName(i); STRING sValue = p->GetValue(i); VPSZ pszName = szdup(sName.c_str()); VPSZ pszValue = szdup(sValue.c_str()); SetName(i,pszName); SetValue(i,pszValue); } }
// Function that creates a status bar HWND CStatusBar::Create(HWND hWnd, SOption& option, CMainListView& listview) { Init(hWnd, option, listview); HWND hSBWnd = CreateStatusWindow( WS_CHILD | WS_VISIBLE | CCS_BOTTOM, nullptr, m_hWnd, ID_STATUS); m_hSBWnd = hSBWnd; int sb_size[SBSIZE]; memset(sb_size, 0, sizeof(sb_size)); SendMessage(hSBWnd, SB_SETPARTS, SBSIZE, reinterpret_cast<LPARAM>(sb_size)); SetCount(); return hSBWnd; }
NTSTATUS PRIVILEGES_SET::CopyFromUser( PPRIVILEGE_SET ps ) { struct { ULONG count; ULONG control; } x; NTSTATUS r = ::CopyFromUser( &x, ps, sizeof x ); if (r < STATUS_SUCCESS) return r; SetCount( x.count ); Control = x.control; r = ::CopyFromUser( Privileges, ps->Privilege, Count * sizeof Privileges[0] ); return STATUS_SUCCESS; }
ON_BOOL32 ON_SurfaceArray::Read( ON_BinaryArchive& file ) { int major_version = 0; int minor_version = 0; ON__UINT32 tcode = 0; ON__INT64 big_value = 0; int flag; Destroy(); ON_BOOL32 rc = file.BeginRead3dmBigChunk( &tcode, &big_value ); if (rc) { rc = ( tcode == TCODE_ANONYMOUS_CHUNK ); if (rc) rc = file.Read3dmChunkVersion(&major_version,&minor_version); if (rc && major_version == 1) { ON_Object* p; int count; ON_BOOL32 rc = file.ReadInt( &count ); if (rc) { SetCapacity(count); SetCount(count); Zero(); int i; for ( i = 0; rc && i < count && rc; i++ ) { flag = 0; rc = file.ReadInt(&flag); if (rc && flag==1) { p = 0; rc = file.ReadObject( &p ); // polymorphic surfaces m_a[i] = ON_Surface::Cast(p); if ( !m_a[i] ) delete p; } } } } else { rc = false; } if ( !file.EndRead3dmChunk() ) rc = false; } return rc; }
bool ON_Polyline::CreateInscribedPolygon( const ON_Circle& circle, int side_count ) { bool rc = ( circle.IsValid() && side_count >= 3 ) ? true : false; if ( rc ) { SetCapacity(side_count+1); SetCount(side_count+1); double a = 2.0*ON_PI/side_count; int i; for ( i = 0; i < side_count; i++ ) { m_a[i] = circle.PointAt(a*i); } m_a[side_count] = m_a[0]; } else Destroy(); return rc; }
void __fastcall TPolyline::ReplaceNullPart(TPolyline *Ref) { if (Ref->Count) { for (int i=1;i<FCount;i++) { if ((FPoints[i-1].X==0)&&(FPoints[i].X==0)) { TPolyline tmp; tmp.CopyAndCut(Ref,FPoints[i-1].L,FPoints[i].L); int n=FCount; int s=tmp.Count-2; SetCount(FCount+tmp.Count-2); for (int j=n-1;j>i;j--) FPoints[j+s]=FPoints[j]; for (int j=0;j<tmp.Count;j++) FPoints[i+j-1]=tmp[j]; i+=s; } } } }
Pit::Pit(const Config &config) : m_channel(config.channel), m_is_init(true) { assert(m_channel < PIT_COUNT); assert(!g_instances[m_channel]); assert(config.count > 0); g_instances[m_channel] = this; // System enable PIT Sim::SetEnableClockGate(Sim::ClockGate::kPit, true); CLEAR_BIT(PIT->MCR, PIT_MCR_MDIS_SHIFT); CLEAR_BIT(PIT->MCR, PIT_MCR_FRZ_SHIFT); SetEnable(false); SetCount(config.count); ConsumeInterrupt(); SetIsr(config.isr); if (config.is_enable) { SetEnable(true); } }
void Plantable::Plant(std::shared_ptr<Item> sourceItem) { auto x = Player::Get().GetPositionX(); auto y = Player::Get().GetPositionY(); auto currentLandmark = GameState::Get().GetCurrentLandmark(); auto currentTile = currentLandmark->GetTile(x, y); if (currentTile.TileType != TileType::Tilled) { GameState::Get().AddLogMessage("You can only plant on tilled land!"); return; } auto item = currentLandmark->GetItem(x, y); if (item != nullptr) { GameState::Get().AddLogMessageFmt("Cannot plant, %s is on the ground here.", item->GetName().c_str()); return; } auto crop = GameState::Get().GetItemFromItemDatabase(this->Crop); crop->SetCount(1); currentLandmark->AddItem(x, y, crop); auto growableInterface = crop->GetInterface<Growable>(ItemInterfaceType::Growable); if (growableInterface != nullptr) { growableInterface->StartGrowing(crop); } sourceItem->RemoveOne(); // Equip another item if we can find one for (auto item : Player::Get().GetInventory()) { if (item->ItemTarget->GetName() != sourceItem->GetName()) { continue; } Player::Get().EquipFromInventory(item->ItemTarget); break; } }
void TextList::DataRefresh() { if ( !valid ) { valid = true; GC gc( this ); gc.Set( GetFont() ); int X = 0; int cnt = list.count(); for ( int i = 0; i < cnt; i++ ) { if ( list[i].pixelWidth < 0 ) { list[i].pixelWidth = gc.GetTextExtents( list[i].str.data() ).x; } if ( list[i].pixelWidth > X ) { X = list[i].pixelWidth; } } if ( GetCount() != list.count() ) { SetCount( list.count() ); } if ( X != this->GetItemWidth() ) { SetItemSize( GetItemHeight(), X ); } CalcScroll(); Invalidate(); } }