diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 7cc04d223065c043946347a45bc23b08497aef5c..1c678ecaf025866271191a651e9f38cb58d65dfd 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
unit g_netmsg;
interface
Math, ENet, e_input, e_fixedbuffer, e_graphics, e_log,
g_textures, g_gfx, g_sound, g_console, g_basic, g_options, g_main,
g_game, g_player, g_map, g_panel, g_items, g_weapons, g_phys, g_gui,
- g_language, g_monsters, g_netmaster,
- WADEDITOR, MAPDEF;
+ g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF;
const
NET_KEY_LEFT = 1;
begin
Result := 0;
if not gGameOn then Exit;
-
+
GT := e_Raw_Read_LongWord(P);
PID := C^.Player;
Pl := g_Player_Get(PID);
Pl := g_Player_Get(C^.Player);
if Pl = nil then Exit;
Name := Pl.Name;
-
+
if Start then
begin
if not g_Console_CommandBlacklisted(Command) then
var
Map: string;
begin
- g_ProcessResourceStr(gMapInfo.Map, nil, nil, @Map);
+ Map := g_ExtractFileName(gMapInfo.Map);
e_Buffer_Clear(@NetOut);
function ReadFile(const FileName: TFileName): AByte;
var
- FileStream : TFileStream;
+ FileStream : TStream;
+ fname: string;
begin
+ e_WriteLog(Format('NETWORK: looking for file "%s"', [FileName]), MSG_NOTIFY);
+ fname := findDiskWad(FileName);
+ if length(fname) = 0 then
+ begin
+ e_WriteLog(Format('NETWORK: file "%s" not found!', [FileName]), MSG_FATALERROR);
+ SetLength(Result, 0);
+ exit;
+ end;
+ e_WriteLog(Format('NETWORK: found file "%s"', [fname]), MSG_NOTIFY);
Result := nil;
- FileStream:= TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
+ FileStream := openDiskFileRO(fname);
try
- if FileStream.Size>0 then
+ if FileStream.Size > 0 then
begin
SetLength(Result, FileStream.Size);
FileStream.Read(Result[0], FileStream.Size);