Commit Graph
4789 Commits
Author SHA1 Message Date
Marco Antonio J. Costaandmajcosta 00a805cc39 remove lying, outdated or superfluous comments
no more guards, no more cpp files included
2026-07-21 09:46:41 -03:00
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
steph-pgandAsdow ba64ed53c6 Items can now be taken from non colapsed POWs 2026-07-02 19:16:55 +03:00
Asdow c61f57bd9b Whitespace adjustment 2026-06-22 00:21:31 +03:00
Asdow 4d5593ebcb Fix render misalignment at 960x540 resolution
Should also work for any custom resolution that suffers from the same issue
2026-06-22 00:21:31 +03:00
Asdow 601fabf401 Fix tile rendering misalignment at 1440x900 and 1600x900 resolutions
Shamelessly stolen from Stracciatella code
2026-06-22 00:21:31 +03:00
steph-pgandAsdow eb8ecb31f0 fix POWs in LOS keeps you in turnbased mode 2026-06-20 20:03:16 +03:00
Asdow 2801af552e Set moved item old entry to not existing 2026-06-20 17:11:37 +03:00
Asdow ef30192b29 Leave merc equipment to current sector in UB 2026-06-20 08:49:56 +03:00
Asdow 392ba66df3 Enable dismissing mercs in UB before game start
Jerry Melo complains about too many mercs if player has hired over 6 mercs and refuses to fly. This allows player to dismiss mercs until the pilot is happy.
2026-06-20 08:49:56 +03:00
Asdow d4dd5f07df Disable contract renewal in UB 2026-06-20 08:49:56 +03:00
db29feed11 Don't strip robot's installed components on mapscreen drop-all
The mapscreen "drop everything" hotkey (Shift+W) looped over every
inventory slot from HELMETPOS to NUM_INV_SLOTS and dumped each one.
Madlab's robot stores its installed gear in those same slots - ammo (14),
targeting (15), chassis/armour (16) and utility (17). Dropping these left
the robot defenceless, and the player cannot re-install the components
through normal inventory, so the loss was permanent.

Skip the robot's component slots in the drop loop; only its general cargo
slot (ROBOT_INVENTORY_SLOT) may still be emptied. Regular mercs are
unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 23:06:33 +03:00
Asdow 1fc5f939bf Use new RandomGridNoUnloadedSector() for autoresolve
* Load required mapinfo for checking suitable gridnos
* Modify SOLDIERTYPE::DropSectorEquipment( ) to take an external gridno when placing items into an unloaded sector
2026-06-15 22:01:07 +03:00
Asdow 9e0105caec Add function for choosing random gridno in an unloaded sector 2026-06-15 22:01:07 +03:00
Asdow 0cc7fb4e39 Add function for loading world height data 2026-06-15 22:01:07 +03:00
Asdow db15679ec1 Add missing Iter->Exists() checks 2026-06-12 15:52:24 +03:00
Asdow 6a8a22aba2 Move iter->exists() check to first 2026-06-12 15:52:24 +03:00
Asdow 9b654ff3f1 Fix typo 2026-06-12 15:51:03 +03:00
Asdow a67f4b8a8f Formatting 2026-06-12 15:51:03 +03:00
Asdow 673dea01af Use correct sector for Chitzena 2026-06-12 15:51:03 +03:00
Marco Antonio J. Costaandmajcosta b44b6cebb8 Revert PR544
"Corpses are not properly shown even if within mercs' vision due to the check only
running intermittently since we're not constantly running the reveal roofs and items
function. In addition, mercs such as Raven who have the quoteexpheadshotonly set to true,
will NEVER reveal any corpses"

Revert "Remove extra line"

This reverts commit 1e1eb88864.

Revert "Move visibility check after already included pCorpse check"

This reverts commit 72e586a378.

Revert "Make 3rd party corpses invisible till they in fov"

This reverts commit 07dbf9c848.
2026-06-02 19:17:31 -03:00
Asdow 8bc3dbd0aa Prevent RebelCommand::DailyUpdate() from running twice when loading autosave 2026-06-02 23:59:30 +03:00
Marco Antonio J. Costaandmajcosta b4176bb2d9 Fix/drag unconscious softlock
Same logic but cleaned up version of https://github.com/1dot13/source/pull/602 which Tais contributed with Claude Code's help

Most calls to SOLDIERTYPE::IsDragging() aren't supposed to have a side effect of cancelling a drag, being simple queries.
Changing the default to reflect that is right move.

Assisted-by: Claude:
2026-06-01 21:45:55 -03:00
Asdow 8b3e417872 Guard against illegal array access
Hovering mouse over an option long enough that the popup text appears and scrolling to last page with mouse wheel would run into assertion error in gprintfdirty()  Assert(pFontString!=NULL); if the option was one of the last ones that didn't have a text box in the last option page.
2026-05-28 17:44:21 +03:00
AsdowandClaude Opus 4.7 b949189881 Fix palette resolution
The LayerProp palette lookup was gated on the *filter* attribute instead
of the *palette* attribute -- the filter checks from the line above were
copy-pasted verbatim. As a result, any LayerProp with an empty filter but
a real palette never resolved its palette table: paletteTable stayed NULL
and the layer fell back to the merc's shade table.

