invertika_game.Game.GameState.serializeLooks C# (CSharp) Method

serializeLooks() static private method

static private serializeLooks ( Character ch, ISL.Server.Network.MessageOut msg, bool full ) : void
ch Character
msg ISL.Server.Network.MessageOut
full bool
return void
        static void serializeLooks(Character ch, MessageOut msg, bool full)
        {
            //const Possessions &poss = ch.getPossessions();
            //unsigned int nb_slots = itemManager.getVisibleSlotCount();

            //// Bitmask describing the changed entries.
            //int changed = (1 << nb_slots) - 1;
            //if (!full)
            //{
            //    // TODO: do not assume the whole equipment changed,
            //    // when an update is asked for.
            //    changed = (1 << nb_slots) - 1;
            //}

            //std::vector<unsigned int> items;
            //items.resize(nb_slots, 0);
            //// Partially build both kinds of packet, to get their sizes.
            //unsigned int mask_full = 0, mask_diff = 0;
            //unsigned int nb_full = 0, nb_diff = 0;
            //std::map<unsigned int, unsigned int>::const_iterator it =
            //                                                poss.equipSlots.begin();
            //for (unsigned int i = 0; i < nb_slots; ++i)
            //{
            //    if (changed & (1 << i))
            //    {
            //        // Skip slots that have not changed, when sending an update.
            //        ++nb_diff;
            //        mask_diff |= 1 << i;
            //    }
            //    if (it == poss.equipSlots.end() || it.first > i) continue;
            //    ItemClass *eq;
            //    items[i] = it.first && (eq = itemManager.getItem(it.first)) ?
            //               eq.getSpriteID() : 0;
            //    if (items[i])
            //    {
            //        /* If we are sending the whole equipment, only filled slots have to
            //           be accounted for, as the other ones will be automatically cleared. */
            //        ++nb_full;
            //        mask_full |= 1 << i;
            //    }
            //}

            //// Choose the smaller payload.
            //if (nb_full <= nb_diff) full = true;

            ///* Bitmask enumerating the sent slots.
            //   Setting the upper bit tells the client to clear the slots beforehand. */
            //int mask = full ? mask_full | (1 << 7) : mask_diff;

            //msg.writeInt8(mask);
            //for (unsigned int i = 0; i < nb_slots; ++i)
            //{
            //    if (mask & (1 << i)) msg.writeInt16(items[i]);
            //}
        }