Fixed Bug #6443: Can't Load Selections from Save Game

This commit is contained in:
mr-russ 2003-11-09 21:19:12 +00:00
parent a36df20636
commit 3d356fb62a
2 changed files with 5 additions and 9 deletions

View file

@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
<li>Fixed Bug #6443: Can't Load Selections from Save Game (from Russell Smith).
<li>Fixed Bug #6301: Fog of War problem after using Holy Vision (from Russell Smith).
<li>Fixed Bug #6306: DebugCheck at src/clone/unit_draw.c:895 (from Russell Smith).
<li>Allow selection of more than 9 units (from Nehal Mistry).

View file

@ -962,14 +962,8 @@ global int AddSelectedAirUnitsInRectangle(int sx0, int sy0, int sx1, int sy1)
*/
global void InitSelections(void)
{
int i;
Selected = malloc(MaxSelectable * sizeof(Unit*));
if ((i = NumSelected)) { // Cleanup after load
while (i--) {
Selected[i] = UnitSlots[(int)Selected[i]];
}
if (!Selected) {
Selected = malloc(MaxSelectable * sizeof(Unit*));
}
}
@ -1036,13 +1030,14 @@ local SCM CclSelection(SCM num, SCM units)
{
int i;
InitSelections();
NumSelected = gh_scm2int(num);
i = 0;
while (!gh_null_p(units)) {
char* str;
str = gh_scm2newstr(gh_car(units), NULL);
Selected[i++] = (Unit*)strtol(str + 1, NULL, 16);
Selected[i++] = UnitSlots[strtol(str + 1, NULL, 16)];
free(str);
units = gh_cdr(units);
}