void Limbo(char plr) { int i, AstroList[100], BarA, count, now2, tag = 0; memset(AstroList, -1, sizeof AstroList); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; }; DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } FadeIn(2, 10, 0, 0); while (1) { key = 0; WaitForMouseUp(); key = 0; GetMouse(); //Mouse ManSelect from being Clicked on for (i = 0; i < 8; i++) { if (x >= 27 && y >= (131 + i * 8) && x <= 151 && y <= (137 + i * 8) && mousebuttons > 0 && (now2 - BarA + i) <= (count - 1)) { now2 -= BarA; now2 += i; BarA = i; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); WaitForMouseUp(); } } // Left Arrow Up if ((mousebuttons > 0 && x >= 6 && y >= 130 && x <= 18 && y <= 161 && count > 0) || key == UP_ARROW) { InBox(6, 130, 18, 161); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 0 && now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; i = 51; } } while (mousebuttons == 1 || key == UP_ARROW) { delay(100); if (BarA == 0 && now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; key = 0; GetMouse(); } //WaitForMouseUp();key=0; OutBox(6, 130, 18, 161); delay(10); }; // Left Arrow Down if ((mousebuttons > 0 && x >= 6 && y >= 163 && x <= 18 && y <= 194 && count > 0) || key == DN_ARROW) { InBox(6, 163, 18, 194); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 7 && (now2 < count - 1)) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA < 7 && now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; i = 51; } } while (mousebuttons == 1 || key == DN_ARROW) { delay(100); if (BarA == 7 && (now2 < count - 1)) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; if (BarA < 7 && now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); LimboText(plr, AstroList[now2]); }; key = 0; GetMouse(); } //key=0;WaitForMouseUp();key=0; OutBox(6, 163, 18, 194); delay(10); }; // Continue if ((mousebuttons > 0 && x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) { InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); music_stop(); return; } // Select Transfer Button if ((mousebuttons > 0 && x >= 167 && y >= 48 && x <= 239 && y <= 65) || key == LT_ARROW) { tag = 0; InBox(167, 48, 239, 65); OutBox(241, 48, 313, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(185, 85, "TRANSFER TO LOCATION"); } // Select Visit To Button if ((mousebuttons > 0 && x >= 241 && y >= 48 && x <= 313 && y <= 65) || key == RT_ARROW) { tag = 1; InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); } // Selection Loops for (i = 0; i < 5; i++) { // Program Transfer if ((tag == 0 && Data->P[plr].Manned[i].Num >= 0) && ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i)) || key == 0x0030 + i)) { InBox(167, 95 + 21 * i, 236, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(167, 95 + 21 * i, 236, 109 + 21 * i); Data->P[plr].Pool[AstroList[now2]].Assign = i + 1; Data->P[plr].Pool[AstroList[now2]].Unassigned = 0; Data->P[plr].Pool[AstroList[now2]].Moved = 0; for (i = now2; i < count; i++) { AstroList[i] = AstroList[i + 1]; } AstroList[i] = -1; count--; if (count == 0) { fill_rectangle(10, 52, 89, 101, 7 + plr * 3); Clear(); } if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } }; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } } // Program Visit if ((tag == 1 && Data->P[plr].Manned[i].Num >= 0) && ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i)) || key == 0x0030 + i)) { InBox(167, 95 + 21 * i, 236, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(167, 95 + 21 * i, 236, 109 + 21 * i); music_stop(); Programs(plr, i + 1); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); fill_rectangle(26, 129, 153, 195, 0); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; } DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } // ShBox(26,130+BarA*8,152,138+BarA*8); // DispLeft(plr,BarA,count,now2,&AstroList[0]); // LimboText(plr,AstroList[now2]); FadeIn(2, 10, 0, 0); } // Training Transfer if ((tag == 0 && count > 0) && ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) { InBox(244, 95 + 21 * i, 313, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); skilLev = 0; // Figure out relevant skill level bfr sending to Adv Training -Leon if (i == 0) { skilLev = Data->P[plr].Pool[AstroList[now2]].Cap; } if (i == 1) { skilLev = Data->P[plr].Pool[AstroList[now2]].LM; } if (i == 2) { skilLev = Data->P[plr].Pool[AstroList[now2]].EVA; } if (i == 3) { skilLev = Data->P[plr].Pool[AstroList[now2]].Docking; } if (i == 4) { skilLev = Data->P[plr].Pool[AstroList[now2]].Endurance; } display::graphics.setForegroundColor(2); if (Data->P[plr].Pool[AstroList[now2]].TrainingLevel > 6) { Help("i120"); } else if (skilLev > 3) { OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); // If they have a 4 in that skill, don't send to Adv Training for it } else if (Data->P[plr].Cash < 3) { Help("i121"); } else { if (skilLev > 2) { // If they have a 3 in that skill, send them directly to Adv III and charge just 2MB Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_3; Data->P[plr].Cash -= 2; } else { Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_1; Data->P[plr].Cash -= 3; } Data->P[plr].Pool[AstroList[now2]].Focus = i + 1; Data->P[plr].Pool[AstroList[now2]].Assign = 0; Data->P[plr].Pool[AstroList[now2]].Unassigned = 0; Data->P[plr].Pool[AstroList[now2]].Moved = 0; for (i = now2; i < count; i++) { AstroList[i] = AstroList[i + 1]; } AstroList[i] = -1; count--; if (count == 0) { fill_rectangle(10, 52, 89, 101, 7 + plr * 3); Clear(); } if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } }; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } } // else } // if adv training // Training Visit if (tag == 1 && ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) { InBox(244, 95 + 21 * i, 313, 109 + 21 * i); if (key > 0) { delay(140); } WaitForMouseUp(); key = 0; OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); music_stop(); Train(plr, i + 1); DrawLimbo(plr); music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY); fill_rectangle(166, 78, 314, 88, 10); display::graphics.setForegroundColor(11); draw_string(203, 85, "VISIT LOCATION"); InBox(241, 48, 313, 65); OutBox(167, 48, 239, 65); fill_rectangle(26, 129, 153, 195, 0); now2 = BarA = count = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0) { AstroList[count++] = i; } DispLeft(plr, BarA, count, now2, &AstroList[0]); if (count > 0) { LimboText(plr, AstroList[now2]); } FadeIn(2, 10, 0, 0); } } }; /* end while */ } /* end Limbo */
/** * The main capsule building interface. * * Programs refers to the Manned capsule programs, specifically the * ones where astronauts may be assigned. This has the main control * loop for the capsule building user interface. * * \param plr the country running the program * \param prog the capsule style */ void Programs(char plr, char prog) { int i, max, chk, tst; int now2 = 0, count = 0, grp = 0, BarA = 0; int M[100], CrewCount[8]; char ksel = 0; helpText = "i036"; keyHelpText = "k036"; for (i = 0; i < 100; i++) { M[i] = -1; } if (prog > 4) { max = 4; } else if (prog == 4) { max = 3; } else { max = prog; } music_start(M_PRGMTRG); DrawProgs(plr, prog); Flts(0, 0); for (i = 0; i < ASTRONAUT_CREW_MAX; i++) { CrewCount[i] = Data->P[plr].CrewCount[prog][i]; if (CrewCount[i] == 0) { FltsTxt(i, 8); } if (CrewCount[i] < max && CrewCount[i] != 0) { FltsTxt(i, 9); } if (CrewCount[i] == max) { FltsTxt(i, 1); } } for (i = 0; i < Data->P[plr].AstroCount; i++) { if (Data->P[plr].Pool[i].Assign == prog && Data->P[plr].Pool[i].Crew == 0) { M[count++] = i; } } ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); FadeIn(2, 10, 0, 0); chk = CheckProgram(plr, prog); if (chk == 0) { if (plr == 0) { Help("i113"); } else { Help("i114"); } music_stop(); return; } WaitForMouseUp(); while (1) { key = 0; GetMouse(); for (i = 0; i < 8; i++) { // Right Select Box if (x >= 27 && y >= (131 + i * 8) && x <= 151 && y <= (137 + i * 8) && mousebuttons > 0 && (now2 - BarA + i) <= (count - 1)) { // Left now2 -= BarA; now2 += i; BarA = i; fill_rectangle(26, 129, 153, 195, 0); DispLeft(plr, BarA, count, now2, &M[0]); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); BarSkill(plr, BarA, now2, &M[0]); WaitForMouseUp(); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } } if (mousebuttons > 0 || key > 0) { /* Gameplay */ if (((x >= 6 && y >= 130 && x <= 18 && y <= 161 && mousebuttons > 0) || key == UP_ARROW) && count > 0) { /* Lft Up */ InBox(6, 130, 18, 161); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 0) if (now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } i = 51; } } while (mousebuttons == 1 || key == UP_ARROW) { delay(100); if (BarA == 0) if (now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } key = 0; GetMouse(); } OutBox(6, 130, 18, 161); delay(10); } else if (((x >= 6 && y >= 163 && x <= 18 && y <= 194 && mousebuttons > 0) || key == DN_ARROW) && count > 0) { /* Lft Dwn */ InBox(6, 163, 18, 194); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 7) if (now2 < count - 1) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA < 7) if (now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } i = 51; } } while (mousebuttons == 1 || key == DN_ARROW) { delay(100); if (BarA == 7) if (now2 < count - 1) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA < 7) if (now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } key = 0; GetMouse(); } //WaitForMouseUp(); OutBox(6, 163, 18, 194); } else if (key == K_HOME) { fill_rectangle(26, 129, 153, 195, 0); BarA = 0; now2 = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } else if (key == K_END) { fill_rectangle(26, 129, 153, 195, 0); BarA = MIN(count - 1, 7); now2 = count - 1; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } else if (key == 'S') { // Show Skill ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); BarSkill(plr, BarA, now2, &M[0]); } else if (((x >= 4 && y >= 86 && x <= 12 && y <= 92 && mousebuttons > 0) || key == '1') && CrewCount[grp] >= 1) { /* Display Man 1 */ InBox(4, 86, 12, 92); AstLevel(plr, prog, grp, 0); OutBox(4, 86, 12, 92); } else if (((x >= 4 && y >= 95 && x <= 12 && y <= 101 && mousebuttons > 0) || key == '2') && prog >= 2 && CrewCount[grp] >= 2) { /* Display Man 2 */ InBox(4, 95, 12, 101); AstLevel(plr, prog, grp, 1); OutBox(4, 95, 12, 101); } else if (((x >= 4 && y >= 104 && x <= 12 && y <= 110 && mousebuttons > 0) || key == '3') && prog >= 3 && CrewCount[grp] >= 3) { /* Display Man 3 */ InBox(4, 104, 12, 110); AstLevel(plr, prog, grp, 2); OutBox(4, 104, 12, 110); } else if (((x >= 4 && y >= 113 && x <= 12 && y <= 119 && mousebuttons > 0) || key == '4') && prog >= 5 && CrewCount[grp] >= 4) { /* Display Man 4 */ InBox(4, 113, 12, 119); AstLevel(plr, prog, grp, 3); OutBox(4, 113, 12, 119); } else if (key == 'C') { ClearIt(); ksel = grp; //save old flt crew if (grp == 7) { grp = 0; } else { ++grp; } Flts(ksel, grp); NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); if (key > 0) { delay(150); } } else if (x >= 164 && y >= 139 && x <= 238 && y <= 151 && mousebuttons > 0) { /* Flt Crew I */ ClearIt(); Flts(grp, 0); grp = 0; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 154 && x <= 238 && y <= 166 && mousebuttons > 0) { /* Flt Crew II */ ClearIt(); Flts(grp, 1); grp = 1; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 169 && x <= 238 && y <= 181 && mousebuttons > 0) { /* Flt Crew III */ ClearIt(); Flts(grp, 2); grp = 2; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 184 && x <= 238 && y <= 196 && mousebuttons > 0) { /* Flt Crew IV */ ClearIt(); Flts(grp, 3); grp = 3; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 139 && x <= 315 && y <= 151 && mousebuttons > 0) { /* Flt Crew V */ ClearIt(); Flts(grp, 4); grp = 4; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 154 && x <= 315 && y <= 166 && mousebuttons > 0) { /* Flt Crew VI */ ClearIt(); Flts(grp, 5); grp = 5; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 169 && x <= 315 && y <= 181 && mousebuttons > 0) { /* Flt Crew VII */ ClearIt(); Flts(grp, 6); grp = 6; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 184 && x <= 315 && y <= 196 && mousebuttons > 0) { /* Flt Crew VIII */ ClearIt(); Flts(grp, 7); grp = 7; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (((x >= 245 && y >= 88 && x <= 314 && y <= 100 && mousebuttons > 0) || key == 'A') && CrewCount[grp] < max) { /* Assign 'Naut */ if (Data->P[plr].Crew[prog][grp][CrewCount[grp]] == 0 && count > 0) { InBox(245, 88, 314, 100); Data->P[plr].Crew[prog][grp][CrewCount[grp]] = M[now2] + 1; AstNames(CrewCount[grp], &Data->P[plr].Pool[M[now2]].Name[0], Data->P[plr].Pool[M[now2]].Mood); Data->P[plr].Pool[M[now2]].Crew = grp + 1; Data->P[plr].Pool[M[now2]].Task = CrewCount[grp]; Data->P[plr].Pool[M[now2]].Unassigned = 1; for (i = now2; i < count; i++) { M[i] = M[i + 1]; } M[i] = -1; count--; if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } } fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); CrewCount[grp]++; Data->P[plr].CrewCount[prog][grp] = CrewCount[grp]; if (CrewCount[grp] == max) { FltsTxt(grp, 1); } else { FltsTxt(grp, 9); } NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 88, 314, 100); } /* End outer if */ } else if ((x >= 245 && y >= 106 && x <= 314 && y <= 118 && mousebuttons > 0) || key == 'B') { /* Break Group */ tst = Data->P[plr].Crew[prog][grp][0] - 1; /* If the crew is assigned to a mission, create an alert * that it cannot be broken while the mission is planned. */ if (Data->P[plr].Pool[tst].Prime > 0) { OutBox(245, 106, 314, 118); /* Copy the screen area into a buffer before drawing * the dialog so it can be repainted after the dialog * is dismissed */ display::LegacySurface buffer(170, 131); buffer.copyFrom(display::graphics.legacyScreen(), 75, 43, 244, 173); /* Draw the alert message */ ShBox(75, 43, 244, 173); IOBox(81, 152, 238, 167); InBox(81, 70, 238, 113); fill_rectangle(82, 71, 237, 112, 7 + 3 * plr); display::graphics.setForegroundColor(1); draw_heading(118, 50, "PROBLEM", 0, -1); draw_string(136, 162, "CONTINUE"); display::graphics.setForegroundColor(11); draw_string(88, 80, "FLIGHT CREW "); draw_number(0, 0, grp + 1); draw_string(0, 0, " IS ALREADY"); draw_string(88, 88, "ASSIGNED TO THE "); if (Data->P[plr].Pool[tst].Prime == 4 || Data->P[plr].Pool[tst].Prime == 3) { draw_string(0, 0, "PRIMARY"); } else { draw_string(0, 0, "BACKUP"); } draw_string(88, 96, "CREW OF A CURRENT MISSION:"); draw_string(88, 104, "CANNOT BREAK THIS CREW."); WaitForMouseUp(); i = 1; while (i == 1) { key = 0; GetMouse(); if (mousebuttons > 0 || key > 0) { if ((x >= 83 && y >= 154 && x <= 236 && y <= 165 && mousebuttons != 0) || key == K_ENTER) { InBox(83, 154, 236, 165); WaitForMouseUp(); OutBox(83, 154, 236, 165); /* Closing the alert message. * Redraw the screen behind it from buffer */ buffer.copyTo(display::graphics.legacyScreen(), 75, 43); i = 2; } } } } else if (Data->P[plr].Crew[prog][grp][0] != 0) { InBox(245, 106, 314, 118); while (CrewCount[grp] > 0) { M[count] = Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] - 1; Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] = 0; Data->P[plr].Pool[M[count]].Crew = 0; Data->P[plr].Pool[M[count]].Moved = 0; Data->P[plr].Pool[M[now2]].Unassigned = 0; CrewCount[grp]--; count++; } ClearIt(); fill_rectangle(26, 129, 153, 195, 0); FltsTxt(grp, 8); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); for (i = 1; i < 5; i++) { DrawPosition(prog, i); } WaitForMouseUp(); OutBox(245, 106, 314, 118); } } else if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { /* Exit */ InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); delay(10); for (i = 0; i < 8; i++) { if (CrewCount[i] < max) while (CrewCount[i] > 0) { M[count] = Data->P[plr].Crew[prog][i][CrewCount[i] - 1] - 1; Data->P[plr].Crew[prog][i][CrewCount[i] - 1] = 0; Data->P[plr].Pool[M[count]].Crew = 0; Data->P[plr].CrewCount[prog][i] = 0; CrewCount[i]--; count++; } Data->P[plr].CrewCount[prog][i] = CrewCount[i]; } for (i = 0; i < count; i++) { Data->P[plr].Pool[M[i]].Assign = 0; } music_stop(); return; /* Done */ } } } }