Revision 7ac0ee88
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/network/RubikNetwork.java | ||
---|---|---|
37 | 37 |
import org.distorted.objectlib.main.ObjectList; |
38 | 38 |
|
39 | 39 |
import static org.distorted.objectlib.main.ObjectList.MAX_LEVEL; |
40 |
import static org.distorted.objectlib.main.ObjectList.NUM_OBJECTS; |
|
40 | 41 |
|
41 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 43 |
|
... | ... | |
96 | 97 |
"%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" |
97 | 98 |
}; |
98 | 99 |
|
99 |
private static int mTotal = 0; |
|
100 | 100 |
private static String[][][] mCountry; |
101 | 101 |
private static String[][][] mName; |
102 | 102 |
private static float[][][] mTime; |
... | ... | |
113 | 113 |
|
114 | 114 |
private static void initializeStatics() |
115 | 115 |
{ |
116 |
if( mTotal==0 ) mTotal = ObjectList.getTotal(); |
|
117 |
if( mCountry==null ) mCountry = new String[mTotal][MAX_LEVEL][MAX_PLACES]; |
|
118 |
if( mName==null ) mName = new String[mTotal][MAX_LEVEL][MAX_PLACES]; |
|
119 |
if( mTime==null ) mTime = new float[mTotal][MAX_LEVEL][MAX_PLACES]; |
|
120 |
if( mPlaces==null ) mPlaces = new int[mTotal][MAX_LEVEL]; |
|
116 |
if( mCountry==null ) mCountry = new String[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES]; |
|
117 |
if( mName==null ) mName = new String[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES]; |
|
118 |
if( mTime==null ) mTime = new float[NUM_OBJECTS][MAX_LEVEL][MAX_PLACES]; |
|
119 |
if( mPlaces==null ) mPlaces = new int[NUM_OBJECTS][MAX_LEVEL]; |
|
121 | 120 |
} |
122 | 121 |
|
123 | 122 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
166 | 165 |
return false; |
167 | 166 |
} |
168 | 167 |
|
169 |
for(int i=0; i<mTotal; i++)
|
|
168 |
for(int i=0; i<NUM_OBJECTS; i++)
|
|
170 | 169 |
for(int j=0; j<MAX_LEVEL; j++) |
171 | 170 |
{ |
172 | 171 |
mPlaces[i][j] = 0; |
... | ... | |
205 | 204 |
|
206 | 205 |
if( s5>s4 && s4>s3 && s3>s2 && s2>s1 && s1>0 ) |
207 | 206 |
{ |
208 |
int object = ObjectList.unpackObjectFromString( row.substring(0,s1) );
|
|
207 |
int object = ObjectList.getOrdinal( row.substring(0,s1) );
|
|
209 | 208 |
|
210 |
if( object>=0 && object<mTotal )
|
|
209 |
if( object>=0 && object<NUM_OBJECTS )
|
|
211 | 210 |
{ |
212 | 211 |
int level = Integer.parseInt( row.substring(s1+1,s2) ); |
213 | 212 |
String name = row.substring(s2+1, s3); |
Also available in: Unified diff
Simplify ObjectList: now there's just one object per size.