0x0 22 Posted January 7, 2020 Share Posted January 7, 2020 (edited) Hello, Corrections of some syntax error made by Ymir; cmd_general.cpp Find: ACMD(do_shutdown) { if (NULL == ch) { sys_err("Accept shutdown command from %s.", ch->GetName()); } TPacketGGShutdown p; p.bHeader = HEADER_GG_SHUTDOWN; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown)); Shutdown(10); } Replace: ACMD(do_shutdown) { if (!ch) return; sys_err("Accept shutdown command from %s.", ch->GetName()); TPacketGGShutdown p; p.bHeader = HEADER_GG_SHUTDOWN; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown)); Shutdown(10); } Dungeon.cpp Find: float CDungeon::GetUniqueHpPerc(const std::string& key) { TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { sys_err("Unknown Key : %s", key.c_str()); return false; } return (100.f*it->second->GetHP())/it->second->GetMaxHP(); } Replace: float CDungeon::GetUniqueHpPerc(const std::string& key) { TUniqueMobMap::iterator it = m_map_UniqueMob.find(key); if (it == m_map_UniqueMob.end()) { sys_err("Unknown Key : %s", key.c_str()); return 0.0f; } return (100.f*it->second->GetHP())/it->second->GetMaxHP(); } ClientManager.cpp Find: if (!dwSkillVnum > 120) Replace: if (dwSkillVnum > 120) Special Thanks @Moț; 4 hours ago, Moț said: shopEx.cpp find: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); it++) replace: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); ++it) also.. https://metin2.download/picture/k8piuyv0W07PbA6gp3kmZ42nYMoS4dAO/.png https://metin2.download/picture/D2t9q59MQPppWr0ScxOHOpJH1V5lLW7N/.png https://metin2.download/picture/kZVA00wrJ8j83lH597T4gQ5G5zaym2KP/.png https://metin2.download/picture/09X9g1Y85ZpoZr5plfqh3aUku29gymbj/.png https://metin2.download/picture/u51vmKe8YSC5Q3j2O7oC1vTo9Nigz7xe/.png https://metin2.download/picture/x6OzWwKo2da4EHUok8LhGb9E38PqIujR/.png https://metin2.download/picture/ou68uvjJAvGI7E3wByuD1kR7asqKne1v/.png https://metin2.download/picture/U4DRewp9dO877maqnu11lIvHWw8E185o/.png https://metin2.download/picture/E1SL7D3GaeNgCOQW16K3sqNATlpkvFsZ/.png https://metin2.download/picture/51Cr9qvXNmSu18D8oi1Gm4p5V4S74tdE/.png https://metin2.download/picture/kbbTgUK45BFeTT08HVMdpBMrb2F1oqZx/.png Reveal hidden contents Reveal hidden contents Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 9 1 2 1 12 Best Regards, 0x0 Link to comment Share on other sites More sharing options...
DrTurk 133 Posted January 7, 2020 Share Posted January 7, 2020 vor 7 Stunden schrieb 0x0: if (!dwSkillVnum > 120) Replace: if (dwSkillVnum > 120) else if ((dwItemVnum == 50300 || dwItemVnum == 70037) && pItemAward->dwSocket0 == 0) { DWORD dwSkillIdx; DWORD dwSkillVnum; do { dwSkillIdx = number(0, m_vec_skillTable.size()-1); dwSkillVnum = m_vec_skillTable[dwSkillIdx].dwVnum; } while(dwSkillVnum != 0 || dwSkillVnum < 120); pItemAward->dwSocket0 = dwSkillVnum; } 1 Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 8, 2020 Share Posted January 8, 2020 All good. 1 Link to comment Share on other sites More sharing options...
Premium Jira 458 Posted January 8, 2020 Premium Share Posted January 8, 2020 (edited) shopEx.cpp find: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); it++) replace: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); ++it) also.. https://metin2.download/picture/Eziqx2XJsuhVlb077I2wPax2wZRt7pFd/.png https://metin2.download/picture/moxD19akij5ejv0654XcC0tq02l7h8PY/.png https://metin2.download/picture/uBAgZqE5aiUnoMvH7j136F12e5299X0P/.png https://metin2.download/picture/G4ew1M831T0MeDCsVLsEMyIOEa4Xgcl6/.png https://metin2.download/picture/zZfOwANO4AxJs0ve4daA3i9yfZxcsN2a/.png https://metin2.download/picture/5Z9HIb7sE83CenGVxAYVu4XmrSq52xF2/.png https://metin2.download/picture/FgIDWFYtmyjEh29kcFZReGQIMC7i1cBI/.png https://metin2.download/picture/D7atk50SF6yMIW2Yh4mlb1PHcoJ5jztz/.png https://metin2.download/picture/Ii1VYGuT0bw55gkRF3VZ3QMHy62OEa2r/.png https://metin2.download/picture/PIqq2S0LTph0W3RzsqVsQIU0cM8KKsYV/.png https://metin2.download/picture/xX1xSchAC83125KhIR71HEn4NmJyl4hn/.png Spoiler Spoiler Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 4 Link to comment Share on other sites More sharing options...
0x0 22 Posted January 8, 2020 Author Share Posted January 8, 2020 14 hours ago, DrTurk said: else if ((dwItemVnum == 50300 || dwItemVnum == 70037) && pItemAward->dwSocket0 == 0) { DWORD dwSkillIdx; DWORD dwSkillVnum; do { dwSkillIdx = number(0, m_vec_skillTable.size()-1); dwSkillVnum = m_vec_skillTable[dwSkillIdx].dwVnum; } while(dwSkillVnum != 0 || dwSkillVnum < 120); pItemAward->dwSocket0 = dwSkillVnum; } Good idea but there's a little mistake; while(dwSkillVnum != 0 || dwSkillVnum < 120); Replace: while(dwSkillVnum > 120); Here 0 control is unnecessary table 0 vnum does not have skill 1 Best Regards, 0x0 Link to comment Share on other sites More sharing options...
0x0 22 Posted January 8, 2020 Author Share Posted January 8, 2020 (edited) 4 hours ago, Moț said: shopEx.cpp find: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); it++) replace: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); ++it) also.. https://metin2.download/picture/Eziqx2XJsuhVlb077I2wPax2wZRt7pFd/.png https://metin2.download/picture/moxD19akij5ejv0654XcC0tq02l7h8PY/.png https://metin2.download/picture/uBAgZqE5aiUnoMvH7j136F12e5299X0P/.png https://metin2.download/picture/G4ew1M831T0MeDCsVLsEMyIOEa4Xgcl6/.png https://metin2.download/picture/zZfOwANO4AxJs0ve4daA3i9yfZxcsN2a/.png https://metin2.download/picture/5Z9HIb7sE83CenGVxAYVu4XmrSq52xF2/.png https://metin2.download/picture/FgIDWFYtmyjEh29kcFZReGQIMC7i1cBI/.png https://metin2.download/picture/D7atk50SF6yMIW2Yh4mlb1PHcoJ5jztz/.png https://metin2.download/picture/Ii1VYGuT0bw55gkRF3VZ3QMHy62OEa2r/.png https://metin2.download/picture/PIqq2S0LTph0W3RzsqVsQIU0cM8KKsYV/.png https://metin2.download/picture/xX1xSchAC83125KhIR71HEn4NmJyl4hn/.png Reveal hidden contents Reveal hidden contents Thx Bro I added to topic Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal Best Regards, 0x0 Link to comment Share on other sites More sharing options...
Premium Jira 458 Posted January 8, 2020 Premium Share Posted January 8, 2020 Just now, 0x0 said: Thx Bro I added to topic that is a small part 1 Link to comment Share on other sites More sharing options...
0x0 22 Posted January 8, 2020 Author Share Posted January 8, 2020 38 minutes ago, Moț said: that is a small part Better than nothing Best Regards, 0x0 Link to comment Share on other sites More sharing options...
Honorable Member Mali 41750 Posted January 8, 2020 Honorable Member Share Posted January 8, 2020 5 hours ago, Moț said: shopEx.cpp find: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); it++) replace: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); ++it) really? 6 Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 8, 2020 Share Posted January 8, 2020 Would be nice if you could also provide informations about the fixes, and why is better like this way. Example the virtual void with void [...] override; is the same virtual void is for overidding, could be also virtual void [...] override; ++i increments the value, then returns it. i++ returns the value, and then increments it. Also when the function is float a simple 0 do the work if the value is zero. return 0.0f; return 0; NULL = 0 (can return integers) nullptr (is keyword that represents a null pointer value, not integers) Thanks. 2 Link to comment Share on other sites More sharing options...
UdvAtt108 100 Posted January 8, 2020 Share Posted January 8, 2020 13 minutes ago, HITRON said: Would be nice if you could also provide informations about the fixes, and why is better like this way. Example the virtual void with void [...] override; is the same virtual void is for overidding, could be also virtual void [...] override; ++i increments the value, then returns it. i++ returns the value, and then increments it. Thanks. I would like to correct you. ++it is more efficient because it++ need to return a copy of the object then increment itself. 2 All wolves are gray in the dark. Link to comment Share on other sites More sharing options...
Honorable Member Mali 41750 Posted January 8, 2020 Honorable Member Share Posted January 8, 2020 12 minutes ago, UdvAtt108 said: I would like to correct you. ++it is more efficient because it++ need to return a copy of the object then increment itself. I know what they mean.We are talking about wrong codes, not efficient 3 Link to comment Share on other sites More sharing options...
0x0 22 Posted January 8, 2020 Author Share Posted January 8, 2020 The ++it and it++ operations you are talking about do not matter when used as a single line because they are not used with another process. Example: it++; and ++it; If the variable returned in for loop is set it does not matter. Example: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); it++) and for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end(); ++it) The process here is the same: for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end()) { ++it; } and for (itertype(m_vec_shopTabs) it = m_vec_shopTabs.begin(); it != m_vec_shopTabs.end()) { it++; } You're right if it's used in an array operation. Example: row[i++] and row[++i] Best Regards, 0x0 Link to comment Share on other sites More sharing options...
HITRON 694 Posted January 24, 2020 Share Posted January 24, 2020 The part of the code with the .killscript is not really needed there is a sys_err instead, i think the code could be safe removed. Link to comment Share on other sites More sharing options...
Hik 108 Posted March 2, 2020 Share Posted March 2, 2020 touch(path:".killscript"); error: use of undeclared identifier 'path'; did you mean 'catch'? Still gives error. Link to comment Share on other sites More sharing options...
Honorable Member Distraught 5895 Posted August 21, 2020 Honorable Member Share Posted August 21, 2020 On 1/8/2020 at 5:16 PM, UdvAtt108 said: I would like to correct you. ++it is more efficient because it++ need to return a copy of the object then increment itself. And you really think the compiler won't optimize it anyway? 1 Link to comment Share on other sites More sharing options...
Recommended Posts