Commit Graph
84 Commits
Author SHA1 Message Date
Marco Antonio J. Costaandmajcosta ffe987061e remove DrawMoneyOnScreen
there's already a function to draw text on the screen. a money amount is
text, so just return a string and print that.
2025-09-26 02:31:02 -03:00
Marco Antonio J. Costaandmajcosta e14a337e03 Prevent AllowReinforcements from reverting to TRUE regardless of setting whenever you save 2025-09-25 15:27:30 -03:00
Marco Antonio J. Costaandmajcosta 4ec012ce7b fix bug where combat doesn't end on team retreat
fixes issue #498 where retreating from combat in a sector that has a merc
inbound via the airdrop marker causes combat not to end

the reason this fails is that a the inbound soldier counts as being in
the sector being retreated from, even though he isn't

I add a check for `MercPtrs[i]->bInSector` so this doesn't happen

that way the function doesn't leave early and CheckForEndOfCombatMode is
reached
2025-09-11 22:00:32 -03:00
Marco Antonio J. Costaandmajcosta ac59eba898 get rid of unnecessary #defines 2025-09-05 20:31:11 -03:00
Marco Antonio J. Costaandmajcosta 216cd78b18 Let players make an IMP with 3 major and 0 minor traits 2025-09-02 20:02:15 -03:00
Marco Antonio J. Costaandmajcosta 7d9cd87da8 fully externalize bQueenLosingControlOfSector 2025-09-02 20:01:47 -03:00
Marco Antonio J. Costaandmajcosta e5d25810f6 nuke console 2025-08-31 13:50:19 -03:00
Marco Antonio J. Costaandmajcosta 5d3cc7969f fix code that relies on transitive includes 2025-08-30 19:09:06 -03:00
Marco Antonio J. Costaandmajcosta 272ba56fa1 remove unused function 2025-08-30 18:48:16 -03:00
Marco Antonio J. Costaandmajcosta 3c44f133fd Actually fix NOTIFY_IF_SLEEP_FAILS for multiple mercs selected 2025-08-24 07:39:00 -03:00
Marco Antonio J. Costaandmajcosta 616d9a08e6 Fix NOTIFY_IF_SLEEP_FAILS for multiple mercs selected 2025-08-12 23:18:49 -03:00
Marco Antonio J. Costaandmajcosta ebd2e25e0f Fix a wrong #ifdef to runtime check conversion
I didn't get this right the first time, non-Chinese text was looking
funny in dialog boxes
2025-01-09 21:37:19 -03:00
Marco Antonio J. Costaandmajcosta ff8376d625 Keep UB specific enum value for all builds
but at the end, not beginning as to not make a mess

along with an intro.lua change in gamedir/Data-UB/Scripts this gets rid of a nasty preprocessor conditional in a header file
2025-01-09 21:34:07 -03:00
Marco Antonio J. Costaandmajcosta 7aa0e18352 Revert "make sure these steps run"
This reverts commit 1976dee738.

Revert "yet another fix for the github actions"

This reverts commit 552951795c.

Revert "make sure CI to assemble release on 'v*' tag push or manually"

This reverts commit 8897769f0d.
2025-01-07 16:51:30 -03:00
Marco Antonio J. Costaandmajcosta 1976dee738 make sure these steps run
otherwise there is no 'source' working directory for the final step
2025-01-07 14:13:46 -03:00
Marco Antonio J. Costaandmajcosta 552951795c yet another fix for the github actions
github.ref_name isn't 'master' when a tag is pushed, but the tag name,
so it won't trigger a release build when a 'v*' tag is pushed
2025-01-07 13:19:03 -03:00
Marco Antonio J. Costaandmajcosta 8897769f0d make sure CI to assemble release on 'v*' tag push or manually
also put bash script through shellcheck to be more posix compliant
2025-01-07 13:09:23 -03:00
Marco Antonio J. Costaandmajcosta ac6a1504df add a space to string to prevent compilation errors in GB2312 2025-01-05 10:04:04 -03:00
Marco Antonio J. Costaandmajcosta 22e67f66fa Move wine.cpp into its own library
avoid extra compilations that way
2025-01-05 07:57:57 -03:00
Marco Antonio J. Costaandmajcosta f471b74f5b fix inconsistent case for a few files
you can now build in a case-sensitive filesystem
2025-01-04 13:14:22 -03:00
Marco Antonio J. Costaandmajcosta 846abf5f1c Convert Text.h to utf-8-sig and move ChineseSpecString* there
This time without mangling the characters
2025-01-02 13:53:27 -03:00
Marco Antonio J. Costaandmajcosta ed73bd07ae Revert "Make Chinese specific strings compile-time instead of conditional"
When these lines were edited, I likely opened _ChineseText.cpp in the
wrong encoding, and therefore saved it in the wrong encoding, mangling
the characters

