auditorysystem.h

来自「2002年」· C头文件 代码 · 共 79 行

H
79
字号
#ifndef __AUDITORYSYSTEM_H__
#define __AUDITORYSYSTEM_H__

#include "types.h"
#include "smp_datastruct.h"
#include "bitaudio.h"

const int MAXAUDIOMESG = 8096;
const int CP_max_msgdata = 10;

enum MsgDataType{
	Msg_INT,
	Msg_ShortFloat,
	Msg_LongFloat
};

enum Msg_Type{
	Msg_MyPlayerPos = 12,
	Msg_TheirPlayerPos = 23,
	Msg_BallPos = 7,
	Msg_BallVel = 51,
	Msg_Pass = 73,
	Msg_Ballcontroller = 74,
};

class MsgData{
public:
	MsgData(float data = 0, MsgDataType precision = Msg_ShortFloat){ this->data =data; this->precision = precision;}
	MsgData(int data){ this->data =(float)data; this->precision = Msg_INT;}
	MsgDataType precision;
	float data;
	void operator =(float d){ this->data = d;}
};


class AuditoryProcessV7 : public CBitAuditory{
protected:
	char auditorybuffer[MAXAUDIOMESG];
	char saybuffer[MAXAUDIOMESG];
	int  p_auditorybuffer;
	float msgData[CP_max_msgdata];
	int MsgDataNum;
	int MsgNo;

//ciphertext
	inline int  ciphertext(char m);
	inline char deciphertext(int e);
	Time LastSpeakingTime;

public:
	AuditoryProcessV7();
/*********	AddMsg	*****************************/	
	bool SumMsg();
	void ResetBuffer();
/**********	SendMsg	****************************/
	void SendMsg();
	int encrypt(int data);
	int decrypt(int data);
	void encipher(char* buffer, int len);
	void decipher(char* buffer, int len);
/***********	Strategy	****************/
	bool IsCaptain(UNum NO);
	bool CanSpeak(bool is_begin);
	void Communication(bool is_begin);
};

class AuditoryProcessV8 : public AuditoryProcessV7{
protected:
	Index<UNum, SP_team_size> broaded_players;
	bool selfannounced;
	bool AttentionBall();

public:
	void CommunicationV8();
	void Make_attention();
};

#endif //__AUDITORYSYSTEM_H__

⌨️ 快捷键说明

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