From 418257ef26823ed548211f1803973665e7fca2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Mon, 11 Oct 2010 19:59:54 +0200 Subject: [PATCH] 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. --- docs/sdk/definition/category.xml | 4 --- planet/Objects.c4d/Clonk.c4d/DefCore.txt | 1 + src/game/object/C4Def.cpp | 1 - src/game/object/C4Def.h | 6 ---- src/game/object/C4Object.cpp | 5 ++- src/game/object/C4ObjectList.cpp | 39 +++++++++--------------- src/game/object/C4ObjectList.h | 2 +- src/game/object/C4ObjectMenu.cpp | 4 +-- 8 files changed, 21 insertions(+), 41 deletions(-) diff --git a/docs/sdk/definition/category.xml b/docs/sdk/definition/category.xml index 07fa1503e..e8a3d99e2 100644 --- a/docs/sdk/definition/category.xml +++ b/docs/sdk/definition/category.xml @@ -41,10 +41,6 @@ C4D_Environment Environmental control object. - - C4D_TradeLiving - A living being that can be sold at the home base. - C4D_Magic A magic spell. diff --git a/planet/Objects.c4d/Clonk.c4d/DefCore.txt b/planet/Objects.c4d/Clonk.c4d/DefCore.txt index 6ab08d3c6..26f3f9243 100644 --- a/planet/Objects.c4d/Clonk.c4d/DefCore.txt +++ b/planet/Objects.c4d/Clonk.c4d/DefCore.txt @@ -17,6 +17,7 @@ Collection=-8,-10,16,27 ContactIncinerate=1 Prey=1 CrewMember=1 +NoGet=1 Float=-2 ColorByOwner=1 BorderBound=1 diff --git a/src/game/object/C4Def.cpp b/src/game/object/C4Def.cpp index 16f534b98..837300943 100644 --- a/src/game/object/C4Def.cpp +++ b/src/game/object/C4Def.cpp @@ -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 }, diff --git a/src/game/object/C4Def.h b/src/game/object/C4Def.h index 9da8c0c0a..51ef93061 100644 --- a/src/game/object/C4Def.h +++ b/src/game/object/C4Def.h @@ -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, diff --git a/src/game/object/C4Object.cpp b/src/game/object/C4Object.cpp index ca6dbb1b0..1c922a115 100644 --- a/src/game/object/C4Object.cpp +++ b/src/game/object/C4Object.cpp @@ -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(Def->Mass*Con/FullCon,1); diff --git a/src/game/object/C4ObjectList.cpp b/src/game/object/C4ObjectList.cpp index 9fd6f3fd3..5f339bddb 100644 --- a/src/game/object/C4ObjectList.cpp +++ b/src/game/object/C4ObjectList.cpp @@ -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; diff --git a/src/game/object/C4ObjectList.h b/src/game/object/C4ObjectList.h index 4629f4b09..6f1a31b2d 100644 --- a/src/game/object/C4ObjectList.h +++ b/src/game/object/C4ObjectList.h @@ -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 diff --git a/src/game/object/C4ObjectMenu.cpp b/src/game/object/C4ObjectMenu.cpp index 0ac544976..09078624b 100644 --- a/src/game/object/C4ObjectMenu.cpp +++ b/src/game/object/C4ObjectMenu.cpp @@ -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;