Project

General

Profile

« Previous | Next » 

Revision 5f54927b

Added by Leszek Koltunski over 2 years ago

Preparation for local creation of puzzles: remove the 'ObjectType' enum from TwistyObject class.

View differences:

src/main/java/org/distorted/objectlib/json/JsonReader.java
75 75
  private int mScrambleType, mNumScrambles;
76 76
  private int[] mColor;
77 77
  private int mInternalColor;
78
  private ObjectType mType;
79 78
  private boolean mResetMaps;
80 79
  private String mTutorialObject;
81 80
  private String[][] mTutorials;
81
  private long mSignature;
82 82

  
83 83
  private static JsonReader mThis;
84 84

  
......
110 110
    mResetMaps       = object.getBoolean("resetmaps");
111 111
    mNumFaces        = object.getInt("num_faces");
112 112

  
113
    int ordinal = ObjectType.getOrdinal(mShortName);
114
    mType = ordinal>=0 ? ObjectType.getObject(ordinal) : null;
113
    try
114
      {
115
      mSignature = object.getLong("signature");
116
      }
117
    catch(JSONException ex)
118
      {
119
      // objects older than Feb 2022 do not have the 'signature' field. They all use the ObjectType.ordinal
120
      // as their signature.
121
      mSignature = ObjectType.getOrdinal(mShortName);
122
      }
115 123
    }
116 124

  
117 125
///////////////////////////////////////////////////////////////////////////////////////////////////
......
874 882

  
875 883
///////////////////////////////////////////////////////////////////////////////////////////////////
876 884

  
877
  public ObjectType intGetObjectType()
885
  public long getSignature()
878 886
    {
879
    return mType;
887
    return mSignature;
880 888
    }
881 889

  
882 890
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff