hedgewars/uConsole.pas
changeset 2948 3f21a9dc93d0
parent 2915 a02f276035e8
child 2990 b62e567f17b9
--- a/hedgewars/uConsole.pas	Sat Mar 06 10:54:24 2010 +0000
+++ b/hedgewars/uConsole.pas	Sat Mar 06 10:59:20 2010 +0000
@@ -102,33 +102,33 @@
 var Len: LongInt;
     done: boolean;
 begin
-	{$IFDEF DEBUGFILE}AddFileLog('Console write: ' + s);{$ENDIF}
-	Write(s);
-	done:= false;
-	
-	while not done do
-	begin
-		Len:= cLineWidth - Length(ConsoleLines[CurrLine].s);
-		SetLine(ConsoleLines[CurrLine], ConsoleLines[CurrLine].s + copy(s, 1, Len));
-		Delete(s, 1, Len);
-		if byte(ConsoleLines[CurrLine].s[0]) = cLineWidth then
-		begin
-			inc(CurrLine);
-			if CurrLine = cLinesCount then CurrLine:= 0;
-			PByte(@ConsoleLines[CurrLine].s)^:= 0
-		end;
-		done:= (Length(s) = 0);
-	end;
+    {$IFDEF DEBUGFILE}AddFileLog('Console write: ' + s);{$ENDIF}
+    Write(s);
+    done:= false;
+    
+    while not done do
+    begin
+        Len:= cLineWidth - Length(ConsoleLines[CurrLine].s);
+        SetLine(ConsoleLines[CurrLine], ConsoleLines[CurrLine].s + copy(s, 1, Len));
+        Delete(s, 1, Len);
+        if byte(ConsoleLines[CurrLine].s[0]) = cLineWidth then
+        begin
+            inc(CurrLine);
+            if CurrLine = cLinesCount then CurrLine:= 0;
+            PByte(@ConsoleLines[CurrLine].s)^:= 0
+        end;
+        done:= (Length(s) = 0);
+    end;
 end;
 
 procedure WriteLnToConsole(s: shortstring);
 begin
-	WriteToConsole(s);
-	WriteLn;
-	inc(CurrLine);
-	if CurrLine = cLinesCount then
-		CurrLine:= 0;
-	PByte(@ConsoleLines[CurrLine].s)^:= 0
+    WriteToConsole(s);
+    WriteLn;
+    inc(CurrLine);
+    if CurrLine = cLinesCount then
+        CurrLine:= 0;
+    PByte(@ConsoleLines[CurrLine].s)^:= 0
 end;
 
 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
@@ -188,7 +188,7 @@
 
 function GetLastConsoleLine: shortstring;
 var valueStr: shortstring;
-	i: LongWord;
+    i: LongWord;
 begin
 i:= (CurrLine + cLinesCount - 2) mod cLinesCount;
 valueStr:= ConsoleLines[i].s;
@@ -214,105 +214,105 @@
 procedure init_uConsole;
 var i: LongInt;
 begin
