Skip to content

Commit

Permalink
Prevent "menu" attribute from being removed from persistent items
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Apr 20, 2024
1 parent a28525f commit 33d3ddf
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2010 - Stendhal *
* (C) Copyright 2003-2024 - Stendhal *
***************************************************************************
***************************************************************************
* *
Expand Down Expand Up @@ -54,9 +54,9 @@ public Item transform(RPObject rpobject) {
boolean autobind = item.has("autobind");
if (rpobject.has("persistent")
&& (rpobject.getInt("persistent") == 1)) {
/*
* Keep [new] rpclass
*/
// keep [new] menu
final String menuvalue = item.get("menu");
// keep [new] rpclass
final RPClass rpclass = item.getRPClass();
item.fill(rpobject);
item.setRPClass(rpclass);
Expand All @@ -67,6 +67,11 @@ public Item transform(RPObject rpobject) {
if (autobind) {
item.put("autobind", "");
}

// prevent persistent from removing "menu" attribute
if (!item.has("menu") && menuvalue != null) {
item.put("menu", menuvalue);
}
}

if (item instanceof StackableItem) {
Expand Down

0 comments on commit 33d3ddf

Please sign in to comment.