OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4IDList Class Reference

#include <C4IDList.h>

Inheritance diagram for C4IDList:
[legend]
Collaboration diagram for C4IDList:
[legend]

Public Member Functions

 C4IDList ()
 
 C4IDList (const C4IDList &rCopy)
 
C4IDListoperator= (const C4IDList &rCopy)
 
 ~C4IDList ()
 
bool operator== (const C4IDList &rhs) const
 
void Default ()
 
void Clear ()
 
bool IsClear () const
 
C4ID GetID (size_t index, int32_t *ipCount=nullptr) const
 
int32_t GetCount (size_t index) const
 
bool SetCount (size_t index, int32_t iCount)
 
int32_t GetIDCount (C4ID c_id, int32_t iZeroDefVal=0) const
 
bool SetIDCount (C4ID c_id, int32_t iCount, bool fAddNewID=false)
 
bool IncreaseIDCount (C4ID c_id, bool fAddNewID=true, int32_t IncreaseBy=1, bool fRemoveEmpty=false)
 
bool DecreaseIDCount (C4ID c_id, bool fRemoveEmptyID=true)
 
int32_t GetNumberOfIDs () const
 
int32_t GetIndex (C4ID c_id) const
 
C4ID GetID (C4DefList &rDefs, int32_t dwCategory, int32_t index, int32_t *ipCount=nullptr) const
 
int32_t GetCount (C4DefList &rDefs, int32_t dwCategory, int32_t index) const
 
bool SetCount (C4DefList &rDefs, int32_t dwCategory, int32_t index, int32_t iCount)
 
int32_t GetNumberOfIDs (C4DefList &rDefs, int32_t dwCategory) const
 
bool Add (C4IDList &rList)
 
bool ConsolidateValids (C4DefList &rDefs, int32_t dwCategory=0)
 
bool DeleteItem (size_t iIndex)
 
void Draw (C4Facet &cgo, int32_t iSelection, C4DefList &rDefs, DWORD dwCategory, bool fCounts=true, int32_t iAlign=0) const
 
void CompileFunc (StdCompiler *pComp, bool fValues=true)
 

Protected Attributes

size_t Count
 
C4ID id [C4IDListChunkSize]
 
C4IDListChunkpNext
 

Detailed Description

Definition at line 46 of file C4IDList.h.

Constructor & Destructor Documentation

C4IDList::C4IDList ( )

Definition at line 61 of file stub-handle.cpp.

61 {}
C4IDList::C4IDList ( const C4IDList rCopy)

Definition at line 57 of file C4IDList.cpp.

References Default().

57  : C4IDListChunk()
58 {
59  Default();
60  *this = rCopy;
61 }
void Default()
Definition: stub-handle.cpp:63

Here is the call graph for this function:

C4IDList::~C4IDList ( )

Definition at line 62 of file stub-handle.cpp.

62 {}

Member Function Documentation

bool C4IDList::Add ( C4IDList rList)

Definition at line 351 of file C4IDList.cpp.

References C4IDListChunkSize, C4IDListChunk::Count, Count, C4IDListChunk::id, IncreaseIDCount(), and C4IDListChunk::pNext.

