1. switch (c->months_of_bankruptcy) {
  2. case 0:
  3. case 1:
  4. case 2:
  5. case 3:
  6. /* special case 4: warn company */
  7. case 5:
  8. case 6:
  9. /* special case 7: offer company for sale */
  10. case 8:
  11. case 9:
  12. break;
  13. /* special case 10: bankrupt! */
  14. case 4:{
  15. CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1);
  16. cni->FillData(c);
  17. SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
  18. SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
  19. SetDParamStr(2, cni->company_name);
  20. AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
  21. AI::BroadcastNewEvent(new ScriptEventCompanyInTrouble(c->index));
  22. Game::NewEvent(new ScriptEventCompanyInTrouble(c->index));
  23. break;
  24. }
  25. case 7: {
  26. /* Check if the company has any value.. if not, declare it bankrupt
  27. * right now */
  28. Money val = CalculateCompanyValue(c, false);
  29. if (val > 0) {
  30. c->bankrupt_value = val;
  31. c->bankrupt_asked = 1 << c->index; // Don't ask the owner
  32. c->bankrupt_timeout = 0;
  33. break;
  34. }
  35. /* FALL THROUGH to case 10... */
  36. }
  37. default:
  38. case 10:
  39. if (!_networking && _local_company == c->index) {
  40. /* If we are in offline mode, leave the company playing. Eg. there
  41. * is no THE-END, otherwise mark the client as spectator to make sure
  42. * he/she is no long in control of this company. However... when you
  43. * join another company (cheat) the "unowned" company can bankrupt. */
  44. c->bankrupt_asked = MAX_UVALUE(CompanyMask);
  45. break;
  46. }