forked from Mirrors/openclonk
Remove C4D_TradeLiving in favour of C4Def::NoGet
Previously, C4D_Livings without C4D_TradeLiving had an implicit NoGet. They now have to use that flag like every other object.
parent
f7588418c1
commit
418257ef26
|
@ -41,10 +41,6 @@
|
||||||
<col>C4D_Environment</col>
|
<col>C4D_Environment</col>
|
||||||
<col>Environmental control object.</col>
|
<col>Environmental control object.</col>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
|
||||||
<col>C4D_TradeLiving</col>
|
|
||||||
<col>A living being that can be sold at the home base.</col>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<col>C4D_Magic</col>
|
<col>C4D_Magic</col>
|
||||||
<col>A magic spell.</col>
|
<col>A magic spell.</col>
|
||||||
|
|
|
@ -17,6 +17,7 @@ Collection=-8,-10,16,27
|
||||||
ContactIncinerate=1
|
ContactIncinerate=1
|
||||||
Prey=1
|
Prey=1
|
||||||
CrewMember=1
|
CrewMember=1
|
||||||
|
NoGet=1
|
||||||
Float=-2
|
Float=-2
|
||||||
ColorByOwner=1
|
ColorByOwner=1
|
||||||
BorderBound=1
|
BorderBound=1
|
||||||
|
|
|
@ -236,7 +236,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
|
||||||
{ "C4D_Environment", C4D_Environment },
|
{ "C4D_Environment", C4D_Environment },
|
||||||
|
|
||||||
{ "C4D_Knowledge", C4D_Knowledge },
|
{ "C4D_Knowledge", C4D_Knowledge },
|
||||||
{ "C4D_TradeLiving", C4D_TradeLiving },
|
|
||||||
{ "C4D_Magic", C4D_Magic },
|
{ "C4D_Magic", C4D_Magic },
|
||||||
{ "C4D_CrewMember", C4D_CrewMember },
|
{ "C4D_CrewMember", C4D_CrewMember },
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ C4D_Rule = 1<<6,
|
||||||
C4D_Environment = 1<<7,
|
C4D_Environment = 1<<7,
|
||||||
|
|
||||||
C4D_Knowledge = 1<<8,
|
C4D_Knowledge = 1<<8,
|
||||||
C4D_TradeLiving = 1<<9,
|
|
||||||
C4D_Magic = 1<<10,
|
C4D_Magic = 1<<10,
|
||||||
C4D_CrewMember = 1<<11,
|
C4D_CrewMember = 1<<11,
|
||||||
|
|
||||||
|
@ -105,11 +104,6 @@ const int32_t C4D_VehicleControl_None = 0,
|
||||||
C4D_VehicleControl_Outside = 1,
|
C4D_VehicleControl_Outside = 1,
|
||||||
C4D_VehicleControl_Inside = 2;
|
C4D_VehicleControl_Inside = 2;
|
||||||
|
|
||||||
const int32_t C4D_Sell = C4D_StaticBack | C4D_Structure | C4D_Vehicle | C4D_Object | C4D_TradeLiving,
|
|
||||||
C4D_Get = C4D_Sell,
|
|
||||||
C4D_Take = C4D_Get,
|
|
||||||
C4D_Activate = C4D_Get;
|
|
||||||
|
|
||||||
const DWORD C4D_Load_None = 0,
|
const DWORD C4D_Load_None = 0,
|
||||||
C4D_Load_Picture = 1,
|
C4D_Load_Picture = 1,
|
||||||
C4D_Load_Bitmap = 2,
|
C4D_Load_Bitmap = 2,
|
||||||
|
|
|
@ -267,9 +267,8 @@ bool C4Object::Init(C4PropList *pDef, C4Object *pCreator,
|
||||||
xdir=nxdir; ydir=nydir; rdir=nrdir;
|
xdir=nxdir; ydir=nydir; rdir=nrdir;
|
||||||
|
|
||||||
// Initial mobility
|
// Initial mobility
|
||||||
if (Category!=C4D_StaticBack)
|
if (!!xdir || !!ydir || !!rdir)
|
||||||
if (!!xdir || !!ydir || !!rdir)
|
Mobile=1;
|
||||||
Mobile=1;
|
|
||||||
|
|
||||||
// Mass
|
// Mass
|
||||||
Mass=Max<int32_t>(Def->Mass*Con/FullCon,1);
|
Mass=Max<int32_t>(Def->Mass*Con/FullCon,1);
|
||||||
|
|
|
@ -849,7 +849,7 @@ void C4ObjectList::DeleteObjects()
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// C4ObjectListIterator
|
// C4ObjectListIterator
|
||||||
|
|
||||||
C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
|
C4Object *C4ObjectListIterator::GetNext(int32_t *piCount)
|
||||||
{
|
{
|
||||||
// end reached?
|
// end reached?
|
||||||
if (pCurrID == rList.end()) return NULL;
|
if (pCurrID == rList.end()) return NULL;
|
||||||
|
@ -860,10 +860,6 @@ C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
|
||||||
else
|
else
|
||||||
// next item
|
// next item
|
||||||
if (++pCurr == rList.end()) return NULL;
|
if (++pCurr == rList.end()) return NULL;
|
||||||
// skip mismatched category
|
|
||||||
if (dwCategory)
|
|
||||||
while (!((*pCurr)->Category & dwCategory))
|
|
||||||
if (++pCurr == rList.end()) return NULL;
|
|
||||||
// next ID section reached?
|
// next ID section reached?
|
||||||
if ((*pCurr)->id != (*pCurrID)->id)
|
if ((*pCurr)->id != (*pCurrID)->id)
|
||||||
pCurrID = pCurr;
|
pCurrID = pCurr;
|
||||||
|
@ -872,24 +868,20 @@ C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
|
||||||
// otherwise, it must be checked, whether this is a duplicate item already iterated
|
// otherwise, it must be checked, whether this is a duplicate item already iterated
|
||||||
// if so, advance the list
|
// if so, advance the list
|
||||||
for (C4ObjectList::iterator pCheck = pCurrID; pCheck != pCurr; ++pCheck)
|
for (C4ObjectList::iterator pCheck = pCurrID; pCheck != pCurr; ++pCheck)
|
||||||
if (!dwCategory || ((*pCheck)->Category & dwCategory))
|
if ((*pCheck)->CanConcatPictureWith(*pCurr))
|
||||||
if ((*pCheck)->CanConcatPictureWith(*pCurr))
|
{
|
||||||
|
// next object of matching category
|
||||||
|
if (++pCurr == rList.end()) return NULL;
|
||||||
|
// next ID chunk reached?
|
||||||
|
if ((*pCurr)->id != (*pCurrID)->id)
|
||||||
{
|
{
|
||||||
// next object of matching category
|
// then break here
|
||||||
if (++pCurr == rList.end()) return NULL;
|
pCurrID = pCurr;
|
||||||
if (dwCategory)
|
break;
|
||||||
while (!((*pCurr)->Category & dwCategory))
|
|
||||||
if (++pCurr == rList.end()) return NULL;
|
|
||||||
// next ID chunk reached?
|
|
||||||
if ((*pCurr)->id != (*pCurrID)->id)
|
|
||||||
{
|
|
||||||
// then break here
|
|
||||||
pCurrID = pCurr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// restart check for next object
|
|
||||||
pCheck = pCurrID;
|
|
||||||
}
|
}
|
||||||
|
// restart check for next object
|
||||||
|
pCheck = pCurrID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (piCount)
|
if (piCount)
|
||||||
{
|
{
|
||||||
|
@ -898,9 +890,8 @@ C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
|
||||||
// add additional objects of same ID to the count
|
// add additional objects of same ID to the count
|
||||||
C4ObjectList::iterator pCheck(pCurr);
|
C4ObjectList::iterator pCheck(pCurr);
|
||||||
for (++pCheck; pCheck != rList.end() && (*pCheck)->id == (*pCurr)->id; ++pCheck)
|
for (++pCheck; pCheck != rList.end() && (*pCheck)->id == (*pCurr)->id; ++pCheck)
|
||||||
if (!dwCategory || ((*pCheck)->Category & dwCategory))
|
if ((*pCheck)->CanConcatPictureWith(*pCurr))
|
||||||
if ((*pCheck)->CanConcatPictureWith(*pCurr))
|
++*piCount;
|
||||||
++*piCount;
|
|
||||||
}
|
}
|
||||||
// return found object
|
// return found object
|
||||||
return *pCurr;
|
return *pCurr;
|
||||||
|
|
|
@ -187,7 +187,7 @@ private:
|
||||||
C4ObjectListIterator(const C4ObjectListIterator &rCopy); // no copy ctor
|
C4ObjectListIterator(const C4ObjectListIterator &rCopy); // no copy ctor
|
||||||
public:
|
public:
|
||||||
C4ObjectListIterator(C4ObjectList &rList) : rList(rList), pCurr(rList.end()), pCurrID(rList.begin()) {} // ctor
|
C4ObjectListIterator(C4ObjectList &rList) : rList(rList), pCurr(rList.end()), pCurrID(rList.begin()) {} // ctor
|
||||||
C4Object *GetNext(int32_t *piCount, uint32_t dwCategory=0); // get next object; return NULL if end is reached
|
C4Object *GetNext(int32_t *piCount); // get next object; return NULL if end is reached
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -154,7 +154,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
||||||
{
|
{
|
||||||
// Add target contents items
|
// Add target contents items
|
||||||
C4ObjectListIterator iter(pTarget->Contents);
|
C4ObjectListIterator iter(pTarget->Contents);
|
||||||
while ((pObj = iter.GetNext(&iCount, C4D_Activate)))
|
while ((pObj = iter.GetNext(&iCount)))
|
||||||
{
|
{
|
||||||
pDef = pObj->Def;
|
pDef = pObj->Def;
|
||||||
if (pDef->NoGet) continue;
|
if (pDef->NoGet) continue;
|
||||||
|
@ -191,7 +191,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
||||||
{
|
{
|
||||||
// Add target contents items
|
// Add target contents items
|
||||||
C4ObjectListIterator iter(pTarget->Contents);
|
C4ObjectListIterator iter(pTarget->Contents);
|
||||||
while ((pObj = iter.GetNext(&iCount, C4D_Get)))
|
while ((pObj = iter.GetNext(&iCount)))
|
||||||
{
|
{
|
||||||
pDef = pObj->Def;
|
pDef = pObj->Def;
|
||||||
if (pDef->NoGet) continue;
|
if (pDef->NoGet) continue;
|
||||||
|
|
Loading…
Reference in New Issue