• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Rescaled Latitude Limits modmod + No Latitude/Longitude Limits modmod

Updated to SVN 11166

There is separate version for SVN 11131, as SVN 11132 breaks saves, all modmods and scenarios.
 
Which version do I download to use for SVN 11166? Does it matter if I'm planning on using the 'World' map script?
Would like there to be as many animals and resources as possible for my next game set up.
 
Which version do I download to use for SVN 11166? Does it matter if I'm planning on using the 'World' map script?
Would like there to be as many animals and resources as possible for my next game set up.
Use SVN one.
Other SVN one clearly says its for SVN 11131 or earlier.
Use no latitude limits.
 
The files changed by this modmod were modified by 11197 (Assets/XML/Buildings/zAnimals_CIV4BuildingInfos.xml) and 11216 (Assets/XML/Buildings/Regular_CIV4BuildingInfos.xml).

Edit: In the latest version of this modmod (11192) the "No Latitude ..." variant has different settings for the "Crosses" tech (Carpentry & Conduct instead of Code of Laws, and a cost of 68 instead of 225) and for the "Public Stoning" obsoletion tech (Bronze Working instead of Executions).

Is the following correct: For the "Rescaled" version, the values for iMinLatitude and for iMaxLatitude are divided by 6.5 and rounded, and for the "No" version, both those tags and the tags bLatitudeAbs, iMaxLongitude and iMinLongitude are removed?

Edit2: If that is correct, there are a few additional files that would probably needed to be add at least for the "No" option.

Spoiler Image :

LatLong 2020-08-24 194200.png



Edit3: Here is a C# script to create the file set for Original and Rescaled, assuming that dividing by 6.5 is correct (it yields the given results for all latitudes in the files), written in .NET Core SDK 3.1.401 (the directories need to be adapted):

Spoiler C# file :

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;

namespace myApp
{
class Program
{
private static readonly Decimal ratio = Decimal.Parse("6.5", new CultureInfo("en-US"));
private const string SourceDirectory = @"D:\SVN\C2C\";
private const string OutputOriginalDirectory = @"D:\LLOrig\";
private const string OutputRescaledDirectory = @"D:\LLResc\";

static void Main(string[] args)
{
string startFolder = SourceDirectory + @"Assets\";
DirectoryInfo dir = new DirectoryInfo(startFolder);
IEnumerable<FileInfo> fileList = dir.GetFiles("*.*", SearchOption.AllDirectories);
Regex regex = new Regex("(iMinLatitude)|(iMaxLatitude)");
var queryMatchingFiles =
from file in fileList
where file.Extension == ".xml"
let fileText = GetFileText(file.FullName)
where regex.IsMatch(fileText)
select file.FullName;

Console.WriteLine("The text was found in the following files:");
foreach (string filename in queryMatchingFiles)
{
Console.WriteLine(filename);
string newFilename = filename.Replace(SourceDirectory, OutputOriginalDirectory);
XDocument doc = XDocument.Parse(GetFileText(filename), LoadOptions.PreserveWhitespace);
Directory.CreateDirectory(Path.GetDirectoryName(newFilename));
doc.Save(newFilename);
XElement root = doc.Root;
IEnumerable<XElement> rootDescs = root.Descendants();
IEnumerable<XElement> allMins =
from desc in rootDescs
where desc.Name.LocalName == "iMinLatitude"
select desc;
List<XElement> allMinList = allMins.ToList();
foreach (XElement minElement in allMins)
{
var reduced = ReduceValue(minElement.Value);
minElement.SetValue(reduced);
}
IEnumerable<XElement> allMaxs =
from desc in rootDescs
where desc.Name.LocalName == "iMaxLatitude"
select desc;
List<XElement> allMaxList = allMaxs.ToList();
foreach (XElement maxElement in allMaxs)
{
var reduced = ReduceValue(maxElement.Value);
maxElement.SetValue(reduced);
}
string rescaledFilename = filename.Replace(SourceDirectory, OutputRescaledDirectory);
Directory.CreateDirectory(Path.GetDirectoryName(rescaledFilename));
doc.Save(rescaledFilename);
}

}

// Read the contents of the file.
// Source: https://docs.microsoft.com/en-us/do...o-query-the-contents-of-files-in-a-folder-lin
static string GetFileText(string name)
{
string fileContents = String.Empty;

// If the file has been deleted since we took
// the snapshot, ignore it and return the empty string.
if (File.Exists(name))
{
fileContents = File.ReadAllText(name);
}
return fileContents;
}

static string ReduceValue(string original)
{
return Decimal.ToInt32(Decimal.Round(Convert.ToDecimal(original) / ratio)).ToString();
}
}
}
 
Last edited:
Rest of files are unnecessary, also no idea how some of this stuff sneaked in last update - probably mouse failure to select that one file lmao.

Updated to SVN 11219
 
Last edited:
  • Like
Reactions: tmv
Is there a way to download past versions? Specifically the version working with SVN 11210.
 
No worries - making the edits myself wasn't as tedious as I was expecting. Just trying to finish a pretty long game from before a hiatus before I update.
 
After I replace the SVN (11280) files with this fix, what am I doing wrong?
CP9KN.png
Modmod doesn't work on SVN 11280 - its loses compatibility extremely fast!

Use V41.2 (download it from moddb) or latest SVN (always use latest SVN).
 
Last edited:
Fixed the hardcodedness of Animal civs that got me in trouble with my 100-civs build.
Simply had to compare it to the unmodded file, duh.
The latter says PREDATOR_PLAYER, not 40+.
Duh, indeed.
 

Attachments

That's because its not SVN yet
What do you mean?
The whole point was that the file HERE has it hardcoded to NUMBERS, whereas the original file has it coded to NAMES.
Thus, obviously, if I changed the numbers, it'd glitch - but it shouldn't glitch if it was using names in the first place.
Not tested yet, though, just a change that I saw being logically sound, lol.

On a side question:
How do you UPDATE Git repositories the same way you do it with SVN by simply right-clicking it?
I had to literally redownload (clone) it from scratch when I thought I messed something up in it.
 
Back
Top Bottom