src/network/network_server.cpp
branchnoai
changeset 9724 b39bc69bb2f2
parent 9723 eee46cb39750
child 9837 c9ec4f82e0d0
equal deleted inserted replaced
9723:eee46cb39750 9724:b39bc69bb2f2
     6 #include "../openttd.h" // XXX StringID
     6 #include "../openttd.h" // XXX StringID
     7 #include "../debug.h"
     7 #include "../debug.h"
     8 #include "../strings_func.h"
     8 #include "../strings_func.h"
     9 #include "network_data.h"
     9 #include "network_data.h"
    10 #include "core/tcp.h"
    10 #include "core/tcp.h"
    11 #include "../train.h"
    11 #include "../vehicle_base.h"
    12 #include "../aircraft.h"
    12 #include "../vehicle_func.h"
    13 #include "../date_func.h"
    13 #include "../date_func.h"
    14 #include "table/strings.h"
       
    15 #include "network_server.h"
    14 #include "network_server.h"
    16 #include "network_udp.h"
    15 #include "network_udp.h"
    17 #include "../console.h"
    16 #include "../console.h"
    18 #include "../command_func.h"
    17 #include "../command_func.h"
    19 #include "../saveload.h"
    18 #include "../saveload.h"
    21 #include "../variables.h"
    20 #include "../variables.h"
    22 #include "../genworld.h"
    21 #include "../genworld.h"
    23 #include "../core/alloc_func.hpp"
    22 #include "../core/alloc_func.hpp"
    24 #include "../fileio.h"
    23 #include "../fileio.h"
    25 #include "../string_func.h"
    24 #include "../string_func.h"
       
    25 #include "../player_base.h"
       
    26 #include "../player_func.h"
       
    27 #include "../player_gui.h"
       
    28 #include "../settings_type.h"
       
    29 
       
    30 #include "table/strings.h"
    26 
    31 
    27 // This file handles all the server-commands
    32 // This file handles all the server-commands
    28 
    33 
    29 static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs);
    34 static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs);
    30 
    35 
  1294 		_network_player_info[p->index].performance = p->old_economy[0].performance_history;
  1299 		_network_player_info[p->index].performance = p->old_economy[0].performance_history;
  1295 	}
  1300 	}
  1296 
  1301 
  1297 	// Go through all vehicles and count the type of vehicles
  1302 	// Go through all vehicles and count the type of vehicles
  1298 	FOR_ALL_VEHICLES(v) {
  1303 	FOR_ALL_VEHICLES(v) {
  1299 		if (!IsValidPlayer(v->owner)) continue;
  1304 		if (!IsValidPlayer(v->owner) || !v->IsPrimaryVehicle()) continue;
  1300 
  1305 		byte type = 0;
  1301 		switch (v->type) {
  1306 		switch (v->type) {
  1302 			case VEH_TRAIN:
  1307 			case VEH_TRAIN: type = 0; break;
  1303 				if (IsFrontEngine(v)) _network_player_info[v->owner].num_vehicle[0]++;
  1308 			case VEH_ROAD: type = (v->cargo_type != CT_PASSENGERS) ? 1 : 2; break;
  1304 				break;
  1309 			case VEH_AIRCRAFT: type = 3; break;
  1305 
  1310 			case VEH_SHIP: type = 4; break;
  1306 			case VEH_ROAD:
  1311 			default: continue;
  1307 				if (v->cargo_type != CT_PASSENGERS) {
  1312 		}
  1308 					_network_player_info[v->owner].num_vehicle[1]++;
  1313 		_network_player_info[v->owner].num_vehicle[type]++;
  1309 				} else {
       
  1310 					_network_player_info[v->owner].num_vehicle[2]++;
       
  1311 				}
       
  1312 				break;
       
  1313 
       
  1314 			case VEH_AIRCRAFT:
       
  1315 				if (IsNormalAircraft(v)) _network_player_info[v->owner].num_vehicle[3]++;
       
  1316 				break;
       
  1317 
       
  1318 			case VEH_SHIP:
       
  1319 				_network_player_info[v->owner].num_vehicle[4]++;
       
  1320 				break;
       
  1321 
       
  1322 			default: break;
       
  1323 		}
       
  1324 	}
  1314 	}
  1325 
  1315 
  1326 	// Go through all stations and count the types of stations
  1316 	// Go through all stations and count the types of stations
  1327 	FOR_ALL_STATIONS(s) {
  1317 	FOR_ALL_STATIONS(s) {
  1328 		if (IsValidPlayer(s->owner)) {
  1318 		if (IsValidPlayer(s->owner)) {