Changeset - r14221:ad11f2ede08b
[Not reviewed]
master
2 6 0
rubidium - 15 years ago 2010-01-11 20:00:14
rubidium@openttd.org
(svn r18782) -Codechange: move the content of callback_table.cpp to network_command.cpp; it's only ever used there.
8 files changed with 32 insertions and 90 deletions:
0 comments (0 inline, 0 general)
projects/openttd_vs80.vcproj
Show inline comments
 
@@ -476,10 +476,6 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\callback_table.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\cargopacket.cpp"
 
				>
 
			</File>
 
@@ -812,10 +808,6 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\callback_table.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\cargo_type.h"
 
				>
 
			</File>
projects/openttd_vs90.vcproj
Show inline comments
 
@@ -473,10 +473,6 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\callback_table.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\cargopacket.cpp"
 
				>
 
			</File>
 
@@ -809,10 +805,6 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\callback_table.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\cargo_type.h"
 
				>
 
			</File>
source.list
Show inline comments
 
@@ -4,7 +4,6 @@ animated_tile.cpp
 
articulated_vehicles.cpp
 
autoreplace.cpp
 
bmp.cpp
 
callback_table.cpp
 
cargopacket.cpp
 
cargotype.cpp
 
cheat.cpp
 
@@ -112,7 +111,6 @@ base_media_func.h
 
base_station_base.h
 
bmp.h
 
bridge.h
 
callback_table.h
 
cargo_type.h
 
cargopacket.h
 
cargotype.h
src/callback_table.cpp
Show inline comments
 
deleted file
src/callback_table.h
Show inline comments
 
deleted file
src/network/network_client.cpp
Show inline comments
 
@@ -233,7 +233,7 @@ DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLI
 
	 *    uint32: P2
 
	 *    uint32: Tile
 
	 *    string: text
 
	 *    uint8:  CallBackID (see callback_table.c)
 
	 *    uint8:  CallBackID
 
	 */
 

	
 
	Packet *p = new Packet(PACKET_CLIENT_COMMAND);
src/network/network_command.cpp
Show inline comments
 
@@ -16,9 +16,35 @@
 
#include "network_internal.h"
 
#include "network_client.h"
 
#include "../command_func.h"
 
#include "../callback_table.h"
 
#include "../company_func.h"
 

	
 
/** Table with all the callbacks we'll use for conversion*/
 
static const CommandCallback * const _callback_table[] = {
 
	/* 0x00 */ NULL,
 
	/* 0x01 */ CcBuildPrimaryVehicle,
 
	/* 0x02 */ CcBuildAirport,
 
	/* 0x03 */ CcBuildBridge,
 
	/* 0x04 */ CcBuildCanal,
 
	/* 0x05 */ CcBuildDocks,
 
	/* 0x06 */ CcFoundTown,
 
	/* 0x07 */ CcBuildRoadTunnel,
 
	/* 0x08 */ CcBuildRailTunnel,
 
	/* 0x09 */ CcBuildWagon,
 
	/* 0x0A */ CcRoadDepot,
 
	/* 0x0B */ CcRailDepot,
 
	/* 0x0C */ CcPlaceSign,
 
	/* 0x0D */ CcPlaySound10,
 
	/* 0x0E */ CcPlaySound1D,
 
	/* 0x0F */ CcPlaySound1E,
 
	/* 0x10 */ CcStation,
 
	/* 0x11 */ CcTerraform,
 
	/* 0x12 */ CcAI,
 
	/* 0x13 */ CcCloneVehicle,
 
	/* 0x14 */ CcGiveMoney,
 
	/* 0x15 */ CcCreateGroup,
 
	/* 0x16 */ CcFoundRandomTown,
 
};
 

	
 
/** Local queue of packets */
 
static CommandPacket *_local_command_queue = NULL;
 

	
 
@@ -158,7 +184,7 @@ const char *NetworkClientSocket::Recv_Co
 
	if (!IsValidCommand(cp->cmd))               return "invalid command";
 
	if (GetCommandFlags(cp->cmd) & CMD_OFFLINE) return "offline only command";
 
	if ((cp->cmd & CMD_FLAGS_MASK) != 0)        return "invalid command flag";
 
	if (callback > _callback_table_count)       return "invalid callback";
 
	if (callback > lengthof(_callback_table))   return "invalid callback";
 

	
 
	cp->callback = _callback_table[callback];
 
	return NULL;
 
@@ -179,11 +205,11 @@ void NetworkClientSocket::Send_Command(P
 
	p->Send_string(cp->text);
 

	
 
	byte callback = 0;
 
	while (callback < _callback_table_count && _callback_table[callback] != cp->callback) {
 
	while (callback < lengthof(_callback_table) && _callback_table[callback] != cp->callback) {
 
		callback++;
 
	}
 

	
 
	if (callback == _callback_table_count) {
 
	if (callback == lengthof(_callback_table)) {
 
		DEBUG(net, 0, "Unknown callback. (Pointer: %p) No callback sent", cp->callback);
 
		callback = 0; // _callback_table[0] == NULL
 
	}
src/network/network_server.cpp
Show inline comments
 
@@ -480,7 +480,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SER
 
	 *    uint32: P2
 
	 *    uint32: Tile
 
	 *    string: text
 
	 *    uint8:  CallBackID (see callback_table.c)
 
	 *    uint8:  CallBackID
 
	 *    uint32: Frame of execution
 
	 */
 

	
0 comments (0 inline, 0 general)