This reverts commit cd69f5f3ae.
2025-01-02 13:53:27 -03:00
Marco Antonio J. Costaandmajcosta b908bcecb9 fix missing icon in executable
the Ja2.rc file needs to be in the add_executable target for the icon
to appear, and that one requires WinMain.

so get rid of dummy.cpp and put sgp/sgp.cpp in there
2025-01-02 08:02:52 -03:00
Marco Antonio J. Costaandmajcosta a7b0091a27 use link-time optimization when creating a release
it's a lot slower, but we don't release often
2025-01-01 18:10:47 -03:00
Marco Antonio J. Costaandmajcosta 7aafa7aada fix the GitHub actions for VS2022's quirk too
missed this change in 98cdffe5, fix it now
2025-01-01 18:10:47 -03:00
Marco Antonio J. Costa 959c29434e Adjust the build system
Language is now just built once per app (still some JA2UB conditionals
going on in there) but building everything should now take eight times
less work
2024-12-31 18:24:36 -03:00
Marco Antonio J. Costa e9686c0dca reformat CMakeLists.txt 2024-12-31 16:28:45 -03:00
Marco Antonio J. Costa 10037291f3 remove preprocessor from i18n Multi Language Graphic Utils.cpp 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 9ed713f952 move Utils/Multi Language Graphic Utils.* to i18n
has language preprocessor silliness, straight to jail
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa cccec0ef11 straggler in Utils/Font Control.cpp 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4a7625cef0 Slightly clunky RUSSIAN conversion 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 70f09471c2 just cast g_lang into lua's language code
because magically I got the enum order right first try
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa b15c4ef96c the really gnarly CHINESE #ifdef conversions
these seem to be right, chinese text appears to be flowing correctly
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa ecdc8916f2 Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n
Just awful
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4b563fefc8 Slightly clunkier fix for RUSSIAN conditional 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa cf0b4dfc40 Manual unrolling preprocessor stuff and added function
This function is just for GERMAN but it has a unique name so it's no
problem.

Had to slightly change how MercID gets populated
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 5fb989a1fc Move Text.h over to i18n too
Never use relative paths for #includes. Didn't touch the rest because
out of scope.
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 33e8c1dc39 Move all the translated strings over to i18n
It's where all conditional language preprocessor goes
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 73f7812165 Slightly less straightforward CHINESE conversion in Interface Items.cpp
A bit clunkier, had to repeat function calls because of how
preprocessor tricks don't map 1:1 with actual C++.
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa d008d10b31 Replace a ton of trivial #ifdefs with runtime checks
This one is big, but unless I missed something, should be all be
trivial.

scripted-diff with the following, then manually tweaked whatever needed:
```

if [ $# -ne 3 ]; then
    echo "Usage: $0 '<pattern>' '<replacement>' '<filename>'"
    exit 1
fi

pattern="$1"
replacement="$2"
filename="$3"

if [ ! -f "$filename" ]; then
    echo "Error: File $filename does not exist."
    exit 1
fi

sed -i '/'"$pattern"'/ {
    :loop
    $ !{
        N
        /'"$pattern"'.*\n.*#endif/ {
            s/'"$pattern"'/'"$replacement"'/
            s/#else/} else {/
            s/#endif/}/
            P
            D
        }
        /'"$pattern"'/ b loop
    }
}' "$filename"

echo "Replacement complete in $filename"
```

h/t to Grok2 for the sed command
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa cd69f5f3ae Make Chinese specific strings compile-time instead of conditional
eventually we'll switch between CHINESE and other languages during
runtime, so even if language is not chinese, these symbols must still
be there

these symbol names aren't used so this is fine
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa bf6de9f342 Move GetLanguagePrefix function into i18n 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 5d19c1fe25 make conditional CHINESE preprocessor def into global constant 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4624fe92f0 leave CHINESE struct member UINT8 Width[0x80]
this might cause a horrifying alignment bug, but I doubt it
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 3acd2cea97 move Ja 2 Libs.* to i18n
it has preprocessor silliness in it
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4d4e039da7 add an internationalization constant
gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single
library, so to restrict the number of targets that need to be built 8x