-	CurrLine:= 0;
-	Variables:= nil;
-	isDeveloperMode:= true;
-	
-	// initConsole
-	cLineWidth:= cScreenWidth div 10;
-	if cLineWidth > 255 then
-		cLineWidth:= 255;
-	for i:= 0 to Pred(cLinesCount) do 
-		PByte(@ConsoleLines[i])^:= 0;
-	
-	RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
-	RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
-	RegisterVariable('capture' , vtCommand, @chCapture      , true );
-	RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
-	RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
-	RegisterVariable('addtrig' , vtCommand, @chAddTrigger   , false);
-	RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
-	RegisterVariable('map'     , vtCommand, @chSetMap       , false);
-	RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
-	RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
-	RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
-	RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
-	RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
-	RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
-	RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
-	RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
-	RegisterVariable('landadds', vtLongInt, @cLandAdditions , false);
-	RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
-	RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
-	RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
-	RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
-	RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
-	RegisterVariable('fort'    , vtCommand, @chFort         , false);
-	RegisterVariable('voicepack',vtCommand, @chVoicepack    , false);
-	RegisterVariable('grave'   , vtCommand, @chGrave        , false);
-	RegisterVariable('bind'    , vtCommand, @chBind         , true );
-	RegisterVariable('addhh'   , vtCommand, @chAddHH        , false);
-	RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
-	RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
-	RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
-	RegisterVariable('quit'    , vtCommand, @chQuit         , true );
-	RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
-	RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
-	RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
-	RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
-	RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
-	RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
-	RegisterVariable('skip'    , vtCommand, @chSkip         , false);
-	RegisterVariable('history' , vtCommand, @chHistory      , true );
-	RegisterVariable('chat'    , vtCommand, @chChat         , true );
-	RegisterVariable('newgrave', vtCommand, @chNewGrave     , false);
-	RegisterVariable('say'     , vtCommand, @chSay          , true );
-	RegisterVariable('hogsay'  , vtCommand, @chHogSay       , true );
-	RegisterVariable('team'    , vtCommand, @chTeamSay      , true );
-	RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
-	RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
-	RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
-	RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
-	RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
-	RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
-	RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
-	RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
-	RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
-	RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
-	RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
-	RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
-	RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
-	RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
-	RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
-	RegisterVariable('timer'   , vtCommand, @chTimer        , false);
-	RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
-	RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
-	RegisterVariable('slot'    , vtCommand, @chSlot         , false);
-	RegisterVariable('put'     , vtCommand, @chPut          , false);
-	RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
-	RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
-	RegisterVariable('fullscr' , vtCommand, @chFullScr      , true );
-	RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
-	RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
-	RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
-	RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
-	RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
-	RegisterVariable('pause'   , vtCommand, @chPause        , true );
-	RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
-	RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
-	RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
-	RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
-	RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
-	RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
-	RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
-	RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
-	RegisterVariable('flag'    , vtCommand, @chFlag         , false);
-	RegisterVariable('script'  , vtCommand, @chScript       , false);
+    CurrLine:= 0;
+    Variables:= nil;
+    isDeveloperMode:= true;
+    
+    // initConsole
+    cLineWidth:= cScreenWidth div 10;
+    if cLineWidth > 255 then
+        cLineWidth:= 255;
+    for i:= 0 to Pred(cLinesCount) do 
+        PByte(@ConsoleLines[i])^:= 0;
+    
+    RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
+    RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
+    RegisterVariable('capture' , vtCommand, @chCapture      , true );
+    RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
+    RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
+    RegisterVariable('addtrig' , vtCommand, @chAddTrigger   , false);
+    RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
+    RegisterVariable('map'     , vtCommand, @chSetMap       , false);
+    RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
+    RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
+    RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
+    RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
+    RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
+    RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
+    RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
+    RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
+    RegisterVariable('landadds', vtLongInt, @cLandAdditions , false);
+    RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
+    RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
+    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
+    RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
+    RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
+    RegisterVariable('fort'    , vtCommand, @chFort         , false);
+    RegisterVariable('voicepack',vtCommand, @chVoicepack    , false);
+    RegisterVariable('grave'   , vtCommand, @chGrave        , false);
+    RegisterVariable('bind'    , vtCommand, @chBind         , true );
+    RegisterVariable('addhh'   , vtCommand, @chAddHH        , false);
+    RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
+    RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
+    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
+    RegisterVariable('quit'    , vtCommand, @chQuit         , true );
+    RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
+    RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
+    RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
+    RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
+    RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
+    RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
+    RegisterVariable('skip'    , vtCommand, @chSkip         , false);
+    RegisterVariable('history' , vtCommand, @chHistory      , true );
+    RegisterVariable('chat'    , vtCommand, @chChat         , true );
+    RegisterVariable('newgrave', vtCommand, @chNewGrave     , false);
+    RegisterVariable('say'     , vtCommand, @chSay          , true );
+    RegisterVariable('hogsay'  , vtCommand, @chHogSay       , true );
+    RegisterVariable('team'    , vtCommand, @chTeamSay      , true );
+    RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
+    RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
+    RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
+    RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
+    RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
+    RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
+    RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
+    RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
+    RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
+    RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
+    RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
+    RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
+    RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
+    RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
+    RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
+    RegisterVariable('timer'   , vtCommand, @chTimer        , false);
+    RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
+    RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
+    RegisterVariable('slot'    , vtCommand, @chSlot         , false);
+    RegisterVariable('put'     , vtCommand, @chPut          , false);
+    RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
+    RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
+    RegisterVariable('fullscr' , vtCommand, @chFullScr      , true );
+    RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
+    RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
+    RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
+    RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
+    RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
+    RegisterVariable('pause'   , vtCommand, @chPause        , true );
+    RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
+    RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
+    RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
+    RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
+    RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
+    RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
+    RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
+    RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
+    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
+    RegisterVariable('script'  , vtCommand, @chScript       , false);
 end;
 
 procedure free_uConsole;
 begin
-	FreeVariablesList();
+    FreeVariablesList();
 end;
 
 end.