Skip to content

Commit 0009bc8

Browse files
committed
Revert try/catch in engine loops
Bump version and date
1 parent e048a0a commit 0009bc8

File tree

4 files changed

+73
-73
lines changed

4 files changed

+73
-73
lines changed

AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="ru.exlmoto.astrosmash"
4-
android:versionCode="1"
5-
android:versionName="1.0" >
4+
android:versionCode="2"
5+
android:versionName="1.1" >
66

77
<uses-sdk
88
android:minSdkVersion="8"

res/values-ru/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<string name="CreditsHelp">Помощь</string>
3434
<string name="ButtonHelp">Помощь</string>
3535
<string name="AboutHelpLabel">Справка и помощь</string>
36-
<string name="Version">v1.1 | 23-JAN-2017</string>
36+
<string name="Version">v1.1 | 04-FEB-2017</string>
3737
<string name="IconDesc">Иконка AstroSmash</string>
3838
<string name="AboutString">Портирование с Java ME (J2ME) MIDlet на Android OS с использованием отрисовки с помощью канваса SurfaceView:\n• © 2016 S. \"EXL\" KLS\nemail: [email protected]\nemail: [email protected]\n\nИсходный код:\nhttp://github.com/EXL/AstroSmash\n\nСтатья про портирование AstroSmash:\nhttp://exlmoto.ru/astrosmash-droid\n\nБлагодарности:\n• Данилу Медведеву за идею и поддержку;\n• Никите Прокопчику за классные фотографии;\n• mvb06\'у за тестирование APK-пакета;\n• baat\'у за помощь и поддержку;\n• Zorge.R\'у за хостинг, терпение и помощь.</string>
3939
<string name="DoubleFire">Два снаряда</string>

res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<string name="CreditsHelp">Help</string>
3434
<string name="ButtonHelp">Help Game</string>
3535
<string name="AboutHelpLabel">About &amp; Help</string>
36-
<string name="Version">v1.1 | 23-JAN-2017</string>
36+
<string name="Version">v1.1 | 04-FEB-2017</string>
3737
<string name="IconDesc">Icon AstroSmash</string>
3838
<string name="AboutString">Porting from Java ME (J2ME) MIDlet to Android OS application with using SurfaceView Canvas drawing:\n• © 2016 S. \"EXL\" KLS\nemail: [email protected]\nemail: [email protected]\n\nSource Code:\nhttp://github.com/EXL/AstroSmash\n\nArticle About Porting AstroSmash:\nhttp://exlmoto.ru/astrosmash-droid\n\nThanks to:\n• Danil Medvedev for idea and support;\n• Nikita Prokopchik for cool photos;\n• mvb06 for testing APK-package;\n• baat for help and support;\n• Zorge.R for hosting, patience and help.</string>
3939
<string name="DoubleFire">Double Fire</string>

src/ru/exlmoto/astrosmash/AstroSmashEngine/GameWorld.java

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,18 @@ public void fireBullet() {
226226
}
227227

228228
protected void tickBullets(long paramLong) {
229-
// try {
230-
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
231-
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
232-
localCollidable.tick(paramLong, this);
233-
int j = localCollidable.getY() + localCollidable.getHeight();
234-
if (j <= 0) {
235-
sendBulletToHell(localCollidable);
229+
try {
230+
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
231+
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
232+
localCollidable.tick(paramLong, this);
233+
int j = localCollidable.getY() + localCollidable.getHeight();
234+
if (j <= 0) {
235+
sendBulletToHell(localCollidable);
236+
}
236237
}
238+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
239+
localArrayIndexOutOfBoundsException.printStackTrace();
237240
}
238-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
239-
// localArrayIndexOutOfBoundsException.printStackTrace();
240-
// }
241241
}
242242

243243
protected void paintMessage(Canvas canvas, Paint paint, String paramString1, String paramString2) {
@@ -263,57 +263,57 @@ protected void paintMessage(Canvas canvas, Paint paint, String paramString1, Str
263263
}
264264

265265
protected void paintFlyingBullets(Canvas canvas, Paint paint) {
266-
// try {
267-
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
268-
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
269-
localCollidable.paint(canvas, paint);
266+
try {
267+
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
268+
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
269+
localCollidable.paint(canvas, paint);
270+
}
271+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
272+
localArrayIndexOutOfBoundsException.printStackTrace();
270273
}
271-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
272-
// localArrayIndexOutOfBoundsException.printStackTrace();
273-
// }
274274
}
275275

276276
protected void hyperSpace() {
277277
this.m_ship.setX(AstroSmashView.getAbsRandomInt() % (this.m_nScreenWidth - this.m_ship.getWidth()));
278278
}
279279

