src/players.cpp
changeset 10365 fa999605dd21
parent 10322 02d72ef5a6a7
child 10372 93844492fdd9
equal deleted inserted replaced
10363:d47dabff0d29 10365:fa999605dd21
   459 {
   459 {
   460 	Player *p;
   460 	Player *p;
   461 	/* Find a free slot */
   461 	/* Find a free slot */
   462 	FOR_ALL_PLAYERS(p) {
   462 	FOR_ALL_PLAYERS(p) {
   463 		if (!p->is_active) {
   463 		if (!p->is_active) {
       
   464 			free(p->name);
       
   465 			free(p->president_name);
   464 			PlayerID i = p->index;
   466 			PlayerID i = p->index;
   465 			memset(p, 0, sizeof(Player));
   467 			memset(p, 0, sizeof(Player));
   466 			memset(&_players_ai[i], 0, sizeof(PlayerAI));
   468 			memset(&_players_ai[i], 0, sizeof(PlayerAI));
   467 			memset(&_players_ainew[i], 0, sizeof(PlayerAiNew));
   469 			memset(&_players_ainew[i], 0, sizeof(PlayerAiNew));
   468 			p->index = i;
   470 			p->index = i;
   916 
   918 
   917 			/* Remove the company */
   919 			/* Remove the company */
   918 			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
   920 			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
   919 			p->is_active = false;
   921 			p->is_active = false;
   920 		}
   922 		}
   921 		RemoveAllEngineReplacementForPlayer(p);
       
   922 		RemoveAllGroupsForPlayer(p->index);
       
   923 
       
   924 	} break;
   923 	} break;
   925 
   924 
   926 	case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */
   925 	case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */
   927 		PlayerID pid_old = (PlayerID)GB(p2,  0, 16);
   926 		PlayerID pid_old = (PlayerID)GB(p2,  0, 16);
   928 		PlayerID pid_new = (PlayerID)GB(p2, 16, 16);
   927 		PlayerID pid_new = (PlayerID)GB(p2, 16, 16);