saveloadstatus.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "saveloadstatus.h"
  19. #include "mutex.h"
  20. #define MAX_STATUS_TEXT_ID 2
  21. static CriticalSectionClass text_mutex;
  22. static StringClass status_text[MAX_STATUS_TEXT_ID];
  23. void SaveLoadStatus::Set_Status_Text(const char* text,int id)
  24. {
  25. CriticalSectionClass::LockClass m(text_mutex);
  26. WWASSERT(id<MAX_STATUS_TEXT_ID);
  27. status_text[id]=text;
  28. if (id==0) status_text[1]="";
  29. }
  30. void SaveLoadStatus::Get_Status_Text(StringClass& text, int id)
  31. {
  32. CriticalSectionClass::LockClass m(text_mutex);
  33. WWASSERT(id<MAX_STATUS_TEXT_ID);
  34. text=status_text[id];
  35. }
  36. static int status_count;
  37. void SaveLoadStatus::Reset_Status_Count( void )
  38. {
  39. status_count = 0;
  40. }
  41. void SaveLoadStatus::Inc_Status_Count( void )
  42. {
  43. status_count++;
  44. }
  45. int SaveLoadStatus::Get_Status_Count( void )
  46. {
  47. return status_count;
  48. }