 |
|  |
 |
|
NelsonAndBronte
|
|
I was idly looking through the code and came upon the following lines in buildingutil.cpp. These three functions appear to be intended to return the maximum offense bonus for buildings present in a city. However, the body of the code seems to look for the wrong building characteristics for both water and ar improvements. AFAICS this implies that improvements such as costal forts or flak guns do not function as expected. The correction appears obvious. Thoughts?
code: double buildingutil_GetOffenseBonusLand(const uint64 built_improvements)
{
double best = 0;
FOREACH_BUILT(GetOffenseBonusLand) {
double cur;
if(rec->GetOffenseBonusLand(cur) && cur > best)
best = cur;
}
return best;
}
double buildingutil_GetOffenseBonusWater(const uint64 built_improvements)
{
double best = 0;
FOREACH_BUILT(GetOffenseBonusWater) {
double cur;
if(rec->GetOffenseBonusLand(cur) && cur > best)
best = cur;
}
return best;
}
double buildingutil_GetOffenseBonusAir(const uint64 built_improvements)
{
double best = 0;
FOREACH_BUILT(GetOffenseBonusWater) {
double cur;
if(rec->GetOffenseBonusLand(cur) && cur > best)
best = cur;
}
return best;
})
|
|
|  |
 |
|
NelsonAndBronte
|
|
I replaced the code with the proper look up values. The code to actually return the values entered in buildings.txt looks correct. I havent tried to compile CTP2, yet. Here is the changed code:
code:
double buildingutil_GetOffenseBonusWater(const uint64 built_improvements)
{
// Iterate through all the buildings in the city
// and return the value of the MAXMIMUM bonus only,
// This bonus is not additive
double best = 0;
FOREACH_BUILT(GetOffenseBonusWater) {
double cur;
if(rec->GetOffenseBonusWater(cur) && cur > best)
best = cur;
// original code below checked for the wrong bonus
// if(rec->GetOffenseBonusLand(cur) && cur > best)
// best = cur;
}
return best;
}
double buildingutil_GetOffenseBonusAir(const uint64 built_improvements)
{
// Iterate through all the buildings in the city
// and return the value of the MAXMIMUM bonus only,
// This bonus is not additive
double best = 0;
FOREACH_BUILT(GetOffenseBonusAir) {
double cur;
if(rec->GetOffenseBonusAir(cur) && cur > best)
best = cur;
}
return best;
// original code below checked for the wrong bonus
// FOREACH_BUILT(GetOffenseBonusWater) {
// double cur;
// if(rec->GetOffenseBonusLand(cur) && cur > best)
// best = cur;
// }
// return best;
}
|
|
|  |
All times are GMT. The time now is 05:31. Apolyton Time is 00:31. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|