[iagno] Small optimisation.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Small optimisation.
- Date: Wed, 22 May 2019 13:02:30 +0000 (UTC)
commit 5714fd01fa3135d564e82ab24c378b801eaf99b5
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu May 16 15:36:39 2019 +0200
Small optimisation.
src/game.vala | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index ee99b64..a38dbc8 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -320,16 +320,19 @@ private class GameState : Object
/* Count number of enemy pieces we are beside */
int8 enemy_count = -1;
+ bool is_valid_location = false; // garbage; TODO report bug
int8 xt = (int8) x;
int8 yt = (int8) y;
do {
enemy_count++;
xt += x_step;
yt += y_step;
- } while (is_valid_location_signed (xt, yt) && tiles [xt, yt] == enemy);
+ is_valid_location = is_valid_location_signed (xt, yt);
+ }
+ while (is_valid_location && tiles [xt, yt] == enemy);
/* Must be a line of enemy pieces then one of ours */
- if (enemy_count <= 0 || !is_valid_location_signed (xt, yt) || tiles [xt, yt] != color)
+ if (enemy_count <= 0 || !is_valid_location || tiles [xt, yt] != color)
return 0;
return (uint8) enemy_count;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]