大富翁

command.h

#ifndef COMMAND_H
#define COMMAND_H

#include "rich_decl.h"

#ifdef __cplusplus
extern "C"
{
#endif

void run(Game *game);

#ifdef __cplusplus
}
#endif
#endif

map.h

#ifndef MAP_H
#define MAP_H

#include "rich_decl.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef enum{
    START = 'S',
    LAND = '0',
    HOSPITAL = 'H',
    TOOLS_HOUSE = 'T',
    GIFT_HOUSE = 'G',
    //PRISION = 'P',//代表公园
	PARK = 'P',
    MINE = '$',
    MAGIC_HOUSE = 'M',
    OWN_LAND = 1,
    OTHERS_LAND = 2
}PLACE_TYPE;

#define WIDTH 30
#define HEIGHT 8

struct Place
{
    char type;     //地形,如'0'空地,'1'茅屋,'T'道具屋
    Player *owner; //土地主人,公共资产owner为null
    int price;     //土地初始地价;对于矿地,代表的是点数
    unsigned int x;
    unsigned int y;
	int hasBlock;//是否有路障
	int hasBomb;//是否有炸弹
};

void initMap(Game *game);
unsigned int getPlaceNum(Game *game);
Place* getPlaceByIndex(Game *game,unsigned int idx);
int isHighestLevel( Place *place );
char getMapChr(int row, int column);
void setMapChr(int row,int column,char chr);
PLACE_TYPE getPlaceType(Place *place,Player *player);
#define CHAR2INT(chr) (int)(chr-'0')
#define INT2CHAR(chr) (char)(chr+'0')

#ifdef __cplusplus
}
#endif
#endif

player.h

#ifndef PLAYER_H
#define PLAYER_H

#include "rich_decl.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define MAX_PLACE_NUM 512
typedef enum
{
	E_IN_WEALTH	= 0,  //财神附生;
	E_OUT_WEALTH		// 财神附生结束

}E_STATUS;

typedef struct TOOLS_s
{
	unsigned int total;
	unsigned int block;
	unsigned int baby;
}TOOLS_t;

struct Player{
    int id;     //玩家编号,1开始
    char *name; //玩家姓名
    int money;  //资金
    int points; //点数
    int houseId[MAX_PLACE_NUM];//玩家房产 标号ID
    int houseNum;        //房产数量
    unsigned int pos;     //玩家当前位置
    char acronym;         //玩家显示在屏幕的符号
    unsigned short color; //玩家颜色
	E_STATUS status;	  // 财神状态
	unsigned int runNum; // 财神附体后该玩家运行的次数

	int byeStatus;//是否轮空:1-轮空,在监狱;0-不轮空
	unsigned int byeNum;//轮空次数

	TOOLS_t tools;
};

void initializePlayer(Game *game);
int getPlayerNum(Game *game);
Player* getCurrentPlayer(Game *game);
void nextPlayer(Game *game);
Player *getPlayerByIndex(Game *game,int idx);
unsigned int getPlayerPosition(Player *);

void goRandomSteps(Game *game);
void goGivenSteps(Game *game, unsigned int steps);
void setBlock(Game *game, int place_num);
void useRobot(Game *game);
void sellPlace(Game *game, unsigned int steps);

#ifdef __cplusplus
}
#endif
#endif


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值