Skip to content

Commit

Permalink
fix(skymp5-server): fix setDisplayName not cleared from db (skyrim-mu…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove authored Apr 14, 2024
1 parent 3f6de86 commit 58fa467
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 8 additions & 4 deletions skymp5-server/cpp/server_guest_lib/MpObjectReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "OpenContainerMessage.h"
#include "TeleportMessage.h"

#include "script_classes/PapyrusObjectReference.h" // kOriginalNameExpression

constexpr uint32_t kPlayerCharacterLevel = 1;

UpdatePropertyMessage MpObjectReference::CreatePropertyMessage(
Expand Down Expand Up @@ -335,10 +337,12 @@ void MpObjectReference::VisitProperties(const PropertiesVisitor& visitor,
}

if (ChangeForm().displayName.has_value()) {
std::string raw = *ChangeForm().displayName;
nlohmann::json j = raw;
std::string displayNameAsJson = j.dump();
visitor("displayName", displayNameAsJson.data());
const std::string& raw = *ChangeForm().displayName;
if (raw != PapyrusObjectReference::kOriginalNameExpression) {
nlohmann::json j = raw;
std::string displayNameAsJson = j.dump();
visitor("displayName", displayNameAsJson.data());
}
}

// Property flags (isVisibleByOwner, isVisibleByNeighbor) should be checked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,11 +857,7 @@ VarValue PapyrusObjectReference::SetDisplayName(
}
const char* displayName = static_cast<const char*>(arguments[0]);

if (!strcmp(displayName, kOriginalNameExpression)) {
selfRefr->SetDisplayName(std::nullopt);
} else {
selfRefr->SetDisplayName(displayName);
}
selfRefr->SetDisplayName(displayName);

bool force = static_cast<bool>(arguments[1]);
std::ignore = force;
Expand Down

0 comments on commit 58fa467

Please sign in to comment.