Send a struct into a WORD

Results 1 to 9 of 9
  1. #1
    DBO Developer Nicolas321 is offline
    MemberRank
    May 2014 Join Date
    482Posts

    Send a struct into a WORD

    Hi, just like the title said, I want to know how I can do to send a STRUCT into a WORD, because GU_RANKBATTLE_BATTLE_TEAM_INFO_NFY I have to send wMemberInfo with this sRANKBATTLE_MATCH_MEMBER_INFO.

    So I try

    Code:
    sRANKBATTLE_MATCH_MEMBER_INFO Test = new sRANKBATTLE_MATCH_MEMBER_INFO[2];
    Test[0].id = 0;
    Test[0].team = RED_TEAM;
    
    Test[1].id = 2;
    Test[1].team = BLUE_TEAM;
    
    memcpy(&pPacket.wMemberInfo, Test, sizeof(sRANKBATTLE_MATCH_MEMBER_INFO));
    or
    memcpy(&pPacket.wMemberInfo, Test, sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*2);
    // This don't work, WHY? So my idea is change what the client recive and change send WORD for sRANKBATTLE_MATCH_MEMBER_INFO
    Or any have other idea?
    @Arnie36


  2. #2
    Don't quote me Arnie36 is offline
    MemberRank
    Jun 2006 Join Date
    207Posts

    Re: Send a struct into a WORD

    if wMemberInfo is a word sRANKBATTLE_MATCH_MEMBER_INFO[2] doesn't fit in it
    if .id and .team both are a BYTE it needs at least a DWORD

  3. #3
    DBO Developer Nicolas321 is offline
    MemberRank
    May 2014 Join Date
    482Posts

    Re: Send a struct into a WORD

    But is all how it's made, is what I said, maybe the client is wrong, I don't know.

    You know how to change the parameters for GU_ in client? Because for server only change WORD for sRANKBATTLE_MATCH_MEMBER_INFO.
    Last edited by Nicolas321; 16-06-15 at 01:42 AM.

  4. #4
    Don't quote me Arnie36 is offline
    MemberRank
    Jun 2006 Join Date
    207Posts

    Re: Send a struct into a WORD

    you have to copy the sRANKBATTLE_MATCH_MEMBER_INFO in to sVARIABLE_DATA
    wMemberInfo should have the location of that data in sVARIABLE_DATA

    wOwnerPartyName is the location(position) in sVARIABLE_DATA for the unicode name of wchar OwnerPartyName
    wChallengerPartyName is the location(position) in sVARIABLE_DATA for the unicode name of wchar ChallengerPartyName



    pPacket.byCount = 2;
    pPacket.wMemberInfo = 0;
    memcpy(&pPacket.sVARIABLE_DATA, Test, sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount);

    pPacket.wOwnerPartyName = sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount);
    memcpy((&pPacket.sVARIABLE_DATA)+(sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount)), L"Owner", NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE);

    pPacket.wChallengerPartyName = pPacket.wOwnerPartyName + NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE;
    memcpy((&pPacket.sVARIABLE_DATA)+pPacket.wOwnerPartyName+NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE, L"Challenger", NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE);
    Last edited by Arnie36; 16-06-15 at 02:07 PM.

  5. #5
    Server Developer luiz45 is offline
    MemberRank
    Apr 2006 Join Date
    233Posts

    Re: Send a struct into a WORD

    Or maybe the structs can be wrong...like if i remember correctly...
    the packet for load Quests
    The packet in Server side is seted to be only one position
    but in client server was 10 positions
    Then was nescessary the change in packet struct in server side...

    And @Arnie36
    pPacket.byCount = 2;
    pPacket.wMemberInfo = 0;
    memcpy(&pPacket.sVARIABLE_DATA, Test, sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount);

    pPacket.wOwnerPartyName = sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount);
    memcpy((&pPacket.sVARIABLE_DATA)+(sizeof(sRANKBATTLE_MATCH_MEMBER_INFO)*pPacket.byCount)), L"Owner", NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE);

    pPacket.wChallengerPartyName = pPacket.wOwnerPartyName + NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE;
    memcpy((&pPacket.sVARIABLE_DATA)+pPacket.wOwnerPartyName+NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE, L"Challenger", NTL_MAX_SIZE_PARTY_NAME_IN_UNICODE);
    where you found that way?

  6. #6
    Server Developer luiz45 is offline
    MemberRank
    Apr 2006 Join Date
    233Posts

    Re: Send a struct into a WORD

    Oh! i see, thank's ^-^

  7. #7
    DBO Developer Nicolas321 is offline
    MemberRank
    May 2014 Join Date
    482Posts

    Re: Send a struct into a WORD

    But if I want to send another thing like TEAM or something like that, what I have to do?

  8. #8
    Don't quote me Arnie36 is offline
    MemberRank
    Jun 2006 Join Date
    207Posts

    Re: Send a struct into a WORD

    Quote Originally Posted by Nicolas321 View Post
    But if I want to send another thing like TEAM or something like that, what I have to do?
    I'm not sure what your asking but in your first post you use

    sRANKBATTLE_MATCH_MEMBER_INFO Test = new sRANKBATTLE_MATCH_MEMBER_INFO[2];
    Test[0].id = 0;
    Test[0].team = RED_TEAM;

    Test[1].id = 2;
    Test[1].team = BLUE_TEAM;

    but it should be
    /*
    struct sRANKBATTLE_MATCH_MEMBER_INFO
    {
    HOBJECT hPc;
    BYTE byTeam; // eRANKBATTLE_TEAM_TYPE
    BYTE byState; // eRANKBATTLE_MEMBER_STATE
    };
    */
    Test[0].hPc = firstplayerHandle;
    Test[0].byTeam = RANKBATTLE_TEAM_CHALLENGER;
    Test[0].byState = RANKBATTLE_MEMBER_STATE_NORMAL;

    Test[1].hPc = secondplayerHandle;
    Test[1].byTeam = RANKBATTLE_TEAM_OTHER;
    Test[1].byState = RANKBATTLE_MEMBER_STATE_NORMAL;

  9. #9
    DBO Developer Nicolas321 is offline
    MemberRank
    May 2014 Join Date
    482Posts

    Re: Send a struct into a WORD

    I put that like for example, because I don't have the files rightnow... I didn't know how was the struct of sRANKBATTLE_MATCH_MEMBER_INFO



Advertisement