标题:帮兄弟看看错在那里
只看楼主
longwanyun
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-11-3
 问题点数:0 回复次数:2 
帮兄弟看看错在那里
编译时错误提示:
error C2039: “szPassword” : 不是“CMD_GF_BankStorage”的成员        AttemperEngineSink.cpp     行3422就是下面代码中红色地方
------------------------------------------------------------------------------------------------------------------

//存储事件
bool CAttemperEngineSink::OnEventBankStorage(const void * pData, WORD wDataSize, DWORD dwSocketID)
{
    //参数验证
    ASSERT( sizeof(CMD_GF_BankStorage) == wDataSize );
    if ( sizeof(CMD_GF_BankStorage) != wDataSize ) return false;

    //获取玩家
    IServerUserItem * pIServerUserItem=GetServerUserItem(LOWORD(dwSocketID));
    ASSERT(pIServerUserItem!=NULL);
    if(pIServerUserItem==NULL) return false;
    tagServerUserData *pServerUserData = pIServerUserItem->GetUserData();

    //判断状态
    if(m_pGameServiceOption->wServerType==GAME_GENRE_GOLD)
    {
        if(pServerUserData->wTableID!=INVALID_TABLE)
        {
            SendRoomMessage(dwSocketID,TEXT("请退出游戏后,再进行存储操作!"),SMT_EJECT);
            return true;
        }
    }

    //类型转换
    CMD_GF_BankStorage *pBankStorage= (CMD_GF_BankStorage*)pData;
    LONG lGameGold = pServerUserData->UserScoreInfo.lGameGold;

    //效验数据
    ASSERT(pBankStorage->lStorageValue>0 && pBankStorage->lStorageValue<=lGameGold);
    if(!(pBankStorage->lStorageValue>0 && pBankStorage->lStorageValue<=lGameGold))return false;

    //密码效验
    if (lstrcmp(pIServerUserItem->GetPassword(),pBankStorage->szPassword)!=0)
    {
        SendRoomMessage(dwSocketID,TEXT("密码有误,请查证后再次尝试操作!"),SMT_EJECT);
        return true;
    }

    //修改金币
    ModifyGameGold(pIServerUserItem,-pBankStorage->lStorageValue);

    //修改帐款
    ModifyBankStorageGold(pIServerUserItem,pBankStorage->lStorageValue);
    SendRoomMessage(dwSocketID,TEXT("存储成功!"),SMT_EJECT);

    //变量定义
    DBR_GR_BankStorage BankStorage;
    ZeroMemory(&BankStorage, sizeof(BankStorage));
    BankStorage.lStorageCount = pBankStorage->lStorageValue;
    BankStorage.dwUserID = pServerUserData->dwUserID;
    BankStorage.dwClientIP = pIServerUserItem->GetClientIP();

    //投递请求
    m_pIDataBaseEngine->PostDataBaseRequest(DBR_GR_BANK_STORAGE_GOLD,0,&BankStorage, sizeof(BankStorage));

    return true;
}

搜索更多相关主题的帖子: 3422 兄弟 
2011-11-03 11:19
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:507
帖 子:8890
专家分:53117
注 册:2011-1-18
得分:0 
这个提示还不够?
2011-11-03 15:22
edsoki
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-1-29
得分:0 
这个问题在结构中CMD_GF_BankStorage加一个TCHAR szPassword[32]
如下:
//存储金币
struct CMD_GF_BankStorage
{
    TCHAR                               szPassword[32];
    LONG                                lStorageValue;                    //存储金币
    BYTE                                cbGameAction;                    //游戏操作
};




[ 本帖最后由 edsoki 于 2013-1-29 00:28 编辑 ]
2013-01-29 00:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-354144-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.236517 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved