您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFREE函数代码示例

51自学网 2021-06-01 19:58:56
  C++
这篇教程C++ CFREE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CFREE函数的典型用法代码示例。如果您正苦于以下问题:C++ CFREE函数的具体用法?C++ CFREE怎么用?C++ CFREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CFREE函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ConfigSaveJSON

void ConfigSaveJSON(const Config *config, const char *filename){	FILE *f = fopen(filename, "w");	char *text = NULL;	json_t *root;	if (f == NULL)	{		printf("Error saving config '%s'/n", filename);		return;	}	setlocale(LC_ALL, "");	root = json_new_object();	json_insert_pair_into_object(root, "Version", json_new_number(VERSION));	ConfigSaveVisit(config, root);	json_tree_to_string(root, &text);	char *formatText = json_format_string(text);	fputs(formatText, f);	// clean up	CFREE(formatText);	CFREE(text);	json_free_value(&root);	fclose(f);}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:29,


示例2: MissionTerminate

void MissionTerminate(Mission *m){	CFREE(m->Title);	CFREE(m->Description);	for (int i = 0; i < (int)m->Objectives.size; i++)	{		MissionObjective *mo = CArrayGet(&m->Objectives, i);		CFREE(mo->Description);	}	CArrayTerminate(&m->Objectives);	CArrayTerminate(&m->Enemies);	CArrayTerminate(&m->SpecialChars);	CArrayTerminate(&m->Items);	CArrayTerminate(&m->ItemDensities);	CArrayTerminate(&m->Weapons);	switch (m->Type)	{	case MAPTYPE_CLASSIC:		break;	case MAPTYPE_STATIC:		CArrayTerminate(&m->u.Static.Tiles);		CArrayTerminate(&m->u.Static.Items);		CArrayTerminate(&m->u.Static.Wrecks);		CArrayTerminate(&m->u.Static.Characters);		CArrayTerminate(&m->u.Static.Objectives);		CArrayTerminate(&m->u.Static.Keys);		break;	}}
开发者ID:kodephys,项目名称:cdogs-sdl,代码行数:29,


示例3: CampaignIntroDraw

static void CampaignIntroDraw(void *data){	// This will only draw once	const CampaignSetting *c = data;	GraphicsBlitBkg(&gGraphicsDevice);	const int w = gGraphicsDevice.cachedConfig.Res.x;	const int h = gGraphicsDevice.cachedConfig.Res.y;	const int y = h / 4;	// Display title + author	char *buf;	CMALLOC(buf, strlen(c->Title) + strlen(c->Author) + 16);	sprintf(buf, "%s by %s", c->Title, c->Author);	FontOpts opts = FontOptsNew();	opts.HAlign = ALIGN_CENTER;	opts.Area = gGraphicsDevice.cachedConfig.Res;	opts.Pad.y = y - 25;	FontStrOpt(buf, Vec2iZero(), opts);	CFREE(buf);	// Display campaign description	// allow some slack for newlines	if (strlen(c->Description) > 0)	{		CMALLOC(buf, strlen(c->Description) * 2);		// Pad about 1/6th of the screen width total (1/12th left and right)		FontSplitLines(c->Description, buf, w * 5 / 6);		FontStr(buf, Vec2iNew(w / 12, y));		CFREE(buf);	}}
开发者ID:Wuzzy2,项目名称:cdogs-sdl,代码行数:32,


示例4: UIObjectDestroy

void UIObjectDestroy(UIObject *o){	size_t i;	UIObject **objs = o->Children.data;	CFREE(o->Tooltip);	for (i = 0; i < o->Children.size; i++, objs++)	{		UIObjectDestroy(*objs);	}	CArrayTerminate(&o->Children);	if (o->IsDynamicData)	{		CFREE(o->Data);	}	switch (o->Type)	{	case UITYPE_TEXTBOX:		CFREE(o->u.Textbox.Hint);		break;	case UITYPE_TAB:		CArrayTerminate(&o->u.Tab.Labels);		break;	default:		// do nothing		break;	}	CFREE(o);}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:28,


示例5: ConvertCampaignSetting

void ConvertCampaignSetting(CampaignSetting *dest, CampaignSettingOld *src){	int i;	CFREE(dest->Title);	CSTRDUP(dest->Title, src->title);	CFREE(dest->Author);	CSTRDUP(dest->Author, src->author);	CFREE(dest->Description);	CSTRDUP(dest->Description, src->description);	for (i = 0; i < src->missionCount; i++)	{		Mission m;		MissionInit(&m);		ConvertMission(&m, &src->missions[i]);		CArrayPushBack(&dest->Missions, &m);	}	CharacterStoreTerminate(&dest->characters);	CharacterStoreInit(&dest->characters);	for (i = 0; i < src->characterCount; i++)	{		Character *ch = CharacterStoreAddOther(&dest->characters);		ConvertCharacter(ch, &src->characters[i]);		CharacterSetLooks(ch, &ch->looks);	}}
开发者ID:kodephys,项目名称:cdogs-sdl,代码行数:25,


示例6: UIObjectDestroy

void UIObjectDestroy(UIObject *o){	CFREE(o->Tooltip);	CA_FOREACH(UIObject *, obj, o->Children)		UIObjectDestroy(*obj);	CA_FOREACH_END()	CArrayTerminate(&o->Children);	if (o->IsDynamicData)	{		CFREE(o->Data);	}	switch (o->Type)	{	case UITYPE_TEXTBOX:		CFREE(o->u.Textbox.Hint);		break;	case UITYPE_TAB:		CArrayTerminate(&o->u.Tab.Labels);		break;	default:		// do nothing		break;	}	CFREE(o);}
开发者ID:FlyingTarrasque,项目名称:cdogs-sdl,代码行数:25,


示例7: ConfigSaveJSON

void ConfigSaveJSON(Config *config, const char *filename){	FILE *f = fopen(filename, "w");	char *text = NULL;	json_t *root;	if (f == NULL)	{		printf("Error saving config '%s'/n", filename);		return;	}	setlocale(LC_ALL, "");	root = json_new_object();	json_insert_pair_into_object(root, "Version", json_new_number(VERSION));	AddGameConfigNode(&config->Game, root);	AddGraphicsConfigNode(&config->Graphics, root);	AddInputConfigNode(&config->Input, root);	AddInterfaceConfigNode(&config->Interface, root);	AddSoundConfigNode(&config->Sound, root);	AddQuickPlayConfigNode(&config->QuickPlay, root);	json_tree_to_string(root, &text);	char *formatText = json_format_string(text);	fputs(formatText, f);	// clean up	CFREE(formatText);	CFREE(text);	json_free_value(&root);	fclose(f);}
开发者ID:kodephys,项目名称:cdogs-sdl,代码行数:34,


示例8: ScreenMissionBriefing

bool ScreenMissionBriefing(const struct MissionOptions *m){	const int w = gGraphicsDevice.cachedConfig.Res.x;	const int h = gGraphicsDevice.cachedConfig.Res.y;	const int y = h / 4;	MissionBriefingData mData;	memset(&mData, 0, sizeof mData);	mData.IsOK = true;	// Title	CMALLOC(mData.Title, strlen(m->missionData->Title) + 32);	sprintf(mData.Title, "Mission %d: %s",		m->index + 1, m->missionData->Title);	mData.TitleOpts = FontOptsNew();	mData.TitleOpts.HAlign = ALIGN_CENTER;	mData.TitleOpts.Area = gGraphicsDevice.cachedConfig.Res;	mData.TitleOpts.Pad.y = y - 25;	// Password	if (m->index > 0)	{		sprintf(			mData.Password, "Password: %s", gAutosave.LastMission.Password);		mData.PasswordOpts = FontOptsNew();		mData.PasswordOpts.HAlign = ALIGN_CENTER;		mData.PasswordOpts.Area = gGraphicsDevice.cachedConfig.Res;		mData.PasswordOpts.Pad.y = y - 15;	}	// Split the description, and prepare it for typewriter effect	mData.TypewriterCount = 0;	// allow some slack for newlines	CMALLOC(mData.Description, strlen(m->missionData->Description) * 2 + 1);	CCALLOC(mData.TypewriterBuf, strlen(m->missionData->Description) * 2 + 1);	// Pad about 1/6th of the screen width total (1/12th left and right)	FontSplitLines(m->missionData->Description, mData.Description, w * 5 / 6);	mData.DescriptionPos = Vec2iNew(w / 12, y);	// Objectives	mData.ObjectiveDescPos =		Vec2iNew(w / 6, y + FontStrH(mData.Description) + h / 10);	mData.ObjectiveInfoPos =		Vec2iNew(w - (w / 6), mData.ObjectiveDescPos.y + FontH());	mData.ObjectiveHeight = h / 12;	mData.MissionOptions = m;	GameLoopData gData = GameLoopDataNew(		&mData, MissionBriefingUpdate,		&mData, MissionBriefingDraw);	GameLoop(&gData);	if (mData.IsOK)	{		SoundPlay(&gSoundDevice, StrSound("mg"));	}	CFREE(mData.Title);	CFREE(mData.Description);	CFREE(mData.TypewriterBuf);	return mData.IsOK;}
开发者ID:Wuzzy2,项目名称:cdogs-sdl,代码行数:60,


示例9: TrySaveJSONFile

bool TrySaveJSONFile(json_t *node, const char *filename){	bool res = true;	char *text;	json_tree_to_string(node, &text);	char *ftext = json_format_string(text);	FILE *f = fopen(filename, "w");	if (f == NULL)	{		LOG(LM_MAIN, LL_ERROR, "failed to open file(%s) for saving: %s",			filename, strerror(errno));		res = false;		goto bail;	}	size_t writeLen = strlen(ftext);	const size_t rc = fwrite(ftext, 1, writeLen, f);	if (rc != writeLen)	{		LOG(LM_MAIN, LL_ERROR, "Wrote (%d) of (%d) bytes: %s",			(int)rc, (int)writeLen, strerror(errno));		res = false;		goto bail;	}bail:	CFREE(text);	CFREE(ftext);	if (f != NULL) fclose(f);	return res;}
开发者ID:ChunHungLiu,项目名称:cdogs-sdl,代码行数:30,


示例10: PY_pdbdata_tp_dealloc

static void PY_pdbdata_tp_dealloc(PY_pdbdata *self)   {/* XXX    PD_free(self->file, self->type, self->data) ;*//* Check if the data actually belongs to another object. * For example, by indexing.  In this case self->data * may be pointer into the middle of an array so * we can not delete it directly.  Instead decrement the parent. */    if (self->parent == NULL)       {if (self->data != NULL)	   {_PP_rel_syment(self->dpobj->host_chart, self->data,			   self->nitems, self->type);            CFREE(self->data);};}    else       {Py_DECREF(self->parent);        self->parent = NULL;        self->data   = NULL;};    CFREE(self->type);    _PD_rl_dimensions(self->dims);    _PD_rl_defstr(self->dp);    Py_XDECREF(self->dpobj);    PY_self_free(self);    return;}
开发者ID:sabrown256,项目名称:pactnew,代码行数:28,


示例11: TrySaveJSONFile

bool TrySaveJSONFile(json_t *node, const char *filename){	bool res = true;	char *text;	json_tree_to_string(node, &text);	char *ftext = json_format_string(text);	FILE *f = fopen(filename, "w");	if (f == NULL)	{		printf("failed to open. Reason: [%s]./n", strerror(errno));		res = false;		goto bail;	}	size_t writeLen = strlen(ftext);	const size_t rc = fwrite(ftext, 1, writeLen, f);	if (rc != writeLen)	{		printf("Wrote (%d) of (%d) bytes. Reason: [%s]./n",			(int)rc, (int)writeLen, strerror(errno));		res = false;		goto bail;	}bail:	CFREE(text);	CFREE(ftext);	if (f != NULL) fclose(f);	return res;}
开发者ID:FlyingTarrasque,项目名称:cdogs-sdl,代码行数:29,


示例12: VisitedNodesDestroy

static inline void VisitedNodesDestroy(VisitedNodes visitedNodes){    CFREE(visitedNodes->nodeRecordsIndex);	CFREE(visitedNodes->nodeRecords);	CFREE(visitedNodes->openNodes);	CFREE(visitedNodes);}
开发者ID:ChunHungLiu,项目名称:cdogs-sdl,代码行数:7,


示例13: MenuSystemTerminate

void MenuSystemTerminate(MenuSystem *ms){	MenuDestroySubmenus(ms->root);	CFREE(ms->root);	CFREE(ms->customDisplayFuncs);	CFREE(ms->customDisplayDatas);	memset(ms, 0, sizeof *ms);}
开发者ID:MrDesTinY,项目名称:cdogs-sdl,代码行数:8,


示例14: makeh

static void makeh(void)   {int i, j, l, sz, change, N_var;    double t1, t2, *tt, **td, *pd, *time, **ldata;    haelem **tab, *hp;    source_record *sp;    time_list *tp;    pcons *pp, *pn;/* order the times for each variable in srctab */    sz    = srctab->size;    tab   = srctab->table;    N_var = 0;    for (i = 0; i < sz; i++)        for (hp = tab[i]; hp != NULL; hp = hp->next)            {tp = (time_list *) (hp->def);             l  = tp->length;/* copy the list into arrays */             tt = time = CMAKE_N(double, l);             td = ldata = CMAKE_N(double *, l);             for (pp = tp->list; pp != NULL; pp = pn)                 {sp = (source_record *) pp->car;                  *(tt++) = sp->time;                  *(td++) = sp->data;                  pn = (pcons *) pp->cdr;                  CFREE(sp);                  CFREE(pp);};/* sort the arrays according to the times */             change = TRUE;             while (change)                {change = FALSE;                 for (j = 1; j < l; j++)                     {t1 = time[j-1];                      t2 = time[j];                      if (t2 < t1)                         {pd         = ldata[j-1];                          ldata[j-1] = ldata[j];                          ldata[j]   = pd;                          time[j]    = t1;                          time[j-1]  = t2;                          change     = TRUE;};};};/* write the variable and source_record array out */             write_var(pdsf, hp->name, time, ldata, l);             N_var++;/* release the temporary storage for this variable */             CFREE(time);             CFREE(ldata);};/* finish up */    PD_write(pdsf, "n_variables", "integer", &N_var);    PD_close(pdsf);    pdsf = NULL;        return;}
开发者ID:sabrown256,项目名称:pactnew,代码行数:57,


示例15: PlayerListTerminate

static void PlayerListTerminate(GameLoopData *data){	PlayerList *pl = data->Data;	CArrayTerminate(&pl->playerUIDs);	MenuSystemTerminate(&pl->ms);	CFREE(pl->data);	CFREE(pl);}
开发者ID:cxong,项目名称:cdogs-sdl,代码行数:9,


示例16: GraphicsTerminate

void GraphicsTerminate(GraphicsDevice *device){	debug(D_NORMAL, "Shutting down video.../n");	SDL_FreeSurface(device->icon);	SDL_FreeSurface(device->screen);	SDL_VideoQuit();	CFREE(device->buf);	CFREE(device->bkg);}
开发者ID:gallegretti,项目名称:cdogs-sdl,代码行数:9,


示例17: MapNewLoadCampaignJSON

void MapNewLoadCampaignJSON(json_t *root, CampaignSetting *c){	CFREE(c->Title);	c->Title = GetString(root, "Title");	CFREE(c->Author);	c->Author = GetString(root, "Author");	CFREE(c->Description);	c->Description = GetString(root, "Description");}
开发者ID:alexmustafa,项目名称:cdogs-sdl,代码行数:9,


示例18: AmmoClassesClear

void AmmoClassesClear(CArray *ammo){	CA_FOREACH(Ammo, a, *ammo)		CFREE(a->Name);		CFREE(a->Sound);		CFREE(a->DefaultGun);	CA_FOREACH_END()	CArrayClear(ammo);}
开发者ID:cxong,项目名称:cdogs-sdl,代码行数:9,


示例19: MenuDestroy

void MenuDestroy(MenuSystem *menu){	if (menu == NULL || menu->root == NULL)	{		return;	}	MenuDestroySubmenus(menu->root);	CFREE(menu->root);	CFREE(menu);}
开发者ID:jacquelinekay,项目名称:cdogs-sdl,代码行数:10,


示例20: AmmoClassesClear

void AmmoClassesClear(CArray *ammo){	for (int i = 0; i < (int)ammo->size; i++)	{		Ammo *a = CArrayGet(ammo, i);		CFREE(a->Name);		CFREE(a->Sound);	}	CArrayClear(ammo);}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:10,


示例21: FreeTrigger

void FreeTrigger(TTrigger * t){	if (!t)		return;	FreeTrigger(t->left);	FreeTrigger(t->right);	CFREE(t->actions);	CFREE(t);}
开发者ID:bugamn,项目名称:cdogs-sdl,代码行数:10,


示例22: WeaponClassesClear

void WeaponClassesClear(CArray *classes){	for (int i = 0; i < (int)classes->size; i++)	{		GunDescription *gd = CArrayGet(classes, i);		CFREE(gd->name);		CFREE(gd->Description);	}	CArrayClear(classes);}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:10,


示例23: BulletClassFree

static void BulletClassFree(BulletClass *b){	CFREE(b->Name);	CFREE(b->HitSound.Object);	CFREE(b->HitSound.Flesh);	CFREE(b->HitSound.Wall);	CArrayTerminate(&b->OutOfRangeGuns);	CArrayTerminate(&b->HitGuns);	CArrayTerminate(&b->Falling.DropGuns);	CArrayTerminate(&b->ProximityGuns);}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:11,


示例24: LoadArchivePics

static void LoadArchivePics(	PicManager *pm, const char *archive, const char *dirname){	char *buf = NULL;	char path[CDOGS_PATH_MAX];	sprintf(path, "%s/%s", archive, dirname);	tinydir_dir dir;	if (tinydir_open(&dir, path) != 0)	{		LOG(LM_MAP, LL_DEBUG, "no pic dir(%s): %s", path, strerror(errno));		goto bail;	}	while (dir.has_next)	{		tinydir_file file;		if (tinydir_readfile(&dir, &file) != 0)		{			LOG(LM_MAP, LL_WARN, "cannot read file: %s", strerror(errno));			break;		}		if (!file.is_reg) goto nextFile;		long len;		buf = ReadFileIntoBuf(file.path, "rb", &len);		if (buf == NULL) goto nextFile;		SDL_RWops *rwops = SDL_RWFromMem(buf, len);		bool isPng = IMG_isPNG(rwops);		if (isPng)		{			SDL_Surface *data = IMG_Load_RW(rwops, 0);			if (data != NULL)			{				char nameBuf[CDOGS_FILENAME_MAX];				PathGetBasenameWithoutExtension(nameBuf, file.path);				PicManagerAdd(&pm->customPics, &pm->customSprites, nameBuf, data);			}		}		rwops->close(rwops);	nextFile:		CFREE(buf);		buf = NULL;		if (tinydir_next(&dir) != 0)		{			printf(				"Could not go to next file in dir %s: %s/n",				path, strerror(errno));			goto bail;		}	}bail:	CFREE(buf);	tinydir_close(&dir);}
开发者ID:FlyingTarrasque,项目名称:cdogs-sdl,代码行数:54,


示例25: CampaignSettingTerminate

void CampaignSettingTerminate(CampaignSetting *setting){	CFREE(setting->Title);	CFREE(setting->Author);	CFREE(setting->Description);	CA_FOREACH(Mission, m, setting->Missions)		MissionTerminate(m);	CA_FOREACH_END()	CArrayTerminate(&setting->Missions);	CharacterStoreTerminate(&setting->characters);	memset(setting, 0, sizeof *setting);}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:12,


示例26: LoadArchiveSounds

static void LoadArchiveSounds(	SoundDevice *device, const char *archive, const char *dirname){	char *buf = NULL;	char path[CDOGS_PATH_MAX];	sprintf(path, "%s/%s", archive, dirname);	tinydir_dir dir;	if (tinydir_open(&dir, path) != 0)	{		LOG(LM_MAP, LL_DEBUG, "no sound dir(%s): %s", path, strerror(errno));		goto bail;	}	while (dir.has_next)	{		tinydir_file file;		tinydir_readfile(&dir, &file);		if (!file.is_reg) goto nextFile;		long len;		buf = ReadFileIntoBuf(file.path, "rb", &len);		if (buf == NULL) goto nextFile;		SDL_RWops *rwops = SDL_RWFromMem(buf, len);		Mix_Chunk *data = Mix_LoadWAV_RW(rwops, 0);		if (data != NULL)		{			char nameBuf[CDOGS_FILENAME_MAX];			strcpy(nameBuf, file.name);			// Remove extension			char *dot = strrchr(nameBuf, '.');			if (dot != NULL)			{				*dot = '/0';			}			SoundAdd(&device->customSounds, nameBuf, data);		}		rwops->close(rwops);	nextFile:		CFREE(buf);		buf = NULL;		if (tinydir_next(&dir) != 0)		{			printf(				"Could not go to next file in dir %s: %s/n",				path, strerror(errno));			goto bail;		}	}bail:	CFREE(buf);	tinydir_close(&dir);}
开发者ID:FlyingTarrasque,项目名称:cdogs-sdl,代码行数:52,


示例27: ObjectiveLoadJSON

void ObjectiveLoadJSON(Objective *o, json_t *node, const int version){	memset(o, 0, sizeof *o);	o->Description = GetString(node, "Description");	JSON_UTILS_LOAD_ENUM(o->Type, node, "Type", StrObjectiveType);	// Set objective colours based on type	o->color = ObjectiveTypeColor(o->Type);	if (version < 8)	{		// Index numbers used for all objective classes; convert them		// to their class handles		LoadInt(&o->u.Index, node, "Index");		switch (o->Type)		{		case OBJECTIVE_COLLECT:			o->u.Pickup = IntPickupClass(o->u.Index);			break;		case OBJECTIVE_DESTROY:			o->u.MapObject = IntMapObject(o->u.Index);			break;		default:			// do nothing			break;		}	}	else	{		char *tmp;		switch (o->Type)		{		case OBJECTIVE_COLLECT:			tmp = GetString(node, "Pickup");			o->u.Pickup = StrPickupClass(tmp);			CFREE(tmp);			break;		case OBJECTIVE_DESTROY:			tmp = GetString(node, "MapObject");			o->u.MapObject = StrMapObject(tmp);			CFREE(tmp);			break;		default:			LoadInt(&o->u.Index, node, "Index");			break;		}	}	LoadInt(&o->Count, node, "Count");	LoadInt(&o->Required, node, "Required");	LoadInt(&o->Flags, node, "Flags");}
开发者ID:ChunHungLiu,项目名称:cdogs-sdl,代码行数:49,


示例28: MapObjectsTerminate

void MapObjectsTerminate(MapObjects *classes){	MapObjectsClear(&classes->Classes);	CArrayTerminate(&classes->Classes);	MapObjectsClear(&classes->CustomClasses);	CArrayTerminate(&classes->CustomClasses);	CA_FOREACH(char *, s, classes->Destructibles)		CFREE(*s);	CA_FOREACH_END()	CArrayTerminate(&classes->Destructibles);	CA_FOREACH(char *, s, classes->Bloods)		CFREE(*s);	CA_FOREACH_END()	CArrayTerminate(&classes->Bloods);}
开发者ID:carstene1ns,项目名称:cdogs-sdl,代码行数:15,


示例29: LoadCharacters

void LoadCharacters(	CharacterStore *c, json_t *charactersNode, const int version){	json_t *child = charactersNode->child;	CharacterStoreTerminate(c);	CharacterStoreInit(c);	while (child)	{		Character *ch = CharacterStoreAddOther(c);		char *tmp;		if (version < 7)		{			// Old version stored character looks as palette indices			int face;			LoadInt(&face, child, "face");			ch->Class = IntCharacterClass(face);			int skin, arm, body, leg, hair;			LoadInt(&skin, child, "skin");			LoadInt(&arm, child, "arm");			LoadInt(&body, child, "body");			LoadInt(&leg, child, "leg");			LoadInt(&hair, child, "hair");			ConvertCharacterColors(skin, arm, body, leg, hair, &ch->Colors);		}		else		{			tmp = GetString(child, "Class");			ch->Class = StrCharacterClass(tmp);			CFREE(tmp);			LoadColor(&ch->Colors.Skin, child, "Skin");			LoadColor(&ch->Colors.Arms, child, "Arms");			LoadColor(&ch->Colors.Body, child, "Body");			LoadColor(&ch->Colors.Legs, child, "Legs");			LoadColor(&ch->Colors.Hair, child, "Hair");		}		LoadInt(&ch->speed, child, "speed");		tmp = GetString(child, "Gun");		ch->Gun = StrGunDescription(tmp);		CFREE(tmp);		LoadInt(&ch->maxHealth, child, "maxHealth");		LoadInt(&ch->flags, child, "flags");		LoadInt(&ch->bot->probabilityToMove, child, "probabilityToMove");		LoadInt(&ch->bot->probabilityToTrack, child, "probabilityToTrack");		LoadInt(&ch->bot->probabilityToShoot, child, "probabilityToShoot");		LoadInt(&ch->bot->actionDelay, child, "actionDelay");		child = child->next;	}}
开发者ID:CrypticGator,项目名称:cdogs-sdl,代码行数:48,


示例30: NetInputClientConnect

void NetInputClientConnect(NetInputClient *n, Uint32 host){	if (!NetInputChannelTryOpen(&n->channel, 0, host))	{		printf("Failed to open channel/n");		return;	}	n->channel.otherPort = NET_INPUT_UDP_PORT;	// Handshake	// Send SYN	UDPpacket packet = NetInputNewPacket(&n->channel, sizeof(NetMsgSyn));	NetMsgSyn *packetSyn = (NetMsgSyn *)packet.data;	n->channel.seq = rand() & (Uint16)-1;	SDLNet_Write16(n->channel.seq, &packetSyn->seq);	if (!NetInputTrySendPacket(&n->channel, packet))	{		printf("Failed to send SYN/n");		goto bail;	}	n->channel.seq++;	// Wait for SYN-ACK	// TODO: don't wait forever	n->channel.state = CHANNEL_STATE_WAIT_HANDSHAKE;	while (!NetInputRecvBlocking(&n->channel, TryParseSynAck, &n->channel))	{		// Spin	}	// Send ACK	CFREE(packet.data);	packet = NetInputNewPacket(&n->channel, sizeof(NetMsgAck));	NetMsgAck *packetAck = (NetMsgAck *)packet.data;	SDLNet_Write16(n->channel.ack, &packetAck->ack);	if (!NetInputTrySendPacket(&n->channel, packet))	{		printf("Failed to send ACK/n");		goto bail;	}	n->channel.state = CHANNEL_STATE_CONNECTED;	return;bail:	CFREE(packet.data);}
开发者ID:kodephys,项目名称:cdogs-sdl,代码行数:48,



注:本文中的CFREE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CFRangeMake函数代码示例
C++ CFPlugInRemoveInstanceForFactory函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。