MeNi
*^#%$%
- Joined
- Jul 23, 2008
- Messages
- 183
- Reaction score
- 12
Otóż mam taką sobie funkcyjkę w TFSie:
i na jej podstawie chciałbym zrobić coś takiego:
niestety, ale ta druga funkcja nie działa, zawsze zwraca jakieś dziwne wyniki z okolic 0,1,2, co jest nie tak?
// EDIT:
Code:
uint32_t Container::getItemHoldingCount() const
{
uint32_t counter = 0;
for(ContainerIterator it = begin(); it != end(); ++it)
++counter;
return counter;
}
i na jej podstawie chciałbym zrobić coś takiego:
Code:
uint32_t Container::getAllItemHoldingCount(const uint32_t rec) const
{
if(rec > g_config.getNumber(ConfigManager::MAX_ITEM_COUNT))
return rec+1;
uint32_t counter = 0;
for(ContainerIterator it = begin(); it != end(); ++it)
{
if(const Container* container = (*it)->getContainer())
counter = container->getAllItemHoldingCount(counter) + 1;
else
[COLOR="#FF0000"]counter = 1;[/COLOR]
}
return counter;
}
niestety, ale ta druga funkcja nie działa, zawsze zwraca jakieś dziwne wyniki z okolic 0,1,2, co jest nie tak?
// EDIT:
Code:
uint32_t Container::getAllItemHoldingCount(const uint32_t rec) const
{
if(rec > g_config.getNumber(ConfigManager::MAX_ITEM_COUNT))
return rec+1;
uint32_t counter = 0;
for(ContainerIterator it = begin(); it != end(); ++it)
{
if(const Container* container = (*it)->getContainer())
counter = container->getAllItemHoldingCount(counter) + 1;
else
[COLOR="#00FF00"]++counter;[/COLOR]
}
return counter;
}
Last edited: