Jump to content

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


Recommended Posts

  • Former Staff

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

Everyday you wake up as a Metin2 developer is a bad day...

METIN1 src when

Link to comment
Share on other sites

Announcements



×
×
  • 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.