src/players.cpp
branch0.6
changeset 10366 960aae8c20e2
parent 10324 adab4d41a259
child 11127 5e9620220703
equal deleted inserted replaced
10364:40889da45fc9 10366:960aae8c20e2
   451 {
   451 {
   452 	Player *p;
   452 	Player *p;
   453 	/* Find a free slot */
   453 	/* Find a free slot */
   454 	FOR_ALL_PLAYERS(p) {
   454 	FOR_ALL_PLAYERS(p) {
   455 		if (!p->is_active) {
   455 		if (!p->is_active) {
       
   456 			free(p->name);
       
   457 			free(p->president_name);
   456 			PlayerID i = p->index;
   458 			PlayerID i = p->index;
   457 			memset(p, 0, sizeof(Player));
   459 			memset(p, 0, sizeof(Player));
   458 			memset(&_players_ai[i], 0, sizeof(PlayerAI));
   460 			memset(&_players_ai[i], 0, sizeof(PlayerAI));
   459 			memset(&_players_ainew[i], 0, sizeof(PlayerAiNew));
   461 			memset(&_players_ainew[i], 0, sizeof(PlayerAiNew));
   460 			p->index = i;
   462 			p->index = i;
   910 
   912 
   911 			/* Remove the company */
   913 			/* Remove the company */
   912 			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
   914 			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
   913 			p->is_active = false;
   915 			p->is_active = false;
   914 		}
   916 		}
   915 		RemoveAllEngineReplacementForPlayer(p);
       
   916 		RemoveAllGroupsForPlayer(p->index);
       
   917 
       
   918 	} break;
   917 	} break;
   919 
   918 
   920 	case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */
   919 	case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */
   921 		PlayerID pid_old = (PlayerID)GB(p2,  0, 16);
   920 		PlayerID pid_old = (PlayerID)GB(p2,  0, 16);
   922 		PlayerID pid_new = (PlayerID)GB(p2, 16, 16);
   921 		PlayerID pid_new = (PlayerID)GB(p2, 16, 16);