TEVENT.CPP (31575B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/TEVENT.CPP 1 3/03/97 10:25a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : TEVENT.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 11/28/95 * 28 * * 29 * Last Update : July 29, 1996 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * Attaches_To -- Determines what event can be attached to. * 34 * EventChoiceClass::Draw_It -- Displays the event choice class as a text string. * 35 * Event_From_Name -- retrieves EventType for given name * 36 * Event_Needs -- Returns with what this event type needs for data. * 37 * Name_From_Event -- retrieves name for EventType * 38 * TEventClass::Build_INI_Entry -- Builds the ini text for this event. * 39 * TEventClass::Read_INI -- Parses the INI text for this event's data. * 40 * TEventClass::Reset -- Reset the trigger for a subsequent "spring". * 41 * TEventClass::operator () -- Action operator to see if event is satisfied. * 42 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 43 44 45 #include "function.h" 46 47 /* 48 ** This is the text name for all of the trigger events. These are used by the scenario editor 49 */ 50 const char * EventText[TEVENT_COUNT] = { 51 "-No Event-", 52 "Entered by...", 53 "Spied by...", 54 "Thieved by...", 55 "Discovered by player", 56 "House Discovered...", 57 "Attacked by anybody", 58 "Destroyed by anybody", 59 "Any Event", 60 "Destroyed, Units, All...", 61 "Destroyed, Buildings, All...", 62 "Destroyed, All...", 63 "Credits exceed (x100)...", 64 "Elapsed Time (1/10th min)...", 65 "Mission Timer Expired", 66 "Destroyed, Buildings, #...", 67 "Destroyed, Units, #...", 68 "No Factories left", 69 "Civilians Evacuated", 70 "Build Building Type...", 71 "Build Unit Type...", 72 "Build Infantry Type...", 73 "Build Aircraft Type...", 74 "Leaves map (team)...", 75 "Zone Entry by...", 76 "Crosses Horizontal Line...", 77 "Crosses Vertical Line...", 78 "Global is set...", 79 "Global is clear...", 80 "Destroyed, Fakes, All...", 81 "Low Power...", 82 "All bridges destroyed", 83 "Building exists..." 84 }; 85 86 87 /* 88 ** This is an ordinal list of trigger events. This list 89 ** is used when generating the trigger dialog box. 90 */ 91 EventChoiceClass EventChoices[TEVENT_COUNT] = { 92 {TEVENT_NONE}, 93 {TEVENT_PLAYER_ENTERED}, 94 {TEVENT_SPIED}, 95 {TEVENT_THIEVED}, 96 {TEVENT_DISCOVERED}, 97 {TEVENT_HOUSE_DISCOVERED}, 98 {TEVENT_ATTACKED}, 99 {TEVENT_DESTROYED}, 100 {TEVENT_ANY}, 101 {TEVENT_UNITS_DESTROYED}, 102 {TEVENT_BUILDINGS_DESTROYED}, 103 {TEVENT_ALL_DESTROYED}, 104 {TEVENT_CREDITS}, 105 {TEVENT_TIME}, 106 {TEVENT_MISSION_TIMER_EXPIRED}, 107 {TEVENT_NBUILDINGS_DESTROYED}, 108 {TEVENT_NUNITS_DESTROYED}, 109 {TEVENT_NOFACTORIES}, 110 {TEVENT_EVAC_CIVILIAN}, 111 {TEVENT_BUILD}, 112 {TEVENT_BUILD_UNIT}, 113 {TEVENT_BUILD_INFANTRY}, 114 {TEVENT_BUILD_AIRCRAFT}, 115 {TEVENT_LEAVES_MAP}, 116 {TEVENT_ENTERS_ZONE}, 117 {TEVENT_CROSS_HORIZONTAL}, 118 {TEVENT_CROSS_VERTICAL}, 119 {TEVENT_GLOBAL_SET}, 120 {TEVENT_GLOBAL_CLEAR}, 121 {TEVENT_FAKES_DESTROYED}, 122 {TEVENT_LOW_POWER}, 123 {TEVENT_ALL_BRIDGES_DESTROYED}, 124 {TEVENT_BUILDING_EXISTS}, 125 }; 126 127 128 /*********************************************************************************************** 129 * EventChoiceClass::Draw_It -- Displays the event choice class as a text string. * 130 * * 131 * This utility routine is used by the list box display code to print the text line that * 132 * describes the event choice action. * 133 * * 134 * INPUT: see below... * 135 * * 136 * OUTPUT: none * 137 * * 138 * WARNINGS: none * 139 * * 140 * HISTORY: * 141 * 07/29/1996 JLB : Created. * 142 *=============================================================================================*/ 143 void EventChoiceClass::Draw_It(int , int x, int y, int width, int height, bool selected, TextPrintType flags) const 144 { 145 RemapControlType * scheme = GadgetClass::Get_Color_Scheme(); 146 static int _tabs[] = {13,40}; 147 if ((flags & 0x0F) == TPF_6PT_GRAD || (flags & 0x0F) == TPF_EFNT) { 148 149 if (selected) { 150 flags = flags | TPF_BRIGHT_COLOR; 151 LogicPage->Fill_Rect(x, y, x + width - 1, y + height - 1, scheme->Shadow); 152 } else { 153 if (!(flags & TPF_USE_GRAD_PAL)) { 154 flags = flags | TPF_MEDIUM_COLOR; 155 } 156 } 157 158 Conquer_Clip_Text_Print(Description(), x, y, scheme, TBLACK, flags, width, _tabs); 159 } else { 160 Conquer_Clip_Text_Print(Description(), x, y, (selected ? &ColorRemaps[PCOLOR_DIALOG_BLUE] : &ColorRemaps[PCOLOR_GREY]), TBLACK, flags, width, _tabs); 161 } 162 } 163 164 165 /*********************************************************************************************** 166 * TEventClass::Reset -- Reset the trigger for a subsequent "spring". * 167 * * 168 * This will reset the trigger event so that it may be "sprung" again. Typically, this * 169 * occurs for persistent triggers. * 170 * * 171 * INPUT: none * 172 * * 173 * OUTPUT: none * 174 * * 175 * WARNINGS: none * 176 * * 177 * HISTORY: * 178 * 11/28/1995 JLB : Created. * 179 *=============================================================================================*/ 180 void TEventClass::Reset(TDEventClass & td) const 181 { 182 td.IsTripped = false; 183 if (Event == TEVENT_TIME) { 184 td.Timer = Data.Value * (TICKS_PER_MINUTE/10); 185 } 186 } 187 188 189 /*********************************************************************************************** 190 * TEventClass::operator () -- Action operator to see if event is satisfied. * 191 * * 192 * This routine is called to see if the event has been satisfied. Typically, when the * 193 * necessary trigger events have been satisfied, then the trigger is sprung. For some * 194 * events, the act of calling this routine is tacit proof enough that the event has * 195 * occurred. For most other events, the success condition must be explicitly checked. * 196 * * 197 * INPUT: event -- The event that has occurred according to the context from which this * 198 * routine was called. In the case of no specific event having occurred, * 199 * then TEVENT_ANY will be passed in. * 200 * * 201 * house -- The house that this event is tied to. * 202 * * 203 * object-- The object that this event might apply to. For object triggering * 204 * events, this will point to the perpetrator object. * 205 * * 206 * forced-- If this event is forced by some outside action, this flag will be true. * 207 * Forcing only occurs as an explicit action from another trigger. * 208 * * 209 * OUTPUT: Was this event satisfied? A satisfied event will probably spring the trigger * 210 * it is attached to. * 211 * * 212 * WARNINGS: none * 213 * * 214 * HISTORY: * 215 * 11/28/1995 JLB : Created. * 216 *=============================================================================================*/ 217 bool TEventClass::operator () (TDEventClass & td, TEventType event, HousesType house, ObjectClass const * object, bool forced) 218 { 219 /* 220 ** If this trigger event has been forced, then no further checks are required. 221 ** Force the trigger to be tripped. 222 */ 223 if (forced) { 224 td.IsTripped = true; 225 } 226 227 if (td.IsTripped) return(true); 228 229 /* 230 ** Triggers based on the game's global environment such as time or 231 ** global flags are triggered only when the appropriate condition 232 ** is true. 233 */ 234 switch (Event) { 235 case TEVENT_GLOBAL_SET: 236 if (!Scen.GlobalFlags[Data.Value]) return(false); 237 return(true); 238 239 case TEVENT_GLOBAL_CLEAR: 240 if (Scen.GlobalFlags[Data.Value]) return(false); 241 return(true); 242 243 case TEVENT_MISSION_TIMER_EXPIRED: 244 // if (MissionSuspend == -1 || MissionTimer != 0) return(false); 245 if (!Scen.MissionTimer.Is_Active() || Scen.MissionTimer != 0) return(false); 246 return(true); 247 248 case TEVENT_TIME: 249 if (td.Timer != 0) return(false); 250 return(true); 251 } 252 253 /* 254 ** Don't trigger this event if the parameters mean nothing. Typical of 255 ** this would be for events related to time or other outside influences. 256 */ 257 if (Event == TEVENT_NONE) { 258 return(false); 259 } 260 261 /* 262 ** If this is not the event for this trigger, just return. This is only 263 ** necessary to check for those trigger events that are presumed to be 264 ** true just by the fact that this routine is called with the appropriate 265 ** event identifier. 266 */ 267 if (Event == TEVENT_ATTACKED || 268 Event == TEVENT_DESTROYED || 269 Event == TEVENT_DISCOVERED || 270 Event == TEVENT_SPIED || 271 Event == TEVENT_NONE || 272 Event == TEVENT_CROSS_HORIZONTAL || 273 Event == TEVENT_CROSS_VERTICAL || 274 Event == TEVENT_ENTERS_ZONE || 275 Event == TEVENT_PLAYER_ENTERED) { 276 277 if (event != Event && event != TEVENT_ANY) { 278 return(false); 279 } 280 } 281 282 /* 283 ** The cell entry trigger event is only tripped when an object of the 284 ** matching ownership has entered the cell in question. All other 285 ** conditions will not trigger the event. 286 */ 287 if (Event == TEVENT_PLAYER_ENTERED || Event == TEVENT_CROSS_HORIZONTAL || Event == TEVENT_CROSS_VERTICAL || Event == TEVENT_ENTERS_ZONE) { 288 if (!object || object->Owner() != Data.House) return(false); 289 td.IsTripped = true; 290 return(true); 291 } 292 293 /* 294 ** Check for all bridges destroyed condition. 295 */ 296 if (Event == TEVENT_ALL_BRIDGES_DESTROYED) { 297 if (Scen.BridgeCount) return(false); 298 td.IsTripped = true; 299 return(true); 300 } 301 302 /* 303 ** The following trigger events are not considered to have sprung 304 ** merely by fact that this routine has been called. These trigger 305 ** events must be verified manually by examining the house that 306 ** they are assigned to. 307 */ 308 HouseClass * hptr = HouseClass::As_Pointer(house); 309 int index; 310 if (hptr != NULL) { 311 switch (Event) { 312 /* 313 ** Check to see if a team of the appropriate type has left the map. 314 */ 315 case TEVENT_LEAVES_MAP: 316 for (index = 0; index < Teams.Count(); index++) { 317 TeamClass * ptr = Teams.Ptr(index); 318 if (ptr->Class == Team && ptr->Is_Empty() && ptr->IsLeaveMap) { 319 // if (ptr->Class == Team && ptr->House == hptr && ptr->Is_Empty() && ptr->IsLeaveMap) { 320 td.IsTripped = true; 321 break; 322 } 323 } 324 if (index == Teams.Count()) return(false); 325 break; 326 327 /* 328 ** Credits must be equal or greater to the value specified. 329 */ 330 case TEVENT_CREDITS: 331 if (hptr->Available_Money() < Data.Value) return(false); 332 break; 333 334 /* 335 ** Ensure that there are no more factories left. 336 */ 337 case TEVENT_NOFACTORIES: 338 if (hptr->BScan & (STRUCTF_AIRSTRIP|STRUCTF_TENT|STRUCTF_WEAP|STRUCTF_BARRACKS|STRUCTF_CONST)) return(false); 339 break; 340 341 /* 342 ** Ensure that there are no fake structures left. 343 */ 344 case TEVENT_FAKES_DESTROYED: 345 //PG_TO_FIX 346 //warning C4293: '<<': shift count negative or too big, undefined behavior 347 //Indeed, STRUCTF_FAKEWEAP and STRUCTF_FAKECONST don't fit in the BScan bit range. ST - 5/9/2019 348 //if (hptr->BScan & (STRUCTF_FAKECONST|STRUCTF_FAKEWEAP)) return(false); 349 break; 350 351 /* 352 ** A civilian must have been evacuated. 353 */ 354 case TEVENT_EVAC_CIVILIAN: 355 if (!hptr->IsCivEvacuated) return(false); 356 break; 357 358 /* 359 ** Verify that the structure has been built. 360 */ 361 case TEVENT_BUILDING_EXISTS: 362 if ((hptr->ActiveBScan & (1 << Data.Structure)) == 0) return(false); 363 // if (hptr->Get_Quantity(Data.Structure) == 0) return(false); 364 break; 365 366 /* 367 ** Verify that the structure has been built. 368 */ 369 case TEVENT_BUILD: 370 if (hptr->JustBuiltStructure != Data.Structure) return(false); 371 td.IsTripped = true; 372 break; 373 374 /* 375 ** Verify that the unit has been built. 376 */ 377 case TEVENT_BUILD_UNIT: 378 if (hptr->JustBuiltUnit != Data.Unit) return(false); 379 td.IsTripped = true; 380 break; 381 382 /* 383 ** Verify that the infantry has been built. 384 */ 385 case TEVENT_BUILD_INFANTRY: 386 if (hptr->JustBuiltInfantry != Data.Infantry) return(false); 387 td.IsTripped = true; 388 break; 389 390 /* 391 ** Verify that the aircraft has been built. 392 */ 393 case TEVENT_BUILD_AIRCRAFT: 394 if (hptr->JustBuiltAircraft != Data.Aircraft) return(false); 395 td.IsTripped = true; 396 break; 397 398 /* 399 ** Verify that the specified number of buildings have been destroyed. 400 */ 401 case TEVENT_NBUILDINGS_DESTROYED: 402 if ((int)hptr->BuildingsLost < Data.Value) return(false); 403 break; 404 405 /* 406 ** Verify that the specified number of units have been destroyed. 407 */ 408 case TEVENT_NUNITS_DESTROYED: 409 if ((int)hptr->UnitsLost < Data.Value) return(false); 410 break; 411 412 default: 413 break; 414 } 415 } 416 417 hptr = HouseClass::As_Pointer(Data.House); 418 if (hptr) { 419 switch (Event) { 420 case TEVENT_LOW_POWER: 421 if (hptr->Power_Fraction() >= 1) return(false); 422 break; 423 424 // case TEVENT_SPIED: 425 // if (!hptr->IsSpied) return(false); 426 // break; 427 428 case TEVENT_THIEVED: 429 if (!hptr->IsThieved) return(false); 430 break; 431 432 /* 433 ** Verify that the house has been discovered. 434 */ 435 case TEVENT_HOUSE_DISCOVERED: 436 if (!hptr->IsDiscovered) return(false); 437 break; 438 439 /* 440 ** Verify that all buildings have been destroyed. 441 */ 442 case TEVENT_BUILDINGS_DESTROYED: 443 if (hptr->ActiveBScan) return(false); 444 break; 445 446 /* 447 ** Verify that all units have been destroyed -- with some 448 ** exceptions. 449 */ 450 case TEVENT_UNITS_DESTROYED: 451 if (hptr->ActiveUScan | hptr->ActiveIScan) return(false); 452 break; 453 454 /* 455 ** Verify that all buildings and units have been destroyed. 456 */ 457 case TEVENT_ALL_DESTROYED: 458 if (hptr->ActiveBScan | hptr->ActiveUScan | hptr->ActiveIScan | hptr->ActiveVScan) return(false); 459 break; 460 461 default: 462 break; 463 } 464 } 465 466 return(true); 467 } 468 469 470 /*********************************************************************************************** 471 * TEventClass::Build_INI_Entry -- Builds the ini text for this event. * 472 * * 473 * This routine will build the ini text for this trigger event. The ini text is appended * 474 * to the string buffer specified. This routine is used to build the complete trigger * 475 * ini text for writing out to the INI scenario file. * 476 * * 477 * INPUT: ptr -- Pointer to the string buffer that will hold the event INI data. * 478 * * 479 * OUTPUT: none * 480 * * 481 * WARNINGS: none * 482 * * 483 * HISTORY: * 484 * 11/28/1995 JLB : Created. * 485 *=============================================================================================*/ 486 void TEventClass::Build_INI_Entry(char * ptr) const 487 { 488 sprintf(ptr, "%d,%d,%d", Event, TeamTypes.Logical_ID(Team), Data.Value); 489 } 490 491 492 /*********************************************************************************************** 493 * TEventClass::Read_INI -- Parses the INI text for this event's data. * 494 * * 495 * This routine is used to parse the INI data line to fetch the event's data from it. * 496 * * 497 * INPUT: none * 498 * * 499 * OUTPUT: none * 500 * * 501 * WARNINGS: none * 502 * * 503 * HISTORY: * 504 * 11/28/1995 JLB : Created. * 505 *=============================================================================================*/ 506 void TEventClass::Read_INI(void) 507 { 508 char const * token; 509 switch (NewINIFormat) { 510 default: 511 Event = TEventType(atoi(strtok(NULL, ","))); 512 Team.Set_Raw(atoi(strtok(NULL, ","))); 513 Data.Value = atoi(strtok(NULL, ",")); 514 break; 515 516 case 1: 517 token = strtok(NULL, ","); 518 Event = TEVENT_NONE; 519 if (token) Event = TEventType(atoi(token)); 520 521 token = strtok(NULL, ","); 522 Team = NULL; 523 Data.Value = -1; 524 if (token) { 525 if (Event_Needs(Event) == NEED_TEAM) { 526 Team = TeamTypes.Raw_Ptr(atoi(token)); 527 } else { 528 Data.Value = atoi(token); 529 } 530 } 531 break; 532 533 case 0: 534 Event = TEventType(atoi(strtok(NULL, ","))); 535 536 strtok(NULL, ","); 537 strtok(NULL, ","); 538 539 Team = TeamTypeClass::From_Name(strtok(NULL, ",")); 540 Data.Value = atoi(strtok(NULL, ",")); 541 strtok(NULL, ","); 542 break; 543 } 544 } 545 546 547 /*********************************************************************************************** 548 * Event_Needs -- Returns with what this event type needs for data. * 549 * * 550 * This routine will examine the specified event type and return a code that indicates * 551 * the type of data that must be supplied to this event. Some events require no data and * 552 * these will return NEED_NONE. * 553 * * 554 * INPUT: event -- The event type to examine. * 555 * * 556 * OUTPUT: Returns with the type of additional data that is needed by this event. * 557 * * 558 * WARNINGS: none * 559 * * 560 * HISTORY: * 561 * 11/28/1995 JLB : Created. * 562 *=============================================================================================*/ 563 NeedType Event_Needs(TEventType event) 564 { 565 switch (event) { 566 case TEVENT_THIEVED: 567 case TEVENT_PLAYER_ENTERED: 568 case TEVENT_CROSS_HORIZONTAL: 569 case TEVENT_CROSS_VERTICAL: 570 case TEVENT_ENTERS_ZONE: 571 case TEVENT_HOUSE_DISCOVERED: 572 case TEVENT_BUILDINGS_DESTROYED: 573 case TEVENT_UNITS_DESTROYED: 574 case TEVENT_ALL_DESTROYED: 575 case TEVENT_LOW_POWER: 576 return(NEED_HOUSE); 577 578 case TEVENT_NUNITS_DESTROYED: 579 case TEVENT_NBUILDINGS_DESTROYED: 580 case TEVENT_CREDITS: 581 case TEVENT_TIME: 582 case TEVENT_GLOBAL_SET: 583 case TEVENT_GLOBAL_CLEAR: 584 return(NEED_NUMBER); 585 586 case TEVENT_BUILDING_EXISTS: 587 case TEVENT_BUILD: 588 return(NEED_STRUCTURE); 589 590 case TEVENT_BUILD_UNIT: 591 return(NEED_UNIT); 592 593 case TEVENT_BUILD_INFANTRY: 594 return(NEED_INFANTRY); 595 596 case TEVENT_BUILD_AIRCRAFT: 597 return(NEED_AIRCRAFT); 598 599 case TEVENT_LEAVES_MAP: 600 return(NEED_TEAM); 601 602 default: 603 break; 604 } 605 return(NEED_NONE); 606 } 607 608 609 /*********************************************************************************************** 610 * Event_From_Name -- retrieves EventType for given name * 611 * * 612 * INPUT: * 613 * name name to get event for * 614 * * 615 * OUTPUT: * 616 * EventType for given name * 617 * * 618 * WARNINGS: * 619 * none. * 620 * * 621 * HISTORY: * 622 * 11/29/1994 BR : Created. * 623 *=============================================================================================*/ 624 TEventType Event_From_Name (char const * name) 625 { 626 if (name) { 627 for (TEventType i = TEVENT_NONE; i < TEVENT_COUNT; i++) { 628 if (!stricmp(name, EventText[i])) { 629 return(i); 630 } 631 } 632 } 633 634 return(TEVENT_NONE); 635 } 636 637 638 /*********************************************************************************************** 639 * Name_From_Event -- retrieves name for EventType * 640 * * 641 * INPUT: * 642 * event EventType to get name for * 643 * * 644 * OUTPUT: * 645 * name for EventType * 646 * * 647 * WARNINGS: * 648 * none. * 649 * * 650 * HISTORY: * 651 * 11/29/1994 BR : Created. * 652 *=============================================================================================*/ 653 char const * Name_From_Event(TEventType event) 654 { 655 return(EventText[event]); 656 } 657 658 659 /*********************************************************************************************** 660 * Attaches_To -- Determines what event can be attached to. * 661 * * 662 * This routine is used to determine what this event type can be attached to in the game. * 663 * Some events are specifically tied to cells or game object. This routine will indicate * 664 * this requirement. * 665 * * 666 * INPUT: event -- The event type to examine. * 667 * * 668 * OUTPUT: Returns with the attachable characteristics for this event type. These * 669 * characteristics are represented by a composite bit field. Some events can be * 670 * attached to multiple objects. * 671 * * 672 * WARNINGS: none * 673 * * 674 * HISTORY: * 675 * 11/28/1995 JLB : Created. * 676 *=============================================================================================*/ 677 AttachType Attaches_To(TEventType event) 678 { 679 AttachType attach = ATTACH_NONE; 680 681 switch (event) { 682 case TEVENT_CROSS_HORIZONTAL: 683 case TEVENT_CROSS_VERTICAL: 684 case TEVENT_ENTERS_ZONE: 685 case TEVENT_PLAYER_ENTERED: 686 case TEVENT_ANY: 687 case TEVENT_DISCOVERED: 688 case TEVENT_NONE: 689 attach = attach | ATTACH_CELL; 690 break; 691 692 default: 693 break; 694 } 695 696 switch (event) { 697 case TEVENT_SPIED: 698 case TEVENT_PLAYER_ENTERED: 699 case TEVENT_DISCOVERED: 700 case TEVENT_DESTROYED: 701 case TEVENT_ATTACKED: 702 case TEVENT_ANY: 703 case TEVENT_NONE: 704 attach = attach | ATTACH_OBJECT; 705 break; 706 707 default: 708 break; 709 } 710 711 switch (event) { 712 // case TEVENT_CROSS_HORIZONTAL: 713 // case TEVENT_CROSS_VERTICAL: 714 case TEVENT_ENTERS_ZONE: 715 case TEVENT_ANY: 716 attach = attach | ATTACH_MAP; 717 break; 718 719 default: 720 break; 721 } 722 723 switch (event) { 724 case TEVENT_LOW_POWER: 725 case TEVENT_EVAC_CIVILIAN: 726 case TEVENT_BUILDING_EXISTS: 727 case TEVENT_BUILD: 728 case TEVENT_BUILD_UNIT: 729 case TEVENT_BUILD_INFANTRY: 730 case TEVENT_BUILD_AIRCRAFT: 731 case TEVENT_NOFACTORIES: 732 case TEVENT_BUILDINGS_DESTROYED: 733 case TEVENT_NBUILDINGS_DESTROYED: 734 case TEVENT_UNITS_DESTROYED: 735 case TEVENT_NUNITS_DESTROYED: 736 case TEVENT_ALL_DESTROYED: 737 case TEVENT_HOUSE_DISCOVERED: 738 case TEVENT_CREDITS: 739 // case TEVENT_ATTACKED: 740 case TEVENT_THIEVED: 741 case TEVENT_ANY: 742 case TEVENT_FAKES_DESTROYED: 743 attach = attach | ATTACH_HOUSE; 744 break; 745 746 default: 747 break; 748 } 749 750 switch (event) { 751 case TEVENT_TIME: 752 case TEVENT_GLOBAL_SET: 753 case TEVENT_GLOBAL_CLEAR: 754 case TEVENT_MISSION_TIMER_EXPIRED: 755 case TEVENT_ANY: 756 case TEVENT_ALL_BRIDGES_DESTROYED: 757 case TEVENT_LEAVES_MAP: 758 attach = attach | ATTACH_GENERAL; 759 break; 760 761 default: 762 break; 763 } 764 765 return(attach); 766 }