• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ C++ issues: declaring, private -> public and setting member

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,424
Solutions
15
Reaction score
175
Location
Sweden
I have three errors I've researched which I do not fully understand how to solve.
Excuse me if im not providing with enough information, Im lacking bits of C++ knowledge but Im trying my best and solved most errors so far.

What I need help with is pretty much on HOW to go further solving these issues. How to declare properly, how to access or change private members to public and how to set isRewardCorpse a member of container.

Engine im using:
TFS 1.4

The code I used as base:
Reward System [remake of #1628] by cezarguimaraes · Pull Request #1641 · otland/forgottenserver (https://github.com/otland/forgottenserver/pull/1641/files)

First one is:
Error C2065 'query': undeclared identifier theforgottenserver C:\GameFatev2 -vc14\src\iologindata.cpp 452
Related to this code:
C++:
    query.str(std::string());
    query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_rewards` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC";
    if ((result = db.storeQuery(query.str()))) {
        loadItems(itemMap, result);

Secondary:
Error C2248 'Container::unlocked': cannot access private member declared in class 'Container' theforgottenserver C:\GameFatev2 -vc14\src\reward.cpp 10
Related to this code:
C++:
#include "otpch.h"

#include <iostream>
#include "reward.h"

Reward::Reward() :
    Container(ITEM_REWARD_CONTAINER)
{
    maxSize = 32;
    unlocked = false;
    pagination = true;
}

Third one:
Error C2039 'isRewardCorpse': is not a member of 'Container' theforgottenserver C:\GameFatev2 -vc14\src\actions.cpp 401
Le code:
C++:
        uint32_t corpseOwner = container->getCorpseOwner();
        if (container->isRewardCorpse()) {
            //only players who participated in the fight can open the corpse
            if (!player->getReward(container->getIntAttr(ITEM_ATTRIBUTE_DATE), false)) {
                return RETURNVALUE_YOUARENOTTHEOWNER;
            }          
        } else if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) {
            return RETURNVALUE_YOUARENOTTHEOWNER;
        }
 
Back
Top