Changeset 364 for trunk/Protocol.pas


Ignore:
Timestamp:
Apr 12, 2021, 11:55:20 PM (4 years ago)
Author:
chronos
Message:
  • Added: Partial network game play implementation.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Protocol.pas

    r334 r364  
    12751275  TClientCall = procedure (Command, Player: Integer; var Data); stdcall;
    12761276
     1277  TCommand = (
     1278    cmInitModule = $0000,
     1279    cmReleaseModule = $0100,
     1280    cmBroadcast = $0200,
     1281    cmHelpOnly = $0700,
     1282    cmStartHelp = $0710,
     1283    cmStartCredits = $0720,
     1284
     1285    cmNewGame = $0800,
     1286    cmLoadGame = $0810,
     1287    cmMovie = $0820,
     1288    cmNewGameEx = $0840,
     1289    cmLoadGameEx = $0850,
     1290    cmNewMap = $0880,
     1291    cmReplay = $08E0,
     1292    cmGetReady = $08F0,
     1293    cmBreakGame = $0900,
     1294
     1295    cmTurn = $2000,
     1296    cmResume = $2010,
     1297    cmContinue = $2080,
     1298    cmMovieTurn = $2100,
     1299    cmMovieEndTurn = $2110,
     1300    cmEditMap = $2800,
     1301
     1302    // cShowTileM=$3000;cShowTileA=$3010;cShowFoundCity=$3020;
     1303    cmShowUnitChanged = $3030,
     1304    cmShowAfterMove = $3040,
     1305    cmShowAfterAttack = $3050,
     1306    cmShowCityChanged = $3090,
     1307    // cShowMove=$3100;cShowCapture=$3110;
     1308    // cShowAttackBegin=$3200;cShowAttackWon=$3210;cShowAttackLost=$3220;
     1309    cmShowMoving = $3140,
     1310    cmShowCapturing = $3150,
     1311    cmShowAttacking = $3240,
     1312    cmShowMissionResult = $3300,
     1313    cmShowShipChange = $3400,
     1314    cmShowGreatLibTech = $3500,
     1315    cmShowTurnChange = $3700,
     1316    cmShowCancelTreaty = $3800,
     1317    cmShowEndContact = $3810,
     1318    cmShowCancelTreatyByAlliance = $3820,
     1319    cmShowSupportAllianceAgainst = $3830,
     1320    cmShowPeaceViolation = $3880,
     1321    cmShowGame = $3F00, { cShowSuperView=$3F80; }
     1322    cmRefreshDebugMap = $3F90,
     1323
     1324    // diplomacy commands equal to server, see below
     1325
     1326    cmDebugMessage = $7000,
     1327    cmShowNego = $7010
     1328  );
     1329
    12771330  TUn = packed record
    12781331    Loc: LongInt; { location }
     
    17771830function DelphiRandom: Extended; overload;
    17781831procedure DelphiRandomize;
     1832function GetCommandDataSize(Command: TCommand): Integer;
    17791833
    17801834
     
    19191973end;
    19201974
     1975function GetCommandDataSize(Command: TCommand): Integer;
     1976begin
     1977  case Command of
     1978    cmInitModule: Result := SizeOf(TInitModuleData);
     1979    cmGetReady: Result := 0;
     1980    cmTurn: Result := 0;
     1981    cmShowTurnChange: Result := SizeOf(Integer);
     1982    cmShowNego: Result := SizeOf(TShowNegoData);
     1983    cmNewGame, cmLoadGame, cmMovie, cmNewMap: Result := SizeOf(TNewGameData);
     1984    else begin
     1985      Result := 0;
     1986    end;
     1987  end;
     1988end;
     1989
     1990
    19211991initialization
    19221992
Note: See TracChangeset for help on using the changeset viewer.