Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ison

#1
Fixed (currently on unstable branch on Steam)
#2
Interesting! I checked it and it indeed ranges from -18 to -10. I checked the git history and it's been like this at least since 2014, so even if we change the code we'll probably adjust the values to match the old behavior. Thanks for finding this!
#3
Quote from: ByJacob on November 28, 2019, 02:59:51 PM
Hi developers :D
It is possibile to add Polish Language Worker to code ??

public class LanguageWorker_Polish : LanguageWorker
{
public override string WithIndefiniteArticle(string str, Gender gender, bool plural = false, bool name = false)
{
return str;
}

public override string WithDefiniteArticle(string str, Gender gender, bool plural = false, bool name = false)
{
return str;
}

private interface IResolver
{
string Resolve(string[] arguments);
}

private class ReplaceResolver : IResolver
{
// ^Replace('{0}', 'jeden-jedna')^
private static readonly Regex _argumentRegex =
new Regex(@"'(?<old>[^']*?)'-'(?<new>[^']*?)'", RegexOptions.Compiled);

public string Resolve(string[] arguments)
{
if (arguments.Length == 0)
{
return null;
}

string input = arguments[0];

if (arguments.Length == 1)
{
return input;
}

for (int i = 1; i < arguments.Length; ++i)
{
string argument = arguments[i];

Match match = _argumentRegex.Match(argument);
if (!match.Success)
{
return null;
}

string oldValue = match.Groups["old"].Value;
string newValue = match.Groups["new"].Value;

if (oldValue == input)
{
return newValue;
}

//Log.Message(string.Format("input: {0}, old: {1}, new: {2}", input, oldGroup.Captures[i].Value, newGroup.Captures[i].Value));
}

return input;
}
}

private class NumberCaseResolver : IResolver
{
// ^Number( {0} | '# komentarz' | '# komentarze' | '# komentarzy' | '# komentarza' )^
// ^Number( {0} | '1           | 2              | 10              | 1/2            )^
private static readonly Regex _numberRegex =
new Regex(@"(?<floor>[0-9]+)(\.(?<frac>[0-9]+))?", RegexOptions.Compiled);

public string Resolve(string[] arguments)
{
if (arguments.Length != 5)
{
return null;
}

string numberStr = arguments[0];
Match numberMatch = _numberRegex.Match(numberStr);
if (!numberMatch.Success)
{
return null;
}

bool hasFracPart = numberMatch.Groups["frac"].Success;

string floorStr = numberMatch.Groups["floor"].Value;

string formOne = arguments[1].Trim('\'');
string formSeveral = arguments[2].Trim('\'');
string formMany = arguments[3].Trim('\'');
string fraction = arguments[4].Trim('\'');

if (hasFracPart)
{
return fraction.Replace("#", numberStr);
}

int floor = int.Parse(floorStr);
return GetFormForNumber(floor, formOne, formSeveral, formMany).Replace("#", numberStr);
}

private static string GetFormForNumber(int number, string formOne, string formSeveral, string formMany)
{
if (number == 1)
{
return formOne;
}

if (number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20))
{
return formSeveral;
}

return formMany;
}
}

private static readonly ReplaceResolver replaceResolver = new ReplaceResolver();
private static readonly NumberCaseResolver numberCaseResolver = new NumberCaseResolver();

private static readonly Regex _languageWorkerResolverRegex =
new Regex(@"\^(?<resolverName>\w+)\(\s*(?<argument>[^|]+?)\s*(\|\s*(?<argument>[^|]+?)\s*)*\)\^",
RegexOptions.Compiled);

public override string PostProcessedKeyedTranslation(string translation)
{
translation = base.PostProcessedKeyedTranslation(translation);
return PostProcess(translation);
}

public override string PostProcessed(string str)
{
str = base.PostProcessed(str);
return PostProcess(str);
}

private static string PostProcess(string translation)
{
return _languageWorkerResolverRegex.Replace(translation, EvaluateResolver);
}

private static string EvaluateResolver(Match match)
{
string keyword = match.Groups["resolverName"].Value;

Group argumentsGroup = match.Groups["argument"];

string[] arguments = new string[argumentsGroup.Captures.Count];
for (int i = 0; i < argumentsGroup.Captures.Count; ++i)
{
arguments[i] = argumentsGroup.Captures[i].Value.Trim();
}

IResolver resolver = GetResolverByKeyword(keyword);

string result = resolver.Resolve(arguments);
if (result == null)
{
Log.Error(string.Format("Error happened while resolving LW instruction: \"{0}\"", match.Value));
return match.Value;
}

return result;
}

private static IResolver GetResolverByKeyword(string keyword)
{
switch (keyword)
{
case "Replace":
return replaceResolver;
case "Number":
return numberCaseResolver;
default:
return null;
}
}
}


Thanks for posting the LanguageWorker! However, since 1.3 we've introduced a new system which makes such custom code unnecessary. We now support "numCase" and "replace" resolvers natively and every language can use them. You could take a look at the Russian language for an example.
#4
Thanks for reporting everyone, it could be because we've introduced texture atlases in 1.3 to increase performance. There could be a bug somewhere which prevents the texture atlases from being created correctly, we'll investigate this.
#5
Thanks, added to Mantis.
#6
Bugs / Re: Possible bug in ExplosionCellsToHit
September 17, 2020, 02:54:32 PM
Great find, it's a bug indeed. Thanks! We'll fix it.
#7
Thanks, we'll check it.
#8
Thanks for reporting! We'll fix it today. The fix will apply to existing games as well, so it should work fine after the update.
#9
Could anyone please upload a savefile where this happens? Does it still happen on the unstable branch?
#10
Could you please upload the logfile? Maybe it's related to FMOD errors flood.
#11
Does it still happen on unstable branch?
#12
I think reinstalling the game should help, it sometimes happens when Steam fails to update files properly.
#13
Could you upload a savefile where this happens? Fire reservations should be ignored if the pawn is more than 5 cells away.
#14
It's a known issue, thanks for reporting.
#15
Added to todo, thanks.