Example #1
0
size_t DisplayTypeDecl(FILE *fp, TypeDecl *typeDecl, int indent)
{
	Type *type;
	size_t len = 0;
	size_t i;

	bool padtype  = typeDecl->declList.size() ? true : false;

	DisplayTags(fp, typeDecl->tagList);
	DisplayWhitespace(fp, &typeDecl->tagRef);


	if(typeDecl->typeAlias)
		fprintf(fp, "typedef ");
	
	len += RecurseDisplayType(fp, typeDecl, typeDecl->baseType, indent, padtype && typeDecl->nested);

	// display each variable-decl
	for(i = 0; i < typeDecl->declList.size(); i++)
	{
		len += fprintf(fp, " ");

		type = typeDecl->declList[i];
		
		Type *restore = BreakLink(type, typeDecl->baseType);
	
		type = InvertType(type);

		len += RecurseDisplayType(fp, typeDecl, type, indent, false);

		if(i < typeDecl->declList.size() - 1)
			len += fprintf(fp, ",");

		type = InvertType(type);
		RestoreLink(restore, typeDecl->baseType);
	}

	return len;
}
Example #2
0
void RenderType(TCHAR *buf, int len, Type *type)
{
	stringprint sbuf(buf, len);

	Type *restore = 0;
	Type *tptr;

	for(tptr = type; tptr; tptr = tptr->link)
	{
		if(tptr->ty == typeTYPEDEF)
		{
			tptr = tptr->link;
			restore = BreakLink(type, tptr);
			break;
		}
	}

	type = InvertType(type);
	RecurseRenderType(sbuf, type);
	type = InvertType(type);

	if(restore)
		RestoreLink(restore, tptr);
}
Example #3
0
DDWORD CProjectile::EngineMessageFn(DDWORD messageID, void *pData, DFLOAT fData)
{
	switch(messageID)
	{
		case MID_UPDATE:
		{
			if (!Update((DVector *)pData))
			{
				CServerDE* pServerDE = BaseClass::GetServerDE();
				if (!pServerDE) return 0;

				pServerDE->RemoveObject(m_hObject);		
			}
			break;
		}

		case MID_PRECREATE:
		{
			ObjectCreateStruct *ocs = (ObjectCreateStruct*)pData;
			m_dwClientID = ocs->m_UserData;
			ocs = DNULL;

			DDWORD dwRet = BaseClass::EngineMessageFn(messageID, pData, fData);

			if (fData != PRECREATE_SAVEGAME)
				PostPropRead((ObjectCreateStruct*)pData);

			return dwRet;
		}

		case MID_INITIALUPDATE:
		{
			if (fData != INITIALUPDATE_SAVEGAME)
				InitialUpdate((DVector *)pData);
			break;
		}

		case MID_TOUCHNOTIFY:
		{
			HandleTouch((HOBJECT)pData);
			break;
		}

		case MID_LINKBROKEN:
		{
			HOBJECT hObj = (HOBJECT)pData;
			BreakLink(hObj);
			break;
		}

		case MID_SAVEOBJECT:
			Save((HMESSAGEWRITE)pData, (DDWORD)fData);
			break;

		case MID_LOADOBJECT:
			Load((HMESSAGEREAD)pData, (DDWORD)fData);
			break;

		default : break;
	}


	return BaseClass::EngineMessageFn(messageID, pData, fData);
}