this still has UB/EDITOR definitions so that still needs to be dealt
with before we can build it only 8 times
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costaandmajcosta dd5cabc6ba actually make link-time optimization default to OFF
sorry, I lied in the last commit. didn't mean to
2024-12-29 07:29:13 -03:00
Marco Antonio J. Costaandmajcosta a83dfbefb0 add option to enable link time optimization
a bit slower to compile for developing so defaults to 'false', but
might be a good idea for the releases.
2024-12-27 18:17:20 -03:00
Marco Antonio J. Costaandmajcosta dc72a43a19 silence narrowing conversions in MSVC
we all know they're there, whenever someone fixes it (lol), this
should be removed
2024-12-27 03:08:36 -03:00
Marco Antonio J. Costaandmajcosta 897f684705 remove all #include's for Language Defines
scripted diff:

find . -type f -iname "*.h" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \;
find . -type f -iname "*.cpp" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \;
2024-12-27 02:35:29 -03:00
Marco Antonio J. Costaandmajcosta 0993789430 remove Language Defines file
we don't do it like that anymore, the build system takes care of it
2024-12-27 02:35:29 -03:00
Marco Antonio J. Costaandmajcosta 6b9997b9c5 we don't use USE_CODE_PAGE anymore 2024-12-26 11:51:31 -03:00
Marco Antonio Jaguaribe Costaandmajcosta f4f48f23c7 cmake: favor vertical layout and absolute paths for include_directories
just the way git works should tilt us towards tall code rather than very
long lines, easier for merging/conflicts
2024-12-24 08:28:02 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 184b44c386 a couple consistency extension changes
iniErrorReport is a log file, all other log files have .log extension, so make it
consistent with that

make Ja2_settings.ini's extension lowercase. OCD, sorry.
2024-12-15 15:25:28 -03:00
Marco Antonio J. Costaandmajcosta 86ad401186 add newline at end of file where it's lacking
.editorconfig already enforces it but it's getting changed piecemeal in
every commit. just get it done with.

the script:
```

find . -type f -not -path "./.git/*" -not -path "./.vs/*" | while read -r file; do
	isFile=$(file -0 "$file" | cut -d $'\0' -f2)
	case "$isFile" in
		(*text*)
			echo "$file is text"
			if [[ $(tail -c 1 "$file" | wc -l) -ne 1 ]]; then
				echo "" >> "$file"
			fi
			;;
		(*)
			echo "file isn't text"
			;;
	esac
done
```
2024-12-14 19:05:48 -03:00
Marco Antonio J. Costaandmajcosta 1d58bda82d cross-compilation scaffolding WIP
requires clang/lld or mingw, obviously

