From bbf4d19de39a7b9be9a1e9c150dcd9b52ea89376 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 15 Jul 2016 15:20:36 -0400 Subject: [PATCH] Revert "Changed tuple use to struct in maps.cpp (LoadV2) (should help in client drops where slow zone boot-ups are a factor)" This reverts commit 02cedce54eaf590d0ac02fc7dd52c8feb9313f2c. This is breaks moors! --- changelog.txt | 9 +-------- zone/map.cpp | 30 +++++++++--------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/changelog.txt b/changelog.txt index a051fb6e2..efa9b257a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,15 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 07/14/2016 == -Uleat: Changed LoadV2Map usage of std::tuplet to struct PointEntry () - - This appears to help with zone boot times when V2 maps are used on windows systems - unverified on linux systems as of this time - - Current visual studio implementation for tuples is to pass by value whereas structs are passed by reference. The overhead is noticeable when processing VLS data objects (~33 seconds versus ~9 seconds in 'moors' for the affected code with my system) - - This change, in addition to the recent sin/cos change by mackal, should improve zone boot times and help alleviate client dumps on zoning due to time-outs - in some cases - - Please report any issues observed by this or any other change - == 07/09/2016 == Uleat: Important fix for mob pathing - - This should fix failed pathing issues (and high cpu usage for zone.exe) for mobs in affected zones + - This should fix failed pathing issues (and high cpu usage for zone.exe) for mobs in affect zones - Changed variable 'gridno' type from int16 to int32 to reflect actual return value of fetch (values do exceed 32767 aka int16.max) - Precision loss from int32 to int16 conversion was causing grid id to be changed to quest controlled movement in cases where (gridno & 0x8000 == true) diff --git a/zone/map.cpp b/zone/map.cpp index a5c677f6b..0fb1036d5 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -348,18 +348,6 @@ struct ModelEntry std::vector polys; }; -struct PointEntry -{ - PointEntry(float x, float y, float z) { x_val = x; y_val = y; z_val = z; } - void set(float x, float y, float z) { x_val = x; y_val = y; z_val = z; } - bool operator==(const PointEntry& r) const { return (x_val == r.x_val && y_val == r.y_val && z_val == r.z_val); } - bool operator<(const PointEntry& r) const { return (x_val < r.x_val && y_val < r.y_val && z_val < r.z_val); } - - float x_val; - float y_val; - float z_val; -}; - bool Map::LoadV2(FILE *f) { uint32 data_size; if (fread(&data_size, sizeof(data_size), 1, f) != 1) { @@ -804,7 +792,7 @@ bool Map::LoadV2(FILE *f) { } int row_number = -1; - std::map cur_verts; + std::map, uint32> cur_verts; for (uint32 quad = 0; quad < ter_quad_count; ++quad) { if ((quad % quads_per_tile) == 0) { ++row_number; @@ -830,7 +818,7 @@ bool Map::LoadV2(FILE *f) { float QuadVertex4Z = floats[quad + row_number + 1]; uint32 i1, i2, i3, i4; - PointEntry t(QuadVertex1X, QuadVertex1Y, QuadVertex1Z); + std::tuple t = std::make_tuple(QuadVertex1X, QuadVertex1Y, QuadVertex1Z); auto iter = cur_verts.find(t); if (iter != cur_verts.end()) { i1 = iter->second; @@ -838,10 +826,10 @@ bool Map::LoadV2(FILE *f) { else { i1 = (uint32)verts.size(); verts.push_back(glm::vec3(QuadVertex1X, QuadVertex1Y, QuadVertex1Z)); - cur_verts[t] = i1; + cur_verts[std::make_tuple(QuadVertex1X, QuadVertex1Y, QuadVertex1Z)] = i1; } - t.set(QuadVertex2X, QuadVertex2Y, QuadVertex2Z); + t = std::make_tuple(QuadVertex2X, QuadVertex2Y, QuadVertex2Z); iter = cur_verts.find(t); if (iter != cur_verts.end()) { i2 = iter->second; @@ -849,10 +837,10 @@ bool Map::LoadV2(FILE *f) { else { i2 = (uint32)verts.size(); verts.push_back(glm::vec3(QuadVertex2X, QuadVertex2Y, QuadVertex2Z)); - cur_verts[t] = i2; + cur_verts[std::make_tuple(QuadVertex2X, QuadVertex2Y, QuadVertex2Z)] = i2; } - t.set(QuadVertex3X, QuadVertex3Y, QuadVertex3Z); + t = std::make_tuple(QuadVertex3X, QuadVertex3Y, QuadVertex3Z); iter = cur_verts.find(t); if (iter != cur_verts.end()) { i3 = iter->second; @@ -860,10 +848,10 @@ bool Map::LoadV2(FILE *f) { else { i3 = (uint32)verts.size(); verts.push_back(glm::vec3(QuadVertex3X, QuadVertex3Y, QuadVertex3Z)); - cur_verts[t] = i3; + cur_verts[std::make_tuple(QuadVertex3X, QuadVertex3Y, QuadVertex3Z)] = i3; } - t.set(QuadVertex4X, QuadVertex4Y, QuadVertex4Z); + t = std::make_tuple(QuadVertex4X, QuadVertex4Y, QuadVertex4Z); iter = cur_verts.find(t); if (iter != cur_verts.end()) { i4 = iter->second; @@ -871,7 +859,7 @@ bool Map::LoadV2(FILE *f) { else { i4 = (uint32)verts.size(); verts.push_back(glm::vec3(QuadVertex4X, QuadVertex4Y, QuadVertex4Z)); - cur_verts[t] = i4; + cur_verts[std::make_tuple(QuadVertex4X, QuadVertex4Y, QuadVertex4Z)] = i4; } indices.push_back(i4);