Page 1 of 1

Bug in NoAI API: AITown.GetTownRating

Posted: 08 Jul 2010 23:52
by Morloth
Dear devs,

I think the AITown.GetTownRating returns the wrong town rating. It seems that when I check for:

Code: Select all

local companyID = AICompany.ResolveCompanyID(AICompany.COMPANY_SELF);
if (AITown.GetTownRating(town, companyID) == AITown.TOWN_RATING_GOOD) {
   ...
}
The code actually checks for AITown.TOWN_RATING_VERY_GOOD. So it seems that all the values assigned to the town ratings are 1 too high. The function in src/ai/api/ai_town.cpp should read:

Code: Select all

return max(TOWN_RATING_APPALLING, (TownRating)((t->ratings[company] / 200) + 4));
For instance, when the town's rating is 1, it should return TOWN_RATING_MEDIOCRE (4) but it returns TOWN_RATING_POOR (3).

Cheers,
Bram

Re: Bug in NoAI API: AITown.GetTownRating

Posted: 09 Jul 2010 22:45
by ChillCore
Fixed in r20103.
Thank you frosch.