just make sure the MSVC_DIRECTORY env variable points to valid Visual Studio Build Tools directory
and do: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=clang_or_mingw_toolchain_file`
2024-12-13 19:24:59 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 98cdffe5fd (actually) fix broken MS2022 behavior
a recent Visual Studio update introduced an error unless there is a
CMakePresets.json file present, completely blowing up the previous
setup.

after this commit, you should either delete the CMakeUserPresets.json
file from your root or add it to your system - NOT repo! - excludesFile:
https://stackoverflow.com/questions/7335420/global-git-ignore
2024-12-09 14:19:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 2424066aab Revert "fix broken MS2022 behavior"
This reverts commit b89c63058f.
2024-12-09 13:45:08 -03:00
Marco Antonio Jaguaribe Costaandmajcosta b89c63058f fix broken MS2022 behavior
a recent Visual Studio update introduced an error unless there is a
CMakePresets.json file present, this patches it over for now and makes
note to remove it once this is fixed
2024-12-09 13:38:40 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 0b21d1d798 add a TODO file
put your TODOs here so you won't forget, or in case you do, maybe
someone can pick it up in the decades to come
2024-12-09 12:58:43 -03:00
Marco Costaandmajcosta dee2415d4a simplify SOLDIERTYPE::GetDiseaseContactProtection( ) 2024-04-03 22:09:05 -03:00
Marco Costaandmajcosta 049ec47219 make OBJECTTYPE::Exists() const 2024-04-03 22:09:05 -03:00
Marco Costaandmajcosta d670383f3a add const accessor to Inventory 2024-04-03 22:09:05 -03:00
Marco Antonio Jaguaribe Costaandmajcosta f11393728c Unbreak Github Actions
our CI expects GameVersion.cpp to be at the root directory. just unbreak
for now.
2023-10-23 19:28:23 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 5d3118ea75 pluck multiplayer into its own lib 2023-10-23 10:36:35 -03:00
Marco Antonio Jaguaribe Costaandmajcosta eca4086d30 inherit minimum cmake version from ja2
all this does is silence the warning that cmake 2.6 is deprecated, we're
never building bfVFS standalone anyway
2023-10-07 09:21:11 -03:00
Marco Antonio Jaguaribe Costaandmajcosta b68f206969 remove annoying warning on MSVC 19.37.32822
`register` keyword does exactly nothing:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5033?view=msvc-170
2023-10-07 09:13:55 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 764d2f9389 remove int AStarPathFinder::CalcG(int*) function
not being called by anyone at the moment
2023-06-03 22:01:38 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 760f8ab3d7 Remove all MSBuild files
now that CI is using cmake, we can be clean up the tree quite a bit

btw, cmake can still configure for the msbuild generator for those so inclined:

create the folder, cmd to it, run `cmake [project_root_dir] -G"Visual Studio 17 2022" -A Win32 -DLanguages=ENGLISH -DApplications=JA2` once, then open the solution file using Visual Studio 2022
2023-05-08 06:44:35 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 18417ce45a Get CMake's MSBuild generator to work correctly
- MSBuild has safe exception handlers (safeseh) enabled by default, which
some of our libraries don't support

- also needs legacy_stdio_definitions.lib to be linked
2023-05-07 07:23:07 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 74f4979296 A few nits
create empty CMakeUserPresets.json file so build happens on first run
comment doesn't apply anymore
no need to specify the compiler when using msbuild@xxx
ask ninja for the verbose command line when building
2023-04-22 04:31:37 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 3173b73ba0 don't build ja2 export tool by default
most users don't need this, better if whoever needs it just set
BUILD_JA2EXPORT=ON on their end
2023-04-22 01:40:11 -03:00
Marco Antonio Jaguaribe Costaandmajcosta aa3e10cd29 missing NO_ZLIB_COMPRESSION compile definition for SGP
forgot about that one
2023-02-01 10:02:46 -03:00
Marco Antonio Jaguaribe Costaandmajcosta f8f8461a65 replace header preprocessor conditional with cpp function 2023-01-30 09:25:01 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 30fe4bd33b better name for the app/lang dependent shared lib targets 2023-01-27 20:51:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta dc5eaf7b67 better name for the executable target 2023-01-27 20:51:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 7bbe68e6dd improve the comments on root CMakeLists.txt file 2023-01-27 20:51:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 319a0ca979 Extract Debug definitions to some syntactic sugar
this will be used in more targets in the future, this will avoid
repetition
2023-01-27 20:51:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 06f7827d4a There's no need to make a copy of this list, really 2023-01-27 20:51:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 0ee2cfe010 Add Ja2Export target and get it to build on C++17
nice little tool
2023-01-26 19:09:05 -03:00
Marco Antonio Jaguaribe CostaandAsdow d4abc82488 Address review feedback 2023-01-19 00:13:08 +02:00
Marco Antonio Jaguaribe CostaandAsdow 8b1c4effa0 nuke all the #if 0's
scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
2023-01-19 00:13:08 +02:00
Marco Antonio Jaguaribe Costa 1312b4dcbe Make cmake build and preset work the version bundled with VS2019 2023-01-15 18:59:57 -03:00
Marco Antonio Jaguaribe Costa 8609944467 Add a CMake build
Tried to stay as close as possible to ja2_2019.sln

On Visual Studio 2022 just Project -> CMake Settings for Ja2, add
the x86 configurations you want and press F7.

Below shows how the -DLanguages -DApplications switches work, If you don't
set them, the CMakeCache.txt of them will be set to ENGLISH and JA2,
respectively:

cmake [...] // nothing set, configure just JA2_ENGLISH.exe by default
cmake [...] -DApplications="JA2UB" // configures just Unfinished Business
cmake [...] build -DApplications="JA2UB;JA2UBMAPEDITOR" // Unfinished Business and UB Map Editor
cmake [...] build -DApplications="JA2UB;JA2MAPEDITOR;ALL" // ALL is in the list, configures every application
cmake [...] build -DApplications="JA2MAPEDITOR;DeathStranding" // fatal error: DeathStranding not an application

cmake [...] -DLanguages="GERMAN" // configures just German targets
cmake [...] build -DLanguages="GERMAN;ENGLISH" // German and English
cmake [...] build -DLanguages="GERMAN;ENGLISH;ALL" // ALL is in the list, configures every language
cmake [...] build -DLanguages="ENGLISH;ESPERANTO" // fatal error: ESPERANTO not supported
2023-01-14 02:08:39 -03:00