summaryrefslogtreecommitdiff
path: root/ai_new.c
diff options
context:
space:
mode:
authorpasky <pasky@openttd.org>2005-03-11 22:27:49 +0000
committerpasky <pasky@openttd.org>2005-03-11 22:27:49 +0000
commit89d1c60c3f30fe52721bdddfb9abe161724491e8 (patch)
treed3c313730787956232b94f559cf95abb61400dd2 /ai_new.c
parentf820aa3f6050a569352142d7a1aed872f8067644 (diff)
downloadopenttd-89d1c60c3f30fe52721bdddfb9abe161724491e8.tar.xz
(svn r1994) Fix: 1159456 - hopefully prevent the new AI to get stuck in an infinite loop forlorny trying to build its haven. Unintentionally bundled with trivial tidyup.
Diffstat (limited to 'ai_new.c')
-rw-r--r--ai_new.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ai_new.c b/ai_new.c
index f1d43742f..d52920556 100644
--- a/ai_new.c
+++ b/ai_new.c
@@ -9,6 +9,8 @@
// TODO: als er iets in path komt, bouwt AI gewoon verder :(
// TODO: mail routes
+// FIXME: This code is horrible. Indisputably from the style POV, at least. --pasky
+
/*
* End of Dutch part
*/
@@ -84,15 +86,15 @@ static void AiNew_State_Nothing(Player *p) {
// - Check route
// - Build HQ
static void AiNew_State_WakeUp(Player *p) {
- int32 money;
- int c;
- assert(p->ainew.state == AI_STATE_WAKE_UP);
+ int32 money;
+ int c;
+ assert(p->ainew.state == AI_STATE_WAKE_UP);
// First, check if we have a HQ
if (p->location_of_house == 0) {
// We have no HQ yet, build one on a random place
// Random till we found a place for it!
// TODO: this should not be on a random place..
- while (!AiNew_Build_CompanyHQ(p, Random() % MapSize())) { }
+ AiNew_Build_CompanyHQ(p, Random() % MapSize());
// Enough for now, but we want to come back here the next time
// so we do not change any status
return;
@@ -181,8 +183,8 @@ static void AiNew_State_WakeUp(Player *p) {
}
static void AiNew_State_ActionDone(Player *p) {
- p->ainew.action = AI_ACTION_NONE;
- p->ainew.state = AI_STATE_NOTHING;
+ p->ainew.action = AI_ACTION_NONE;
+ p->ainew.state = AI_STATE_NOTHING;
}
// Check if a city or industry is good enough to start a route there