Changeset - r25197:81f87c2b998f
[Not reviewed]
master
0 6 0
Patric Stout - 3 years ago 2021-04-20 14:42:37
truebrain@openttd.org
Remove: "map_name" from server announcements / listing

The idea back in the days was nice, but it never resulted in
anything useful. Most servers either read "(loaded game)" or
"Random Map", neither being useful. It was meant for heightmaps,
so you could find a server that was using a specific one .. but
there are many things wrong with that idea. Mostly, servers tend
to save and load savegames from time to time, after which the
original heightmap used was lost.

All in all, removing map_name all together is just better.
6 files changed with 3 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/network/core/game.h
Show inline comments
 
@@ -22,7 +22,6 @@
 
 * be sent to the clients.
 
 */
 
struct NetworkServerGameInfo {
 
	char map_name[NETWORK_NAME_LENGTH];             ///< Map which is played ["random" for a randomized map]
 
	byte clients_on;                                ///< Current count of clients on server
 
};
 

	
src/network/core/udp.cpp
Show inline comments
 
@@ -205,7 +205,7 @@ void NetworkUDPSocketHandler::SendNetwor
 
	p->Send_uint8 (info->clients_max);
 
	p->Send_uint8 (info->clients_on);
 
	p->Send_uint8 (info->spectators_on);
 
	p->Send_string(info->map_name);
 
	p->Send_string(""); // Used to be map-name.
 
	p->Send_uint16(info->map_width);
 
	p->Send_uint16(info->map_height);
 
	p->Send_uint8 (info->map_set);
 
@@ -275,7 +275,7 @@ void NetworkUDPSocketHandler::ReceiveNet
 
				info->game_date    = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
 
				info->start_date   = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
 
			}
 
			p->Recv_string(info->map_name, sizeof(info->map_name));
 
			while (p->Recv_uint8() != 0) {} // Used to contain the map-name.
 
			info->map_width      = p->Recv_uint16();
 
			info->map_height     = p->Recv_uint16();
 
			info->map_set        = p->Recv_uint8 ();
src/network/network_admin.cpp
Show inline comments
 
@@ -170,7 +170,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 
	p->Send_string(GetNetworkRevisionString());
 
	p->Send_bool  (_network_dedicated);
 

	
 
	p->Send_string(_network_game_info.map_name);
 
	p->Send_string(""); // Used to be map-name.
 
	p->Send_uint32(_settings_game.game_creation.generation_seed);
 
	p->Send_uint8 (_settings_game.game_creation.landscape);
 
	p->Send_uint32(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
src/network/network_gui.cpp
Show inline comments
 
@@ -628,7 +628,6 @@ public:
 

	
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_HOR_CENTER);
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 4 + FONT_HEIGHT_NORMAL, sel->info.server_name, TC_ORANGE, SA_HOR_CENTER); // game name
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 8 + 2 * FONT_HEIGHT_NORMAL, sel->info.map_name, TC_BLACK, SA_HOR_CENTER); // map name
 

	
 
			uint16 y = r.top + detail_height + 4;
 

	
src/network/network_udp.cpp
Show inline comments
 
@@ -190,7 +190,6 @@ void ServerNetworkUDPSocketHandler::Rece
 
	ngi.dedicated      = _network_dedicated;
 
	ngi.grfconfig      = _grfconfig;
 

	
 
	strecpy(ngi.map_name, _network_game_info.map_name, lastof(ngi.map_name));
 
	strecpy(ngi.server_name, _settings_client.network.server_name, lastof(ngi.server_name));
 
	strecpy(ngi.server_revision, GetNetworkRevisionString(), lastof(ngi.server_revision));
 

	
src/openttd.cpp
Show inline comments
 
@@ -1048,9 +1048,6 @@ void SwitchToMode(SwitchMode new_mode)
 

	
 
		case SM_RESTARTGAME: // Restart --> 'Random game' with current settings
 
		case SM_NEWGAME: // New Game --> 'Random game'
 
			if (_network_server) {
 
				seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "Random Map");
 
			}
 
			MakeNewGame(false, new_mode == SM_NEWGAME);
 
			break;
 

	
 
@@ -1073,18 +1070,12 @@ void SwitchToMode(SwitchMode new_mode)
 
				IConsoleCmdExec("exec scripts/game_start.scr 0");
 
				/* Decrease pause counter (was increased from opening load dialog) */
 
				DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
 
				if (_network_server) {
 
					seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title);
 
				}
 
			}
 
			break;
 
		}
 

	
 
		case SM_RESTART_HEIGHTMAP: // Load a heightmap and start a new game from it with current settings
 
		case SM_START_HEIGHTMAP: // Load a heightmap and start a new game from it
 
			if (_network_server) {
 
				seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Heightmap)", _file_to_saveload.title);
 
			}
 
			MakeNewGame(true, new_mode == SM_START_HEIGHTMAP);
 
			break;
 

	
0 comments (0 inline, 0 general)