MCPcopy Create free account
hub / github.com/SimHacker/micropolis / load

Method load

micropolis-java/src/micropolisj/engine/TileSpec.java:153–196  ·  view source on GitHub ↗
(String inStr, Properties tilesRc)

Source from the content-addressed store, hash-verified

151 }
152
153 protected void load(String inStr, Properties tilesRc)
154 {
155 Scanner in = new Scanner(inStr);
156
157 while (in.hasMore()) {
158
159 if (in.peekChar() == '(') {
160 in.eatChar('(');
161 String k = in.readAttributeKey();
162 String v = "true";
163 if (in.peekChar() == '=') {
164 in.eatChar('=');
165 v = in.readAttributeValue();
166 }
167 in.eatChar(')');
168
169 if (!attributes.containsKey(k)) {
170 attributes.put(k, v);
171 String sup = tilesRc.getProperty(k);
172 if (sup != null) {
173 load(sup, tilesRc);
174 }
175 }
176 else {
177 attributes.put(k, v);
178 }
179 }
180
181 else if (in.peekChar() == '|' || in.peekChar() == ',') {
182 in.eatChar(in.peekChar());
183 }
184
185 else {
186 String v = in.readImageSpec();
187 images.add(v);
188 }
189 }
190
191 this.canBulldoze = getBooleanAttribute("bulldozable");
192 this.canBurn = !getBooleanAttribute("noburn");
193 this.canConduct = getBooleanAttribute("conducts");
194 this.overWater = getBooleanAttribute("overwater");
195 this.zone = getBooleanAttribute("zone");
196 }
197
198 static class Scanner
199 {

Callers 1

parseMethod · 0.95

Calls 7

hasMoreMethod · 0.95
peekCharMethod · 0.95
eatCharMethod · 0.95
readAttributeKeyMethod · 0.95
readAttributeValueMethod · 0.95
readImageSpecMethod · 0.95
getBooleanAttributeMethod · 0.95

Tested by

no test coverage detected