The most visible victim is the heli fast-rope arrival layer
(filter="" palette="hats"): rendered with the merc palette, the rope's
pixel indices (45-81, 166-172) hit the merc's unreplaced orange/red glow
ramp instead of the rope's own tan/green, painting orange specks along the
rope. Testing the palette attribute restores the intended "hats" palette
and the correct rope colours; it also fixes any other empty-filter layers.

Co-Authored-By: Claude Opus 4.7
2026-05-28 16:33:48 +03:00
JuqiandAsdow cc19490898 update Chinese translations 2026-05-25 08:37:30 +03:00
GreysaandAsdow 9fac0a8ecd Tidy up code 2026-05-23 21:22:28 +03:00
GreysaandAsdow 346e5c6293 fix for issue #580 2026-05-23 21:22:28 +03:00
GreysaandAsdow 0bea84374e fixed some screenmsg strings not changed 2026-05-23 21:22:28 +03:00
GreysaandAsdow 3d589bd78e A little code cleanup and moved debug reload to shift + alt + r 2026-05-23 21:22:28 +03:00
GreysaandAsdow e1c8bee1d1 Message strings added to language files. 2026-05-23 21:22:28 +03:00
GreysaandAsdow ead2932316 Added dual wielding unjamming, tidied up reload and unjam code a little 2026-05-23 21:22:28 +03:00
GreysaandAsdow bb55299ff6 Basic implementaion of unjamming on reload hotkey.
TODO:
text strings
check dual wielding
2026-05-23 21:22:28 +03:00
JuqiandAsdow 2d4f62a5b6 Correct two errors in the Chinese translation 2026-05-13 16:02:28 +03:00
Asdow 03a7b017b6 Change mouse cursor if attachment attempt fails 2026-05-06 23:23:07 +03:00
Asdow edf8f2f086 Fix crash when failing an attachment via item desc popup callback 2026-05-06 23:23:07 +03:00
Asdow 78ed49c73d Remove corpse structure from world when removing corpse
Fixes not being able to take all corpses from one tile, if multiple corpses were stacked on top of each other. With the structure not deleted, the  GetCorpseAtGridNo would not find an existing corpse anymore.
2026-05-06 11:28:11 +03:00
Asdow 5697acabb3 Take most recent corpse from tile
Fixes crash when taking a corpse on roof when multiple corpses are stacked on one tile.
2026-05-06 11:28:11 +03:00
Asdow 09197e421c Add a function for finding last matching structure 2026-05-06 11:28:11 +03:00
JuqiandAsdow 46afd90fdc Add Chinese translation 2026-05-04 12:10:10 +03:00
JuqiandAsdow 80ba0a05d7 Revert "Add Chinese translation"
This reverts commit e7d436d9fa.
2026-05-04 12:10:10 +03:00
JuqiandAsdow aab34bff20 Add Chinese translation 2026-05-04 12:10:10 +03:00
JuqiandAsdow ef325c1cde (Chinese) Add support for line breaks in ITEMS.XML
Added detection of the NEWLINE_CHAR character "±" to enable line breaks not only when text exceeds display width, but also upon encountering NEWLINE_CHAR.
Note: This character has been conventionally adopted in the Chinese community as a line break marker within XML item descriptions. The modification affects Chinese text display only.
2026-05-02 09:39:03 +03:00
Asdow 99a4ff1527 Guard against invalid value 2026-05-02 09:31:09 +03:00
Marco Antonio J. Costaandmajcosta f2d1b09fc6 add comment to CMakeLists.txt
save people a trip to learn.microsoft.com
2026-04-08 15:25:48 -03:00
Marco Antonio J. CostaandAsdow 31970291bd make preprocessor definitions consistent in every single lib
SGP did not seem to make any use of compilationFlags or debugFlags when
translating from msbuild to cmake, but there could be a thrice removed
transitive include I've missed.

there's a small probability this fixes some obscure UB or one-definition rule
violation that's causing the mystery crashes people have reported
2026-04-08 21:06:34 +03:00
GreysaandGitHub 0a758179c2 Advanced repairs skill check (#581)
* Add technician level skill check for advanced repair

* changed readability
2026-03-17 10:35:29 +01:00
noooooo4499andAsdow 481e95d42d Avoid breaking compatibility with gamedirs with old HourlyUpdate scripts
They are mapped to the right variable now
2026-02-25 10:47:47 +02:00
Asdow 8f178a59ab Add filename to error text for pngloader 2026-02-23 18:23:08 +02:00
Asdow a6d96f5f31 Remove compiler warnings 2026-02-21 21:00:38 +02:00