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.
Günther Brammer 2010-10-11 19:59:54 +02:00
parent f7588418c1
commit 418257ef26
8 changed files with 21 additions and 41 deletions

View File

@ -41,10 +41,6 @@
<col>C4D_Environment</col>
<col>Environmental control object.</col>
</row>
<row>
<col>C4D_TradeLiving</col>
<col>A living being that can be sold at the home base.</col>
</row>
<row>
<col>C4D_Magic</col>
<col>A magic spell.</col>

View File

@ -17,6 +17,7 @@ Collection=-8,-10,16,27
ContactIncinerate=1
Prey=1
CrewMember=1
NoGet=1
Float=-2
ColorByOwner=1
BorderBound=1

View File

@ -236,7 +236,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
{ "C4D_Environment", C4D_Environment },
{ "C4D_Knowledge", C4D_Knowledge },
{ "C4D_TradeLiving", C4D_TradeLiving },
{ "C4D_Magic", C4D_Magic },
{ "C4D_CrewMember", C4D_CrewMember },

View File

@ -57,7 +57,6 @@ C4D_Rule = 1<<6,
C4D_Environment = 1<<7,
C4D_Knowledge = 1<<8,
C4D_TradeLiving = 1<<9,
C4D_Magic = 1<<10,
C4D_CrewMember = 1<<11,
@ -105,11 +104,6 @@ const int32_t C4D_VehicleControl_None = 0,
C4D_VehicleControl_Outside = 1,
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,
C4D_Load_Picture = 1,
C4D_Load_Bitmap = 2,

View File

@ -267,9 +267,8 @@ bool C4Object::Init(C4PropList *pDef, C4Object *pCreator,
xdir=nxdir; ydir=nydir; rdir=nrdir;
// Initial mobility
if (Category!=C4D_StaticBack)
if (!!xdir || !!ydir || !!rdir)
Mobile=1;
if (!!xdir || !!ydir || !!rdir)
Mobile=1;
// Mass
Mass=Max<int32_t>(Def->Mass*Con/FullCon,1);

View File

@ -849,7 +849,7 @@ void C4ObjectList::DeleteObjects()
// -------------------------------------------------
// C4ObjectListIterator
C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
C4Object *C4ObjectListIterator::GetNext(int32_t *piCount)
{
// end reached?
if (pCurrID == rList.end()) return NULL;
@ -860,10 +860,6 @@ C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
else
// next item
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?
if ((*pCurr)->id != (*pCurrID)->id)
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
// if so, advance the list
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
if (++pCurr == rList.end()) return NULL;
if (dwCategory)
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;
// then break here
pCurrID = pCurr;
break;
}
// restart check for next object
pCheck = pCurrID;
}
}
if (piCount)
{
@ -898,9 +890,8 @@ C4Object *C4ObjectListIterator::GetNext(int32_t *piCount, uint32_t dwCategory)
// add additional objects of same ID to the count
C4ObjectList::iterator pCheck(pCurr);
for (++pCheck; pCheck != rList.end() && (*pCheck)->id == (*pCurr)->id; ++pCheck)
if (!dwCategory || ((*pCheck)->Category & dwCategory))
if ((*pCheck)->CanConcatPictureWith(*pCurr))
++*piCount;
if ((*pCheck)->CanConcatPictureWith(*pCurr))
++*piCount;
}
// return found object
return *pCurr;

View File

@ -187,7 +187,7 @@ private:
C4ObjectListIterator(const C4ObjectListIterator &rCopy); // no copy ctor
public:
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

View File

@ -154,7 +154,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
{
// Add target contents items
C4ObjectListIterator iter(pTarget->Contents);
while ((pObj = iter.GetNext(&iCount, C4D_Activate)))
while ((pObj = iter.GetNext(&iCount)))
{
pDef = pObj->Def;
if (pDef->NoGet) continue;
@ -191,7 +191,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
{
// Add target contents items
C4ObjectListIterator iter(pTarget->Contents);
while ((pObj = iter.GetNext(&iCount, C4D_Get)))
while ((pObj = iter.GetNext(&iCount)))
{
pDef = pObj->Def;
if (pDef->NoGet) continue;