352 {
353  C4IDListChunk *pQueryChunk=&rList;
354  size_t cnt=rList.Count,cntl=0;
355  while (cnt--)
356  {
357  IncreaseIDCount(pQueryChunk->id[cntl], true, pQueryChunk->Count[cntl]);
358  if (++cntl==C4IDListChunkSize)
359  {
360  pQueryChunk=pQueryChunk->pNext;
361  cntl=0;
362  }
363  }
364  return true;
365 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
bool IncreaseIDCount(C4ID c_id, bool fAddNewID=true, int32_t IncreaseBy=1, bool fRemoveEmpty=false)
Definition: C4IDList.cpp:220
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

void C4IDList::Clear ( )

Definition at line 64 of file stub-handle.cpp.

Referenced by C4GameParameters::Clear(), C4RoundResults::Clear(), C4SGame::Default(), C4SAnimals::Default(), C4SEnvironment::Default(), C4Def::DefaultDefCore(), and C4RoundResults::EvaluateGoals().

64 {}

Here is the caller graph for this function:

void C4IDList::CompileFunc ( StdCompiler pComp,
bool  fValues = true 
)

Definition at line 69 of file stub-handle.cpp.

69 {}
bool C4IDList::ConsolidateValids ( C4DefList rDefs,
int32_t  dwCategory = 0 
)

Definition at line 367 of file C4IDList.cpp.

References C4IDListChunkSize, C4Def::Category, Count, DeleteItem(), C4IDListChunk::id, C4DefList::ID2Def(), and C4IDListChunk::pNext.

Referenced by C4Player::ScenarioInit().

368 {
369  bool fIDsRemoved=false;
370  C4IDListChunk *pQueryChunk=this;
371  size_t cnt=Count,cntl=0;
372  C4Def* pDef;
373  while (cnt--)
374  {
375  // ID does not resolve to a valid def or category is specified and def does not match category
376  if (!(pDef = rDefs.ID2Def(pQueryChunk->id[cntl])) || (dwCategory && !(pDef->Category & dwCategory)))
377  {
378  // delete it
379  DeleteItem(Count-cnt-1);
380  // handle this list index again!
381  --cntl;
382  // something was done
383  fIDsRemoved=true;
384  }
385  if (++cntl==C4IDListChunkSize)
386  {
387  pQueryChunk=pQueryChunk->pNext;
388  cntl=0;
389  }
390  }
391  return fIDsRemoved;
392 }
C4Def * ID2Def(C4ID id)
C4IDListChunk * pNext
Definition: C4IDList.h:36
Definition: C4Def.h:98
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
int32_t Category
Definition: C4Def.h:117
bool DeleteItem(size_t iIndex)
Definition: C4IDList.cpp:423
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4IDList::DecreaseIDCount ( C4ID  c_id,
bool  fRemoveEmptyID = true 
)
inline

Definition at line 69 of file C4IDList.h.

References IncreaseIDCount().

70  { return IncreaseIDCount(c_id, false, -1, fRemoveEmptyID); }
bool IncreaseIDCount(C4ID c_id, bool fAddNewID=true, int32_t IncreaseBy=1, bool fRemoveEmpty=false)
Definition: C4IDList.cpp:220

Here is the call graph for this function:

void C4IDList::Default ( )

Definition at line 63 of file stub-handle.cpp.

Referenced by C4IDList(), C4SDefinitions::Default(), C4SRealism::Default(), C4SPlrStart::Default(), C4SLandscape::Default(), and C4Player::DefaultRuntimeData().

63 {}

Here is the caller graph for this function:

bool C4IDList::DeleteItem ( size_t  iIndex)

Definition at line 423 of file C4IDList.cpp.

References C4IDListChunkSize, C4IDListChunk::Count, Count, C4IDListChunk::id, and C4IDListChunk::pNext.

Referenced by ConsolidateValids(), IncreaseIDCount(), and C4Player::SetKnowledge().

424 {
425  // invalid index
426  if (!Inside<size_t>(iIndex+1,1u,Count)) return false;
427  // get chunk to delete of
428  size_t index=iIndex;
429  C4IDListChunk *pQueryChunk=this;
430  while (index>=C4IDListChunkSize) { pQueryChunk=pQueryChunk->pNext; index-=C4IDListChunkSize; }
431  // shift down all entries behind
432  size_t cnt=--Count-iIndex,cntl=index,cntl2=cntl;
433  C4IDListChunk *pNextChunk=pQueryChunk;
434  while (cnt--)
435  {
436  // check for list overlap
437  if (++cntl2==C4IDListChunkSize)
438  {
439  pNextChunk=pQueryChunk->pNext;
440  cntl2=0;
441  }
442  // move down
443  pQueryChunk->id[cntl]=pNextChunk->id[cntl2];
444  pQueryChunk->Count[cntl]=pNextChunk->Count[cntl2];
445  // next item
446  pQueryChunk=pNextChunk; cntl=cntl2;
447  }
448  // done
449  return true;
450 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
size_t Count
Definition: C4IDList.h:55

Here is the caller graph for this function:

void C4IDList::Draw ( C4Facet cgo,
int32_t  iSelection,
C4DefList rDefs,
DWORD  dwCategory,
bool  fCounts = true,
int32_t  iAlign = 0 
) const

Definition at line 394 of file C4IDList.cpp.

References ARight, C4Draw::DEFAULT_MESSAGE_COLOR, C4DefList::Draw(), C4GraphicsResource::FontRegular, GetID(), CStdFont::GetLineHeight(), GetNumberOfIDs(), C4Facet::GetSectionCount(), GraphicsResource, C4Facet::Hgt, pDraw, sprintf, C4Facet::Surface, C4Draw::TextOut(), C4Facet::TruncateSection(), C4Facet::Wdt, C4Facet::X, and C4Facet::Y.

397 {
398 
399  int32_t sections = cgo.GetSectionCount();
400  int32_t idnum = GetNumberOfIDs(rDefs,dwCategory);
401  int32_t firstid = Clamp<int32_t>(iSelection-sections/2,0,std::max<int32_t>(idnum-sections,0));
402  int32_t idcount;
403  C4ID c_id;
404  C4Facet cgo2;
405  char buf[10];
406  for (int32_t cnt=0; (cnt<sections) && (c_id=GetID(rDefs,dwCategory,firstid+cnt,&idcount)); cnt++)
407  {
408  cgo2 = cgo.TruncateSection(iAlign);
409  rDefs.Draw(c_id,cgo2,(firstid+cnt==iSelection),0);
410  sprintf(buf,"%dx",idcount);
411  if (fCounts) pDraw->TextOut(buf, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - ::GraphicsResource.FontRegular.GetLineHeight(),C4Draw::DEFAULT_MESSAGE_COLOR,ARight);
412  }
413 
414 }
int GetLineHeight() const
Definition: C4FontLoader.h:125
C4Facet TruncateSection(int32_t iAlign=C4FCT_Left)
Definition: C4Facet.cpp:250
float Y
Definition: C4Facet.h:118
#define sprintf
Definition: Standard.h:164
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:567
int32_t GetSectionCount()
Definition: C4Facet.cpp:46
const int ARight
Definition: C4Surface.h:41
C4GraphicsResource GraphicsResource
C4Draw * pDraw
Definition: C4Draw.cpp:42
Definition: C4Id.h:25
void Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor)
Definition: C4DefList.cpp:407
float Hgt
Definition: C4Facet.h:118
C4Surface * Surface
Definition: C4Facet.h:117
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99
int32_t GetNumberOfIDs() const
Definition: C4IDList.cpp:197
float Wdt
Definition: C4Facet.h:118
float X
Definition: C4Facet.h:118

Here is the call graph for this function:

int32_t C4IDList::GetCount ( size_t  index) const

Definition at line 111 of file C4IDList.cpp.

References C4IDListChunkSize, C4IDListChunk::Count, Count, and C4IDListChunk::pNext.

Referenced by C4Object::CreateContentsByList(), C4Player::ExecBaseProduction(), C4Player::PlaceReadyBase(), C4Player::PlaceReadyMaterial(), and C4Player::PlaceReadyVehic().

112 {
113  // outside list?
114  if (!Inside<size_t>(index+1,1u,Count)) return 0;
115  // get chunk to query
116  const C4IDListChunk *pQueryChunk=this;
117  while (index>=C4IDListChunkSize) { pQueryChunk=pQueryChunk->pNext; index-=C4IDListChunkSize; }
118  // query it
119  return pQueryChunk->Count[index];
120 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
size_t Count
Definition: C4IDList.h:55

Here is the caller graph for this function:

int32_t C4IDList::GetCount ( C4DefList rDefs,
int32_t  dwCategory,
int32_t  index 
) const

Definition at line 287 of file C4IDList.cpp.

References C4D_All, C4IDListChunkSize, C4Def::Category, C4IDListChunk::Count, Count, C4IDListChunk::id, C4DefList::ID2Def(), and C4IDListChunk::pNext.

288 {
289  int32_t cindex=-1;
290  C4Def *cDef;
291  const C4IDListChunk *pQueryChunk=this;
292  size_t cnt=Count,cntl=0;
293  while (cnt--)
294  {
295  if ((dwCategory==C4D_All) || ( (cDef=rDefs.ID2Def(pQueryChunk->id[cntl])) && (cDef->Category & dwCategory) ) )
296  {
297  cindex++;
298  if (cindex==index) return pQueryChunk->Count[cntl];
299  }
300  if (++cntl==C4IDListChunkSize)
301  {
302  pQueryChunk=pQueryChunk->pNext;
303  cntl=0;
304  }
305  }
306  return 0;
307 }
C4Def * ID2Def(C4ID id)
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const int32_t C4D_All
Definition: C4Def.h:39
Definition: C4Def.h:98
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
int32_t Category
Definition: C4Def.h:117
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

C4ID C4IDList::GetID ( size_t  index,
int32_t *  ipCount = nullptr 
) const

Definition at line 99 of file C4IDList.cpp.

References C4IDListChunkSize, C4IDListChunk::Count, Count, C4IDListChunk::id, C4ID::None, and C4IDListChunk::pNext.

Referenced by C4MainMenu::ActivateGoals(), C4DefList::CheckRequireDef(), C4Object::CreateContentsByList(), Draw(), C4Player::ExecBaseProduction(), C4GameParameters::GetGameGoalString(), C4Game::InitAnimals(), C4Game::InitEnvironment(), C4Game::InitGoals(), C4Game::InitRules(), C4Game::InitValueOverloads(), ListExpandValids(), C4Player::PlaceReadyBase(), C4Player::PlaceReadyCrew(), C4Player::PlaceReadyMaterial(), C4Player::PlaceReadyVehic(), and C4GoalDisplay::SetGoals().

100 {
101  // outside list?
102  if (!Inside<size_t>(index+1,1u,Count)) return C4ID::None;
103  // get chunk to query
104  const C4IDListChunk *pQueryChunk=this;
105  while (index>=C4IDListChunkSize) { pQueryChunk=pQueryChunk->pNext; index-=C4IDListChunkSize; }
106  // query it
107  if (ipCount) *ipCount=pQueryChunk->Count[index];
108  return pQueryChunk->id[index];
109 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
static const C4ID None
Definition: C4Id.h:39
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
size_t Count
Definition: C4IDList.h:55

Here is the caller graph for this function:

C4ID C4IDList::GetID ( C4DefList rDefs,
int32_t  dwCategory,
int32_t  index,
int32_t *  ipCount = nullptr 
) const

Definition at line 263 of file C4IDList.cpp.

References C4D_All, C4IDListChunkSize, C4Def::Category, C4IDListChunk::Count, Count, C4IDListChunk::id, C4DefList::ID2Def(), C4ID::None, and C4IDListChunk::pNext.

264 {
265  int32_t cindex=-1;
266  C4Def *cDef;
267  if (ipCount) *ipCount=0;
268  // find id
269  const C4IDListChunk *pQueryChunk=this;
270  size_t cnt=Count,cntl=0;
271  while (cnt--)
272  {
273  if ((dwCategory==C4D_All) || ( (cDef=rDefs.ID2Def(pQueryChunk->id[cntl])) && (cDef->Category & dwCategory) ) )
274  {
275  cindex++;
276  if (cindex==index) { if (ipCount) *ipCount=pQueryChunk->Count[cntl]; return pQueryChunk->id[cntl]; }
277  }
278  if (++cntl==C4IDListChunkSize)
279  {
280  pQueryChunk=pQueryChunk->pNext;
281  cntl=0;
282  }
283  }
284  return C4ID::None;
285 }
C4Def * ID2Def(C4ID id)
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
static const C4ID None
Definition: C4Id.h:39
const int32_t C4D_All
Definition: C4Def.h:39
Definition: C4Def.h:98
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
int32_t Category
Definition: C4Def.h:117
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

int32_t C4IDList::GetIDCount ( C4ID  c_id,
int32_t  iZeroDefVal = 0 
) const

Definition at line 67 of file stub-handle.cpp.

Referenced by C4MainMenu::ActivateGoals(), C4Player::ExecBaseProduction(), C4Game::InitValueOverloads(), C4SGame::IsMelee(), and C4GoalDisplay::SetGoals().

67 { return 0; }

Here is the caller graph for this function:

int32_t C4IDList::GetIndex ( C4ID  c_id) const

Definition at line 202 of file C4IDList.cpp.

References C4IDListChunkSize, Count, C4IDListChunk::id, and C4IDListChunk::pNext.

Referenced by C4Player::SetKnowledge().

203 {
204  // find id in list
205  const C4IDListChunk *pQueryChunk=this;
206  size_t cnt=Count,cntl=0;
207  while (cnt--)
208  {
209  if (pQueryChunk->id[cntl]==c_id) return Count-cnt-1;
210  if (++cntl==C4IDListChunkSize)
211  {
212  pQueryChunk=pQueryChunk->pNext;
213  cntl=0;
214  }
215  }
216  // not found
217  return -1;
218 }
C4IDListChunk * pNext
Definition: C4IDList.h:36
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
size_t Count
Definition: C4IDList.h:55

Here is the caller graph for this function:

int32_t C4IDList::GetNumberOfIDs ( ) const

Definition at line 197 of file C4IDList.cpp.

References Count.

Referenced by C4MainMenu::ActivateGoals(), C4DefList::CheckRequireDef(), Draw(), C4GameParameters::GetGameGoalString(), and C4GoalDisplay::SetGoals().

198 {
199  return Count;
200 }
size_t Count
Definition: C4IDList.h:55

Here is the caller graph for this function:

int32_t C4IDList::GetNumberOfIDs ( C4DefList rDefs,
int32_t  dwCategory 
) const

Definition at line 331 of file C4IDList.cpp.

References C4D_All, C4IDListChunkSize, C4Def::Category, Count, C4IDListChunk::id, C4DefList::ID2Def(), and C4IDListChunk::pNext.

332 {
333  int32_t idnum=0;
334  C4Def *cDef;
335  const C4IDListChunk *pQueryChunk=this;
336  size_t cnt=Count,cntl=0;
337  while (cnt--)
338  {
339  if ((dwCategory==C4D_All) || ( (cDef=rDefs.ID2Def(pQueryChunk->id[cntl])) && (cDef->Category & dwCategory) ) )
340  idnum++;
341  if (++cntl==C4IDListChunkSize)
342  {
343  pQueryChunk=pQueryChunk->pNext;
344  cntl=0;
345  }
346  }
347  return idnum;
348 }
C4Def * ID2Def(C4ID id)
C4IDListChunk * pNext
Definition: C4IDList.h:36
const int32_t C4D_All
Definition: C4Def.h:39
Definition: C4Def.h:98
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
int32_t Category
Definition: C4Def.h:117
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

bool C4IDList::IncreaseIDCount ( C4ID  c_id,
bool  fAddNewID = true,
int32_t  IncreaseBy = 1,
bool  fRemoveEmpty = false 
)

Definition at line 220 of file C4IDList.cpp.

References C4IDListChunk::C4IDListChunk(), C4IDListChunkSize, C4IDListChunk::Count, Count, DeleteItem(), C4IDListChunk::id, and C4IDListChunk::pNext.

Referenced by Add(), DecreaseIDCount(), and C4Player::ExecBaseProduction().

221 {
222  // find id in list
223  C4IDListChunk *pQueryChunk=this;
224  size_t cnt=Count,cntl=0;
225  while (cnt--)
226  {
227  if (pQueryChunk->id[cntl]==c_id)
228  {
229  // increase count
230  pQueryChunk->Count[cntl]+=IncreaseBy;
231  // check count
232  if (fRemoveEmpty && !pQueryChunk->Count[cntl]) DeleteItem(Count-cnt-1);
233  // success
234  return true;
235  }
236  if (++cntl==C4IDListChunkSize)
237  {
238  pQueryChunk=pQueryChunk->pNext;
239  cntl=0;
240  }
241  }
242  // add desired?
243  if (!fAddNewID) return true;
244  // add it
245  // if end was reached, add new chunk
246  if (!pQueryChunk)
247  {
248  C4IDListChunk *pLast=this;
249  while (pLast->pNext) pLast=pLast->pNext;
250  pQueryChunk=new C4IDListChunk();
251  pLast->pNext=pQueryChunk;
252  }
253  // set id
254  pQueryChunk->id[cntl]=c_id;
255  pQueryChunk->Count[cntl]=IncreaseBy;
256  ++Count;
257  // success
258  return true;
259 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
bool DeleteItem(size_t iIndex)
Definition: C4IDList.cpp:423
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4IDList::IsClear ( ) const

Definition at line 94 of file C4IDList.cpp.

References Count.

95 {
96  return !Count;
97 }
size_t Count
Definition: C4IDList.h:55
C4IDList & C4IDList::operator= ( const C4IDList rCopy)

Definition at line 65 of file stub-handle.cpp.

65 { return *this; }
bool C4IDList::operator== ( const C4IDList rhs) const

Definition at line 66 of file stub-handle.cpp.

66 { return false; }
bool C4IDList::SetCount ( size_t  index,
int32_t  iCount 
)

Definition at line 122 of file C4IDList.cpp.

References C4IDListChunkSize, C4IDListChunk::Count, Count, and C4IDListChunk::pNext.

123 {
124  // outside list?
125  if (!Inside<size_t>(index+1,1u,Count)) return false;
126  // get chunk to set in
127  C4IDListChunk *pQueryChunk=this;
128  while (index>=C4IDListChunkSize) { pQueryChunk=pQueryChunk->pNext; index-=C4IDListChunkSize; }
129  // set it
130  pQueryChunk->Count[index]=iCount;
131  // success
132  return true;
133 }
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
size_t Count
Definition: C4IDList.h:55
bool C4IDList::SetCount ( C4DefList rDefs,
int32_t  dwCategory,
int32_t  index,
int32_t  iCount 
)

Definition at line 309 of file C4IDList.cpp.

References C4D_All, C4IDListChunkSize, C4Def::Category, C4IDListChunk::Count, Count, C4IDListChunk::id, C4DefList::ID2Def(), and C4IDListChunk::pNext.

310 {
311  int32_t cindex=-1;
312  C4Def *cDef;
313  C4IDListChunk *pQueryChunk=this;
314  size_t cnt=Count,cntl=0;
315  while (cnt--)
316  {
317  if ((dwCategory==C4D_All) || ( (cDef=rDefs.ID2Def(pQueryChunk->id[cntl])) && (cDef->Category & dwCategory) ) )
318  {
319  cindex++;
320  if (cindex==index) { pQueryChunk->Count[cntl]=iCount; return true; }
321  }
322  if (++cntl==C4IDListChunkSize)
323  {
324  pQueryChunk=pQueryChunk->pNext;
325  cntl=0;
326  }
327  }
328  return false;
329 }
C4Def * ID2Def(C4ID id)
int32_t Count[C4IDListChunkSize]
Definition: C4IDList.h:34
C4IDListChunk * pNext
Definition: C4IDList.h:36
const int32_t C4D_All
Definition: C4Def.h:39
Definition: C4Def.h:98
const size_t C4IDListChunkSize
Definition: C4IDList.h:28
C4ID id[C4IDListChunkSize]
Definition: C4IDList.h:33
int32_t Category
Definition: C4Def.h:117
size_t Count
Definition: C4IDList.h:55

Here is the call graph for this function:

bool C4IDList::SetIDCount ( C4ID  c_id,
int32_t  iCount,
bool  fAddNewID = false 
)

Definition at line 68 of file stub-handle.cpp.

Referenced by C4SPlrStart::CompileFunc(), C4RoundResults::EvaluateGoals(), and C4Player::SetKnowledge().

68 { return false; }

Here is the caller graph for this function:

Member Data Documentation

size_t C4IDList::Count
protected
C4ID C4IDListChunk::id[C4IDListChunkSize]
inherited
C4IDListChunk* C4IDListChunk::pNext
inherited

The documentation for this class was generated from the following files: