gothic-1-community-patch icon indicating copy to clipboard operation
gothic-1-community-patch copied to clipboard

Missing whitespace for skill point(s)

Open AmProsius opened this issue 4 years ago • 5 comments

When learning from teachers, there is a whitespace missing before "skill point" and "skill points" respectively.

AmProsius avatar Jan 06 '21 14:01 AmProsius

https://github.com/AmProsius/gothic-1-community-patch/blob/e66b303623c042ec5cfc387a1b0d4bd352605f12/scriptbase/_work/Data/Scripts/Content/Story/Text.d#L534-L535

changed to

const string NAME_LearnPostfixS		=	" skill point)";	
const string NAME_LearnPostfixP		=	" skill points)";	

catalinstoian avatar Jan 16 '21 18:01 catalinstoian

This fix will be possible. However, it will only work if we know the exact wording for each language we want to support. If the wording is off by a little, or the values have been corrected, the fix would not take effect (which seems like a good option),

szapp avatar Jan 24 '21 21:01 szapp

This bug seems to be present for the English language version of the game only. If the fix doesn't take effect when a mod fixes these strings, that's fine.

AmProsius avatar Jan 25 '21 19:01 AmProsius

This fix should be updated to use the G1CP string manipulation functions. In order to stick to only updating either both or none of the two string, the functions G1CP_GetStringConstId, G1CP_GetStringConstI, and G1CP_SetStringConstI should be used.

https://github.com/AmProsius/gothic-1-community-patch/blob/5abd54ea7c342f19cfa0d1352d30eccc45c0130a/src/Ninja/G1CP/Content/Fixes/Session/fix043_EN_SkillMissingWhitespace.d#L5-L24

changed to (something like):

    var int symb1Id; symb1Id = G1CP_GetStringConstId("NAME_LearnPostfixS", 0);
    var int symb2Id; symb2Id = G1CP_GetStringConstId("NAME_LearnPostfixP", 0);

    // Check if the strings are as expected
    if (Hlp_StrCmp(G1CP_GetStringConstI(symb1Id, 0, "G1CP invalid string"), "skill point)"))
    && (Hlp_StrCmp(G1CP_GetStringConstI(symb2Id, 0, "G1CP invalid string"), "skill points)")) {

        // Only then, fix them
        G1CP_SetStringConstI(symb1Id, 0, " skill point)");
        G1CP_SetStringConstI(symb2Id, 0, " skill points)");

        return TRUE;
    };

    return FALSE;

szapp avatar Feb 03 '22 10:02 szapp

I suggest splitting this fix into separate Fixes and refactor them like this:

G1CP_ReplaceStringConst("NAME_LearnPostfixS", "skill point)", " skill point)");

/*
 * Find a constant string (case-sensitive) and replace it if found. Returns true on success.
 */
func int G1CP_ReplaceStringConst(var string name, var string needle, var string replace) {
    if (STR_Compare(G1CP_GetStringConst(name, 0, "G1CP invalid string"), needle) != STR_EQUAL) {
        return FALSE;
    };

    G1CP_SetStringConst(name, 0, replace);
    return TRUE;
};

Alternatively, we could refactor this and leave both into one fix:

G1CP_ReplaceStringConst("NAME_LearnPostfixS", "skill point)", " skill point)");
G1CP_ReplaceStringConst("NAME_LearnPostfixP", "skill points)", " skill points)");

AmProsius avatar Jan 10 '23 07:01 AmProsius