diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 33571b8bcd182fb5b61cbae55bfabfcd3c9f4a33..caedf4bbaf1e2425ad100c73f637dc556d2a84d9 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
try
dfmapdef := TDynMapDef.Create(pr);
- except on e: Exception do
- raise Exception.Create(Format('ERROR in "mapdef.txt" at (%s,%s): %s', [pr.line, pr.col, e.message]));
+ except
+ on e: TDynParseException do
+ raise Exception.CreateFmt('ERROR in "mapdef.txt" at (%s,%s): %s', [e.tokLine, e.tokCol, e.message]);
+ on e: Exception do
+ raise Exception.CreateFmt('ERROR in "mapdef.txt" at (%s,%s): %s', [pr.tokLine, pr.tokCol, e.message]);
end;
st.Free();
function g_Map_ParseMap (data: Pointer; dataLen: Integer): TDynRecord;
var
wst: TSFSMemoryChunkStream = nil;
- pr: TTextParser = nil;
begin
result := nil;
if (dataLen < 4) then exit;
if (dfmapdef = nil) then raise Exception.Create('internal map loader error');
wst := TSFSMemoryChunkStream.Create(data, dataLen);
-
- if (PAnsiChar(data)[0] = 'M') and (PAnsiChar(data)[1] = 'A') and (PAnsiChar(data)[2] = 'P') and (PByte(data)[3] = 1) then
- begin
- // binary map
- try
- //e_LogWriteln('parsing binary map...');
- result := dfmapdef.parseBinMap(wst);
- except on e: Exception do
+ try
+ result := dfmapdef.parseMap(wst);
+ except
+ on e: TDynParseException do
begin
- e_LogWritefln('ERROR: %s', [e.message]);
+ e_LogWritefln('ERROR at (%s,%s): %s', [e.tokLine, e.tokCol, e.message]);
wst.Free();
result := nil;
exit;
end;
- end;
- wst.Free();
- end
- else
- begin
- // text map
- pr := TFileTextParser.Create(wst);
- try
- //e_LogWriteln('parsing text map...');
- result := dfmapdef.parseMap(pr);
- except on e: Exception do
+ on e: Exception do
begin
- if (pr <> nil) then e_LogWritefln('ERROR at (%s,%s): %s', [pr.tokLine, pr.tokCol, e.message])
- else e_LogWritefln('ERROR: %s', [e.message]);
- pr.Free(); // will free `wst`
+ e_LogWritefln('ERROR: %s', [e.message]);
+ wst.Free();
result := nil;
exit;
end;
- end;
- pr.Free(); // will free `wst`
end;
+
//e_LogWriteln('map parsed.');
end;
moveSpeed := rec.moveSpeed;
//moveStart := rec.moveStart;
//moveEnd := rec.moveEnd;
- //moveActive := rec['move_active'].varvalue;
+ //moveActive := rec['move_active'].value;
if not moveSpeed.isZero then
begin
SetLength(gMovingWallIds, Length(gMovingWallIds)+1);