(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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user