From 5e1e812888954ef3996e04ecbe81166fc3886b0c Mon Sep 17 00:00:00 2001
From: johns <>
Date: Mon, 26 Feb 2001 00:32:15 +0000
Subject: [PATCH] Redraw info panel added to command switch. Debuging code.

---
 src/action/actions.cpp | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/action/actions.cpp b/src/action/actions.cpp
index 7e0030ab5..2f9337454 100644
--- a/src/action/actions.cpp
+++ b/src/action/actions.cpp
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 
 #include "freecraft.h"
 #include "video.h"
@@ -152,7 +153,7 @@ local void HandleUnitAction(Unit* unit)
 
 	    if( IsSelected(unit) ) {	// update display for new action
 		UpdateButtonPanel();
-		MustRedraw|=RedrawButtonPanel;
+		MustRedraw|=RedrawInfoPanel;
 	    }
 	}
 
@@ -200,7 +201,7 @@ local void HandleUnitAction(Unit* unit)
 
 	    if( IsSelected(unit) ) {	// update display for new action
 		UpdateButtonPanel();
-		MustRedraw|=RedrawButtonPanel;
+		MustRedraw|=RedrawInfoPanel;
 	    }
 	}
 #endif
@@ -365,6 +366,41 @@ global void UnitActions(void)
 	    continue;
 	}
 	HandleUnitAction(*table);
+#ifdef no_DEBUG
+	//
+	//	Dump the unit to find the network unsyncron bug.
+	//
+	{
+	static FILE* logf;
+	Unit* unit;
+
+	if( !logf ) {
+	    time_t now;
+	    char buf[256];
+
+	    sprintf(buf,"log_of_freecraft_%d.log",ThisPlayer->Player);
+	    logf=fopen(buf,"wb");
+	    if( !logf ) {
+		return;
+	    }
+	    fprintf(logf,";;; Log file generated by FreeCraft Version "
+		    VERSION "\n");
+	    time(&now);
+	    fprintf(logf,";;;\tDate: %s",ctime(&now));
+	    fprintf(logf,";;;\tMap: %s\n\n",TheMap.Description);
+	}
+
+	unit=*table;
+	fprintf(logf,"%d: ",FrameCounter);
+	fprintf(logf,"%Zd %s S%d/%d-%d\n",
+	    UnitNumber(unit),unit->Type->Ident,
+		unit->State,unit->SubAction,
+		unit->Command.Action);
+		
+	// SaveUnit(unit,logf);
+	fflush(NULL);
+	}
+#endif
     }
 }