Jump to content

Old (char_skill.cpp) Compilation Fix for Boost 1.43+


Recommended Posts

  • Wiki Manager

I had posted this on the past, and for sure it's not needed but I'll report it anyway. (I can't find old topic).

This is just a compilation bugfix for Boost >1.43.

 

What this does, it just makes the VID class hashable for boost.

Another, and perhaps better way, to solve this issue is replace all "boost::unordered_map" to "std::unordered_map" (as it was suggested in the past).

I'm sure you would get this error from clean 40k sources, anything with the smallest fix should not bother this.

 

vid.h

#ifndef __INC_METIN_II_VID_H__
#define __INC_METIN_II_VID_H__

class VID
{
    public:
        VID() : m_id(0), m_crc(0)
        {
        }

        VID(DWORD id, DWORD crc)
        {
            m_id = id;
            m_crc = crc;
        }

        VID(const VID &rvid)
        {
            *this = rvid;
        }

        const VID & operator = (const VID & rhs)
        {
            m_id = rhs.m_id;
            m_crc = rhs.m_crc;
            return *this;
        }

        bool operator == (const VID & rhs) const
        {
            return (m_id == rhs.m_id) && (m_crc == rhs.m_crc);
        }

        bool operator != (const VID & rhs) const
        {
            return !(*this == rhs);
        }

        operator DWORD() const
        {
            return m_id;
        }

        void Reset()
        {
            m_id = 0, m_crc = 0;
        }

        DWORD getID()  const {
            return m_id;
        }

    private:
        DWORD m_id;
        DWORD m_crc;
};

std::size_t hash_value(VID const& v) {
    boost::hash<DWORD> hasher;
    return hasher(v.getID());
}

#endif
  • Love 4

Ripymir(2013)

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.