guardsplayer.h
[html] v
#ifndef __GUARDSPLAYER_H__
#define __GUARDSPLAYER_H__
#include "player.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _Guards;
typedef struct _Guards Guards;
struct _Guards
{
Player player;
};
Guards *GuardsCreate(char *name);
#ifdef __cplusplus
}
#endif
#endif
#ifndef __GUARDSPLAYER_H__
#define __GUARDSPLAYER_H__
#include "player.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _Guards;
typedef struct _Guards Guards;
struct _Guards
{
Player player;
};
Guards *GuardsCreate(char *name);
#ifdef __cplusplus
}
#endif
#endif
guardsplayer.c
[html]
#include <stdio.h>
#include <stdlib.h>
#include "guardsplayer.h"
static void guards_attack(void *thiz)
{
printf("后卫 %s 进攻\n", ((Guards *)thiz)->player.name);
}
static void guards_defend(void *thiz)
{
printf("后卫 %s 防守\n", ((Guards *)thiz)->player.name);
}
static void guards_destroy(void *thiz)
{
return_if_fail(thiz != NULL);
SAFE_FREE(thiz);
}
Guards *GuardsCreate(char *name)
{
Guards *thiz = malloc(sizeof(Guards));
if(thiz != NULL)
{
thiz->player.name = name;
thiz->player.attack = guards_attack;
thiz->player.defend = guards_defend;
thiz->player.destroy = guards_destroy;
}
return thiz;
}
#include <stdio.h>
#include <stdlib.h>
#include "guardsplayer.h"
static void guards_attack(void *thiz)
{
printf("后卫 %s 进攻\n", ((Guards *)thiz)->player.name);
}
static void guards_defend(void *thiz)
{
printf("后卫 %s 防守\n", ((Guards *)thiz)->player.name);
}
static void guards_destroy(void *thiz)
{
return_if_fail(thiz != NULL);
SAFE_FREE(thiz);
}
Guards *GuardsCreate(char *name)
{
Guards *thiz = malloc(sizeof(Guards));
if(thiz != NULL)
{
thiz->player.name = name;
thiz->player.attack = guards_attack;
thiz->player.defend = guards_defend;
thiz->player.destroy = guards_destroy;
}
return thiz;
}
foreigncenterplayer.h
[html]
#ifndef __FORIGNCENTERPLAYER_H__
#define __FORIGNCENTERPLAYER_H__
#include "typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _ForeignCenter;
typedef struct _ForeignCenter ForeignCenter;
struct _ForeignCenter
{
char *name;
void (*fattack)(void *player);
void (*fdefend)(void *player);
void (*fdestroy)(void *player);
};
void foreign_center_attack(void *thiz);
void foreign_center_defend(void *thiz);
void foreign_center_destroy(void *thiz);
#ifdef __cplusplus
}
#endif
#endif
#ifndef __FORIGNCENTERPLAYER_H__
#define __FORIGNCENTERPLAYER_H__
#include "typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _ForeignCenter;
typedef struct _ForeignCenter ForeignCenter;
struct _ForeignCenter
{
char *name;
void (*fattack)(void *player);
void (*fdefend)(void *player);
void (*fdestroy)(void *player);
};
void foreign_center_attack(void *thiz);
void foreign_center_defend(void *thiz);
void foreign_center_destroy(void *thiz);
#ifdef __cplusplus
}
#endif
#endif
foreigncenterplayer.c
[html]
#include <stdio.h>
#include <stdlib.h>
#include "foreigncenterplayer.h"
void foreign_center_attack(void *thiz)
{
printf("外籍中锋 %s 进攻\n", ((ForeignCenter *)thiz)->name);
}
void foreign_center_defend(void *thiz)
{
printf("外籍中锋 %s 防守\n", ((ForeignCenter *)thiz)->name);
}
void foreign_center_destroy(void *thiz)
{
return_if_fail(thiz != NULL);
SAFE_FREE(thiz);
}
static ForeignCenter *ForeignCenterCreate(char *name)
{
ForeignCenter *thiz = malloc(sizeof(ForeignCenter));
if(thiz != NULL)
{
thiz->name = name;
thiz->fattack = foreign_center_attack;
thiz->fdefend = foreign_center_defend;
thiz->fdestroy = foreign_center_destroy;
}
return thiz;
}
#include <stdio.h>
#include <stdlib.h>
#include "foreigncenterplayer.h"
void foreign_center_attack(void *thiz)
{
printf("外籍中锋 %s 进攻\n", ((ForeignCenter *)thiz)->name);
}
void foreign_center_defend(void *thiz)
{
printf("外籍中锋 %s 防守\n", ((ForeignCenter *)thiz)->name);
}
void foreign_center_destroy(void *thiz)
{
return_if_fail(thiz != NULL);
SAFE_FREE(thiz);
}
static ForeignCenter *ForeignCenterCreate(char *name)
{
ForeignCenter *thiz = malloc(sizeof(ForeignCenter));
if(thiz != NULL)
{
thiz->name = name;
thiz->fattack = foreign_center_attack;
thiz->fdefend = foreign_center_defend;
thiz->fdestroy = foreign_center_destroy;
}
return thiz;
}
foreigncenteradapter.h
[html]
#ifndef __FORIGNCENTERADAPTER_H__
#define __FORIGNCENTERADAPTER_H__
#include "player.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _ForeignCenterAdapter;
typedef struct _ForeignCenterAdapter ForeignCenterAdapter;
struct _ForeignCenterAdapter
{
Player player;
};
ForeignCenterAdapter *ForeignCenterAdapterCreate(char *name);
#ifdef __cplusplus
}
#endif
#endif
#ifndef __FORIGNCENTERADAPTER_H__
#define __FORIGNCENTERADAPTER_H__
#include "player.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _ForeignCenterAdapter;
typedef struct _ForeignCenterAdapter ForeignCenterAdapter;
struct _ForeignCenterAdapter
{
Player player;
};
ForeignCenterAdapter *ForeignCenterAdapterCreate(char *name);
#ifdef __cplusplus
}
#endif
#endif
foreigncenteradapter.c
[html]
#include <stdio.h>
#include <stdlib.h>
#include "foreigncenterplayer.h"
#include "foreigncenteradapter.h"
static void foreign_center_adapter_attack(void *thiz)
{
foreign_center_attack(thiz);
}
static void foreign_center_adapter_defend(void *thiz)
{
foreign_center_defend(thiz);
}
static void foreign_center_adapter_destroy(void *thiz)
{