tibia-rme/source/common.cpp

294 lines
6.9 KiB
C++
Raw Permalink Normal View History

//////////////////////////////////////////////////////////////////////
// This file is part of Remere's Map Editor
//////////////////////////////////////////////////////////////////////
2020-07-30 11:42:28 -03:00
// Remere's Map Editor is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
2016-09-29 19:24:45 -03:00
//
2020-07-30 11:42:28 -03:00
// Remere's Map Editor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
2020-07-30 11:42:28 -03:00
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
2016-09-29 19:24:45 -03:00
//
// You should have received a copy of the GNU General Public License
2020-07-30 11:42:28 -03:00
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////
#include "main.h"
#include "common.h"
#include "math.h"
// random generator
2023-10-09 19:12:16 -07:00
std::mt19937 &getRandomGenerator() {
static std::random_device rd;
static std::mt19937 generator(rd());
return generator;
}
2023-10-09 19:12:16 -07:00
int32_t uniform_random(int32_t minNumber, int32_t maxNumber) {
static std::uniform_int_distribution<int32_t> uniformRand;
2023-10-09 19:12:16 -07:00
if (minNumber == maxNumber) {
return minNumber;
2023-10-09 19:12:16 -07:00
} else if (minNumber > maxNumber) {
std::swap(minNumber, maxNumber);
}
return uniformRand(getRandomGenerator(), std::uniform_int_distribution<int32_t>::param_type(minNumber, maxNumber));
}
2023-10-09 19:12:16 -07:00
int32_t uniform_random(int32_t maxNumber) {
return uniform_random(0, maxNumber);
}
//
2023-10-09 19:12:16 -07:00
std::string i2s(const int _i) {
static std::stringstream ss;
ss.str("");
ss << _i;
return ss.str();
}
2023-10-09 19:12:16 -07:00
std::string f2s(const double _d) {
static std::stringstream ss;
ss.str("");
ss << _d;
return ss.str();
}
2023-10-09 19:12:16 -07:00
int s2i(const std::string s) {
return atoi(s.c_str());
}
2023-10-09 19:12:16 -07:00
double s2f(const std::string s) {
return atof(s.c_str());
}
2023-10-09 19:12:16 -07:00
wxString i2ws(const int _i) {
wxString str;
str << _i;
return str;
}
2023-10-09 19:12:16 -07:00
wxString f2ws(const double _d) {
wxString str;
str << _d;
return str;
}
2023-10-09 19:12:16 -07:00
int ws2i(const wxString s) {
long _i;
2023-10-09 19:12:16 -07:00
if (s.ToLong(&_i)) {
return int(_i);
2023-10-09 19:12:16 -07:00
}
return 0;
}
2023-10-09 19:12:16 -07:00
double ws2f(const wxString s) {
double _d;
2023-10-09 19:12:16 -07:00
if (s.ToDouble(&_d)) {
return _d;
2023-10-09 19:12:16 -07:00
}
return 0.0;
}
2023-10-09 19:12:16 -07:00
void replaceString(std::string &str, const std::string sought, const std::string replacement) {
size_t pos = 0;
size_t start = 0;
size_t soughtLen = sought.length();
size_t replaceLen = replacement.length();
2023-10-09 19:12:16 -07:00
while ((pos = str.find(sought, start)) != std::string::npos) {
str = str.substr(0, pos) + replacement + str.substr(pos + soughtLen);
start = pos + replaceLen;
}
}
2023-10-09 19:12:16 -07:00
void trim_right(std::string &source, const std::string &t) {
source.erase(source.find_last_not_of(t) + 1);
}
2023-10-09 19:12:16 -07:00
void trim_left(std::string &source, const std::string &t) {
source.erase(0, source.find_first_not_of(t));
}
2023-10-09 19:12:16 -07:00
void trim(std::string &str) {
// Trim from start
2023-10-09 19:12:16 -07:00
str.erase(str.begin(), std::find_if(str.begin(), str.end(), [](int ch) { return !std::isspace(ch); }));
// Trim from end
2023-10-09 19:12:16 -07:00
str.erase(std::find_if(str.rbegin(), str.rend(), [](int ch) { return !std::isspace(ch); }).base(), str.end());
}
2023-10-09 19:12:16 -07:00
void to_lower_str(std::string &source) {
std::transform(source.begin(), source.end(), source.begin(), tolower);
}
2023-10-09 19:12:16 -07:00
void to_upper_str(std::string &source) {
std::transform(source.begin(), source.end(), source.begin(), toupper);
}
2023-10-09 19:12:16 -07:00
std::string as_lower_str(const std::string &other) {
std::string ret = other;
to_lower_str(ret);
return ret;
}
2023-10-09 19:12:16 -07:00
std::string as_upper_str(const std::string &other) {
std::string ret = other;
to_upper_str(ret);
return ret;
}
2023-10-09 19:12:16 -07:00
bool isFalseString(std::string &str) {
if (str == "false" || str == "0" || str == "" || str == "no" || str == "not") {
return true;
}
return false;
}
2023-10-09 19:12:16 -07:00
bool isTrueString(std::string &str) {
return !isFalseString(str);
}
2023-10-09 19:12:16 -07:00
int random(int low, int high) {
if (low == high) {
return low;
}
2016-09-29 19:24:45 -03:00
2023-10-09 19:12:16 -07:00
if (low > high) {
return low;
}
int range = high - low;
2016-09-29 19:24:45 -03:00
double dist = double(mt_randi()) / 0xFFFFFFFF;
return low + std::min(range, int((1 + range) * dist));
}
2023-10-09 19:12:16 -07:00
int random(int high) {
return random(0, high);
}
2023-10-09 19:12:16 -07:00
std::wstring string2wstring(const std::string &utf8string) {
wxString s(utf8string.c_str(), wxConvUTF8);
return std::wstring((const wchar_t*)s.c_str());
}
2023-10-09 19:12:16 -07:00
std::string wstring2string(const std::wstring &widestring) {
wxString s(widestring.c_str());
return std::string((const char*)s.mb_str(wxConvUTF8));
}
2015-01-23 20:45:25 -03:00
2023-10-09 19:12:16 -07:00
bool posFromClipboard(int &x, int &y, int &z) {
2015-01-23 20:45:25 -03:00
bool done = false;
2023-10-09 19:12:16 -07:00
if (wxTheClipboard->Open()) {
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
2015-01-23 20:45:25 -03:00
std::vector<int> values;
wxTextDataObject data;
wxTheClipboard->GetData(data);
2023-11-08 17:04:13 -08:00
auto text = data.GetText().ToStdString();
2015-01-23 20:45:25 -03:00
2023-10-09 19:12:16 -07:00
if (text.size() < 50) {
2015-01-23 20:45:25 -03:00
bool r = false;
wxString sv;
2023-10-09 19:12:16 -07:00
for (size_t s = 0; s < text.size(); ++s) {
if (text[s] >= '0' && text[s] <= '9') {
2015-01-23 20:45:25 -03:00
sv << text[s];
r = true;
2023-10-09 19:12:16 -07:00
} else if (r) {
2015-01-23 20:45:25 -03:00
values.push_back(ws2i(sv));
sv.Clear();
r = false;
2023-10-09 19:12:16 -07:00
if (values.size() >= 3) {
2015-01-23 20:45:25 -03:00
break;
2023-10-09 19:12:16 -07:00
}
2015-01-23 20:45:25 -03:00
}
}
}
2023-10-09 19:12:16 -07:00
if (values.size() == 3) {
2015-01-23 20:45:25 -03:00
x = values[0];
y = values[1];
z = values[2];
done = true;
}
}
wxTheClipboard->Close();
}
return done;
}
2015-01-24 13:34:52 -03:00
2023-10-09 19:12:16 -07:00
bool posToClipboard(int x, int y, int z, int format) {
if (!wxTheClipboard->Open()) {
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
return false;
2023-10-09 19:12:16 -07:00
}
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
wxTextDataObject* data = new wxTextDataObject();
switch (format) {
case 0:
data->SetText(wxString::Format("{x = %d, y = %d, z = %d}", x, y, z));
break;
case 1:
data->SetText(wxString::Format("{\"x\":%d, \"y\":%d, \"z\":%d}", x, y, z));
break;
case 2:
data->SetText(wxString::Format("%d, %d, %d", x, y, z));
break;
case 3:
data->SetText(wxString::Format("(%d, %d, %d)", x, y, z));
break;
case 4:
data->SetText(wxString::Format("Position(%d, %d, %d)", x, y, z));
break;
default:
wxTheClipboard->Close();
return false;
}
wxTheClipboard->SetData(data);
wxTheClipboard->Close();
return true;
}
2023-11-08 17:04:13 -08:00
bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz, int format) {
2023-10-09 19:12:16 -07:00
if (!wxTheClipboard->Open()) {
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
return false;
2023-10-09 19:12:16 -07:00
}
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
2023-11-08 17:04:13 -08:00
wxTextDataObject* data = new wxTextDataObject();
switch (format) {
case 0:
data->SetText(wxString::Format("{fromx = %d, tox = %d, fromy = %d, toy = %d, fromz = %d, toz = %d}", fromx, tox, fromy, toy, fromz, toz));
break;
case 1:
data->SetText(wxString::Format("{ x = %d, y = %d, z = %d }, { x = %d, y = %d, z = %d }", fromx, fromy, fromz, tox, toy, toz));
break;
case 2:
data->SetText(wxString::Format("Position(%d, %d, %d), Position(%d, %d, %d)", fromx, fromy, fromz, tox, toy, toz));
break;
2023-10-09 19:12:16 -07:00
}
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
2023-11-08 17:04:13 -08:00
wxTheClipboard->SetData(data);
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
wxTheClipboard->Close();
return true;
}
2023-10-09 19:12:16 -07:00
wxString b2yn(bool value) {
return value ? "Yes" : "No";
2015-01-24 13:34:52 -03:00
}
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
2023-10-09 19:12:16 -07:00
wxColor colorFromEightBit(int color) {
if (color <= 0 || color >= 216) {
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
return wxColor(0, 0, 0);
2023-10-09 19:12:16 -07:00
}
feat: synchronizing commits with the official rme repository (#36) * Show indicators for pickupable and moveable items * Fix: drawing always refreshing ui * Fix crash on invalid friend for wallbrush * Option to remove empty spawns * Draws position indicator, some code cleanup * Teleport copy/paste improvements * Fix flood fill * Add function to get minimap/8bit color * Small code cleanup * Cleanup Position * Code cleanup and small optimizations * Code cleanup * Code cleanup and small optimizations (#406) * Cleanup and cast functions. * Avoid adding a new Unique ID if it already exists * Code cleanup and small optimizations * More changes and cleanup * Changes and cleanup * Some changes * Fix copy position. * Only show uid/aid alert if it really changed * Add actions history panel * Does not draw tooltips on minimap mode * Use constexpr * Replace items fix (#408) * Draw grid small optimization * Small change in selection box and Fix #409 * Fix some xpm * Ingame box improvements, add lights support. * Fix go to previous position (#410) * Fix depot crash (#411) * Fix XPMs * Export minimap as .otmm (otclient format) or .png (#413) * Fix glitch after drawing secondary map * fix * Update about_window.cpp * sonar * fix Minimap and progress bar * fix erro load items.xml * fix * fix doodad brush * fix: slightly more accurate house size estimation * feat: update items.otb and items.xml * fix: bad merge * Revert "feat: update items.otb and items.xml" This reverts commit 40f1edc70f17c423282d546a41541a8fe9b92dcc. --------- Co-authored-by: Nailson <Mignari@users.noreply.github.com> Co-authored-by: wtver <51377408+maattch@users.noreply.github.com> Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com> Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 23:02:37 -03:00
const uint8_t red = (uint8_t)(int(color / 36) % 6 * 51);
const uint8_t green = (uint8_t)(int(color / 6) % 6 * 51);
const uint8_t blue = (uint8_t)(color % 6 * 51);
return wxColor(red, green, blue);
}