54 Print(
"Constructing NetGameServer\n");
56 WORD server_port = 11101;
131 join_ann.
SetName(
"Server A.I. Ship");
138 static DWORD time_mark = 0;
145 Print(
"Server Stats\n-------------\n");
176 quit_ann.SetDisconnected(
true);
189 join_ann.
SetName(
"Server A.I. Ship");
224 DWORD nid = msg->
NetID();
236 ship = element->
GetShip(index);
240 Print(
" JOIN DENIED: could not locate ship for remote player\n");
245 Print(
" JOIN DENIED: remote player requested ship with objid = 0\n");
258 Print(
" JOIN DENIED: remote player '%s' not found in lobby\n", name.
data());
263 Print(
" JOIN DENIED: remote player '%s' not authenticated\n", name.
data());
269 if (remote_player && remote_player->
GetShip() != ship) {
270 Print(
" disconnecting remote player from ship '%s'\n", ship->
Name());
272 delete remote_player;
276 if (!remote_player) {
280 remote_player =
new(__FILE__,__LINE__)
NetPlayer(nid);
287 Print(
"remote player name = %s\n", name.
data());
322 join_ann.
SetName(
"Server A.I. Ship");
359 Print(
"Server received Join Announce from '%s'\n", join_ann.
GetName());
389 join_ann.
SetName(
"Server A.I. Ship");
396 Print(
"Quit Request from unknown player NetID: %08X\n", msg->
NetID());
404 Print(
"Server received Quit Announce from NetID: %08x\n", msg->
NetID());
411 Print(
"Server received Game Over from NetID: %08x\n", msg->
NetID());
418 Print(
"Server received Disconnect from NetID: %08x\n", msg->
NetID());
430 if (player && player->
GetShip()) {
446 Print(
"Server received OBJ DAMAGE from NetID: %08x (ignored)\n", msg->
NetID());
458 Print(
"Server received OBJ KILL from NetID: %08x (ignored)\n", msg->
NetID());
468 killer_name = killer->
Name();
483 Print(
"Server received OBJ SPAWN from NetID: %08x (ignored)\n", msg->
NetID());
490 Print(
"Server received OBJ HYPER from NetID: %d\n", msg->
NetID());
496 if (player && player->
GetShip()) {
577 if (!player || ship->
GetObjID() != player->GetObjID()) {
616 int slots[] = { -1,-1,-1,-1 };
622 for (
int i = 0; i < 4; i++) {
647 int* slots = elem_create.
GetSlots();
651 bool alert = elem_create.
GetAlert();
686 for (
int i = 0; i < 4; i++) {
689 hangar->
GotoAlert(squadron, slot, deck, elem, load, !alert);
711 int slot = ship_launch.
GetSlot();
721 hangar->
Launch(squadron, slot);
740 if (nav_data.
IsAdd()) {
745 if (index >= 0 && index < elem->GetFlightPlan().size())
756 if (navpt && index >= 0 && index < elem->GetFlightPlan().size()) {
783 else if (index < elem->FlightPlanLength()) {
831 Print(
"WEP RELEASE on server? objid = %d\n", release.
GetObjID());
850 if (player && radio_msg) {
859 (channel == 0 || channel == remote_player->
GetIFF())) {
861 BYTE* data = comm_msg.
Pack();
862 int size = comm_msg.
Length();
893 if (dst_id == 0xffff || dst_id <= 10) {
894 BYTE* data = chat_msg.
Pack();
895 int size = chat_msg.
Length();
901 if (dst_id == 0xffff || dst_id == 0 || remote_player->
GetIFF() == (int) dst_id-1)
932 if (remote_player && remote_player->
GetNetID()) {
933 BYTE* data = chat_msg.
Pack();
934 int size = chat_msg.
Length();
942 if (dst_id == 0xffff)
973 if (!player || ship->
GetObjID() != player->GetObjID()) {
974 Print(
"NetGameServer::DoSelfDestruct - received request for ship '%s' from wrong player %s\n",
975 ship->
Name(), player ? player->Name() :
"null");
987 if (ship_destroyed) {
1065 BYTE* obj_loc_data = obj_loc.
Pack();
1070 if (remote_player->
GetNetID() && remote_player != player)
1111 BYTE* data = net_data->
Pack();
1112 int size = net_data->
Length();
1117 BYTE msg_type = net_data->
Type();
1119 if (msg_type >= 0x10)
1135 if (remote_player->
GetNetID() && (all || oid != remote_player->
GetObjID()))
1146 BYTE* data = disconnect.
Pack();
1147 int size = disconnect.
Length();
1175 return "NetGameServer";
1183 if (!oid || !spawn)
return;
1185 Print(
"NetGameServer::Respawn(%d, %s)\n", oid, spawn->
Name());
1196 Print(
" RESPAWN LOCAL PLAYER\n\n");