Antal1987
Warlord
Hello, everyone!
Everyone knows that in Civ 3 Editor the user can set "Removes Pop. Pollution" and "Reduces Bldg. Pollution" flags to each improvement
But under certain condititions pollution remains anyway.
I've found some function in Civ III Conquests exe-file, which calculates city pollution.
Lets call it class_City::Calculate_Pollution
As it turned out, total pollution = max(0, population_pollution) + max(0, buildings_pollution)
here is pseudocode of calculating population_pollution and buildingsbuildings_pollutionpollution:
if (City.Size < General_Settings.Max_City_Size)
population_pollution = 0;
else
{
population_pollution = City.Size - General_Settings.Max_City_Size;
if(City.Has_Improvement_With_Flag(Removes_Population_Pollution))
population_pollution = 1;
}
buildings_pollution = sum{Improvement.Pollution where City.Has_Improvement(i)}
if(buildings_pollution > 0)
{
if(City.Has_Improvement_With_Flag(Removes_Population_Pollution))
buildings_pollution = 1;
}
General_Settings.Max_City_Size is a standard scenario parameter
By default it is 12. See Game Rules -> General Settings -> City Size Levels Group -> Maximum size for Level 2 (in Civ3 Editor)
In Civ3Conquests v1.22 function class_City::Calculate_Pollution has address 0x004B1CA0.
There are two hard coded constants in the function:
1) in: population_pollution = 1; Address of the constant (1) is: 0x004B1D61 (4 bytes integer)
2) in: buildings_pollution = 1; Address of the constant (1) is: 0x004B1E08 (4 bytes integer)
In Civ3 that code was duplicated in 2 separate functions (functions' names are fictitious, of course):
1) one for population_pollution calculating (class_City::Calculate_Population_Pollution); Address of the function: 0x004B1AE0; Address of the constant (1): 0x004B1B9E (4 bytes integer).
2) one for buildings_pollution calculating (class_City::Calculate_Improvements_Pollution); Address of the function: 0x004B1BD0; Address of the constant (1): 0x004B1C7B (4 bytes integer).
The game developers obviously didn't use DRY concept.
So in this way, it's enough to change these values to 0 to have zero city pollution.
Of course, the city must have a mass transition and a recycling center
Everyone knows that in Civ 3 Editor the user can set "Removes Pop. Pollution" and "Reduces Bldg. Pollution" flags to each improvement
But under certain condititions pollution remains anyway.
I've found some function in Civ III Conquests exe-file, which calculates city pollution.
Lets call it class_City::Calculate_Pollution
As it turned out, total pollution = max(0, population_pollution) + max(0, buildings_pollution)
here is pseudocode of calculating population_pollution and buildingsbuildings_pollutionpollution:
if (City.Size < General_Settings.Max_City_Size)
population_pollution = 0;
else
{
population_pollution = City.Size - General_Settings.Max_City_Size;
if(City.Has_Improvement_With_Flag(Removes_Population_Pollution))
population_pollution = 1;
}
buildings_pollution = sum{Improvement.Pollution where City.Has_Improvement(i)}
if(buildings_pollution > 0)
{
if(City.Has_Improvement_With_Flag(Removes_Population_Pollution))
buildings_pollution = 1;
}
General_Settings.Max_City_Size is a standard scenario parameter
By default it is 12. See Game Rules -> General Settings -> City Size Levels Group -> Maximum size for Level 2 (in Civ3 Editor)
In Civ3Conquests v1.22 function class_City::Calculate_Pollution has address 0x004B1CA0.
There are two hard coded constants in the function:
1) in: population_pollution = 1; Address of the constant (1) is: 0x004B1D61 (4 bytes integer)
2) in: buildings_pollution = 1; Address of the constant (1) is: 0x004B1E08 (4 bytes integer)
In Civ3 that code was duplicated in 2 separate functions (functions' names are fictitious, of course):
1) one for population_pollution calculating (class_City::Calculate_Population_Pollution); Address of the function: 0x004B1AE0; Address of the constant (1): 0x004B1B9E (4 bytes integer).
2) one for buildings_pollution calculating (class_City::Calculate_Improvements_Pollution); Address of the function: 0x004B1BD0; Address of the constant (1): 0x004B1C7B (4 bytes integer).
The game developers obviously didn't use DRY concept.
So in this way, it's enough to change these values to 0 to have zero city pollution.
Of course, the city must have a mass transition and a recycling center