#ifndef __MINERAL_VEIN_MANAGER_H__ #define __MINERAL_VEIN_MANAGER_H__ #pragma once #define g_MinveralVeinMgr CMineralVeinMgr::GetInstance() #include #include // ±¤¹° Á¤º¸ ±¸Á¶Ã¼ struct MineralInfo { unsigned short m_dwMineralID; // ±¤¹° Item ID unsigned char m_cMin; // ±¤¹° ÃßÃâ Min unsigned char m_cMax; // ±¤¹° ÃßÃâ Max }; typedef std::list MineralInfoList; // ±¤¸Æ Á¤º¸ ±¸Á¶Ã¼ struct MineralVeinInfo { enum Length { MAX_VEIN_NAME_LEN = 32 }; char m_szVeinName[ MAX_VEIN_NAME_LEN ]; // ±¤¸Æ À̸§ unsigned long m_dwVeinColor; // ±¤¸ÆÀÇ »ö»ó ID unsigned long m_dwMaxFertility; // ±¤¸ÆÀÇ ÃÖ´ë Áö·Â unsigned long m_dwNowFertility; // ±¤¸ÆÀÇ ÇöÀç Áö·Â (DB ¿¡¼­ ¾ò¾î¿À´Â °ª) MineralInfoList m_lstMineralInfo; // ±¤¹° ¸®½ºÆ® }; typedef std::map MineralVeinMap; // TGA ÆÄÀÏ Çì´õ #pragma pack (1) struct sTargaHeader { unsigned char IDLength, ColorMapType, ImageType ; unsigned short ColorMapOrigin, ColorMapSize ; unsigned char ColorMapEntrySize ; unsigned short XOrigin, YOrigin, Width, Height ; unsigned char PixelSize ; unsigned char ImageDescriptor ; }; #pragma pack (8) // ±¤¸Æ °ü¸® Ŭ·¡½º class CMineralVeinMgr { public: enum Const { MAX_TYPE_STRING_LEN = 32, MAX_HEXA_COLOR_LEN = 10, COLOR_IMAGE_SIZE = 512 }; static CMineralVeinMgr& GetInstance(); bool Initialize(); void Destroy(); bool LoadMineralVeinsFromFiles(const char* szTextFile, const char* szImageFile = 0); bool SaveMineralVeinsToText(const char* szScriptFile); bool SaveMineralVeinsToBinary(const char* szBinaryFile, const char* szTrashFile = 0); bool LoadMineralVeinsFromBinary(const char* szBinaryFile); MineralVeinInfo* GetMineralVein(unsigned long dwVeinColor) const; MineralVeinInfo* GetMineralVein(float fX, float fZ) const; unsigned long GetVeinColor(float fX, float fZ) const; const char* GetVeinName(float fX, float fZ) const; int GetVeinNum() const; // Áö·Â ÇÁ·Î¼¼½º ÇÔ¼ö void InitializeMiningCampNum(); // Áö·Â´ç ä±¼±â ¼ö¸¦ 0 À¸·Î ¸®¼Â void CalculateMiningCampNum(float fX, float fZ); // ä±¼±â À§Ä¡¿¡ ÇØ´çÇÏ´Â Áö·ÂÀÇ ¿ä»õ ¼ö¸¦ Áõ°¡ÇØÁÖ´Â ÇÔ¼ö int GetMiningCampNum(unsigned long dwVeinColor); // ÇöÀç Áö¿ªÀÇ Ã¤±¼ÁßÀΠä±¼±â ¼ö¸¦ ¸®ÅÏ void CalculateFertility(unsigned long dwProcessType); // Áö·Â ¾÷µ¥ÀÌÆ® void SerializeOutFertility(unsigned long* lpData_Out, unsigned short& wSize); // DB ¿¡¼­ ¾ò¾î¿Â ÇöÀç Áö·Â°ªÀ» ¼³Á¤ÇÏ´Â ÇÔ¼ö bool SetNowFertility(unsigned short wNum, unsigned long* szDataFromDB); bool SetNowFertility(unsigned long dwVeinColor, unsigned long dwFertility); private: typedef std::map VeinToCampNumMap; // < VeinColor, MiningCampNum > CMineralVeinMgr(); ~CMineralVeinMgr(); MineralVeinMap m_mapMineralVein; VeinToCampNumMap m_mapCampNum; unsigned long m_dwColorTable[ COLOR_IMAGE_SIZE ][ COLOR_IMAGE_SIZE ]; }; #endif // __MINERAL_VEIN_MANAGER_H__