mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
(svn r20103) -Fix [FS#3934]: AITown::GetRating() returned wrong values. (Morloth)
This commit is contained in:
parent
24fe1f41a5
commit
cddd6df252
@ -8049,7 +8049,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||||||
GetPopulation(): 737
|
GetPopulation(): 737
|
||||||
GetLocation(): 6446
|
GetLocation(): 6446
|
||||||
GetHouseCount(): 26
|
GetHouseCount(): 26
|
||||||
GetRating(): 5
|
GetRating(): 6
|
||||||
Town 11
|
Town 11
|
||||||
IsValidTown(): true
|
IsValidTown(): true
|
||||||
GetName(): Fort Frindston
|
GetName(): Fort Frindston
|
||||||
@ -8084,7 +8084,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||||||
GetPopulation(): 807
|
GetPopulation(): 807
|
||||||
GetLocation(): 42338
|
GetLocation(): 42338
|
||||||
GetHouseCount(): 33
|
GetHouseCount(): 33
|
||||||
GetRating(): 5
|
GetRating(): 6
|
||||||
Town 16
|
Town 16
|
||||||
IsValidTown(): true
|
IsValidTown(): true
|
||||||
GetName(): Kennville
|
GetName(): Kennville
|
||||||
@ -8119,7 +8119,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||||||
GetPopulation(): 437
|
GetPopulation(): 437
|
||||||
GetLocation(): 22585
|
GetLocation(): 22585
|
||||||
GetHouseCount(): 15
|
GetHouseCount(): 15
|
||||||
GetRating(): 5
|
GetRating(): 6
|
||||||
Town 21
|
Town 21
|
||||||
IsValidTown(): true
|
IsValidTown(): true
|
||||||
GetName(): Franinghead
|
GetName(): Franinghead
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "ai_cargo.hpp"
|
#include "ai_cargo.hpp"
|
||||||
#include "ai_error.hpp"
|
#include "ai_error.hpp"
|
||||||
#include "../../town.h"
|
#include "../../town.h"
|
||||||
|
#include "../../town_type.h"
|
||||||
#include "../../strings_func.h"
|
#include "../../strings_func.h"
|
||||||
#include "../../company_func.h"
|
#include "../../company_func.h"
|
||||||
#include "../../station_base.h"
|
#include "../../station_base.h"
|
||||||
@ -172,8 +173,25 @@
|
|||||||
if (company == AICompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
|
if (company == AICompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
|
||||||
|
|
||||||
const Town *t = ::Town::Get(town_id);
|
const Town *t = ::Town::Get(town_id);
|
||||||
if (!HasBit(t->have_ratings, company)) return TOWN_RATING_NONE;
|
if (!HasBit(t->have_ratings, company)) {
|
||||||
return max(TOWN_RATING_APPALLING, (TownRating)((t->ratings[company] / 200) + 3));
|
return TOWN_RATING_NONE;
|
||||||
|
} else if (t->ratings[company] <= RATING_APPALLING) {
|
||||||
|
return TOWN_RATING_APPALLING;
|
||||||
|
} else if (t->ratings[company] <= RATING_VERYPOOR) {
|
||||||
|
return TOWN_RATING_VERY_POOR;
|
||||||
|
} else if (t->ratings[company] <= RATING_POOR) {
|
||||||
|
return TOWN_RATING_POOR;
|
||||||
|
} else if (t->ratings[company] <= RATING_MEDIOCRE) {
|
||||||
|
return TOWN_RATING_MEDIOCRE;
|
||||||
|
} else if (t->ratings[company] <= RATING_GOOD) {
|
||||||
|
return TOWN_RATING_GOOD;
|
||||||
|
} else if (t->ratings[company] <= RATING_VERYGOOD) {
|
||||||
|
return TOWN_RATING_VERY_GOOD;
|
||||||
|
} else if (t->ratings[company] <= RATING_EXCELLENT) {
|
||||||
|
return TOWN_RATING_EXCELLENT;
|
||||||
|
} else {
|
||||||
|
return TOWN_RATING_OUTSTANDING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ int AITown::GetAllowedNoise(TownID town_id)
|
/* static */ int AITown::GetAllowedNoise(TownID town_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user