Project

General

Profile

« Previous | Next » 

Revision 740fade2

Added by Leszek Koltunski 23 days ago

Fix the association between a RubikObject and its solvers and patterns.

Before, if we rearranged the objects order in the main screen, this would break down.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
46 46
  private final float mDifficulty;
47 47
  private final String mAuthor;
48 48
  private final boolean mAdjColors;
49
  private final int mObjectIndex;
49 50

  
50 51
  private boolean mIsFree;
51 52
  private int mJsonID, mMeshID, mExtrasID;
......
75 76
    mAuthor      = meta.getAuthor();
76 77
    mIsLocal     = false;
77 78
    mAdjColors   = meta.supportsAdjustableStickerColors();
79
    mObjectIndex = ListObjects.getObjectIndex(mUpperName);
78 80

  
79
    int patternOrdinal  = RubikPatternList.getOrdinal(mObjectOrdinal);
81
    int patternOrdinal  = RubikPatternList.getOrdinal(mObjectIndex);
80 82
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
81 83

  
82
    mSolverOrdinal = ImplementedSolversList.getSolverOrdinal(mObjectOrdinal);
84
    mSolverOrdinal = ImplementedSolversList.getSolverOrdinal(mObjectIndex);
83 85
    mExtrasOrdinal = -1;
84 86

  
85 87
    mObjectVersion = meta.objectVersion();
......
104 106
    mYear          = object.year;
105 107
    mAuthor        = object.author;
106 108
    mAdjColors     = object.adjColors;
109
    mObjectIndex   = -1;
107 110

  
108 111
    mPatterns      = null;
109 112
    mExtrasOrdinal = -1;
......
313 316
    return mCategory;
314 317
    }
315 318

  
319
///////////////////////////////////////////////////////////////////////////////////////////////////
320

  
321
  public int getIndex()
322
    {
323
    return mObjectIndex;
324
    }
325

  
316 326
///////////////////////////////////////////////////////////////////////////////////////////////////
317 327

  
318 328
  public float getDifficulty()

Also available in: Unified diff