Exemple #1
0
void groupOrder(DataObject *data) {
    for(int i = 0 ; i < NBORDER ; i++) {
        int maxload = MAXLOAD;
        Command *command = data->_listCmd->at(i);
        if(command->_groupid == -1) {
            data->_group->push_back(new Grp());
            command->_groupid = data->_group->size();
        }
        Command *next = getNextFreeOrder(data->_listCmd, i);
        maxload -= getTotalWeight(next);
        if(maxload >= 0) {
            data->_group->at(command->_groupid)->_cmd->push_back(next);
            next->_groupid = command->_groupid;
        }
    }
}
float MWWorld::ContainerStore::getWeight() const
{
    if (!mWeightUpToDate)
    {
        mCachedWeight = 0;

        mCachedWeight += getTotalWeight (potions);
        mCachedWeight += getTotalWeight (appas);
        mCachedWeight += getTotalWeight (armors);
        mCachedWeight += getTotalWeight (books);
        mCachedWeight += getTotalWeight (clothes);
        mCachedWeight += getTotalWeight (ingreds);
        mCachedWeight += getTotalWeight (lights);
        mCachedWeight += getTotalWeight (lockpicks);
        mCachedWeight += getTotalWeight (miscItems);
        mCachedWeight += getTotalWeight (probes);
        mCachedWeight += getTotalWeight (repairs);
        mCachedWeight += getTotalWeight (weapons);

        mWeightUpToDate = true;
    }

    return mCachedWeight;
}