25 Commits
Author SHA1 Message Date
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
majcostaandAsdow 96ede9299f Change CMake build type from Release to RelWithDebInfo 2025-12-04 19:47:04 +02:00
majcostaandGitHub 4a16698cdb CHINESE: actually display BobbyR amount purchased correctly at runtime (#398)
* Revert "Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n"

This reverts commit ecdc8916f2.

* actually display the amount purchased correctly at runtime
2025-01-03 21:03:09 -03:00
majcostaandGitHub 3e76e9525e Merge pull request #378 from majcosta/pr_remove_language_from_preprocessor
Get every language preprocessor conditional into one library
2024-12-31 18:32:50 -03:00
majcostaandGitHub ae55496e39 Move main executable source to its own directory (#248)
* Move main executable files to their own directory

* Adapt the build to the new file structure

... and fix some weird #include's that were relying on the project root
being an include directory.
2023-10-23 15:46:51 -03:00
majcostaandGitHub 381ab936eb Rename 'Standard Gaming Platform' to 'sgp' (#246)
* rename 'Standard Gaming Platform' to 'sgp'

* Adapt CMakeLists.txt files to renamed SGP directory

* Lowercase it
2023-10-23 10:18:20 -03:00
majcostaandGitHub c8c7066969 Refactor merc backpack checking in FindBestPath (#162)
* remove unused fNonFenceJumper from AstarPathfinder::GetPath

* Extract backpack check into function and flip logic

Avoiding double negatives is nice
2023-07-28 12:07:25 -03:00
majcostaandGitHub a0ac81aa65 Add support for AddressSanitizer instrumentation (#189)
To use, just set `ADDRESS_SANITIZER` to `ON` on the command-line or your
CMakeUserPresets.json file
2023-07-27 18:15:53 +03:00
majcosta dd004dc114 Clean up .gitignore
To set up a personal .gitignore:

using Git Bash:
`echo shelve/ >> ~/.gitignore`
`git config --global core.excludesFile ~/.gitignore`

using Command Prompt, replace `~` with `%USERPROFILE%`
2023-05-23 20:02:42 -03:00
90cd7be71d Add instructions to the README.md file (#142)
* Add instructions to the README.md file

* Update README.md

Co-authored-by: Robert Biter <robert.biter@zalando.de>

---------

Co-authored-by: Robert Biter <robert.biter@zalando.de>
2023-05-09 12:08:33 -03:00
majcostaandGitHub d007d3ba9e Remove gszCivGroupNames dependency from main executable (#114)
* Add include guard to EditorMercs.h

* bring CivGroup related symbols from Tactical over to Editor

and adjust #includes accordingly

* remove redundant #ifdef
2023-01-26 19:09:46 -03:00
57d2674f37 Use a modifiable user-preset sample for VS 2022/2019 (#97)
* Use a modifiable user-preset sample for VS 2022/2019

Customizing a repo-tracked preset file doesn't work:

Type in your gamedir for debugging, or toggle verbose mode for the build, or configure Chinese
UB MapEditor: you now have an unstaged `CMakePresets.json` change in your working directory.
very annoying.

Also, Visual Studio 2022's preset support has a bug: if you have a `CMakePresets.json` file,
no matter in which file (user or repo) the preset you have selected is defined, if you click
"Manage Configurations..." it will always open `CMakePresets.json` for editing, setting the
user up for failure and editing the commited-to-repository file.

Having just the `CMakeUserPresets.json` file also sidesteps another poor Visual Studio 2022
decision: hiding in Folder View files that are .gitignore'd (like `CMakeUserPresets.json`).

In the absence of a `CMakePresets.json` file, selecting "Manage Configurations..." will open
the right file for editing.

The workflow is then:

Copy `CMakeUserPresets.json.sample` into `CMakeUserPresets.json` _once_, then customize
that to your heart's content without git bothering you and accidentally adding an
unwanted change to a patch. Or make your own.

* Added auto-copy of profile template.

* declutter things a bit

move function out of root cmakelists.txt file
move user preset template to a presets directory

this is horrible and I hate it

Co-authored-by: CptMoore <39010654+CptMoore@users.noreply.github.com>
2023-01-21 20:26:49 -03:00
majcostaandGitHub e62fa859ff Re-add Debug messages when door structures are missing (#95)
Uncovered in #87
2023-01-19 12:10:27 +02:00
majcostaandGitHub 6afe785f4b Default to not displaying the fake light around mercs (#86)
* Remove option to disable 'Mercs Lights during Movement"

This might've cost someone some frames in 1999, but today even a 10
year old smartphone can probably run with this turned on at 1080p without
dropping a sweat

This does not remove the menu option which I plan to replace with
'Highlight Mercs' which was hidden for some reason.

'Merc Lights during Movement' is a noop now tho

* Replace 'Merc Lights during movement' with 'Highlight Mercs'

as title

* Make 'Merc Highlights' default to false

"Wtf why am I glowing?" well your problems are over
2023-01-18 20:56:34 +02:00
d6896c9234 Added a minimalistic .editorconfig with some sensible defaults. (#85)
Co-authored-by: CptMoore <39010654+CptMoore@users.noreply.github.com>
2023-01-17 23:33:24 -08:00
majcostaandGitHub 6b0c704b19 avoid static initialization order fiasco in soundman.cpp (#80)
when running the cmake Debug build instead of the ja2_vs2019.sln file s_SoundLog is undefined.
the most likely reason for that is that static objects in global scope
have unspecified initialization order. the problem is fixed if the
static SoundLog object is created inside the SoundLog(CHAR8*) function
instead.

also remove the comment whose meaning apparently has been lost to the
sands of time
2023-01-17 23:33:06 -08:00
majcostaandGitHub e4295acfec simplify the language/executable validation function (#79)
* simplify the language/executable validation function

removing the 'ALL' corner-case so that the default behavior is to configure all valid languages and applications allows to simplify this function quite a bit

* keep the CMakePreset.json options listed for ease of use
2023-01-17 23:32:38 -08:00
majcostaandGitHub 512717aff9 remove leftover references to removed files in VS project files (#69)
missed those in #49
2023-01-10 20:40:58 +02:00
majcostaandGitHub cee328f073 replace auto_ptr with std::unique_ptr (#64)
deprecated in C++11 and removed in C++17
2023-01-06 22:49:41 +02:00
majcostaandGitHub be4f1b5e1c remove std:binary_function inheritance from comparator (#65)
deprecated since C++11, removed in C++17
2023-01-06 22:49:27 +02:00
majcostaandGitHub aaa8b094c9 remove UTIL and JA2 preprocessor definitions (#66)
UTIL is never used, and JA2 is always used. assumption being we'll never make 1.13 for Wizardry 8.

video2.h doesn't exist, which prevented me from deleting it.
2023-01-05 20:40:36 +02:00
majcostaandGitHub 24425a82b1 More unused stuff removal (#49)
* More unused stuff removal

delete:
- giant 'metaheaders' (JA2 All.h, Laptop All.h, etc), preferring to add #includes directly where needed
- unused ExceptionHandling and DbMan translation units
- unused WizShare.h, Bitmap.h, trle.h, video_private.h headers

* remove mentions from vc proj files too

* remove preprocessor conditionals for unused definitions

find . -iname '*.h' -o -iname '*.cpp' -exec unifdef.exe -m -UPRECOMPILED_HEADERS -UJA2_PRECOMPILED_HEADERS -UWIZ8_PRECOMPILED_HEADERS -UPRECOMPILEDHEADERS {} ';'

then manually fixed a couple files the tool errored out on

* yes, the comments too

as title
2023-01-03 15:51:48 +02:00
majcostaandGitHub 6024ed62b0 convert UTF-16LE files to UTF-8 (#55)
these three files were in UTF-16LE encoding for some reason, which led
to git treating them as binary files, which means they weren't being git
grep'd

I just converted them using iconv -f utf-16le -t utf8 [origFile] -o
[destFile]

use git show --text to view
2023-01-01 09:26:45 +02:00
majcostaandGitHub 03e5fbbffd remove Mutex Manager and associated dead code (#44)
this does nothing
2022-12-19 17:43:03 -08:00
12c778118e Remove write-only variable (#42)
git-svn-id: svn://tron.homeunix.org/ja2/trunk@30 5e31c081-6ce3-0310-bb30-f584a8092234

-

https://github.com/ja2-stracciatella/ja2-stracciatella/commit/d1d7fe722a68b07bc8bdc3c90ba9149746eec24e

Co-authored-by: tron <tron@5e31c081-6ce3-0310-bb30-f584a8092234>
2022-12-11 01:27:47 -08:00