Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.52 KB | None | 0 0
  1.  
  2. void barrackBuilderCommanderList(uint64_t accountId, zmsg_t *replyMsg) {
  3.  
  4.     int commandersCount = 1;
  5.  
  6.     #pragma pack(push, 1)
  7.     struct {
  8.         VariableSizePacketHeader variableSizeHeader;
  9.         uint64_t accountId;
  10.         uint8_t unk1;
  11.         uint8_t commandersCount;
  12.         CommanderPkt commanders[commandersCount];
  13.     } replyPacket;
  14.     #pragma pack(pop)
  15.  
  16.     PacketType packetType = BC_COMMANDER_LIST;
  17.     CHECK_SERVER_PACKET_SIZE(replyPacket, packetType);
  18.  
  19.     BUILD_REPLY_PACKET(replyPacket, replyMsg)
  20.     {
  21.         variableSizePacketHeaderInit(&replyPacket.variableSizeHeader, packetType, sizeof(replyPacket));
  22.         replyPacket.accountId = accountId;
  23.         replyPacket.unk1 = 1; // ICBT - equal to 1 or 4
  24.         replyPacket.commandersCount = commandersCount;
  25.  
  26.         /*----------------------
  27.          Test Code
  28.         ------------------------*/
  29.         for (int commanderIndex = 0; commanderIndex < replyPacket.commandersCount; commanderIndex++) {
  30.             CommanderPkt *currentCommander = &replyPacket.commanders[commanderIndex];
  31.             commanderInit(currentCommander);
  32.             // Set some info
  33.             strncpy(currentCommander->familyName, "MyTeamName", sizeof(currentCommander->familyName));
  34.             strncpy(currentCommander->commanderName, "Fulanito", sizeof(currentCommander->commanderName));
  35.             currentCommander->accountId = accountId;
  36.         }
  37.  
  38.         /*----------------------------
  39.          End test code
  40.         ----------------------------*/
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement