513 |
513 |
514 switch (p->quarters_of_bankrupcy) { |
514 switch (p->quarters_of_bankrupcy) { |
515 case 2: |
515 case 2: |
516 AddNewsItem((StringID)(owner | NB_BTROUBLE), |
516 AddNewsItem((StringID)(owner | NB_BTROUBLE), |
517 NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0); |
517 NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0); |
|
518 for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
|
519 AI_Event(i, new AIEventCompanyInTrouble(owner)); |
|
520 } |
518 break; |
521 break; |
519 case 3: { |
522 case 3: { |
520 /* XXX - In multiplayer, should we ask other players if it wants to take |
523 /* XXX - In multiplayer, should we ask other players if it wants to take |
521 over when it is a human company? -- TrueLight */ |
524 over when it is a human company? -- TrueLight */ |
522 if (IsHumanPlayer(owner)) { |
525 if (IsHumanPlayer(owner)) { |
561 ChangeOwnershipOfPlayerItems(owner, PLAYER_SPECTATOR); |
564 ChangeOwnershipOfPlayerItems(owner, PLAYER_SPECTATOR); |
562 /* Register the player as not-active */ |
565 /* Register the player as not-active */ |
563 p->is_active = false; |
566 p->is_active = false; |
564 |
567 |
565 if (!IsHumanPlayer(owner)) AI_PlayerDied(owner); |
568 if (!IsHumanPlayer(owner)) AI_PlayerDied(owner); |
|
569 |
|
570 /* If the player keeps playing, don't inform the ai of the bankrupt, since |
|
571 * it might get confused. */ |
|
572 for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
|
573 AI_Event(i, new AIEventCompanyBankrupt(owner)); |
|
574 } |
566 } |
575 } |
567 } |
576 } |
568 } |
577 } |
569 |
578 |
570 void DrawNewsBankrupcy(Window *w, const NewsItem *ni) |
579 void DrawNewsBankrupcy(Window *w, const NewsItem *ni) |
1836 static void DoAcquireCompany(Player *p) |
1845 static void DoAcquireCompany(Player *p) |
1837 { |
1846 { |
1838 Player *owner; |
1847 Player *owner; |
1839 int i; |
1848 int i; |
1840 Money value; |
1849 Money value; |
|
1850 PlayerID pi = p->index; |
1841 |
1851 |
1842 SetDParam(0, p->index); |
1852 SetDParam(0, p->index); |
1843 SetDParam(1, p->bankrupt_value); |
1853 SetDParam(1, p->bankrupt_value); |
1844 AddNewsItem((StringID)(_current_player | NB_BMERGER), NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0); |
1854 AddNewsItem((StringID)(_current_player | NB_BMERGER), NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0); |
|
1855 for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
|
1856 AI_Event(i, new AIEventCompanyMerger(pi, _current_player)); |
|
1857 } |
1845 |
1858 |
1846 /* original code does this a little bit differently */ |
1859 /* original code does this a little bit differently */ |
1847 PlayerID pi = p->index; |
|
1848 ChangeNetworkOwner(pi, _current_player); |
1860 ChangeNetworkOwner(pi, _current_player); |
1849 ChangeOwnershipOfPlayerItems(pi, _current_player); |
1861 ChangeOwnershipOfPlayerItems(pi, _current_player); |
1850 |
1862 |
1851 if (p->bankrupt_value == 0) { |
1863 if (p->bankrupt_value == 0) { |
1852 owner = GetPlayer(_current_player); |
1864 owner = GetPlayer(_current_player); |