void InitAI8 () { int i,j; TBase *Base; TAirport *Airport; TField *f; TUnit *u; TPoint p; AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 0; MoneyBadlife = 10000; MBPlaces = NULL; DeniedPlaces = NULL; Docks1 = GetField (D1X, D1Y) -> Unit; Docks2 = GetField (D2X, D2Y) -> Unit; Factory1 = GetField (F1X, F1Y) -> Unit; Factory2 = GetField (F2X, F2Y) -> Unit; Factory3 = GetField (F3X, F3Y) -> Unit; Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } LockDraw (); Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> SetRadar (-1, -1); Army1 -> InsertUnits (); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (-1, -1); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (-1, -1); Army3 -> InsertUnits (); AirArmy3 = new TAirArmy(); AirArmy3 -> SetAR (AA3X1, AA3Y1, AA3X2, AA3Y2); AirArmy3 -> SetRadar (-1, -1); AirArmy3 -> InsertUnits (); AirArmy3 -> Status = asActive; Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (-1, -1); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (-1, -1); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (-1, -1); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> SetRadar (-1, -1); Army7 -> InsertUnits (); Army8 = new TGroundArmy(); Army8 -> SetAR (A8X1, A8Y1, A8X2, A8Y2); Army8 -> SetRadar (-1, -1); Army8 -> InsertUnits (); AirArmy8 = new TAirArmy(); AirArmy8 -> SetAR (AA8X1, AA8Y1, AA8X2, AA8Y2); AirArmy8 -> SetRadar (-1, -1); AirArmy8 -> InsertUnits (); AirArmy8 -> Status = asActive; Marine1 = new TMarine(); Marine1 -> SetAR (M1X1, M1Y1, M1X2, M1Y2); Marine1 -> SetRadar (-1, -1); Marine1 -> InsertUnits (); Marine8 = new TMarine(); Marine8 -> SetAR (M8X1, M8Y1, M8X2, M8Y2); Marine8 -> SetRadar (-1, -1); Marine8 -> InsertUnits (); // Naplnime Docks 1 for (i = TD1X1; i <= TD1X2; i++) { for (j = TD1Y1; j <= TD1Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TDocks *)Units [Docks1]) -> Inventory [((TDocks*)Units [Docks1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Polozime miny for (i = 0; MinePlaces8 [i].x != -1; i++) { MinePlace (MinePlaces8 [i].x, MinePlaces8 [i].y, BADLIFE); } UnlockDraw (); // zamerime jednotku i = GetField (SelX, SelY) -> Unit; Units [i] -> Select (); RedrawMap (); }
void InitAI19 () { int i,j; TBase *Base; TAirport *Airport; TField *f; TUnit *u; TPoint p; LockDraw (); AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 0; MoneyBadlife = 15000; MBPlaces = NULL; DeniedPlaces = NULL; Uran1 = GetField (U1X, U1Y) -> Unit; Uran2 = GetField (U2X, U2Y) -> Unit; Uran3 = GetField (U3X, U3Y) -> Unit; Uran4 = GetField (U4X, U4Y) -> Unit; Uran5 = GetField (U5X, U5Y) -> Unit; Base1 = GetField (B1X, B1Y) -> Unit; Factory1 = GetField (F1X, F1Y) -> Unit; Factory2 = GetField (F2X, F2Y) -> Unit; Factory3 = GetField (F3X, F3Y) -> Unit; Factory4 = GetField (F4X, F4Y) -> Unit; Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> SetRadar (R1X, R1Y); Army1 -> InsertUnits (); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (R2X, R2Y); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (R1X, R1Y); Army3 -> InsertUnits (); Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (R2X, R2Y); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (-1, -1); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (R6X, R6Y); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> SetRadar (R7X, R7Y); Army7 -> InsertUnits (); Army8 = new TGroundArmy(); Army8 -> SetAR (A8X1, A8Y1, A8X2, A8Y2); Army8 -> SetRadar (R8X, R8Y); Army8 -> InsertUnits (); Army9 = new TGroundArmy(); Army9 -> SetAR (A9X1, A9Y1, A9X2, A9Y2); Army9 -> SetRadar (R9X, R9Y); Army9 -> InsertUnits (); Army10 = new TGroundArmy(); Army10 -> SetAR (A10X1, A10Y1, A10X2, A10Y2); Army10 -> SetRadar (-1, -1); Army10 -> InsertUnits (); Army11 = new TGroundArmy(); Army11 -> SetAR (A11X1, A11Y1, A11X2, A11Y2); Army11 -> SetRadar (-1, -1); Army11 -> InsertUnits (); Army12 = new TGroundArmy(); Army12 -> SetAR (A12X1, A12Y1, A12X2, A12Y2); Army12 -> SetRadar (-1, -1); Army12 -> InsertUnits (); Army13 = new TGroundArmy(); Army13 -> SetAR (A13X1, A13Y1, A13X2, A13Y2); Army13 -> SetRadar (-1, -1); Army13 -> InsertUnits (); Army14 = new TGroundArmy(); Army14 -> SetAR (A14X1, A14Y1, A14X2, A14Y2); Army14 -> SetRadar (-1, -1); Army14 -> InsertUnits (); Army15 = new TGroundArmy(); Army15 -> SetAR (A15X1, A15Y1, A15X2, A15Y2); Army15 -> SetRadar (-1, -1); Army15 -> InsertUnits (); Army16 = new TGroundArmy(); Army16 -> SetAR (A16X1, A16Y1, A16X2, A16Y2); Army16 -> SetRadar (-1, -1); Army16 -> InsertUnits (); AirArmy1 = new TAirArmy(); AirArmy1 -> SetAR (AA1X1, AA1Y1, AA1X2, AA1Y2); AirArmy1 -> SetRadar (-1, -1); AirArmy1 -> InsertUnits (); AirArmy1 -> Status = asActive; // Naplnime Urany for (i = TU1X1; i <= TU1X2; i++) { for (j = TU1Y1; j <= TU1Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TUran*)Units [Uran1]) -> Inventory [((TUran*)Units [Uran1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TU2X1; i <= TU2X2; i++) { for (j = TU2Y1; j <= TU2Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TUran*)Units [Uran2]) -> Inventory [((TUran*)Units [Uran2]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TU3X1; i <= TU3X2; i++) { for (j = TU3Y1; j <= TU3Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TUran*)Units [Uran3]) -> Inventory [((TUran*)Units [Uran3]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TU4X1; i <= TU4X2; i++) { for (j = TU4Y1; j <= TU4Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TUran*)Units [Uran4]) -> Inventory [((TUran*)Units [Uran4]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TU5X1; i <= TU5X2; i++) { for (j = TU5Y1; j <= TU5Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TUran*)Units [Uran5]) -> Inventory [((TUran*)Units [Uran5]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Polozime miny for (i = 0; MinePlaces19 [i].x != -1; i++) { MinePlace (MinePlaces19 [i].x, MinePlaces19 [i].y, BADLIFE); } // zamerime jednotku i = GetField (SelX, SelY) -> Unit; Units [i] -> Select (); UnlockDraw (); RedrawMap (); }
void InitAI7 () { int i,j; TBase *Base; TField *f; TUnit *u; LockDraw(); AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 600; MoneyBadlife = 7000; MBPlaces = NULL; DeniedPlaces = NULL; Base6 = GetField (B6X, B6Y) -> Unit; Factory2 = GetField (F2X, F2Y) -> Unit; Olymp1 = GetField (O1X, O1Y) -> Unit; Olymp2 = GetField (O2X, O2Y) -> Unit; Olymp3 = GetField (O3X, O3Y) -> Unit; Olymp4 = GetField (O4X, O4Y) -> Unit; Mohykan1 = GetField (M1X, M1Y) -> Unit; Mohykan2 = GetField (M2X, M2Y) -> Unit; Mohykan3 = GetField (M3X, M3Y) -> Unit; Mohykan4 = GetField (M4X, M4Y) -> Unit; Mesias1 = GetField (Me1X, Me1Y) -> Unit; Ganymedes1 = GetField (Ga1X, Ga1Y) -> Unit; Radar2 = GetField (R2X, R2Y) -> Unit; Pagoda1 = GetField (P1X, P1Y) -> Unit; Pagoda2 = GetField (P2X, P2Y) -> Unit; Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> Status = asActive; // Army1 -> WayPoint.x = WP1X; Army1 -> WayPoint.y = WP1Y; Army1 -> SetAIConst(2); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (R2X, R2Y); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (R3X, R3Y); Army3 -> InsertUnits (); Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (R4X, R4Y); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (R5X, R5Y); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (R6X, R6Y); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> InsertUnits (); Army8 = new TGroundArmy(); Army8 -> SetAR (A8X1, A8Y1, A8X2, A8Y2); Army8 -> InsertUnits (); // Jednotky do Olympu for (i = TO1X1; i <= TO1X2; i++) { for (j = TO1Y1; j <= TO1Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOlymp*)Units [Olymp1]) -> Inventory [((TOlymp*)Units [Olymp1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO2X1; i <= TO2X2; i++) { for (j = TO2Y1; j <= TO2Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOlymp*)Units [Olymp2]) -> Inventory [((TOlymp*)Units [Olymp2]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO3X1; i <= TO3X2; i++) { for (j = TO3Y1; j <= TO3Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOlymp*)Units [Olymp3]) -> Inventory [((TOlymp*)Units [Olymp3]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO4X1; i <= TO4X2; i++) { for (j = TO4Y1; j <= TO4Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOlymp*)Units [Olymp4]) -> Inventory [((TOlymp*)Units [Olymp4]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Polozime miny for (i = 0; MinePlaces7 [i].x != -1; i++) { MinePlace (MinePlaces7 [i].x, MinePlaces7 [i].y, BADLIFE); } UnlockDraw (); }
void InitAI9 () { int i; LockDraw (); AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 0; MoneyBadlife = 7000; MBPlaces = NULL; DeniedPlaces = NULL; ActivationTurn9 = 55; Gargantua1 = GetField (G1X, G1Y) -> Unit; Gargantua2 = GetField (G2X, G2Y) -> Unit; Gargantua3 = GetField (G3X, G3Y) -> Unit; Factory1 = GetField (F1X, F1Y) -> Unit; Factory2 = GetField (F2X, F2Y) -> Unit; Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> SetRadar (R1X, R1Y); Army1 -> InsertUnits (); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (R2X, R2Y); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (R3X, R3Y); Army3 -> InsertUnits (); Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (R4X, R4Y); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (-1, -1); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (R6X, R6Y); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> SetRadar (R7X, R7Y); Army7 -> InsertUnits (); Army8 = new TGroundArmy(); Army8 -> SetAR (A8X1, A8Y1, A8X2, A8Y2); Army8 -> SetRadar (R8X, R8Y); Army8 -> InsertUnits (); Army9 = new TGroundArmy(); Army9 -> SetAR (A9X1, A9Y1, A9X2, A9Y2); Army9 -> SetRadar (-1, -1); Army9 -> InsertUnits (); Army9 -> WayPoint.x = A9WP1X; Army9 -> WayPoint.y = A9WP1Y; Army9 -> Displace (); Army10 = new TGroundArmy(); Army10 -> SetAR (A9X1, A9Y1, A9X2, A9Y2); Army10 -> SetRadar (-1, -1); Army10 -> InsertUnits (); // Polozime miny for (i = 0; MinePlaces9 [i].x != -1; i++) { MinePlace (MinePlaces9 [i].x, MinePlaces9 [i].y, BADLIFE); } // zamerime jednotku i = GetField (SelX, SelY) -> Unit; Units [i] -> Select (); UnlockDraw (); RedrawMap (); }
void InitAI17 () { int i,j; TField *f; TUnit *u; LockDraw (); AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 0; MoneyBadlife = 10000; MBPlaces = NULL; DeniedPlaces = NULL; Oasa1 = GetField (O1X, O1Y) -> Unit; Oasa2 = GetField (O2X, O2Y) -> Unit; Oasa3 = GetField (O3X, O3Y) -> Unit; Oasa4 = GetField (O4X, O4Y) -> Unit; Oasa5 = GetField (O5X, O5Y) -> Unit; Oasa6 = GetField (O6X, O6Y) -> Unit; Neptun1 = GetField (N1X, N1Y) -> Unit; Neptun2 = GetField (N2X, N2Y) -> Unit; Laguna1 = GetField (L1X, L1Y) -> Unit; Laguna2 = GetField (L2X, L2Y) -> Unit; Factory1 = GetField (F1X, F1Y) -> Unit; Base1 = GetField (B1X, B1Y) -> Unit; Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> SetRadar (-1, -1); Army1 -> InsertUnits (); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (-1, -1); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (-1, -1); Army3 -> InsertUnits (); Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (-1, -1); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (R5X, R5Y); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (R6X, R6Y); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> SetRadar (R7X, R7Y); Army7 -> InsertUnits (); Marine1 = new TMarine (); Marine1 -> SetAR (M1X1, M1Y1, M1X2, M1Y2); Marine1 -> SetRadar (-1, -1); Marine1 -> InsertUnits (); Marine1 -> Status = asActive; Marine1 -> SetAIConst (2); Marine1 -> Insert (Oasa5); Marine2 = new TMarine (); Marine2 -> SetAR (M2X1, M2Y1, M2X2, M2Y2); Marine2 -> SetRadar (-1, -1); Marine2 -> InsertUnits (); Marine2 -> Status = asActive; Marine2 -> SetAIConst (2); Marine2 -> Insert (Oasa5); AirArmy1 = new TAirArmy(); AirArmy1 -> SetAR (AA1X1, AA1Y1, AA1X2, AA1Y2); AirArmy1 -> SetRadar (-1, -1); AirArmy1 -> InsertUnits (); AirArmy1 -> Status = asActive; AirArmy1 -> Insert (Oasa5); AirArmy2 = new TAirArmy(); AirArmy2 -> SetAR (AA2X1, AA2Y1, AA2X2, AA2Y2); AirArmy2 -> SetRadar (R2X, R2Y); AirArmy2 -> InsertUnits (); AirArmy2 -> Status = asActive; AirArmy3 = new TAirArmy(); AirArmy3 -> SetAR (AA3X1, AA3Y1, AA3X2, AA3Y2); AirArmy3 -> SetRadar (-1, -1); AirArmy3 -> InsertUnits (); AirArmy3 -> Status = asActive; // Naplnime Oasy for (i = TO1X1; i <= TO1X2; i++) { for (j = TO1Y1; j <= TO1Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa1]) -> Inventory [((TOasa*)Units [Oasa1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO2X1; i <= TO2X2; i++) { for (j = TO2Y1; j <= TO2Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa2]) -> Inventory [((TOasa*)Units [Oasa2]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO3X1; i <= TO3X2; i++) { for (j = TO3Y1; j <= TO3Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa3]) -> Inventory [((TOasa*)Units [Oasa3]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO4X1; i <= TO4X2; i++) { for (j = TO4Y1; j <= TO4Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa4]) -> Inventory [((TOasa*)Units [Oasa4]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO5X1; i <= TO5X2; i++) { for (j = TO5Y1; j <= TO5Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa5]) -> Inventory [((TOasa*)Units [Oasa5]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TO6X1; i <= TO6X2; i++) { for (j = TO6Y1; j <= TO6Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TOasa*)Units [Oasa6]) -> Inventory [((TOasa*)Units [Oasa6]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Naplnime Neptuny for (i = TN1X1; i <= TN1X2; i++) { for (j = TN1Y1; j <= TN1Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TNeptun*)Units [Neptun1]) -> Inventory [((TNeptun*)Units [Neptun1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TN2X1; i <= TN2X2; i++) { for (j = TN2Y1; j <= TN2Y2; j++) { f = GetField (i, j); if (f -> Unit != NO_UNIT ) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); ((TNeptun*)Units [Neptun2]) -> Inventory [((TNeptun*)Units [Neptun2]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Naplnime Laguny for (i = TL1X1; i <= TL1X2; i++) { for (j = TL1Y1; j <= TL1Y2; j++) { u = GetAircraftAt (i, j); if (u != NULL) { u -> PlaceGround (FALSE); ((TLaguna*)Units [Laguna1]) -> Inventory [((TLaguna*)Units [Laguna1]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } for (i = TL2X1; i <= TL2X2; i++) { for (j = TL2Y1; j <= TL2Y2; j++) { u = GetAircraftAt (i, j); if (u != NULL) { u -> PlaceGround (FALSE); ((TLaguna*)Units [Laguna2]) -> Inventory [((TLaguna*)Units [Laguna2]) -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Polozime miny for (i = 0; MinePlaces17 [i].x != -1; i++) { MinePlace (MinePlaces17 [i].x, MinePlaces17 [i].y, BADLIFE); } // zamerime jednotku i = GetField (SelX, SelY) -> Unit; Units [i] -> Select (); UnlockDraw (); RedrawMap (); }
void InitAI5 () { int i,j; TBase *Base; THeliport *Heliport; TAirport *Airport; TField *f; TUnit *u; LockDraw (); AttackFieldPos = 0; DUPos = 0; MoneyGoodlife = 0; MoneyBadlife = 5000; MBPlaces = NULL; DeniedPlaces = NULL; ActivationTurn1 = MaxInt; ActivationTurn2 = MaxInt; ActivationTurn3 = MaxInt; ActivationTurn4 = MaxInt; ActivationTurn5 = MaxInt; ActivationTurn6 = MaxInt; ActivationTurn7 = MaxInt; ActivationTurn8 = MaxInt; Xenon3ActivationTurn = MaxInt; X3MineCnt = 0; Base1 = GetField (B1X, B1Y) -> Unit; Base8 = GetField (B8X, B8Y) -> Unit; Radar1 = GetField (R1X, R1Y) -> Unit; Radar2 = GetField (R2X, R2Y) -> Unit; Radar4 = GetField (R4X, R4Y) -> Unit; Radar5 = GetField (R5X, R5Y) -> Unit; Radar8 = GetField (R8X, R8Y) -> Unit; Factory8 = GetField (F8X, F8Y) -> Unit; Airport1 = GetField (A1X, A1Y) -> Unit; Airport8 = GetField (A8X, A8Y) -> Unit; Heliport4 = GetField (H4X, H4Y) -> Unit; Xenon3 = GetField (X3X, X3Y) -> Unit; for (i = BADLIFE; i < UNITS_TOP; i++) { if (Units [i] != NULL && Units [i] -> X == K1X && Units [i] -> Y == K1Y) { Kobra1 = i; break; } } Towers = new TTowers (); for (i = 0; i < UNITS_TOP; i++) { if (Units [i] == NULL) continue; // vsechny veze a GL if ((((TUnit *) Units [i]) -> Type >= (unHorizont + BADLIFE) && ((TUnit *) Units [i]) -> Type <= (unSpektrum + BADLIFE)) || (((TUnit *) Units[i]) -> Type < BADLIFE)) Towers -> Insert (i); } Army1 = new TGroundArmy(); Army1 -> SetAR (A1X1, A1Y1, A1X2, A1Y2); Army1 -> SetRadar (R1X, R1Y); Army1 -> WayPoint.x = A1WPX; Army1 -> WayPoint.y = A1WPY; Army1 -> InsertUnits (); AirArmy1 = new TAirArmy (); AirArmy1 -> SetAR (AA1X1, AA1Y1, AA1X2, AA1Y2); AirArmy1 -> WayPoint.x = A1WPX; AirArmy1 -> WayPoint.y = A1WPY; AirArmy1 -> SetAIConst (2); // AGRESIVE ARMY AirArmy1 -> Status = asActive; AirArmy1 -> InsertUnits (); Army2 = new TGroundArmy(); Army2 -> SetAR (A2X1, A2Y1, A2X2, A2Y2); Army2 -> SetRadar (R2X, R2Y); Army2 -> InsertUnits (); Army3 = new TGroundArmy(); Army3 -> SetAR (A3X1, A3Y1, A3X2, A3Y2); Army3 -> SetRadar (-1, -1); Army3 -> InsertUnits (); Army4 = new TGroundArmy(); Army4 -> SetAR (A4X1, A4Y1, A4X2, A4Y2); Army4 -> SetRadar (R4X, R4Y); Army4 -> InsertUnits (); Army5 = new TGroundArmy(); Army5 -> SetAR (A5X1, A5Y1, A5X2, A5Y2); Army5 -> SetRadar (R5X, R5Y); Army5 -> InsertUnits (); Army6 = new TGroundArmy(); Army6 -> SetAR (A6X1, A6Y1, A6X2, A6Y2); Army6 -> SetRadar (-1, -1); Army6 -> InsertUnits (); Army7 = new TGroundArmy(); Army7 -> SetAR (A7X1, A7Y1, A7X2, A7Y2); Army7 -> SetRadar (-1, -1); Army7 -> InsertUnits (); Army8 = new TGroundArmy(); Army8 -> SetAR (A8X1, A8Y1, A8X2, A8Y2); Army8 -> SetRadar (R8X, R8Y); Army8 -> InsertUnits (); AirArmy8 = new TAirArmy (); AirArmy8 -> SetAR (AA8X1, AA8Y1, AA8X2, AA8Y2); AirArmy8 -> SetRadar (R8X, R8Y); AirArmy8 -> Status = asActive; AirArmy8 -> InsertUnits (); // Jednotky do zakladny Base = (TBase*)Units [Base1]; for (i = TB1X1; i <= TB1X2; i++) { for (j = TB1Y1; j <= TB1Y2; j++) { f = GetField (i, j); if ((f -> Unit != NO_UNIT) && (f -> Unit >= BADLIFE)) { u = (TUnit *)Units [f -> Unit]; u -> PlaceGround (FALSE); Base -> Inventory [Base -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Kobra 1 do Airportu Airport = (TAirport*)Units [Airport1]; Units [Kobra1] -> PlaceGround (FALSE); Airport -> Inventory [Airport -> LoadedUnits++] = Kobra1; Units [Kobra1] -> X = Units [Kobra1] -> Y = -1; // Rexove do Heliportu 4 Heliport = (THeliport *)Units [Heliport4]; for (i = TH4X1; i <= TH4X2; i++) { for (j = TH4Y1; j <= TH4Y2; j++) { u = GetAircraftAt (i, j); if ((u != NULL) && (u -> Type >= BADLIFE)) { u -> PlaceGround (FALSE); Heliport -> Inventory [Heliport -> LoadedUnits++] = u -> ID; u -> X = u -> Y = -1; } } } // Polozime miny for (i = 0; MinePlaces5 [i].x != -1; i++) { MinePlace (MinePlaces5 [i].x, MinePlaces5 [i].y, BADLIFE); } UnlockDraw (); /////////////////////////////////////////////////////////////////// }