economy.c
changeset 4845 72bbb6e2694e
parent 4814 8e8f3b110279
child 4848 45f848b46222
equal deleted inserted replaced
4844:10fde6a49e04 4845:72bbb6e2694e
   386 				NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   386 				NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   387 			break;
   387 			break;
   388 		case 3: {
   388 		case 3: {
   389 			/* XXX - In multiplayer, should we ask other players if it wants to take
   389 			/* XXX - In multiplayer, should we ask other players if it wants to take
   390 		          over when it is a human company? -- TrueLight */
   390 		          over when it is a human company? -- TrueLight */
   391 			if (IS_HUMAN_PLAYER(owner)) {
   391 			if (IsHumanPlayer(owner)) {
   392 				AddNewsItem( (StringID)(owner + 16),
   392 				AddNewsItem( (StringID)(owner + 16),
   393 					NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   393 					NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   394 				break;
   394 				break;
   395 			}
   395 			}
   396 
   396 
   413 			SetDParam(0, p->name_1);
   413 			SetDParam(0, p->name_1);
   414 			SetDParam(1, p->name_2);
   414 			SetDParam(1, p->name_2);
   415 			AddNewsItem( (StringID)(owner + 16*3), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   415 			AddNewsItem( (StringID)(owner + 16*3), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
   416 
   416 
   417 			// If the player is human, and it is no network play, leave the player playing
   417 			// If the player is human, and it is no network play, leave the player playing
   418 			if (IS_HUMAN_PLAYER(owner) && !_networking) {
   418 			if (IsHumanPlayer(owner) && !_networking) {
   419 				p->bankrupt_asked = 255;
   419 				p->bankrupt_asked = 255;
   420 				p->bankrupt_timeout = 0x456;
   420 				p->bankrupt_timeout = 0x456;
   421 			} else {
   421 			} else {
   422 #ifdef ENABLE_NETWORK
   422 #ifdef ENABLE_NETWORK
   423 				if (IS_HUMAN_PLAYER(owner) && _network_server) {
   423 				if (IsHumanPlayer(owner) && _network_server) {
   424 					// If we are the server, make sure it is clear that his player is no
   424 					// If we are the server, make sure it is clear that his player is no
   425 					//  longer with us!
   425 					//  longer with us!
   426 					NetworkClientInfo *ci;
   426 					NetworkClientInfo *ci;
   427 					NetworkClientState *cs;
   427 					NetworkClientState *cs;
   428 					/* Find all clients that were in control of this company */
   428 					/* Find all clients that were in control of this company */
   434 							NetworkUpdateClientInfo(_network_own_client_index);
   434 							NetworkUpdateClientInfo(_network_own_client_index);
   435 						}
   435 						}
   436 					}
   436 					}
   437 				}
   437 				}
   438 				// Make sure the player no longer controls the company
   438 				// Make sure the player no longer controls the company
   439 				if (IS_HUMAN_PLAYER(owner) && owner == _local_player) {
   439 				if (IsHumanPlayer(owner) && owner == _local_player) {
   440 					// Switch the player to spectator..
   440 					// Switch the player to spectator..
   441 					_local_player = OWNER_SPECTATOR;
   441 					_local_player = OWNER_SPECTATOR;
   442 				}
   442 				}
   443 #endif /* ENABLE_NETWORK */
   443 #endif /* ENABLE_NETWORK */
   444 
   444 
   445 				/* Remove the player */
   445 				/* Remove the player */
   446 				ChangeOwnershipOfPlayerItems(owner, OWNER_SPECTATOR);
   446 				ChangeOwnershipOfPlayerItems(owner, OWNER_SPECTATOR);
   447 				// Register the player as not-active
   447 				// Register the player as not-active
   448 				p->is_active = false;
   448 				p->is_active = false;
   449 
   449 
   450 				if (!IS_HUMAN_PLAYER(owner) && (!_networking || _network_server) && _ai.enabled)
   450 				if (!IsHumanPlayer(owner) && (!_networking || _network_server) && _ai.enabled)
   451 					AI_PlayerDied(owner);
   451 					AI_PlayerDied(owner);
   452 				if (IS_HUMAN_PLAYER(owner) && owner == _local_player && _ai.network_client)
   452 				if (IsHumanPlayer(owner) && owner == _local_player && _ai.network_client)
   453 					AI_PlayerDied(owner);
   453 					AI_PlayerDied(owner);
   454 			}
   454 			}
   455 		}
   455 		}
   456 	}
   456 	}
   457 }
   457 }