Skip to content

Commit 6c63116

Browse files
committed
reduce number of messages on standard output
1 parent 5262dd3 commit 6c63116

File tree

7 files changed

+162
-105
lines changed

7 files changed

+162
-105
lines changed

engine/Data.pas

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ ***************************************************************************
22
33
This file is part of Vespucci.
4-
Copyright (C) 2008, 2009, 2010, 2011 Dirk Stolle
4+
Copyright (C) 2008, 2009, 2010, 2011, 2015 Dirk Stolle
55
66
This program is free software: you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -72,6 +72,8 @@ interface
7272
(x: 50; y: 55)
7373
);
7474

75+
{PlaceDollarSignHereDEFINE DEBUG_CODE 1}
76+
7577
type
7678
{ record type which holds different parts of (player's) score }
7779
TScoreRecord = record
@@ -561,7 +563,7 @@ TData = class
561563
implementation
562564

563565
uses
564-
Terrain;
566+
Terrain, DebugWriter;
565567

566568
constructor TData.Create(const NumNation_Player: LongInt=cNationEngland);
567569
var i: Integer;
@@ -635,7 +637,9 @@ procedure TData.InitializeMap;
635637
begin
636638
if m_Map.LoadFromFile(GetPathBase+america_map_path) then
637639
begin
638-
WriteLn('Map "'+GetPathBase+america_map_path+'" successfully loaded.');
640+
{$IFDEF DEBUG_CODE}
641+
WriteDebugLn('Map "'+GetPathBase+america_map_path+'" successfully loaded.');
642+
{$ENDIF}
639643
InitTribes_America;
640644
end//if
641645
else begin
@@ -828,7 +832,9 @@ procedure TData.StartNewGame(const InAmerica: Boolean; const NumNation_Player: L
828832
SpawnEuropeanNation(j, cSpawnpointsAmerica[i].x, cSpawnpointsAmerica[i].y);
829833
bits:= bits or (1 shl i);
830834
end;//for
831-
WriteLn('First ships created.');
835+
{$IFDEF DEBUG_CODE}
836+
WriteDebugLn('First ships created.');
837+
{$ENDIF}
832838
end
833839
else begin
834840
//generate map
@@ -846,7 +852,9 @@ procedure TData.StartNewGame(const InAmerica: Boolean; const NumNation_Player: L
846852
SpawnEuropeanNation(j, cMap_X-1, cSpawnpointsAmerica[i].y);
847853
bits:= bits or (1 shl i);
848854
end;//for
849-
WriteLn('First ships created.');
855+
{$IFDEF DEBUG_CODE}
856+
WriteDebugLn('First ships created.');
857+
{$ENDIF}
850858
end;//else branch
851859
//TODO: complete this procedure
852860
end;//proc

engine/DebugWriter.pas

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{ ***************************************************************************
2+
3+
This file is part of Vespucci.
4+
Copyright (C) 2015 Dirk Stolle
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
***************************************************************************
20+
}
21+
22+
unit DebugWriter;
23+
24+
interface
25+
26+
{ writes the given message to standard output, but only if DEBUG_CODE is
27+
defined.
28+
29+
parameters:
30+
message - the debug message
31+
}
32+
procedure WriteDebugLn(message: string);
33+
34+
{PlaceDollarSignHereDEFINE DEBUG_CODE 1}
35+
36+
implementation
37+
38+
procedure WriteDebugLn(message: string);
39+
begin
40+
{$IFDEF DEBUG_CODE}
41+
WriteLn(message);
42+
{$ENDIF}
43+
end;
44+
45+
end.

0 commit comments

Comments
 (0)