Files
source/Laptop/CharProfile.h
T
fd2c74727e Make LANGUAGE switchable in runtime (#653)
squashed into a single commit because doing it in steps that all
compiled involved a lot of boilerplate that is pointless to commit to
the repository. GH still has the PR for reference.

g_lang, MAX_MESSAGES_ON_MAP_BOTTOM, and GetLanguagePrefix() were
compile-time constants selected by the ENGLISH/GERMAN/... build
define. They're now runtime, defaulting to the same per-exe value the
define used to pick, and overridable at startup from [Ja2 Settings]
LANGUAGE in Ja2.ini.

-

XMLTacticalMessages is filled at runtime from NewTacticalMessages.xml,
never from compiled-in per-language data: all 8 per-language definitions
were the identical all-zero { L"" }. Delete them and define one shared
buffer in Utils/XML_Language.cpp (the loader) instead of pointer-rebinding
it like the static tables — this drops 9 dead 800KB zero-buffers (8
namespaced copies in LanguageStrings.cpp plus the standalone one) and
leaves no bind-ordering hazard for the XML load path.

-

ExportStrings.cpp privately recompiled one language's full text table
by #including the raw _<LANG>Text.cpp inside namespace Loc, keyed off
the exe-level ENGLISH/GERMAN/... compile macro (whichever the build
happened to select). That's redundant with the pointer globals every
other subsystem already uses (Text.h / LanguageStrings.cpp).

Drop the private copy; the unqualified table names in Loc::ExportStrings
now resolve to the global pointer externs, which BindLanguageStrings has
already rebound to the runtime g_lang by the time this runs (EXPORT_STRINGS
ini flag, checked after GetRuntimeSettings in sgp.cpp). gs_Lang (used only
by Loc::Translate for the Polish/Russian byte remap on raw .edt exports) is
now derived from g_lang via ToLocLanguage, so the export always matches
whatever language is actually active instead of a compile-time pick.

-

Editor/popupmenu.cpp and Strategic/Scheduling.cpp kept their own
call-site extern of gszScheduleActions as CHAR16[NUM_SCHEDULE_ACTIONS][20]
after the real definition changed into a rebindable pointer
(CHAR16 (*)[20], LanguageStrings.cpp). MSVC decays the outer array
dimension when mangling globals, so both declarations produce the same
symbol (?gszScheduleActions@@3PAY0BE@_WA) and the mismatch linked
silently -- but the array-typed TUs then indexed the 4-byte pointer
slot itself as string data, so the editor schedule popup and the map
schedule message text read garbage.

-

add text.def to be single-source of truth on symbol names and use it
 .much simpler, less error prone if adding more strings

-

add pseudo interface for language state. MAX_SAGES_ON_BOTTOM must always
 change in lockstep with g_lang. this isn't foolproof but better

---------

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-07-21 05:33:03 -03:00

121 lines
2.3 KiB
C

#ifndef __CHARPROFILE_H
#define __CHARPROFILE_H
#include "types.h"
void GameInitCharProfile();
void EnterCharProfile();
void ExitCharProfile();
void HandleCharProfile();
void RenderCharProfile();
void ResetCharacterStats( void );
void InitIMPSubPageList( void );
extern BOOLEAN fButtonPendingFlag;
extern BOOLEAN fReDrawCharProfile;
extern INT32 iCurrentImpPage;
// attributes
extern INT32 iStrength;
extern INT32 iDexterity;
extern INT32 iAgility;
extern INT32 iWisdom;
extern INT32 iLeadership;
extern INT32 iHealth;
// skills
extern INT32 iMarksmanship;
extern INT32 iMedical;
extern INT32 iExplosives;
extern INT32 iMechanical;
// sex?
extern BOOLEAN fCharacterIsMale;
// name?
extern CHAR16 pFullName[];
extern CHAR16 pNickName[];
// skills
extern INT32 iSkillA;
extern INT32 iSkillB;
extern INT32 iSkillC; // Added by SANDRO
// persoanlity
extern INT32 iPersonality;
// attitude
extern INT32 iAttitude;
// Flugente: background
extern UINT16 usBackground;
// Flugente: sexism, racism etc.
extern INT8 bRace;
extern INT8 bNationality;
extern INT8 bAppearance;
extern INT8 bAppearanceCareLevel;
extern INT8 bRefinement;
extern INT8 bRefinementCareLevel;
extern INT8 bHatedNationality;
extern INT8 bHatedNationalityCareLevel;
extern INT8 bRacist;
extern UINT8 bSexist;
//addtivies
extern INT32 iAddStrength;
extern INT32 iAddDexterity;
extern INT32 iAddAgility;
extern INT32 iAddWisdom;
extern INT32 iAddHealth ;
extern INT32 iAddLeadership ;
extern INT32 iAddMarksmanship ;
extern INT32 iAddMedical ;
extern INT32 iAddExplosives ;
extern INT32 iAddMechanical ;
// pop up strings
extern STR16* pImpPopUpStrings;
//extern BOOLEAN fIMPCompletedFlag;
enum{
IMP_HOME_PAGE,
IMP_BEGIN,
IMP_FINISH,
IMP_MAIN_PAGE,
IMP_PERSONALITY,
IMP_PERSONALITY_QUIZ,
IMP_PERSONALITY_FINISH,
IMP_ATTRIBUTE_ENTRANCE,
IMP_ATTRIBUTE_PAGE,
IMP_ATTRIBUTE_FINISH,
IMP_PORTRAIT,
IMP_VOICE,
IMP_ABOUT_US,
IMP_CONFIRM,
// These 5 added - SANDRO
IMP_CHARACTER_AND_DISABILITY_ENTRANCE,
IMP_CHARACTER_PAGE,
IMP_DISABILITY_PAGE,
IMP_COLOR_CHOICE_PAGE,
IMP_MINOR_TRAITS_PAGE,
// added by Flugente
IMP_BACKGROUND,
IMP_PREJUDICE,
IMP_GEAR_ENTRANCE,
IMP_GEAR,
IMP_NUM_PAGES,
};
#define COST_OF_PROFILE 3000
#endif