After some quite hard testing on "No leaders after release" bug I will try to describe it as good as possible with my poor English (this would be funny if wasn’t sadly...for me :wacko: ) and to make some suggestions of its cause and possible fixes.
Known facts:
1. After annexation, save-reload, release the country gets all leaders even dormant for that scenario.
2. After annexation-release in same game session the country gets only the leaders which were inactive (KIA, dormant, slept by events in previous or in current game session, manually deleted from save-game file) at the moment of annexation.
3. After annexation the leaders are still left in used by the game memory. Easy to check:
- create an event with some sleepleader commands, which to sleep leaders of country to be annexed
- annex the country
- run that event – in the list of actions you can see which leaders would be slept (their names). If they are not in memory, this event wouldn’t start at all.
4.The game reads all leaders for that country from \Leaders folder (they can be in different .CSV files) and compares them with the list of currently active in-game to find-out which one to activate. This is probably left from non-working feature proposed to not revive already inactive leaders (very good idea, ruined by this bug). Sadly the game logic here is broken and only currently inactive leaders are revived.
Let’s put these facts together and think about used by the game logic:
Theory 1:
This active_leaders list is created for every active country at scenario start from files in \Leaders folder (all of them are parsed and leaders are found by their country ID - CHI, GER, USA...). Dormant leaders and leaders of non-existent (yet) countries are skipped/deleted by this process. Rest leaders are used in current game and are stored in save-game file. On game re-load ONLY the leaders stored in save-game file are used. When a new country is released the game compares ALL leaders for that new country (read from \Leaders folder at every HoI start or just game load - not sure yet) with currently active list (if any) and decides which one to be used. Then the game reads all default values (name. skill, traits etc) for every to be activated leader from the files in \Leaders folder and put him back in game.
The problem is somewhere in the comparison code.
It should look like this for releasing a country after annexation in current game session:
Code:
For All_leaders DO
IF leader_xx IS in (active_leaders list)
Then use_leader_xx
But in this case if we release a NEW country (not recently annexed), active_leaders list will be empty (this list is populated ONLY from leaders stored in save-game file or at scenario start!) and there will be no leaders for that country. May be because of that proto-bug they put a NOT operand and changed the code to this:
Code:
For All_leaders DO
IF leader_xx IS NOT in (active_leaders list)
Then use_leader_xx
This solves the problem if we release a new (for current game session) country, but brings us the well known bug - "No leaders after release".
There are at least 4 solutions to this:
1. Destroy (delete from memory) all leaders of just annexed country - in this case on release we will receive all leaders for that country from files in \Leaders folder. This is OK for game play and may be not so hard to do.
2. Skip comparasion part of the code and just activate all leaders:
Code:
For All_leaders DO use_leader_xx
3. Fix the code - remove that non-sense "NOT" operand and add a condition check is the active_leaders list for country to be released empty. Something like this:
Code:
For All_leaders DO
IF (active_leaders list) NOT EMPTY
THEN
IF leader_xx IS in (active_leaders list)
THEN use_leader_xx
END_IF
ELSE
use_leader_xx
END_IF
As a bonus another check for dormant leaders can be added in case of no active_leaders list:
Code:
For All_leaders DO
IF (active_leaders list) NOT EMPTY
THEN
IF leader_xx IS in (active_leaders list)
THEN use_leader_xx
END_IF
ELSE
IF leader_xx IS NOT in (dormant_leaders list)
THEN use_leader_xx
END_IF
END_IF
4. Ultimate solution (just a dream).

At scenario start create a list of all dormant leaders (even for not yet exist countries) and store it in save-game. Expand this list with all KIA and slept leaders during game play. On country release/creation use game logic like this:
Code:
For All_leaders DO
IF leader_xx IS NOT in ([B]inactive_leaders[/B] list)
THEN use_leader_xx
END_IF
***********************
This may be look quite simple in my supposed solutions (if I am right about the cause of the bug at first place) but the game code is very complex and bug like this is very hard to find and fix. That’s why I post here all my observations + some thoughts, to give PI Developers just another idea where to look for that bug if they decide to fix it.
For final I'll post another way I found during my tests to have (more) leaders on annex-release in the same game session:
1. Create a new leader file (a.csv) with only one CHI leader (ID 49999):
Code:
Name;ID;Country;Rank 3 Year;Rank 2 Year;Rank 1 Year;Rank 0 Year;Ideal Rank;Max Skill;Traits;Skill;Experience;Loyalty;Type;Picture;Start Year;End Year;x
TEST;49999;CHI;1930;1939;1941;1990;1;6;16;2;0;3;0;L50000;1930;1960;x
Don’t forget to add an empty line at the end of this file. Save this file to your Desktop.
2. Start HoI2
3. Start a new 1936 GC as Japan
4. Pause at start
5. Save the game
6. Go to Windows Explorer and copy our new file (a.csv) to Leaders\
7. Exit to HoI main menu (do not exit from the game) and reload that save-game as Japan
8. Open console (<F12>)
9. Type in “ event 3815 ”
10. Select option_a (Puppet China)
11. Save the game again
12. Exit to main menu and load that last save as Nat. China
13. Check Chinese leaders – nearly all of them are active. The 2 dormant aren’t.
EDIT:
Theory 2:
My first theory has one big weakness - I assume that there is a check which leaders to activate, based on their availabillity in the current game. Even if this was true for the first versions of HoI2 they for sure removed this feature when this bug was found (may be even during internal beta-testing before release of HoI2) to make the code more simple and easy for traking-down the bug.
When a country is annexed its leaders remain in game memory -may be in the list of all avilable leaders. I do not know are they changed at all during annexation (like a setting of a not_active_leader flag or delete of contry ID - CHI, GER, ITA...). What I know for sure is that after annexation they are still in memory and can be added to another country with
add_corps command within the current game session.
I can sleep them too, but in this case slept leaders wouldn't be revived on release (if I sleep them before annexation they will be available after release), so there is difference in their record in game memory or sleepleader command gives strange results when sleeping a leader from inexistent country.
If we save the game after annexation all leaders of annexed country will be lost, because leaders are saved separately for every active country.
Let's sumarize these facts again:
1. On annexation leaders are not deleted from game memory, but there is some change in their record in that list (may be removed country identity?)
2. Leaders can be moved from one country to another (with add_corps command) and they are not deleted when their country of orgin ceases to exist.
So is it possible to activate a leader for the just released country if he is still in game memory? I don't think so. There is a check by leaders ID for every leader if this leader is currently in game and if he is, the code skips him. May be there is no check at all but anyway the game code skips active leaders. This is OK - we already have them, but why they are not available to us? I guess because their country ID is deleted from their record during annexation or because of a flag (do not use this leader) which isn't cleared on country recreation, so the game "didn't know" that these leaders belong to this new country.
Possible solutions:
1. Change flags (if any) so these leaders to be assigned to the "new" country after release. In this case they will keep all new traits, expirience and may be battle history gained so far in-game!
2. Clear all leaders assigned to annexed country after annexation from game memory - this will work as the proposed by Gormadoc work-around, but for every country and in every situation.