Project

General

Profile

« Previous | Next » 

Revision 286d73ae

Added by Leszek Koltunski about 4 years ago

Port the downloading into the new 'magic' server.

View differences:

src/main/java/org/distorted/object/RubikObjectList.java
113 113
    return -1;
114 114
    }
115 115

  
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

  
118
  public static int unpackObjectFromString(String obj)
119
    {
120
    int u = obj.indexOf('_');
121
    int l = obj.length();
122

  
123
    if( u>0 )
124
      {
125
      String name = obj.substring(0,u);
126
      int size = Integer.parseInt( obj.substring(u+1,l) );
127

  
128
      for(int i=0; i<NUM_OBJECTS; i++)
129
        {
130
        if( objects[i].name().equals(name) )
131
          {
132
          int s = getSize(i,size);
133
          return pack(i,s);
134
          }
135
        }
136
      }
137

  
138
    return -1;
139
    }
140

  
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

  
143
  public static String getObjectList()
144
    {
145
    String name;
146
    StringBuilder list = new StringBuilder();
147
    int len;
148
    int[] sizes;
149

  
150
    for(int i=0; i<NUM_OBJECTS; i++)
151
      {
152
      sizes = objects[i].mObjectSizes;
153
      len   = sizes.length;
154
      name  = objects[i].name();
155

  
156
      for(int j=0; j<len; j++)
157
        {
158
        if( i>0 || j>0 ) list.append(',');
159
        list.append(name);
160
        list.append('_');
161
        list.append(sizes[j]);
162
        }
163
      }
164

  
165
    return list.toString();
166
    }
167

  
116 168
///////////////////////////////////////////////////////////////////////////////////////////////////
117 169

  
118 170
  public static int getTotal()

Also available in: Unified diff