280280
protected void tickEnemies(long paramLong) {
281-
// try {
282-
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
283-
Enemy localEnemy2 = this.m_vecFlyingEnemies.elementAt(i);
284-
localEnemy2.tick(paramLong, this);
285-
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getX() + localEnemy2.getWidth() >= this.m_nScreenWidth) || (localEnemy2.getY() < 0) || (localEnemy2.getX() < 0)) {
286-
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getY() < 0)) {
287-
updateScore(localEnemy2.getGroundScore());
288-
}
289-
this.m_EnemiesToRecycleStack.push(localEnemy2);
290-
if ((localEnemy2.getEnemyTypeId() == 8) || (localEnemy2.getEnemyTypeId() == 9)) {
291-
this.m_ship.setCollided(true);
292-
shipDestroyed();
293-
updateScore(-100);
294-
break;
295-
}
296-
} else {
297-
if (this.m_ship.intersects(localEnemy2)) {
298-
shipDestroyed();
299-
updateScore(-100);
300-
break;
301-
}
302-
for (int k = 0; k < this.m_vecFlyingBullets.size(); k++) {
303-
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(k);
304-
if (localCollidable.intersects(localEnemy2, 1, 2)) {
305-
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_SHORT);
306-
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_HIT);
307-
updateScore(localEnemy2.getHitScore());
308-
sendBulletToHell(localCollidable);
281+
try {
282+
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
283+
Enemy localEnemy2 = this.m_vecFlyingEnemies.elementAt(i);
284+
localEnemy2.tick(paramLong, this);
285+
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getX() + localEnemy2.getWidth() >= this.m_nScreenWidth) || (localEnemy2.getY() < 0) || (localEnemy2.getX() < 0)) {
286+
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getY() < 0)) {
287+
updateScore(localEnemy2.getGroundScore());
288+
}
289+
this.m_EnemiesToRecycleStack.push(localEnemy2);
290+
if ((localEnemy2.getEnemyTypeId() == 8) || (localEnemy2.getEnemyTypeId() == 9)) {
291+
this.m_ship.setCollided(true);
292+
shipDestroyed();
293+
updateScore(-100);
309294
break;
310295
}
296+
} else {
297+
if (this.m_ship.intersects(localEnemy2)) {
298+
shipDestroyed();
299+
updateScore(-100);
300+
break;
301+
}
302+
for (int k = 0; k < this.m_vecFlyingBullets.size(); k++) {
303+
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(k);
304+
if (localCollidable.intersects(localEnemy2, 1, 2)) {
305+
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_SHORT);
306+
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_HIT);
307+
updateScore(localEnemy2.getHitScore());
308+
sendBulletToHell(localCollidable);
309+
break;
310+
}
311+
}
311312
}
312313
}
314+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
315+
localArrayIndexOutOfBoundsException.printStackTrace();
313316
}
314-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
315-
// localArrayIndexOutOfBoundsException.printStackTrace();
316-
// }
317317
sendWaitingEnemiesToFactory();
318318
if (!this.m_bSuspendEnemies) {
319319
if (this.m_vecFlyingEnemies.size() < MAX_NUM_ENEMIES[this.m_nLevel]) {
@@ -378,14 +378,14 @@ protected void sendDeadEnemyToHell(Enemy paramEnemy) {
378378
}
379379

380380
protected void paintEnemies(Canvas canvas, Paint paint) {
381-
// try {
382-
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
383-
Enemy localEnemy = this.m_vecFlyingEnemies.elementAt(i);
384-
localEnemy.paint(canvas, paint);
381+
try {
382+
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
383+
Enemy localEnemy = this.m_vecFlyingEnemies.elementAt(i);
384+
localEnemy.paint(canvas, paint);
385+
}
386+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
387+
localArrayIndexOutOfBoundsException.printStackTrace();
385388
}
386-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
387-
// localArrayIndexOutOfBoundsException.printStackTrace();
388-
// }
389389
}
390390

391391
protected void sendBulletToHell(Collidable paramCollidable) {
@@ -396,23 +396,23 @@ protected void sendBulletToHell(Collidable paramCollidable) {
396396
protected void shipDestroyed() {
397397
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_LONG);
398398
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_SHIP);
399-
// try {
400-
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
401-
Enemy enemy = this.m_vecFlyingEnemies.elementAt(i);
402-
this.m_EnemiesToRecycleStack.push(enemy);
399+
try {
400+
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
401+
Enemy enemy = this.m_vecFlyingEnemies.elementAt(i);
402+
this.m_EnemiesToRecycleStack.push(enemy);
403+
}
404+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
405+
localArrayIndexOutOfBoundsException1.printStackTrace();
403406
}
404-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
405-
// localArrayIndexOutOfBoundsException1.printStackTrace();
406-
// }
407407
sendWaitingEnemiesToFactory();
408-
// try {
409-
for (int j = 0; j < this.m_vecFlyingBullets.size(); j++) {
410-
Collidable collidable = this.m_vecFlyingBullets.elementAt(j);
411-
this.m_BulletsToRecycleStack.push(collidable);
408+
try {
409+
for (int j = 0; j < this.m_vecFlyingBullets.size(); j++) {
410+
Collidable collidable = this.m_vecFlyingBullets.elementAt(j);
411+
this.m_BulletsToRecycleStack.push(collidable);
412+
}
413+
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
414+
localArrayIndexOutOfBoundsException2.printStackTrace();
412415
}
413-
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
414-
// localArrayIndexOutOfBoundsException2.printStackTrace();
415-
// }
416416
this.m_vecFlyingBullets.removeAllElements();
417417
while (!this.m_BulletsToRecycleStack.empty()) {
418418
Collidable localCollidable = this.m_BulletsToRecycleStack.pop();

0 commit comments

Comments
 (0)