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

📄 msg.h

📁 C人工智能游戏开发的一些实例源代码 C Game development in artificial intelligence source code of some examples
💻 H
字号:
/* Copyright (C) Steve Rabin, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Steve Rabin, 2001"
 */

#ifndef __MSG_H__
#define __MSG_H__

#include "global.h"


//Add new messages here
typedef enum { MSG_NULL,
			   MSG_Randomize,
			   MSG_Timeout,
			   MSG_ChangeState
} MSG_Name;


class MSG_Object
{
public:

	MSG_Object( void );
	MSG_Object( float deliveryTime, MSG_Name name, objectID sender, objectID receiver, int state = -1 );
	~MSG_Object( void ) {}

	MSG_Name GetMsgName( void )					{ return( m_Name ); }
	void SetMsgName( MSG_Name name )			{ m_Name = name; }

	objectID GetSender( void )					{ return( m_Sender ); }
	void SetSender( objectID sender )			{ m_Sender = sender; }

	objectID GetReceiver( void )				{ return( m_Receiver ); }
	void SetReceiver( objectID receiver )		{ m_Receiver = receiver; }

	int GetMsgState( void )						{ return( m_State ); }
	void SetMsgState( int state )				{ m_State = state; }

	float GetDeliveryTime( void )				{ return( m_DeliveryTime ); }
	void SetDeliveryTime( float time )			{ m_DeliveryTime = time; }

	bool IsDelivered( void )					{ return( m_Delivered ); }
	void SetDelivered( bool value )				{ m_Delivered = value; }

private:

	MSG_Name m_Name;		//Message name
	objectID m_Sender;		//Object that sent the message
	objectID m_Receiver;	//Object that will get the message
	int m_State;			//State in which the receiver is allowed get the message (-1 means any state)

	float m_DeliveryTime;	//Time at which to send the message
	bool m_Delivered;		//Whether the message has been delivered

};


#endif	// __MSG_H__

⌨️ 快捷键说明

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