First one, thanks for contribution Bitte melden Sie sich an, um diesen Link zu sehen., looks good, maybe exist methods more good without do these things and rewrite the whole affect structure, but if working fine, is ok. << metin2 is already a shit anyway.
Here are some advices which could help you on future maybe.
- typedef unsigned int DWORD;
You really don't have to use DWORD for affect values.
- DWORD[0 - 4,294,967,295] - 32 bits (4 bytes)
- uint16_t | unsigned short [0 - 65535] - 16 bits (2 bytes)
Exactly what i had in my mind
Now just use an "iterator" of this vector and not the index. Then it is like i would like to do it
- std::vector<DWORD> vGoodAffects = {1, 5, 10, 25};
- std::vector<DWORD>::iterator it = vGoodAffects.begin();
- while (it != vGoodAffects.end())
- {
- RemoveAffect(*it++, false);
- }
That's a very bad practice Bitte melden Sie sich an, um diesen Link zu sehen. for C++11 >, you don't have to use a another iterator of vector, already we have 'Range-based for loop'.
- Executes a for loop over a range.
- Used as a more readable equivalent to the traditional Bitte melden Sie sich an, um diesen Link zu sehen. operating over a range of values, such as all elements in a container.
That's like how should be.
- const std::vector<uint16_t> m_vec_AffectStack = {1, 5, 10, 25};
- for (auto it : m_vec_AffectStack)
- RemoveAffect(it, false);
- I would preffer to check if affect exist first one, and after that to remove it, and use the function wich send the pointer directly of found affect, not the one with type of it.
- The function RemoveAffect(type), first one have a loop while and search affect and after that re-send to remove it on RemoveAffect(pointerFound). - Bitte melden Sie sich an, um diesen Link zu sehen.
So the better one is that one, which send directly to remove it, because already we do the FindAffect which return a pointer from a class method.
- const CAffect * pkAff = FindAffect(it);
- if (pkAff)
- RemoveAffect(const_cast<CAffect *>(pkAff));
Zitat von Sanii
Everytime i see a fixed sized array, i see also the crying skids with errors because of this sizes. (extending array and/or the iteration of it).
Just do that and they will stop to cry next time.
- const int32_t array[] = {10, 20};
- for (int32_t i=0; i<sizeof(array)/sizeof(array[0]); ++i)
#killing#english#succes