SIDEBARGlyphx.CPP (43938B)
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: F:\projects\c&c\vcs\code\sidebar.cpv 2.13 02 Aug 1995 17:03:22 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 : SIDEBARGlyphx.CPP * 24 * * 25 * Programmer : Steve Tall * 26 * * 27 * Start Date : March 14th, 2019 * 28 * * 29 * Last Update : March 14th, 2019 * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 33 34 #include "function.h" 35 #include "SidebarGlyphx.h" 36 37 38 /* 39 ** ST - 3/14/2019 10:49AM 40 ** 41 ** We are going to need one sidebar per player for multiplayer with GlyphX. We can't have different maps / cell arrays per 42 ** player though, so SidebarClass being in the middle of the map/display class hierarchy is a problem. 43 ** 44 ** All the class static data will have to be made non-static so we can have multiple instances. 45 ** 46 ** So, this is a stub sidebar class with the functionality we need just to support the exporting of production data to the 47 ** GlyphX client. 48 ** 49 ** 50 */ 51 52 53 54 /*********************************************************************************************** 55 * SidebarGlyphxClass::SidebarGlyphxClass -- Default constructor for the sidebar. * 56 * * 57 * Constructor for the sidebar handler. It basically sets up the sidebar to the empty * 58 * condition. * 59 * * 60 * INPUT: none * 61 * * 62 * OUTPUT: none * 63 * * 64 * WARNINGS: none * 65 * * 66 * HISTORY: * 67 * 11/17/1994 JLB : Created. * 68 *=============================================================================================*/ 69 SidebarGlyphxClass::SidebarGlyphxClass(void) 70 { 71 //IsRepairActive = false; 72 //IsUpgradeActive = false; 73 //IsDemolishActive = false; 74 } 75 76 77 78 79 /*********************************************************************************************** 80 * SidebarGlyphxClass::Init_Clear -- Sets sidebar to a known (and deactivated) state * 81 * * 82 * INPUT: none * 83 * * 84 * OUTPUT: none * 85 * * 86 * WARNINGS: none * 87 * * 88 * HISTORY: * 89 * 12/24/1994 JLB : Created. * 90 *=============================================================================================*/ 91 void SidebarGlyphxClass::Init_Clear(HouseClass *player_ptr) 92 { 93 SidebarPlayerPtr = player_ptr; 94 95 //IsRepairActive = false; 96 //IsUpgradeActive = false; 97 //IsDemolishActive = false; 98 99 Column[0].Set_Parent_Sidebar(this); 100 Column[1].Set_Parent_Sidebar(this); 101 102 Column[0].Init_Clear(); 103 Column[1].Init_Clear(); 104 105 106 //Activate(false); 107 } 108 109 110 /*********************************************************************************************** 111 * SidebarGlyphxClass::Init_IO -- Adds buttons to the button list * 112 * * 113 * INPUT: none * 114 * * 115 * OUTPUT: none * 116 * * 117 * WARNINGS: none * 118 * * 119 * HISTORY: * 120 * 12/24/1994 JLB : Created. * 121 *=============================================================================================*/ 122 void SidebarGlyphxClass::Init_IO(void) 123 { 124 /* 125 ** If a game was loaded & the sidebar was enabled, pop it up now 126 */ 127 //if (IsSidebarActive) { 128 // IsSidebarActive = false; 129 // Activate(1); 130 //} 131 } 132 133 134 135 /*********************************************************************************************** 136 * SidebarGlyphxClass::Which_Column -- Determines which column a given type should appear. * 137 * * 138 * Use this function to resolve what column the specified object type should be placed * 139 * into. * 140 * * 141 * INPUT: otype -- Pointer to the object type class of the object in question. * 142 * * 143 * OUTPUT: Returns with the column number that the object should be placed in. * 144 * * 145 * WARNINGS: none * 146 * * 147 * HISTORY: * 148 * 01/01/1995 JLB : Created. * 149 *=============================================================================================*/ 150 int SidebarGlyphxClass::Which_Column(RTTIType type) 151 { 152 if (type == RTTI_BUILDINGTYPE || type == RTTI_BUILDING) { 153 return(0); 154 } 155 return(1); 156 } 157 158 159 /*********************************************************************************************** 160 * SidebarGlyphxClass::Factory_Link -- Links a factory to a sidebar strip. * 161 * * 162 * This routine will link the specified factory to the sidebar strip. A factory must be * 163 * linked to the sidebar so that as the factory production progresses, the sidebar will * 164 * show the production progress. * 165 * * 166 * INPUT: factory -- The factory number to attach. * 167 * * 168 * type -- The object type number. * 169 * * 170 * id -- The object sub-type number. * 171 * * 172 * OUTPUT: Was the factory successfully attached to the sidebar strip? * 173 * * 174 * WARNINGS: none * 175 * * 176 * HISTORY: * 177 * 05/19/1995 JLB : Created. * 178 *=============================================================================================*/ 179 bool SidebarGlyphxClass::Factory_Link(int factory, RTTIType type, int id) 180 { 181 return(Column[Which_Column(type)].Factory_Link(factory, type, id)); 182 } 183 184 185 186 /*********************************************************************************************** 187 * SidebarGlyphxClass::Add -- Adds a game object to the sidebar list. * 188 * * 189 * This routine is used to add a game object to the sidebar. Call this routine when a * 190 * factory type building is created. It handles the case of adding an item that has already * 191 * been added -- it just ignores it. * 192 * * 193 * INPUT: object -- Pointer to the object that is being added. * 194 * * 195 * OUTPUT: bool; Was the object added to the sidebar? * 196 * * 197 * WARNINGS: none * 198 * * 199 * HISTORY: * 200 * 11/17/1994 JLB : Created. * 201 *=============================================================================================*/ 202 bool SidebarGlyphxClass::Add(RTTIType type, int id, bool via_capture) 203 { 204 int column; 205 206 /* 207 ** Add the sidebar only if we're not in editor mode. 208 */ 209 if (!Debug_Map) { 210 column = Which_Column(type); 211 212 if (Column[column].Add(type, id, via_capture)) { 213 //Activate(1); 214 return(true); 215 } 216 return(false); 217 } 218 219 return(false); 220 } 221 222 223 224 /*********************************************************************************************** 225 * SidebarGlyphxClass::AI -- Handles player clicking on sidebar area. * 226 * * 227 * This routine handles the processing necessary when the player clicks on the sidebar. * 228 * Typically, this is selection of the item to build. * 229 * * 230 * INPUT: input -- Reference to the keyboard input value. * 231 * * 232 * x,y -- Mouse coordinates at time of input. * 233 * * 234 * OUTPUT: bool; Was the click handled? * 235 * * 236 * WARNINGS: none * 237 * * 238 * HISTORY: * 239 * 10/28/94 JLB : Created. * 240 * 11/11/1994 JLB : Processes input directly. * 241 * 12/26/1994 JLB : Uses factory manager class for construction handling. * 242 * 12/31/1994 JLB : Simplified to use the sidebar strip class handlers. * 243 * 12/31/1994 JLB : Uses mouse coordinate parameters. * 244 * 06/27/1995 JLB : <TAB> key toggles sidebar. * 245 *=============================================================================================*/ 246 void SidebarGlyphxClass::AI(KeyNumType & input, int x, int y) 247 { 248 if (!Debug_Map) { 249 Column[0].AI(input, x, y); 250 Column[1].AI(input, x, y); 251 } 252 } 253 254 255 /*********************************************************************************************** 256 * SidebarGlyphxClass::Recalc -- Examines the sidebar data and updates it as necessary. * 257 * * 258 * Occasionally a factory gets destroyed. This routine must be called in such a case * 259 * because it might be possible that sidebar object need to be removed. This routine will * 260 * examine all existing objects in the sidebar class and if no possible factory can * 261 * produce it, then it will be removed. * 262 * * 263 * INPUT: none * 264 * * 265 * OUTPUT: none * 266 * * 267 * WARNINGS: This routine is exhaustive and thus time consuming. Only call it when really * 268 * necessary. Such as when a factory is destroyed rather than when a non-factory * 269 * is destroyed. * 270 * * 271 * HISTORY: * 272 * 11/30/1994 JLB : Created. * 273 *=============================================================================================*/ 274 void SidebarGlyphxClass::Recalc(void) 275 { 276 Column[0].Recalc(); 277 Column[1].Recalc(); 278 } 279 280 281 282 /*********************************************************************************************** 283 * SidebarGlyphxClass::StripClass::StripClass -- Default constructor for the side strip class. * 284 * * 285 * This constructor is used to reset the side strip to default empty state. * 286 * * 287 * INPUT: none * 288 * * 289 * OUTPUT: none * 290 * * 291 * WARNINGS: none * 292 * * 293 * HISTORY: * 294 * 12/31/1994 JLB : Created. * 295 *=============================================================================================*/ 296 SidebarGlyphxClass::StripClass::StripClass(void) 297 { 298 IsBuilding = false; 299 BuildableCount = 0; 300 for (int index = 0; index < MAX_BUILDABLES; index++) { 301 Buildables[index].BuildableID = 0; 302 Buildables[index].BuildableType = RTTI_NONE; 303 Buildables[index].Factory = -1; 304 Buildables[index].BuildableViaCapture = false; 305 } 306 ParentSidebar = NULL; 307 } 308 309 310 311 /*********************************************************************************************** 312 * SidebarGlyphxClass::StripClass::Init_Clear -- Sets sidebar to a known (and deactivated) state* 313 * * 314 * INPUT: none * 315 * * 316 * OUTPUT: none * 317 * * 318 * WARNINGS: none * 319 * * 320 * HISTORY: * 321 * 12/24/1994 JLB : Created. * 322 *=============================================================================================*/ 323 void SidebarGlyphxClass::StripClass::Init_Clear(void) 324 { 325 IsBuilding = false; 326 BuildableCount = 0; 327 328 /* 329 ** Since we're resetting the strips, clear out all the buildables & factory pointers. 330 */ 331 for (int index = 0; index < MAX_BUILDABLES; index++) { 332 Buildables[index].BuildableID = 0; 333 Buildables[index].BuildableType = RTTI_NONE; 334 Buildables[index].Factory = -1; 335 Buildables[index].BuildableViaCapture = false; 336 } 337 } 338 339 340 341 342 /*********************************************************************************************** 343 * SidebarGlyphxClass::StripClass::Add -- Add an object to the side strip. * 344 * * 345 * Use this routine to add a buildable object to the side strip. * 346 * * 347 * INPUT: object -- Pointer to the object type that can be built and is to be added to * 348 * the side strip. * 349 * * 350 * OUTPUT: bool; Was the object successfully added to the side strip? Failure could be the * 351 * result of running out of room in the side strip array or the object might * 352 * already be in the list. * 353 * * 354 * WARNINGS: none. * 355 * * 356 * HISTORY: * 357 * 12/31/1994 JLB : Created. * 358 *=============================================================================================*/ 359 bool SidebarGlyphxClass::StripClass::Add(RTTIType type, int id, bool via_capture) 360 { 361 if (BuildableCount <= MAX_BUILDABLES) { 362 for (int index = 0; index < BuildableCount; index++) { 363 if (Buildables[index].BuildableType == type && Buildables[index].BuildableID == id) { 364 return(false); 365 } 366 } 367 if (!ScenarioInit && type != RTTI_SPECIAL) { 368 Speak(VOX_NEW_CONSTRUCT); 369 } 370 Buildables[BuildableCount].BuildableType = type; 371 Buildables[BuildableCount].BuildableID = id; 372 Buildables[BuildableCount].Factory = -1; 373 Buildables[BuildableCount].BuildableViaCapture = via_capture; 374 BuildableCount++; 375 return(true); 376 } 377 return(false); 378 } 379 380 381 382 /*********************************************************************************************** 383 * SidebarGlyphxClass::StripClass::AI -- Input and AI processing for the side strip. * 384 * * 385 * The side strip AI processing is performed by this function. This function not only * 386 * checks for player input, but also handles any graphic logic updating necessary as a * 387 * result of flashing or construction animation. * 388 * * 389 * INPUT: input -- The player input code. * 390 * * 391 * x,y -- Mouse coordinate to use. * 392 * * 393 * OUTPUT: bool; Did the AI detect that it will need a rendering change? If this routine * 394 * returns true, then the Draw_It function should be called at the * 395 * earliest opportunity. * 396 * * 397 * WARNINGS: none * 398 * * 399 * HISTORY: * 400 * 12/31/1994 JLB : Created. * 401 * 12/31/1994 JLB : Uses mouse coordinate parameters. * 402 *=============================================================================================*/ 403 bool SidebarGlyphxClass::StripClass::AI(KeyNumType & input, int , int ) 404 { 405 /* 406 ** This is needed as it's where units get queued for structure exit. ST -3/14/2019 12:03PM 407 */ 408 409 410 if (IsBuilding) { 411 for (int index = 0; index < BuildableCount; index++) { 412 int factoryid = Buildables[index].Factory; 413 414 if (factoryid != -1) { 415 FactoryClass * factory = Factories.Raw_Ptr(factoryid); 416 417 if (factory && (factory->Has_Changed() || factory->Is_Blocked())) { 418 419 if (factory->Has_Completed()) { 420 421 /* 422 ** Construction has been completed. Announce this fact to the player and 423 ** try to get the object to automatically leave the factory. Buildings are 424 ** the main exception to the ability to leave the factory under their own 425 ** power. 426 */ 427 TechnoClass * pending = factory->Get_Object(); 428 if (pending) { 429 switch (pending->What_Am_I()) { 430 case RTTI_VESSEL: 431 case RTTI_UNIT: 432 case RTTI_AIRCRAFT: 433 OutList.Add(EventClass(EventClass::PLACE, pending->What_Am_I(), -1)); 434 if (!factory->Is_Blocked()) { 435 Speak(VOX_UNIT_READY); 436 } 437 break; 438 439 case RTTI_BUILDING: 440 if (!factory->Is_Blocked()) { 441 Speak(VOX_CONSTRUCTION); 442 } 443 break; 444 445 case RTTI_INFANTRY: 446 OutList.Add(EventClass(EventClass::PLACE, pending->What_Am_I(), -1)); 447 if (!factory->Is_Blocked()) { 448 Speak(VOX_UNIT_READY); 449 } 450 break; 451 } 452 } 453 } 454 } 455 } 456 } 457 } 458 459 return(false); 460 } 461 462 463 464 465 /*********************************************************************************************** 466 * SidebarGlyphxClass::StripClass::Recalc -- Revalidates the current sidebar list of objects. * 467 * * 468 * This routine will revalidate all the buildable objects in the sidebar. This routine * 469 * comes in handy when a factory has been destroyed, and the sidebar needs to reflect any * 470 * change that this requires. It checks every object to see if there is a factory available * 471 * that could produce it. If none can be found, then the object is removed from the * 472 * sidebar. * 473 * * 474 * INPUT: none * 475 * * 476 * OUTPUT: bool; The sidebar has changed as a result of this call? * 477 * * 478 * WARNINGS: none * 479 * * 480 * HISTORY: * 481 * 01/19/1995 JLB : Created. * 482 * 06/26/1995 JLB : Doesn't collapse sidebar when buildables removed. * 483 *=============================================================================================*/ 484 bool SidebarGlyphxClass::StripClass::Recalc(void) 485 { 486 int ok; 487 488 if (Debug_Map || !BuildableCount) { 489 return(false); 490 } 491 492 /* 493 ** Sweep through all objects listed in the sidebar. If any of those object can 494 ** not be created -- even in theory -- then they must be removed form the sidebar and 495 ** any current production must be abandoned. 496 */ 497 for (int index = 0; index < BuildableCount; index++) { 498 TechnoTypeClass const * tech = Fetch_Techno_Type(Buildables[index].BuildableType, Buildables[index].BuildableID); 499 if (tech) { 500 ok = tech->Who_Can_Build_Me(true, false, ParentSidebar->SidebarPlayerPtr->Class->House) != NULL; 501 } else { 502 503 if ((unsigned)Buildables[index].BuildableID < SPC_COUNT) { 504 ok = ParentSidebar->SidebarPlayerPtr->SuperWeapon[Buildables[index].BuildableID].Is_Present(); 505 } else { 506 ok = false; 507 } 508 } 509 510 if (!ok) { 511 512 /* 513 ** Removes this entry from the list. 514 */ 515 if (BuildableCount > 1 && index < BuildableCount-1) { 516 memcpy(&Buildables[index], &Buildables[index+1], sizeof(Buildables[0])*((BuildableCount-index)-1)); 517 } 518 BuildableCount--; 519 index--; 520 521 Buildables[BuildableCount].BuildableID = 0; 522 Buildables[BuildableCount].BuildableType = RTTI_NONE; 523 Buildables[BuildableCount].Factory = -1; 524 Buildables[BuildableCount].BuildableViaCapture = false; 525 } 526 } 527 528 return(false); 529 } 530 531 532 533 /*********************************************************************************************** 534 * SidebarGlyphxClass::StripClass::Factory_Link -- Links a factory to a sidebar button. * 535 * * 536 * This routine will link the specified factory to this sidebar strip. The exact button to * 537 * link to is determined from the object type and id specified. A linked button is one that * 538 * will show appropriate construction animation (clock shape) that matches the state of * 539 * the factory. * 540 * * 541 * INPUT: factory -- The factory number to link to the sidebar. * 542 * * 543 * type -- The object type that this factory refers to. * 544 * * 545 * id -- The object sub-type that this factory refers to. * 546 * * 547 * OUTPUT: Was the factory successfully attached? Failure would indicate that there is no * 548 * object of the specified type and sub-type in the sidebar list. * 549 * * 550 * WARNINGS: none * 551 * * 552 * HISTORY: * 553 * 05/18/1995 JLB : Created. * 554 *=============================================================================================*/ 555 bool SidebarGlyphxClass::StripClass::Factory_Link(int factory, RTTIType type, int id) 556 { 557 for (int index = 0; index < BuildableCount; index++) { 558 if (Buildables[index].BuildableType == type && Buildables[index].BuildableID == id) { 559 Buildables[index].Factory = factory; 560 IsBuilding = true; 561 562 return(true); 563 } 564 } 565 return(false); 566 } 567 568 569 /*********************************************************************************************** 570 * SidebarGlyphxClass::Abandon_Production -- Stops production of the object specified. * 571 * * 572 * This routine is used to abandon production of the object specified. The factory will * 573 * be completely disabled by this call. * 574 * * 575 * INPUT: type -- The object type that is to be abandoned. The sub-type is not needed * 576 * since it is presumed there can be only one type in production at any * 577 * one time. * 578 * * 579 * factory -- The factory number that is doing the production. * 580 * * 581 * OUTPUT: Was the factory successfully abandoned? * 582 * * 583 * WARNINGS: none * 584 * * 585 * HISTORY: * 586 * 05/18/1995 JLB : Created. * 587 *=============================================================================================*/ 588 bool SidebarGlyphxClass::Abandon_Production(RTTIType type, int factory) 589 { 590 return(Column[Which_Column(type)].Abandon_Production(factory)); 591 } 592 593 594 /*********************************************************************************************** 595 * SidebarGlyphxClass::StripClass::Abandon_Produ -- Abandons production associated with sidebar. * 596 * * 597 * Production of the object associated with this sidebar is abandoned when this routine is * 598 * called. * 599 * * 600 * INPUT: factory -- The factory index that is to be suspended. * 601 * * 602 * OUTPUT: Was the production abandonment successful? * 603 * * 604 * WARNINGS: none * 605 * * 606 * HISTORY: * 607 * 05/18/1995 JLB : Created. * 608 * 08/06/1995 JLB : More intelligent abandon logic for multiple factories. * 609 *=============================================================================================*/ 610 bool SidebarGlyphxClass::StripClass::Abandon_Production(int factory) 611 { 612 bool noprod = true; 613 bool abandon = false; 614 for (int index = 0; index < BuildableCount; index++) { 615 if (Buildables[index].Factory == factory) { 616 Factories.Raw_Ptr(factory)->Abandon(); 617 Buildables[index].Factory = -1; 618 abandon = true; 619 } else { 620 if (Buildables[index].Factory != -1) { 621 noprod = false; 622 } 623 } 624 } 625 626 /* 627 ** If there is no production whatsoever on this strip, then flag it so. 628 */ 629 if (noprod) { 630 IsBuilding = false; 631 } 632 return(abandon); 633 } 634 635 /*********************************************************************************************** 636 * SidebarGlyphxClass::Code_Pointers -- Converts classes pointers to savable representation * 637 * * 638 * INPUT: none * 639 * * 640 * OUTPUT: none * 641 * * 642 * WARNINGS: none * 643 * * 644 * HISTORY: * 645 * 9/25/2019 5:36PM ST : Created. * 646 *=============================================================================================*/ 647 void SidebarGlyphxClass::Code_Pointers(void) 648 { 649 if (SidebarPlayerPtr) { 650 ((HouseClass *&)SidebarPlayerPtr) = (HouseClass *)SidebarPlayerPtr->Class->House; 651 } else { 652 ((HouseClass *&)SidebarPlayerPtr) = (HouseClass *)HOUSE_NONE; 653 } 654 } 655 656 657 /*********************************************************************************************** 658 * SidebarGlyphxClass::Decode_Pointers -- Converts classes savable representation to run-time * 659 * * 660 * INPUT: none * 661 * * 662 * OUTPUT: none * 663 * * 664 * WARNINGS: none * 665 * * 666 * HISTORY: * 667 * 9/25/2019 5:36PM ST : Created. * 668 *=============================================================================================*/ 669 void SidebarGlyphxClass::Decode_Pointers(void) 670 { 671 if (*((HousesType*)&SidebarPlayerPtr) == HOUSE_NONE) { 672 SidebarPlayerPtr = NULL; 673 } else { 674 ((HouseClass *&)SidebarPlayerPtr) = HouseClass::As_Pointer(*((HousesType*)&SidebarPlayerPtr)); 675 } 676 } 677 678 679 /*********************************************************************************************** 680 * SidebarGlyphxClass::Load -- Loads from a save game file. * 681 * * 682 * INPUT: file -- The file to read the data from. * 683 * * 684 * OUTPUT: true = success, false = failure * 685 * * 686 * WARNINGS: none * 687 * * 688 * HISTORY: * 689 * 9/26/2019 10:57AM ST : Created. * 690 *=============================================================================================*/ 691 bool SidebarGlyphxClass::Load(Straw &file) 692 { 693 ::new (this) SidebarGlyphxClass(); 694 695 //bool ok = Read_Object(this, sizeof(*this), file, false); 696 if (file.Get(this, sizeof(*this)) != sizeof(*this)) { 697 return false; 698 } 699 700 Column[0].Set_Parent_Sidebar(this); 701 Column[1].Set_Parent_Sidebar(this); 702 703 return true; 704 } 705 706 707 /*********************************************************************************************** 708 * SidebarGlyphxClass::Save -- Write to a save game file. * 709 * * 710 * INPUT: file -- The file to write the data to. * 711 * * 712 * OUTPUT: true = success, false = failure * 713 * * 714 * WARNINGS: none * 715 * * 716 * HISTORY: * 717 * 9/26/2019 10:57AM ST : Created. * 718 *=============================================================================================*/ 719 bool SidebarGlyphxClass::Save(Pipe &file) 720 { 721 //return(Write_Object(this, sizeof(*this), file)); 722 723 file.Put(this, sizeof(*this)); 724 725 return true; 726 } 727 728 729 extern SidebarGlyphxClass *Get_Current_Context_Sidebar(HouseClass *player_ptr); 730 731 void Sidebar_Glyphx_Init_Clear(HouseClass *player_ptr) 732 { 733 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 734 if (sidebar) { 735 sidebar->Init_Clear(player_ptr); 736 } 737 } 738 739 void Sidebar_Glyphx_Init_IO(HouseClass *player_ptr) 740 { 741 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 742 if (sidebar) { 743 sidebar->Init_IO(); 744 } 745 } 746 747 bool Sidebar_Glyphx_Abandon_Production(RTTIType type, int factory, HouseClass *player_ptr) 748 { 749 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 750 if (sidebar) { 751 return sidebar->Abandon_Production(type, factory); 752 } 753 754 return false; 755 } 756 757 bool Sidebar_Glyphx_Add(RTTIType type, int id, HouseClass *player_ptr, bool via_capture) 758 { 759 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 760 if (sidebar) { 761 return sidebar->Add(type, id, via_capture); 762 } 763 764 return false; 765 } 766 767 void Sidebar_Glyphx_Recalc(HouseClass *player_ptr) 768 { 769 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 770 if (sidebar) { 771 sidebar->Recalc(); 772 } 773 } 774 775 void Sidebar_Glyphx_AI(HouseClass *player_ptr, KeyNumType & input) 776 { 777 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 778 if (sidebar) { 779 sidebar->AI(input, 0, 0); 780 } 781 } 782 783 bool Sidebar_Glyphx_Factory_Link(int factory, RTTIType type, int id, HouseClass *player_ptr) 784 { 785 SidebarGlyphxClass *sidebar = Get_Current_Context_Sidebar(player_ptr); 786 if (sidebar) { 787 return sidebar->Factory_Link(factory, type, id); 788 } 789 790 return false; 791 } 792 793 bool Sidebar_Glyphx_Save(Pipe &file, SidebarGlyphxClass *sidebar) 794 { 795 if (sidebar) { 796 return sidebar->Save(file); 797 } 798 return false; 799 } 800 801 bool Sidebar_Glyphx_Load(Straw &file, SidebarGlyphxClass *sidebar) 802 { 803 if (sidebar) { 804 return sidebar->Load(file); 805 } 806 return false; 807 } 808 809 void Sidebar_Glyphx_Code_Pointers(SidebarGlyphxClass *sidebar) 810 { 811 if (sidebar) { 812 sidebar->Code_Pointers(); 813 } 814 } 815 816 void Sidebar_Glyphx_Decode_Pointers(SidebarGlyphxClass *sidebar) 817 { 818 if (sidebar) { 819 sidebar->Decode_Pointers(); 820 } 821 }