⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logunit.cpp

📁 robocup3d源化码 Nexus3D.tar.gz
💻 CPP
字号:
/*Copyright (C) 2005 Ferdowsi University*/#include <sstream>#include <stdarg.h>#include <string.h> #include "logunit.h"#include "global.h"LogUnit::LogUnit(){ 	for(int i = 0; i < Max_Channels; i++)		LogOn[i] = false;}LogUnit::~LogUnit(){}void LogUnit::SetLogOn(int lognum){	if(IsValidChannel(lognum))		LogOn[lognum] = true;}void LogUnit::SetLogOff(int lognum){	if(IsValidChannel(lognum))		LogOn[lognum] = false;}void LogUnit::SetLabel(int lognum, char* caption){	if (IsValidChannel(lognum))		strcpy(&label[lognum][0], caption);}void LogUnit::LogAction(int lognum,char * format, ...){	if (!IsValidChannel(lognum) || logpause || !LogOn[lognum])		return;	if (label[lognum][0] != 0)		printf("(p%d,t%.2f)[%s]", Unum, CurrentTime, label[lognum]);/*it should write dimulation time istead of 0*/	else		printf("(p%d,t%.2f)[%s]", Unum, CurrentTime, "Undefined");	char * argptr;	va_start(argptr, format);	vsprintf(logstring, format, argptr);	va_end(argptr);	printf(logstring);	printf("\n");	fflush(0);}void LogUnit::Init(int unum){	SetLabel(LOG_NONE,"None");	SetLabel(LOG_POS,"Position");	SetLabel(LOG_GOALIE,"Goalie");	SetLabel(LOG_KICK,"Kick");	SetLabel(LOG_PASS,"Pass");	SetLabel(LOG_ADJUST,"AdjustKick");	SetLabel(LOG_SETPLAY,"SetPlay");	SetLabel(LOG_DRIBBLE,"Dribble");	SetLabel(LOG_SHOOT,"Shoot");	SetLabel(LOG_EVAL,"Evaluate");	SetLabel(LOG_PARSE,"Parser");	SetLabel(LOG_NET,"Network");	SetLabel(LOG_LOG,"LOG");	SetLabel(LOG_UPDATE,"Update");	SetLabel(LOG_GOTO,"Goto");	SetLabel(LOG_INTERCEPT, "Interception");	SetLabel(LOG_HANDLE, "HabdelBall");/* to turn off a channel rem its SetLogOn line */	//SetLogOn(LOG_NONE);	//SetLogOn(LOG_POS);	//SetLogOn(LOG_GOALIE);	//SetLogOn(LOG_KICK);	SetLogOn(LOG_PASS);	SetLogOn(LOG_ADJUST);	//SetLogOn(LOG_SETPLAY);	SetLogOn(LOG_DRIBBLE);	//SetLogOn(LOG_SHOOT);	//SetLogOn(LOG_EVAL);	//SetLogOn(LOG_PARSE);	//SetLogOn(LOG_NET);	//SetLogOn(LOG_LOG);	//SetLogOn(LOG_UPDATE);	//SetLogOn(LOG_GOTO);	SetLogOn(LOG_INTERCEPT);	SetLogOn(LOG_HANDLE);	PauseLog(false);	Unum = unum;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -