summaryrefslogtreecommitdiff
path: root/ai/trolly
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-23 13:04:44 +0000
committertron <tron@openttd.org>2005-10-23 13:04:44 +0000
commit47137cefb72d3b3d3bc6fdefc7a4b103429f6d46 (patch)
tree7a8d1fbbe0d0d6ee2c8e981c57be6a9003505e97 /ai/trolly
parent2cc2154ad26b96b032df2f4fca0ce1634e6330b2 (diff)
downloadopenttd-47137cefb72d3b3d3bc6fdefc7a4b103429f6d46.tar.xz
(svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts - use the trinary operator where appropriate - data types (uint[] -> AcceptedCargo, ...) - if cascade -> switch - if (ptr) -> if (ptr != NULL) - DeMorgan's Law - Fix some comments - 0 -> '\0', change magic numbers to symbolic constants
Diffstat (limited to 'ai/trolly')
-rw-r--r--ai/trolly/build.c4
-rw-r--r--ai/trolly/pathfinder.c6
-rw-r--r--ai/trolly/trolly.c23
3 files changed, 15 insertions, 18 deletions
diff --git a/ai/trolly/build.c b/ai/trolly/build.c
index 80f0fdf1b..bc173892c 100644
--- a/ai/trolly/build.c
+++ b/ai/trolly/build.c
@@ -229,7 +229,7 @@ int AiNew_PickVehicle(Player *p)
count = _cargoc.ai_roadveh_count[p->ainew.cargo];
// Let's check it backwards.. we simply want to best engine available..
- for (i=start+count-1;i>=start;i--) {
+ for (i = start + count - 1; i >= start; i--) {
// Is it availiable?
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
if (!HASBIT(GetEngine(i)->player_avail, _current_player) || GetEngine(i)->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
@@ -238,7 +238,7 @@ int AiNew_PickVehicle(Player *p)
if (!CmdFailed(ret)) break;
}
// We did not find a vehicle :(
- if (CmdFailed(ret)) { return -1; }
+ if (CmdFailed(ret)) return -1;
return i;
}
}
diff --git a/ai/trolly/pathfinder.c b/ai/trolly/pathfinder.c
index aa44014f9..126e0cd41 100644
--- a/ai/trolly/pathfinder.c
+++ b/ai/trolly/pathfinder.c
@@ -506,9 +506,5 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
}
}
- // Res should never be below zero.. if so, make it zero!
- if (res < 0) { res = 0; }
-
- // Return our value
- return res;
+ return (res < 0) ? 0 : res;
}
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index 5e16c51a9..c40b0faef 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -1,17 +1,18 @@
-/* $Id: ai_new.c 2891 2005-08-26 20:26:34Z tron $ */
+/* $Id$ */
/*
- * This AI was created as a direct reaction to the big demand for some good AIs in OTTD.
- * Too bad it never left alpha-stage, and it is considered dead in his current form.
- * By the time of writing this, we, the creator of this AI and a good friend of mine,
- * are designing a whole new AI-system that allows us to create AIs easier and without
- * all the fuzz we encountered while I was working on this AI. By the time that system
- * is finished, you can expect that this AI will dissapear, because it is pretty
- * obselete and bad programmed.
+ * This AI was created as a direct reaction to the big demand for some good AIs
+ * in OTTD. Too bad it never left alpha-stage, and it is considered dead in its
+ * current form.
+ * By the time of writing this, we, the creator of this AI and a good friend of
+ * mine, are designing a whole new AI-system that allows us to create AIs
+ * easier and without all the fuzz we encountered while I was working on this
+ * AI. By the time that system is finished, you can expect that this AI will
+ * dissapear, because it is pretty obselete and bad programmed.
*
- * In the meanwhile I wish you all much fun with this AI; if you are interested as
- * AI-developer in this AI, I advise you not stare too long to some code, some things in
- * here really are... strange ;) But in either way: enjoy :)
+ * Meanwhile I wish you all much fun with this AI; if you are interested as
+ * AI-developer in this AI, I advise you not stare too long to some code, some
+ * things in here really are... strange ;) But in either way: enjoy :)
*
* -- TrueLight :: 2005-09-01
*/