Revision 157:0b95089e72d4 Server/cedserver.lpr
| b/Server/cedserver.lpr | ||
|---|---|---|
| 1 |
(* |
|
| 2 |
* CDDL HEADER START |
|
| 3 |
* |
|
| 4 |
* The contents of this file are subject to the terms of the |
|
| 5 |
* Common Development and Distribution License, Version 1.0 only |
|
| 6 |
* (the "License"). You may not use this file except in compliance |
|
| 7 |
* with the License. |
|
| 8 |
* |
|
| 9 |
* You can obtain a copy of the license at |
|
| 10 |
* http://www.opensource.org/licenses/cddl1.php. |
|
| 11 |
* See the License for the specific language governing permissions |
|
| 12 |
* and limitations under the License. |
|
| 13 |
* |
|
| 14 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
| 15 |
* file and include the License file at |
|
| 16 |
* http://www.opensource.org/licenses/cddl1.php. If applicable, |
|
| 17 |
* add the following below this CDDL HEADER, with the fields enclosed |
|
| 18 |
* by brackets "[]" replaced with your own identifying * information: |
|
| 19 |
* Portions Copyright [yyyy] [name of copyright owner] |
|
| 20 |
* |
|
| 21 |
* CDDL HEADER END |
|
| 22 |
* |
|
| 23 |
* |
|
| 24 |
* Portions Copyright 2008 Andreas Schneider |
|
| 25 |
*) |
|
| 26 |
program cedserver; |
|
| 27 |
|
|
| 28 |
{$mode objfpc}{$H+}
|
|
| 29 |
|
|
| 30 |
uses |
|
| 31 |
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
|
| 32 |
cthreads, |
|
| 33 |
{$ENDIF}{$ENDIF}
|
|
| 34 |
SysUtils, Classes, lnetbase, UConfig, UCEDServer, URadarMap, |
|
| 35 |
ULargeScaleOperations, UPackets, UAdminHandling, UClientHandling, ULandscape, |
|
| 36 |
UPacketHandlers, URegions, UStatics, Logging; |
|
| 37 |
|
|
| 38 |
{$I version.inc}
|
|
| 39 |
|
|
| 40 |
{$IFDEF WINDOWS}{$R cedserver.rc}{$ENDIF}
|
|
| 41 |
|
|
| 42 |
begin |
|
| 43 |
Writeln('');
|
|
| 44 |
Writeln('CentrED Server Version ', ProductVersion);
|
|
| 45 |
Writeln('Copyright ', Copyright);
|
|
| 46 |
//Writeln('================================');
|
|
| 47 |
Writeln('');
|
|
| 48 |
|
|
| 49 |
{$IFDEF Windows}
|
|
| 50 |
if FileExists(ConfigFile) then |
|
| 51 |
Config := TConfig.Create(ConfigFile) |
|
| 52 |
else |
|
| 53 |
Config := TConfig.Init(ConfigFile); |
|
| 54 |
{$ELSE}
|
|
| 55 |
if ParamStr(1) = '--init' then |
|
| 56 |
Config := TConfig.Init(ConfigFile) |
|
| 57 |
else if FileExists(ConfigFile) then |
|
| 58 |
Config := TConfig.Create(ConfigFile) |
|
| 59 |
else begin |
|
| 60 |
Writeln('No valid config file was found. Use --init to create one.');
|
|
| 61 |
Halt; |
|
| 62 |
end; |
|
| 63 |
{$ENDIF}
|
|
| 64 |
|
|
| 65 |
Writeln(TimeStamp, 'Initialization started'); |
|
| 66 |
Randomize; |
|
| 67 |
CEDServerInstance := TCEDServer.Create; |
|
| 68 |
Writeln(TimeStamp, 'Initialization done'); |
|
| 69 |
CEDServerInstance.Run; |
|
| 70 |
Write(TimeStamp, 'Shutting down ... '); |
|
| 71 |
FreeAndNil(CEDServerInstance); |
|
| 72 |
Config.Flush; |
|
| 73 |
FreeAndNil(Config); |
|
| 74 |
Writeln('done');
|
|
| 75 |
end. |
|
| 76 |
|
|
| 1 |
(* |
|
| 2 |
* CDDL HEADER START |
|
| 3 |
* |
|
| 4 |
* The contents of this file are subject to the terms of the |
|
| 5 |
* Common Development and Distribution License, Version 1.0 only |
|
| 6 |
* (the "License"). You may not use this file except in compliance |
|
| 7 |
* with the License. |
|
| 8 |
* |
|
| 9 |
* You can obtain a copy of the license at |
|
| 10 |
* http://www.opensource.org/licenses/cddl1.php. |
|
| 11 |
* See the License for the specific language governing permissions |
|
| 12 |
* and limitations under the License. |
|
| 13 |
* |
|
| 14 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
| 15 |
* file and include the License file at |
|
| 16 |
* http://www.opensource.org/licenses/cddl1.php. If applicable, |
|
| 17 |
* add the following below this CDDL HEADER, with the fields enclosed |
|
| 18 |
* by brackets "[]" replaced with your own identifying * information: |
|
| 19 |
* Portions Copyright [yyyy] [name of copyright owner] |
|
| 20 |
* |
|
| 21 |
* CDDL HEADER END |
|
| 22 |
* |
|
| 23 |
* |
|
| 24 |
* Portions Copyright 2008 Andreas Schneider |
|
| 25 |
*) |
|
| 26 |
program cedserver; |
|
| 27 |
|
|
| 28 |
{$mode objfpc}{$H+}
|
|
| 29 |
|
|
| 30 |
uses |
|
| 31 |
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
|
| 32 |
cthreads, |
|
| 33 |
{$ENDIF}{$ENDIF}
|
|
| 34 |
SysUtils, UConfig, UCEDServer; |
|
| 35 |
|
|
| 36 |
{$I version.inc}
|
|
| 37 |
|
|
| 38 |
{$IFDEF WINDOWS}{$R cedserver.rc}{$ENDIF}
|
|
| 39 |
|
|
| 40 |
begin |
|
| 41 |
Writeln('');
|
|
| 42 |
Writeln('CentrED Server Version ', ProductVersion);
|
|
| 43 |
Writeln('Copyright ', Copyright);
|
|
| 44 |
//Writeln('================================');
|
|
| 45 |
Writeln('');
|
|
| 46 |
|
|
| 47 |
{$IFDEF Windows}
|
|
| 48 |
if FileExists(ConfigFile) then |
|
| 49 |
Config := TConfig.Create(ConfigFile) |
|
| 50 |
else |
|
| 51 |
Config := TConfig.Init(ConfigFile); |
|
| 52 |
{$ELSE}
|
|
| 53 |
if ParamStr(1) = '--init' then |
|
| 54 |
Config := TConfig.Init(ConfigFile) |
|
| 55 |
else if FileExists(ConfigFile) then |
|
| 56 |
Config := TConfig.Create(ConfigFile) |
|
| 57 |
else begin |
|
| 58 |
Writeln('No valid config file was found. Use --init to create one.');
|
|
| 59 |
Halt; |
|
| 60 |
end; |
|
| 61 |
{$ENDIF}
|
|
| 62 |
|
|
| 63 |
Writeln(TimeStamp, 'Initialization started'); |
|
| 64 |
Randomize; |
|
| 65 |
CEDServerInstance := TCEDServer.Create; |
|
| 66 |
Writeln(TimeStamp, 'Initialization done'); |
|
| 67 |
CEDServerInstance.Run; |
|
| 68 |
Write(TimeStamp, 'Shutting down ... '); |
|
| 69 |
FreeAndNil(CEDServerInstance); |
|
| 70 |
Config.Flush; |
|
| 71 |
FreeAndNil(Config); |
|
| 72 |
Writeln('done');
|
|
| 73 |
end. |
|
| 74 |
|
|
Also available in: Unified diff