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