Esempio n. 1
0
sint32 OzoneDatabase::ParseDeadTileNumbers(Token *uvToken, sint32 &food, sint32 &shield, sint32 &trade)
	{
	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tile food production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetNumber(food) ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tile shield production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetNumber(shield) ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tile trade production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetNumber(trade) ;

	return (TRUE) ;
	}
Esempio n. 2
0
void SlicFrame::SetValue(SlicSymbolData *sym, SS_TYPE type, SlicStackValue value)
{
	SlicSymbolData *getsym;
	switch(type) {
		case SS_TYPE_INT:
			sym->SetIntValue(Eval(type, value));
			break;
		case SS_TYPE_VAR:
			getsym = g_slicEngine->GetSymbol(value.m_int);
			if(!sym->SetValueFrom(getsym)) {
				char buf[1024];
				sprintf(buf, "In object %s, variables '%s' and '%s' are of different types", m_segment->GetName(), sym->GetName(), getsym->GetName());
				if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					c3errors_ErrorDialog("Slic", buf);
				}
			}
			break;
		case SS_TYPE_SYM:
			getsym = value.m_sym;
			if(!sym->SetValueFrom(getsym)) {
				char buf[1024];
				sprintf(buf, "In object %s, variables '%s' and '%s' are of different types", m_segment->GetName(), sym->GetName(), getsym->GetName());
				if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					c3errors_ErrorDialog("Slic", buf);
				}
			}
			break;
		default:
		{
			BOOL BadTypeInAssignment = FALSE;
			Assert(BadTypeInAssignment);
			break;
		}
	}
}
Esempio n. 3
0
sint32 ThroneDB::ParseNumber(Token *token, sint32 *number)
{

	sint32 n;

	if (token->GetType() != TOKEN_NUMBER) {
		c3errors_ErrorDialog(token->ErrStr(), "Missing number from ThroneDB");
		g_abort_parse = TRUE;
		return(FALSE);
	}

	token->GetNumber(n);
	token->Next();

	if (n < 0) {
		c3errors_ErrorDialog(token->ErrStr(), "Number in ThroneDB is negative");
		g_abort_parse = TRUE;
		return FALSE;
	} else if (n == 0) {
		c3errors_ErrorDialog(token->ErrStr(), "Number in ThroneDB is zero");
		g_abort_parse = TRUE;
		return TRUE;
	}

	*number = n;

	return(TRUE);
}
Esempio n. 4
0
sint32 FilenameDB::ParseAFilename(Token *token, sint32 count)

{
    char str[_MAX_PATH];

	if (token->GetType() == TOKEN_EOF) {
		return FALSE;
	}

	if (token->GetType() != TOKEN_STRING) {
		c3errors_ErrorDialog  (token->ErrStr(), "Icon name expected");
        g_abort_parse = TRUE;
		return FALSE;
	} else {
   		token->GetString(str);
        SetName(count, str);
	}

    if (token->Next() != TOKEN_QUOTED_STRING) {
		c3errors_ErrorDialog  (token->ErrStr(), "Filename expected");
        g_abort_parse = TRUE;
		return FALSE;
	} else {
   		token->GetString(str);
        SetFilename(count, str);
	}

	token->Next();

    return TRUE;
}
Esempio n. 5
0
AUI_ERRCODE TiffImageFormat::Load(MBCHAR const * filename, aui_Image *image )
{
	uint16	width, height;
	TIFGetMetrics( filename, &width, &height);

	AUI_ERRCODE errcode = image->LoadEmpty( width, height, 16 );
	Assert( errcode == AUI_ERRCODE_OK );
	if ( errcode != AUI_ERRCODE_OK ) {
		c3errors_ErrorDialog("TIF Load", "Unable to find the file '%s'", filename);
		return AUI_ERRCODE_LOADFAILED;
	}

	aui_Surface *surface = image->TheSurface();
	if (!surface) return AUI_ERRCODE_LOADFAILED;

	AUI_ERRCODE retcode = AUI_ERRCODE_OK;

	uint16  * buffer;
	errcode = surface->Lock( NULL, (LPVOID *)&buffer, 0 );
	Assert( errcode == AUI_ERRCODE_OK );
	if ( errcode == AUI_ERRCODE_OK )
	{
		BOOL		is565 = (surface->PixelFormat() == AUI_SURFACE_PIXELFORMAT_565);
		TIFLoadIntoBuffer16( filename, &width, &height, (uint16)surface->Pitch(), buffer, is565);

		errcode = surface->Unlock( buffer );

		Assert( errcode == AUI_ERRCODE_OK );
		if ( errcode != AUI_ERRCODE_OK )
			retcode = AUI_ERRCODE_SURFACEUNLOCKFAILED;
	}

	return retcode;
}
Esempio n. 6
0
AUI_ERRCODE TargaImageFormat::Load(MBCHAR const * filename, aui_Image *image)
{
#ifdef WIN32
    if (_access(filename, 0) != 0)
#else
    struct stat st;
    if (stat(filename, &st) != 0)
#endif
    {
		return LoadRIM(filename, image);
    }

	int		width;
    int     height;
	int		bpp;
	if (!Get_TGA_Dimension(filename, width, height, bpp)) 
    {
		return AUI_ERRCODE_LOADFAILED;
    }

	AUI_ERRCODE errcode = image->LoadEmpty( width, height, 16 );
	Assert( errcode == AUI_ERRCODE_OK );
	if ( errcode != AUI_ERRCODE_OK ) {
		MBCHAR	s[200];
		sprintf(s, "Unable to load the file '%s' (w:%d, h:%d)", filename, width, height);
		c3errors_ErrorDialog("Targa Load", s, filename);
		return AUI_ERRCODE_LOADFAILED;
	}

	aui_Surface * surface = image->TheSurface();
	if (!surface) return AUI_ERRCODE_LOADFAILED;

	AUI_ERRCODE retcode = AUI_ERRCODE_OK;
	uint16 *    buffer;
	errcode = surface->Lock( NULL, (LPVOID *)&buffer, 0 );
	
	Assert( errcode == AUI_ERRCODE_OK );
	if ( errcode == AUI_ERRCODE_OK )
	{
		if (Load_TGA_File(filename, (uint8 *)buffer, (int)surface->Pitch(), width, height, NULL, TRUE))
        {
		    errcode = surface->Unlock( buffer );

		    Assert( errcode == AUI_ERRCODE_OK );
		    if ( errcode != AUI_ERRCODE_OK )
			    retcode = AUI_ERRCODE_SURFACEUNLOCKFAILED;
        }
        else
        {
            (void) surface->Unlock(buffer);
            retcode = AUI_ERRCODE_LOADFAILED;
        }
	}

	return retcode;
}
Esempio n. 7
0
sint32 ThroneDB::CheckToken(Token *token, sint32 type, MBCHAR *error)
{

	if(token->Next() != type) {
		c3errors_ErrorDialog(token->ErrStr(), error);
		g_abort_parse = TRUE;
		return FALSE;
	}

	return(TRUE);
}
Esempio n. 8
0
sint32 FilenameDB::Parse(char *filename)

{

    Token *token = new Token(filename, C3DIR_GAMEDATA);
	Assert(token);

   	if (token->GetType() != TOKEN_NUMBER) {
		c3errors_ErrorDialog  (token->ErrStr(), "Missing number of filenames");
        g_abort_parse = TRUE;
		delete token;
		return FALSE;
	} else {
        sint32 n;
		token->GetNumber(n);
		token->Next();
		if (n <0) {
			c3errors_ErrorDialog(token->ErrStr(), "Number of filename is negative");
            g_abort_parse = TRUE;
			delete token;
			return FALSE;
		}
		SetSize(n);
	}

    int count = 0;
    while (ParseAFilename(token, count)) {
        count++;
    }
    if (g_abort_parse) {
		delete token;
		return FALSE;
	}

	delete token;

    return TRUE;
}
Esempio n. 9
0
BOOL SlicFrame::ArrayLookup(SS_TYPE arrayType, SlicStackValue array,
							SS_TYPE indexType, SlicStackValue indexValue,
							SS_TYPE &retType, SlicStackValue &retValue)
{
	SlicSymbolData * arraySym = SlicStack::GetSymbol(arrayType, array);

	if (arraySym) 
    {
	    sint32 index = Eval(indexType, indexValue);
	    return arraySym->ArrayLookup(index, retType, retValue);
    }
    else
    {
		c3errors_ErrorDialog("Slic", "Array is not a variable");
		return FALSE;
	}
}
Esempio n. 10
0
sint32 OzoneDatabase::ParseAnOzone(Token *uvToken)
	{

	if (uvToken->GetType() == TOKEN_EOF)
		return (FALSE) ;

	if (uvToken->GetType() == TOKEN_OZONE_TRIGGER)
		{
		ParseUVTriggerRecord(uvToken) ;
		}
	else
		{
		c3errors_ErrorDialog(uvToken->ErrStr(), "pollution of type ozone trigger required") ;

		return (FALSE) ;
		}

	return (TRUE) ;
	}
Esempio n. 11
0
GAME_EVENT_HOOK_DISPOSITION SlicSegment::GEVHookCallback(GAME_EVENT type, GameEventArgList *args)
{
	if (IsEnabled())
	{
		SlicObject *so = new SlicObject(this);
		so->AddRef();
		so->Snarf(args);
		so->SetResult((sint32)GEV_HD_Continue);
		g_slicEngine->Execute(so);

		GAME_EVENT_HOOK_DISPOSITION disp = (GAME_EVENT_HOOK_DISPOSITION) so->GetResult();
		so->Release();

		Assert(disp >= GEV_HD_Continue && disp < GEV_HD_MAX);
		if (g_slicEngine->AtBreak())
			return GEV_HD_NeedUserInput;

		switch(disp)
		{
		default:
			if (g_theProfileDB && g_theProfileDB->IsDebugSlic())
			{
				c3errors_ErrorDialog("Slic", "Bad return from event handler");
			}
			break;
		case SLIC_CONST_CONTINUE:
			break;
		case SLIC_CONST_GETINPUT:
			return GEV_HD_NeedUserInput;
		case SLIC_CONST_STOP:
			return GEV_HD_Stop;
		}
	}

	return GEV_HD_Continue;
}
Esempio n. 12
0
sint32 OzoneDatabase::ParseUVTriggerRecord(Token *uvToken)
	{
	double	tmp ;

	if (!token_ParseAnOpenBraceNext(uvToken))
		return (FALSE) ;


	if (uvToken->Next() != TOKEN_UV_NORTH_POLAR_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected north polar region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected north polar region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_NORTH_POLAR] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected north polar region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_NORTH_POLAR] = tmp * 0.01f ;


	if (uvToken->Next() != TOKEN_UV_UPPER_NORTH_MERIDIAN_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper north meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper north meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_UPPER_NORTH_MERIDIAN] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper north meridian region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_UPPER_NORTH_MERIDIAN] = tmp * 0.01f ;


	if (uvToken->Next() != TOKEN_UV_LOWER_NORTH_MERIDIAN_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower north meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower north meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_LOWER_NORTH_MERIDIAN] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower north meridian region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_LOWER_NORTH_MERIDIAN] = tmp * 0.01f ;


	if (uvToken->Next() != TOKEN_UV_EQUATORIAL_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected equatorial region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected equatorial region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_EQUATORIAL] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected equatorial region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_EQUATORIAL] = tmp * 0.01f ;


	if (uvToken->Next() != TOKEN_UV_UPPER_SOUTH_MERIDIAN_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper south meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper south meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_UPPER_SOUTH_MERIDIAN] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected upper south meridian region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_UPPER_SOUTH_MERIDIAN] = tmp * 0.01f ;




	if (uvToken->Next() != TOKEN_UV_LOWER_SOUTH_MERIDIAN_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower south meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower south meridian region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_LOWER_SOUTH_MERIDIAN] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected lower south meridian region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_LOWER_SOUTH_MERIDIAN] = tmp * 0.01f ;


	if (uvToken->Next() != TOKEN_UV_SOUTH_POLAR_PROB)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected south polar region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected south polar region probability found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_prob[REGION_TYPE_SOUTH_POLAR] = tmp * 0.01f ;

	if (uvToken->Next() != TOKEN_NUMBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected south polar region phase bonus found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	uvToken->GetFloat(tmp) ;
	m_meridian_phase_bonus[REGION_TYPE_SOUTH_POLAR] = tmp * 0.01f ;





































	if (uvToken->Next() != TOKEN_CLOSE_BRACE)
		return (FALSE) ;

	return (TRUE) ;
	}
Esempio n. 13
0
//----------------------------------------------------------------------------
//
// Name       : DoInstruction
//
// Description: Executes slic intructions that were previously
//              "compiled" by slicif_add_op.
//
// Parameters : SOP op
//
// Globals    : This function is so big no idea.
//
// Returns    : -
//
// Remark(s)  : The behaviour depends on the given SOP type
//              if you define new operatiors you have of course modify
//              or implement the according behaviour of that function.
//
//              This function is called at slic run time.
//
//----------------------------------------------------------------------------
BOOL SlicFrame::DoInstruction(SOP op)
{
	unsigned char* codePtr = &m_segment->m_code[m_offset];
	unsigned char* origCodePtr = &m_segment->m_code[m_offset];
#if defined(SLIC_DOUBLES)
	double dval;
#endif
	
	sint32 ival, ival2; 

	
	SlicStackValue sval1, sval2, sval3;

	SS_TYPE type1, type2, type3;
	SlicSymbolData *symval;
	BOOL stopped = FALSE;
	sint32 sp;
	sint32 res;
	BOOL calcOffset = TRUE;

	//Added by Martin Gühmann for database access
	SlicDBInterface *conduit;
	char* name;

	switch(op) {
		case SOP_PUSHI:
			sval1.m_int = *(reinterpret_cast<sint32 *>(codePtr));
			codePtr += sizeof(sint32);
			m_stack->Push(SS_TYPE_INT, sval1);
			break;

		case SOP_PUSHD:
#if defined(SLIC_DOUBLES)
			dval = *((double*)codePtr);
            // Probably some handling missing here. Now, we just skip some bytes.
#endif
			codePtr += sizeof(sint32);
			break;

		case SOP_PUSHV:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(int);
			sval1.m_sym = g_slicEngine->GetSymbol(ival);
			if (sval1.m_sym) 
            {
                m_stack->Push(SS_TYPE_SYM, sval1);
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
			}
			break;

		case SOP_PUSHM:
		{
			ival = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL struct symbol %d\n", ival));
				stopped = TRUE;
				break;
			}

			if(symval->GetType() != SLIC_SYM_STRUCT) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, %s is not a struct\n", symval->GetName()));
				stopped = TRUE;
				break;
			}

			SlicStructInstance *theStruct = symval->GetStruct();
			Assert(theStruct);

			ival2 = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			
			sval1.m_sym = theStruct->GetMemberSymbol(ival2);
			m_stack->Push(SS_TYPE_SYM, sval1);
			break;
		}

		case SOP_PUSHAM:
		{
			
			ival = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL struct symbol %d\n", ival));
				stopped = TRUE;
				break;
			}

			if(symval->GetType() != SLIC_SYM_ARRAY) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, %s is not an array\n", symval->GetName()));
				stopped = TRUE;
				break;
			}

			
			sp = m_stack->Pop(type3, sval3);
			Assert(sp >= 1);
			
			
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);

			
			if(!symval->ArrayLookup(Eval(type3, sval3), type1, sval1)) {
				DPRINTF(k_DBG_SLIC, ("Couldn't perform array lookup in SOP_PUSHAM\n"));
				stopped = TRUE;
				break;
			}
			
			
			SlicSymbolData * structSym = SlicStack::GetSymbol(type1, sval1);
			if (!structSym) 
            {
				DPRINTF(k_DBG_SLIC, ("Couldn't find struct symbol in SOP_PUSHAM\n"));
				stopped = TRUE;
				break;
			}
			
			if(structSym->GetType() != SLIC_SYM_STRUCT) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, array symbol id not a struct in SOP_PUSHAM\n"));
				stopped = TRUE;
				break;
			}

			SlicStructInstance *theStruct = structSym->GetStruct();
			Assert(theStruct);
			
			
			ival2 = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			
			sval1.m_sym = theStruct->GetMemberSymbol(ival2);
			m_stack->Push(SS_TYPE_SYM, sval1);
			break;
		}

		case SOP_PUSHA:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(int);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
				break;
			}

			sval1.m_sym = symval;
			m_stack->Push(SS_TYPE_SYM, sval1);
			break;

		case SOP_AINDX:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 1);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			res = ArrayLookup(type2, sval2, type1, sval1,
							  type3, sval3);
			if(res)
				
				m_stack->Push(type3, sval3);
			else {
				sval3.m_int = 0;
				
				m_stack->Push(SS_TYPE_INT, sval3);
			}
			break;
		case SOP_ADD:  
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) + Eval(type1, sval1);
			
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_SUB:  
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) - Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_MULT: 
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) * Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_EXP: 
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = static_cast<int>
				(pow(static_cast<double>(Eval(type2, sval2)), Eval(type1, sval1)));
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		// Bitwise operators:
		case SOP_BAND: 
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) & Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_BOR:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) | Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_BXOR:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) ^ Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_BNOT:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sval3.m_int = ~Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_DIV:  
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			if(Eval(type1, sval1) == 0) {

				//Added by Martin Gühmann
				//It is a problem of slic code and not of the ctp2.exe,
				//the slicer has to solve the problem.
				if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					c3errors_ErrorDialog("Slic", "In object %s: Division by 0.", m_segment->GetName());
				}
				sval3.m_int = 0;
				m_stack->Push(SS_TYPE_INT, sval3);
				break;
			}
			sval3.m_int = Eval(type2, sval2) / Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_MOD:  
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
            {
                sint32 const    divisor = Eval(type1, sval1);
                if (0 == divisor)
                {
                    // Handle error as for SOP_DIV.
                    if (g_theProfileDB && g_theProfileDB->IsDebugSlic())
                    {
                        c3errors_ErrorDialog("Slic", "In object %s: modulo 0.",
                                             m_segment->GetName()
                                            );
                    }
                    sval3.m_int = 0;
                }
                else
                {
                    sval3.m_int = Eval(type2, sval2) % divisor;
                }
            }
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_EQ:   
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = IsEqual(type2, sval2, type1, sval1);
			
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_GT:   
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) > Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_LT:   
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) < Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_GTE:  

			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) >= Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_LTE:  

			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) <= Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_NEQ:
			
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = !IsEqual(type2, sval2, type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_AND:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) && Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_OR:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);
			sval3.m_int = Eval(type2, sval2) || Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);

			break;
		case SOP_NOT:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sval3.m_int = !Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_POP:  
			
			
			Assert(FALSE);
			break;
		case SOP_TRIG: 
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sval3.m_int = Eval(type1, sval1);
			if(!sval3.m_int)
				stopped = TRUE;
			break;
		case SOP_ARGE: 
			sp = m_stack->Pop(type1, sval1);			
			AddArg(type1, sval1);
			break;
		case SOP_ARGID:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, NULL symbol %d\n", ival));
				return FALSE;
			}
			if(symval->GetType() != SLIC_SYM_ID) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, symbol %s is not of type ID\n",
						symval->GetName()));
				return FALSE;
			}
			m_argList->AddArg(symval->GetSegment(), symval);
			break;
		case SOP_ARGS: 
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(symval->GetType() != SLIC_SYM_SVAR) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, string arg doesn't have string type\n"));
				return FALSE;
			}
			m_argList->AddArg(SA_TYPE_STRING, sint32(symval->GetStringId()));
			break;
		case SOP_ARGST:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(symval->GetType() != SLIC_SYM_STRING) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, hard string doesn't have hard string type\n"));
				return FALSE;
			}
			m_argList->AddArg(SA_TYPE_HARD_STRING, symval);
			break;
		case SOP_CALL:
		case SOP_CALLR:
		{
			
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, NULL symbol %d\n", ival));
				return FALSE;
			}
			if(symval->GetType() != SLIC_SYM_FUNC && symval->GetType() != SLIC_SYM_UFUNC) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, symbol %s is not a function\n",
						symval->GetName()));
				return FALSE;
			}
			SlicFunc *funcObj = symval->GetFunction();
			SFN_ERROR err;

			if(!funcObj) {
				
				SlicSegment *segment = g_slicEngine->GetSegment(symval->GetName());
				if(!segment || segment->GetType() != SLIC_OBJECT_FUNCTION) {
					DPRINTF(k_DBG_SLIC, ("Undefined function %s\n", symval->GetName()));
					if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
						c3errors_ErrorDialog("Slic", "%s is not a known function", symval->GetName());
					}
					return FALSE;
				}
				
				
				SlicObject * obj = NULL;
				err = segment->Call(m_argList, obj);
				if (obj)
                {
                    if (op == SOP_CALLR) 
                    {
					    if (g_slicEngine->AtBreak()) 
                        {
                            Assert(!m_resultObject); // need stack when failing?
                            if (m_resultObject)
                            {
                                m_resultObject->Release();
                            }
						    m_resultObject  = obj;
					    } 
                        else 
                        {
						    sval1.m_int = obj->GetResult();
						    m_stack->Push(SS_TYPE_INT, sval1);
						    obj->Release();
					    }
                    }
                    else 
                    {
                        // SOP_CALL: result not used
                        obj->Release();
                    }
				}
			} else {
				err = funcObj->Call(m_argList);
				if(op == SOP_CALLR) {
					switch(funcObj->GetReturnType()) {
						case SFR_INT:
							sval1.m_int = funcObj->GetResult().m_int;
							m_stack->Push(SS_TYPE_INT, sval1);
							break;
						default:
							sval1.m_int = 0;
							m_stack->Push(SS_TYPE_INT, sval1);
							Assert(FALSE);
					}
				}
			}
			if(err != SFN_ERROR_OK) {
				ReportSFError(err, symval);
				stopped = TRUE;
			}

			
			m_argStackPtr--;
			Assert(m_argStackPtr >= -1);
			if(m_argStackPtr >= 0) {
				m_argList = &m_argListArray[m_argStackPtr];
			} else if(m_argStackPtr == -1) {
				m_argList = NULL;
			}

			if(g_slicEngine->AtBreak())
				stopped = TRUE;

			break;
		}
		case SOP_EVENT:
		{
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			if(g_gevManager->IsProcessing()) {
				EVENTLOG(("    "));
			}

			EVENTLOG(("Event:%s(", g_gevManager->GetEventName((GAME_EVENT)ival)));

			GameEventArgList *args = m_argList->CreateGameEventArgs((GAME_EVENT)ival);
			EVENTLOG((") : Serial %d\n", g_gevManager->GetNextSerial()));

			g_gevManager->ArglistAddEvent(GEV_INSERT_Tail,
										  (GAME_EVENT)ival,
										  args);
			
			
			m_argStackPtr--;
			Assert(m_argStackPtr >= -1);
			if(m_argStackPtr >= 0) {
				m_argList = &m_argListArray[m_argStackPtr];
			} else if(m_argStackPtr == -1) {
				m_argList = NULL;
			}

			if(g_slicEngine->AtBreak())
				stopped = TRUE;

			break;
		}
		case SOP_SBLK:
			DPRINTF(k_DBG_SLIC, ("dangling SBLK\n"));
			return FALSE;
		case SOP_END:
			stopped = TRUE;
			codePtr += sizeof(sint32); 
			break;
		case SOP_JMP:
			m_offset    = *(reinterpret_cast<sint32 *>(codePtr));
			calcOffset  = FALSE;
			break;
		case SOP_BNT:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			sp = m_stack->Pop(type2, sval2);
			if(!Eval(type2, sval2)) {
				m_offset = ival;
				calcOffset = FALSE;
			}
			break;
		case SOP_BNEV:
			
			
			
			codePtr += sizeof(sint32);
			
			break;
		case SOP_BUTN:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			ival2 = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);

			symval = g_slicEngine->GetSymbol(ival2);
			if(symval->GetType() != SLIC_SYM_SVAR) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, button string arg doesn't have string type\n"));
				return FALSE;
			}
			g_slicEngine->GetContext()->AddButton(new SlicButton(
				(StringId)symval->GetStringId(), m_segment,
				ival, g_slicEngine->GetContext()));
			break;
		case SOP_OCLS:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);

			g_slicEngine->GetContext()->AddButton(new SlicButton(
					 		 -1, m_segment, ival,
							 g_slicEngine->GetContext()));
			break;
		case SOP_STOP:
			stopped = TRUE;
			break;
		case SOP_NEG:
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			sval3.m_int = 0 - Eval(type1, sval1);
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		case SOP_ASSN:
			ival = *((sint32*)codePtr);
			codePtr += sizeof(sint32);

			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
				break;
			}

			sp = m_stack->Pop(type1, sval1);
			
			
			SetValue(symval, type1, sval1);
			break;
		case SOP_ASSNA:
			
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d in array assignment", ival));
				stopped = TRUE;
				break;
			}

			if(symval->GetType() != SLIC_SYM_ARRAY) {
				if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					c3errors_ErrorDialog("Slic", "Symbol '%s' used in array assignment is not an array", symval->GetName());
				}
				stopped = TRUE;
				break;
			}

			
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 1);

			
			sp = m_stack->Pop(type3, sval3);
			Assert(sp >= 0);
			
			SetArrayValue(symval, type2, sval2, type3, sval3);
			break;
		case SOP_ASSNM:
		{
			ival = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			if(!symval) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL struct symbol %d\n", ival));
				stopped = TRUE;
				break;
			}

			if(symval->GetType() != SLIC_SYM_STRUCT) {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, %s is not a struct\n", symval->GetName()));
				stopped = TRUE;
				break;
			}

			SlicStructInstance *theStruct = symval->GetStruct();
			Assert(theStruct);

			ival2 = *((sint32*)codePtr);
			codePtr += sizeof(sint32);
			
			symval = theStruct->GetMemberSymbol(ival2);
			
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			SetValue(symval, type1, sval1);
			break;
		}
		case SOP_ASSNAM:
		{
			

			
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			SlicSymbolData *arraySym = g_slicEngine->GetSymbol(ival);

			
			ival2 = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			
			if(!arraySym) {
				DPRINTF(k_DBG_SLIC, ("Bad Mojo, symbol %d does not exist", ival));
				stopped = TRUE;
				break;
			}

			if(arraySym->GetType() != SLIC_SYM_ARRAY) {
				DPRINTF(k_DBG_SLIC, ("%s is not an array", arraySym->GetName()));
				stopped = TRUE;
				break;
			}

			
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 1);

			
			sp = m_stack->Pop(type2, sval2);
			Assert(sp >= 0);

			if(!arraySym->ArrayLookup(Eval(type2, sval2), type3, sval3)) {
				DPRINTF(k_DBG_SLIC, ("Array lookup, %s[%d], failed\n", 
									 arraySym->GetName(), Eval(type2, sval2)));
				stopped = TRUE;
				break;
			}

			SlicSymbolData *structSym = SlicStack::GetSymbol(type3, sval3);
			if (!structSym) 
			{
				DPRINTF(k_DBG_SLIC, ("Couldn't find symbol for %s[%d]\n",
									 arraySym->GetName(), Eval(type2, sval2)));
				stopped = TRUE;
				break;
			}

			if(structSym->GetType() != SLIC_SYM_STRUCT) {
				DPRINTF(k_DBG_SLIC, ("%s[%d] is not a struct\n",
									 arraySym->GetName(), Eval(type2, sval2)));
				stopped = TRUE;
				break;
			}

			SlicStructInstance *theStruct = structSym->GetStruct();
			Assert(theStruct);

			if(!theStruct) {
				stopped = TRUE;
				break;
			}
			SlicSymbolData *assnSym = theStruct->GetMemberSymbol(ival2);
			assnSym->SetValueFromStackValue(type1, sval1);
			break;
		}			
		case SOP_SARGS:
			
			m_argStackPtr++;
			Assert(m_argStackPtr < k_ARGLIST_STACK_SIZE);
			if(m_argStackPtr < k_ARGLIST_STACK_SIZE) {
				m_argList = &m_argListArray[m_argStackPtr];
				m_argList->Clear();
			}
			break;
		case SOP_RET:
			
			sp = m_stack->Pop(type1, sval1);
			Assert(sp >= 0);
			g_slicEngine->GetContext()->SetResult(Eval(type1, sval1));
			stopped = TRUE;
			break;
		case SOP_LINE:
		case SOP_LBRK:
		{
			
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			m_currentLine = ival;

			ival2 = *((sint32 *)codePtr);
			if(m_segment->GetFilename()) {
				if(ival2 < 0) {
					
					
					*((sint32 *)codePtr) = FindFileOffset(m_segment->GetFilename(), ival);
					ival2 = *((sint32 *)codePtr);
				}
			}

			codePtr += sizeof(sint32);

			SlicConditional *cond = *((SlicConditional **)codePtr);
			codePtr += sizeof(SlicConditional *);

			if(op == SOP_LBRK || g_slicEngine->BreakRequested()) {
				if(!cond || (cond->Eval() != 0)) {
					
					
					g_slicEngine->Break(m_segment, codePtr - m_segment->m_code, 
										g_slicEngine->GetContext(), m_stack,
										m_messageData);
					stopped = TRUE;
				}
			}

			break;
		}
		case SOP_ASIZE:
			ival = *((sint32 *)codePtr);
			codePtr += sizeof(sint32);
			symval = g_slicEngine->GetSymbol(ival);
			Assert(symval);
			if(symval) {
				sval1.m_int = symval->GetArray()->GetSize();
			}
			else{
				sval1.m_int = 0;
			}
			m_stack->Push(SS_TYPE_INT, sval1);
			break;

		//Added by Martin Gühmann for database support
		case SOP_DBNAME:
		{
			conduit     = GetDatabase(codePtr);
			ival        = *((sint32 *)codePtr);
			codePtr    += sizeof(sint32);
			symval      = g_slicEngine->GetSymbol(ival);

			if (conduit && symval) 
            {
			    sval1.m_sym = symval;
			    sval3.m_int = Eval(SS_TYPE_SYM, sval1);		
			
			    if ((sval3.m_int >= 0) && sval3.m_int < conduit->GetNumRecords())
                {	
                    // No action: value is OK
			    }
			    else
                {
				    sval3.m_int = -1;
                }
                
                m_stack->Push(SS_TYPE_INT, sval3);
			}
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
			}
			break;
		}
		case SOP_DBNAMEREF:
		{
			conduit     = GetDatabase(codePtr);
			ival        = *((sint32 *)codePtr);
			codePtr    += sizeof(sint32);
			symval      = g_slicEngine->GetSymbol(ival);

			if (conduit && symval) 
            {
                //Get the member:
                name = reinterpret_cast<char *>(codePtr);
                Assert(name);
                for ( ; *codePtr++; )
                {
	                // No action: just skip
                }

                sval1.m_sym = symval;
                sval3.m_int = Eval(SS_TYPE_SYM, sval1);		

                if(sval3.m_int > -1 && sval3.m_int < conduit->GetNumRecords()){		
	                sval3.m_int = conduit->GetValue(sval3.m_int, name);
	                m_stack->Push(SS_TYPE_INT, sval3);
                }
                else{
	                if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
		                c3errors_ErrorDialog("Slic", "In object %s no entry found with index %i in %s.", m_segment->GetName(), sval3.m_int, conduit->GetName());
	                }
	                sval3.m_int = 0;
	                m_stack->Push(SS_TYPE_INT, sval3);
                }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
            }
			break;
		}
		case SOP_DBNAMEARRAY:
		{
			conduit     = GetDatabase(codePtr);
			ival        = *((int*)codePtr);
			codePtr    += sizeof(int);
			symval      = g_slicEngine->GetSymbol(ival);

			if (conduit && symval) 
            {
			    //Get the member:
			    name    = reinterpret_cast<char *>(codePtr);
			    Assert(name);
			    for ( ; *codePtr++ ; )
                {
				    // No action: just skip
			    }

			    sval1.m_sym = symval;
			    sval3.m_int = Eval(SS_TYPE_SYM, sval1);		

			    sp = m_stack->Pop(type2, sval2);
			    Assert(sp >= 0);

			    sval2.m_int = Eval(type2, sval2);

			    if(sval3.m_int > -1 && sval3.m_int < conduit->GetNumRecords()){		
				    sval3.m_int = conduit->GetValue(sval3.m_int, name, sval2.m_int);
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
			    else{
				    if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					    c3errors_ErrorDialog("Slic", "In object %s no entry found with index %i in %s.", m_segment->GetName(), sval3.m_int, conduit->GetName());
				    }
				    sval3.m_int = 0;
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, NULL symbol %d\n", ival));
				stopped = TRUE;
			}

			break;
		}
		case SOP_DBNAMECONSTARRAY:
		{
			conduit     = GetDatabase(codePtr);

            if (conduit)
            {
			    sval3.m_int = *((sint32 *)codePtr);
			    codePtr    += sizeof(sint32);
			    //Get the member:
			    name = reinterpret_cast<char *>(codePtr);
			    Assert(name);
			    for ( ; *codePtr++; )
                {
				    // No action: just skip
			    }

			    sp = m_stack->Pop(type2, sval2);
			    Assert(sp >= 0);

			    sval2.m_int = Eval(type2, sval2);


			    if(sval3.m_int > -1 && sval3.m_int < conduit->GetNumRecords()){		
				    sval3.m_int = conduit->GetValue(sval3.m_int, name, sval2.m_int);
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
			    else{
				    if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					    c3errors_ErrorDialog("Slic", "In object %s no entry found with index %i in %s.", m_segment->GetName(), sval3.m_int, conduit->GetName());
				    }
				    sval3.m_int = 0;
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, incorrect database symbol\n"));
				stopped = TRUE;
            }

			break;
		}
		case SOP_DB:
		{
			conduit = GetDatabase(codePtr);

			if (conduit)
            {
			    sp = m_stack->Pop(type1, sval1);
			    Assert(sp >= 0);

			    sval3.m_int = Eval(type1, sval1);

			    if(sval3.m_int > -1 && sval3.m_int < conduit->GetNumRecords()){		
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
			    else{
				    sval3.m_int = -1;
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, incorrect database symbol\n"));
				stopped = TRUE;
            }

			break;
		}
		case SOP_DBREF:
		{
			conduit = GetDatabase(codePtr);

			if (conduit)
            {
			    //Get the member:
			    name = reinterpret_cast<char *>(codePtr);
			    Assert(name);
			    for ( ; *codePtr++ ; )
                {
				    // No action: just skip
			    }

			    sp = m_stack->Pop(type1, sval1);
			    Assert(sp >= 0);

			    sval2.m_int = Eval(type1, sval1);

			    if(sval2.m_int > -1 && sval2.m_int < conduit->GetNumRecords()){		
				    sval3.m_int = conduit->GetValue(sval2.m_int, name);
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
			    else{
				    if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					    c3errors_ErrorDialog("Slic", "In object %s no entry found with index %i in %s.", m_segment->GetName(), sval2.m_int, conduit->GetName());
				    }
				    sval2.m_int = 0;
				    m_stack->Push(SS_TYPE_INT, sval2);
			    }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, incorrect database symbol\n"));
				stopped = TRUE;
            }

			break;
		}
		case SOP_DBARRAY:
		{
			conduit = GetDatabase(codePtr);

			if (conduit)
            {
			    //Get the member:
			    name = reinterpret_cast<char *>(codePtr);
			    Assert(name);
			    for ( ; *codePtr++; )
                {
				    // Just skip
			    }

			    sp = m_stack->Pop(type1, sval1);
			    Assert(sp >= 0);

			    sval1.m_int = Eval(type1, sval1);

			    sp = m_stack->Pop(type2, sval2);
			    Assert(sp >= 0);

			    sval2.m_int = Eval(type2, sval2);

			    if(sval2.m_int > -1 && sval2.m_int < conduit->GetNumRecords()){		
				    sval3.m_int = conduit->GetValue(sval2.m_int, name, sval1.m_int);
				    m_stack->Push(SS_TYPE_INT, sval3);
			    }
			    else{
				    if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
					    c3errors_ErrorDialog("Slic", "In object %s no entry found with index %i in %s.", m_segment->GetName(), sval2.m_int, conduit->GetName());
				    }
				    sval2.m_int = 0;
				    m_stack->Push(SS_TYPE_INT, sval2);
			    }
            }
            else
            {
				DPRINTF(k_DBG_SLIC, ("Bad mojo, incorrect database symbol\n"));
				stopped = TRUE;
            }
            
			break;
		}
		case SOP_DBSIZE:
		{
			//Added by Martin Gühmann to figure out via 
			//slic how many records the database contains
			//Get the database:
			conduit = GetDatabase(codePtr);
			Assert(conduit);
			if (conduit)
            {
				sval3.m_int = conduit->GetNumRecords();
			}
			else
            {
				sval3.m_int = 0;
			}
			m_stack->Push(SS_TYPE_INT, sval3);
			break;
		}

		default:
			DPRINTF(k_DBG_SLIC, ("???\n"));
			break;
	}
	if(calcOffset)
		m_offset += codePtr - origCodePtr;
	return !stopped;
}
Esempio n. 14
0
void SlicFrame::ReportSFError(SFN_ERROR err, SlicSymbolData *sym)
{
	MBCHAR buf[1024];

	sprintf(buf, "In object %s, function %s: ", 
			m_segment->GetName(), sym->GetFunction()->GetName());
	switch(err) {
		case SFN_ERROR_NUM_ARGS:
			strcat(buf, "Wrong number of arguments");
			break;
		case SFN_ERROR_TYPE_ARGS:
			strcat(buf, "Wrong type of argument");
			break;
		case SFN_ERROR_BAD_FUNCTION:
			strcat(buf, "Bad function, bad!");
			break;
		case SFN_ERROR_INTERNAL:
			strcat(buf, "Internal failure (not your fault, don't feel bad)");
			break;
		case SFN_ERROR_TYPE_BUILTIN:
			strcat(buf, "Wrong kind of builtin variable");
			break;
		case SFN_ERROR_NOT_ADVANCE:
			strcat(buf, "Argument is not an advance");
			break;
		case SFN_ERROR_NOT_UNIT_FLAG:
			strcat(buf, "Argument is not a unit flag");
			break;
		case SFN_ERROR_NOT_IN_BUTTON:
			strcat(buf, "This function can only be used inside buttons");
			break;
		case SFN_ERROR_NOT_DIP_MESSAGE:
			strcat(buf, "This function can only be used in diplomatic messages");
			break;
		case SFN_ERROR_NOT_MESSAGE_TYPE:
			strcat(buf, "Invalid message type");
			break;
		case SFN_ERROR_NOT_SEGMENT:
			sprintf(buf + strlen(buf), "There is no object named %s", g_missingSegment);
			break;
		case SFN_ERROR_NOT_TRADE_BID:
			strcat(buf, "Not in a trade bid message");
			break;
		case SFN_ERROR_NOT_SINGLE_RECIPIENT:
			strcat(buf, "Single recipient function called from multiple recipient message");
			break;
		case SFN_ERROR_NOT_ADJACENT:
			strcat(buf, "This function only works with adjacent locations");
			break;
		case SFN_ERROR_UNKNOWN_UNIT_TYPE:
			strcat(buf, "Unknown unit type");
			break;
		case SFN_ERROR_UNKNOWN_BUILDING:
			strcat(buf, "Unknown building");
			break;
		case SFN_ERROR_OUT_OF_RANGE:
			strcat(buf, "Value out of bounds");
			break;
		case SFN_ERROR_DEAD_PLAYER:
			strcat(buf, "Referenced player is not in the game");
			break;
		case SFN_ERROR_EFFECT_NOT_FOUND:
			strcat(buf, "The named special effect does not exist");
			break;
		case SFN_ERROR_SOUND_NOT_FOUND:
			strcat(buf, "The named sound does not exist");
			break;
		case SFN_ERROR_CIV_NOT_FOUND:
			strcat(buf, "The named civilization does not exist");
			break;

		default:
			strcat(buf, "Unknown error");
			break;
	}
	if(g_theProfileDB && g_theProfileDB->IsDebugSlic()) {
		c3errors_ErrorDialog("Slic", buf);
	}
}
Esempio n. 15
0
sint32 OzoneDatabase::ParseUVDeadResourcesRecord(Token *uvToken)
	{
	sint32	i = 0 ;

	if (!token_ParseAnOpenBraceNext(uvToken))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_PALM_OIL)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead palm oil resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_OIL)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead oil resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_PHEASANT)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead pheasant resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_SILK)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead silk resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_SPICE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead spice resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_TUSKS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tusks resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_BLUBBER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead blubber resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_ALIEN_CORPSES)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead alien corpses resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_CLAY)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead clay resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_TOBACCO)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tobacco resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_COTTON)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead cotton resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_COAL)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead coal resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_GRAPES)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead grapes oil resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_GRANITE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead granite oil resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_BANANAS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead bananas resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_JADE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead jade resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_HARDWOOD)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead hardwood resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_IRON)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead iron resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_GOLD)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead gold resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_SILVER)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead silver resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_BUFFALO)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead buffalo resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_WHEAT)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead wheat resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_CORN)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead corn resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_PEAT)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead peat resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_MANGROVE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead mangrove resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_MINK)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead mink resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_CARIBOU)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead caribou resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_FISH)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead fish resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_WHALES)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead whales resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_CRABS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead crabs resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_DIAMONDS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead diamonds resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_MAGNESIUM_NODULE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead magnesium nodule resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_PHOSPHORUS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead phosphorus resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_PLANKTON_UPWELLING)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead plankton upwelling resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_GIANT_CLAM)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead giant clam resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	i++ ;

	if (uvToken->Next() != TOKEN_UV_DEAD_RESOURCE_GIANT_SQUID)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead giant squid `resource production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadResourceNumbers(uvToken, m_dead_food[i], m_dead_shield[i], m_dead_trade[i], m_dead_gold[i]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_CLOSE_BRACE)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "missing closing brace") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	return (TRUE) ;
	}
Esempio n. 16
0
sint32 ThroneDB::ParseAThrone(Token *throneToken, ThroneInfo *throneInfo)
{

	char str[_MAX_PATH];
	StringId str_id;
	sint32 snd_id;

	if(throneToken->GetType() == TOKEN_EOF) return(FALSE);

	if (throneToken->GetType() != TOKEN_STRING) {
		c3errors_ErrorDialog  (throneToken->ErrStr(), "Throne id expected");
        g_abort_parse = TRUE;
		return FALSE;
	}

	throneToken->GetString(str);

	if(!g_theStringDB->GetStringID(str, str_id)) {
		c3errors_ErrorDialog (throneToken->ErrStr(), "Could not find %s in string database", str);
		g_abort_parse = TRUE;
		return FALSE;
	}

	throneInfo->m_name = str_id;

	if(throneToken->Next() != TOKEN_OPEN_BRACE) {
		c3errors_ErrorDialog  (throneToken->ErrStr(), "Missing open brace");
        g_abort_parse = TRUE;
		return FALSE;
	}

	strcpy(throneInfo->m_zoomedImageFilename, "");
	throneInfo->m_text = -1;
	throneInfo->m_upgradeSoundID = -1;
	throneInfo->m_isCeiling = false;
	throneInfo->m_canZoom = false;

	while(throneToken->Next() != TOKEN_CLOSE_BRACE) {
		switch(throneToken->GetType()) {
		case TOKEN_THRONE_UPGRADE_SOUND:

			if(!CheckToken(throneToken, TOKEN_STRING, "Upgrade sound ID missing")) return(FALSE);
			throneToken->GetString(str);

			snd_id = g_theSoundDB->FindTypeIndex(str);
			if(snd_id == -1) {
				c3errors_ErrorDialog (throneToken->ErrStr(), "Could not find %s in sound database", str);
				g_abort_parse = TRUE;
				return FALSE;
			}

			throneInfo->m_upgradeSoundID = snd_id;
			break;
		case TOKEN_THRONE_UPGRADE_TEXT:

			if(!CheckToken(throneToken, TOKEN_STRING, "Upgrade sound ID missing")) return(FALSE);
			throneToken->GetString(str);

			if(!g_theStringDB->GetStringID(str, str_id)) {
				c3errors_ErrorDialog (throneToken->ErrStr(), "Could not find %s in string database", str);
				g_abort_parse = TRUE;
				return FALSE;
			}

			throneInfo->m_text = str_id;
			break;
		case TOKEN_THRONE_IMAGE_ZOOMED:

			if(!CheckToken(throneToken, TOKEN_QUOTED_STRING, "Zoomed image filename expected"))
				return(FALSE);
			throneToken->GetString( str );
			strcpy( throneInfo->m_zoomedImageFilename, str );
			break;
		case TOKEN_THRONE_IS_CEILING:
			throneInfo->m_isCeiling = true;
			break;
		case TOKEN_THRONE_CAN_ZOOM:
			throneInfo->m_canZoom = true;
			break;
		default:
			c3errors_ErrorDialog(throneToken->ErrStr(), "Unexpected token before close brace.");
		    g_abort_parse = TRUE;
			return(FALSE);
		}
	}

	throneToken->Next();

	return TRUE;
}
Esempio n. 17
0
AUI_ERRCODE TargaImageFormat::LoadRIM(MBCHAR const * filename, aui_Image *image)
{
    // Find the last DOS or Unix style file separator
    char const *    lastSep     = strrchr(filename, '\\');  
    if (!lastSep)
    {
        lastSep = strrchr(filename, '/');
    }
    
    char const *    basename        = (lastSep) ? lastSep + 1 : filename;
    size_t const    BASE_LEN_MAX    = 255;
    size_t const    rlen            = strlen(basename);

    if ((rlen < 3) || (rlen >= BASE_LEN_MAX))
    {
		c3errors_ErrorDialog("Targa Load", "Invalid filename '%s'", filename);
        return AUI_ERRCODE_LOADFAILED;
    }

    char rname[1 + BASE_LEN_MAX];
    strncpy(rname, basename, rlen - 3);
    rname[rlen - 3] = 'r';
    rname[rlen - 2] = 'i';
    rname[rlen - 1] = 'm';
    rname[rlen]     = '\0';

    size_t  size    = 0;
    void *  buffer  = g_ImageMapPF ? g_ImageMapPF->getData(rname, size) : NULL;

    if (buffer == NULL) 
    {
        if (g_ImageMapPF && !g_ImageMapPF->IsReported(filename))
        {
		    c3errors_ErrorDialog("Targa Load", "Unable to find the file '%s'", filename);
            g_ImageMapPF->MarkReported(filename);
        }

        return AUI_ERRCODE_LOADFAILED;
    }
    
    uint8 *     image_data  = (uint8 *)buffer + sizeof(RIMHeader);
    RIMHeader * rhead       = (RIMHeader *)buffer;

    if ((rhead->tag[0] != 'R') ||
        (rhead->tag[1] != 'I') ||
        (rhead->tag[2] != 'M') ||
        (rhead->tag[3] != 'F') ||
        (rhead->version != 1)) {
		c3errors_ErrorDialog("Targa Load", "Invalid RIM file format '%s'", rname);
        return AUI_ERRCODE_LOADFAILED;
    }

    sint32 record_is_565 = ((rhead->flags & RFLAG_BIT_ENCODING) != 0);
    if (g_is565Format != record_is_565) {
		c3errors_ErrorDialog("Targa Load", "Invalid RIM file format '%s'", rname);
        return AUI_ERRCODE_LOADFAILED;
    }

    int width   = rhead->width;
    int height  = rhead->height;
    int pitch   = rhead->pitch;

	AUI_ERRCODE errcode = image->LoadFileMapped(width, height, 16, pitch, image_data);
	Assert( errcode == AUI_ERRCODE_OK );
	if ( errcode != AUI_ERRCODE_OK ) {
		c3errors_ErrorDialog("Targa Load", "Unable map the file '%s'", rname);
		return AUI_ERRCODE_LOADFAILED;
	}

	return errcode;
}
Esempio n. 18
0
MBCHAR *CivPaths::FindFile(C3DIR dir, const MBCHAR *filename, MBCHAR *path,
                           bool silent, bool check_prjfile, bool checkScenario)
{
	MBCHAR			fullPath[_MAX_PATH];	

	
	Assert(path != NULL);

	
	Assert(dir < C3DIR_MAX);

	
	Assert(filename != NULL);

	
	if (dir == C3DIR_DIRECT) {
		strcpy(path, filename);

		
		return path;
	}

	
	if(checkScenario){
		if (m_curScenarioPath) {
		
			sprintf(fullPath, "%s%s%s%s%s%s%s", m_curScenarioPath, FILE_SEP, m_localizedPath, FILE_SEP, m_assetPaths[dir], FILE_SEP, filename);
			if (c3files_PathIsValid(fullPath)) {
	
				strcpy(path, fullPath);
				return path;
			}
			sprintf(fullPath, "%s%s%s%s%s%s%s", m_curScenarioPath, FILE_SEP, m_defaultPath, FILE_SEP, m_assetPaths[dir], FILE_SEP, filename);

			if (c3files_PathIsValid(fullPath)) {
			
				strcpy(path, fullPath);
				return path;
			}
		}

		if (m_curScenarioPackPath) {
		
			sprintf(fullPath, "%s%s%s%s%s%s%s", m_curScenarioPackPath, FILE_SEP, m_localizedPath, FILE_SEP, m_assetPaths[dir], FILE_SEP, filename);
			if (c3files_PathIsValid(fullPath)) {

				strcpy(path, fullPath);
				return path;
			}
			sprintf(fullPath, "%s%s%s%s%s%s%s", m_curScenarioPackPath, FILE_SEP, m_defaultPath, FILE_SEP, m_assetPaths[dir], FILE_SEP, filename);
		
			if (c3files_PathIsValid(fullPath)) {
			
				strcpy(path, fullPath);
				return path;
			}
		}
	}

    // The extra data paths take priority over the regular one.
	for 
	(
		std::vector<MBCHAR const *>::iterator	p	= m_extraDataPaths.begin();
		p != m_extraDataPaths.end();
		++p
	)
	{
		MBCHAR const *	l_dataPath	= *p;
		if (MakeAssetPath(fullPath, m_hdPath, l_dataPath, m_localizedPath, m_assetPaths[dir], filename) ||
			MakeAssetPath(fullPath, m_hdPath, l_dataPath, m_defaultPath,   m_assetPaths[dir], filename)
		   ) 
		{
			strcpy(path, fullPath);
			return path;
		}
	}

	// When not found in the new data, try the original directories
	if (MakeAssetPath(fullPath, m_hdPath, m_dataPath, m_localizedPath, m_assetPaths[dir], filename)) {
		
		strcpy(path, fullPath);
		return path;
	}

	
	if (MakeAssetPath(fullPath, m_hdPath, m_dataPath, m_defaultPath, m_assetPaths[dir], filename)) {
		
		strcpy(path, fullPath);
		return path;
	}

	

	// The CD will only have the original content
	if (MakeAssetPath(fullPath, m_cdPath, m_dataPath, m_localizedPath, m_assetPaths[dir], filename)) {
		
		strcpy(path, fullPath);
		return path;
	}

	
	if (MakeAssetPath(fullPath, m_cdPath, m_dataPath, m_defaultPath, m_assetPaths[dir], filename)) {
		
		strcpy(path, fullPath);
		return path;
	}
    
	
    if (check_prjfile && 
        ((dir == C3DIR_PATTERNS) || 
			(dir == C3DIR_PICTURES))) {
        
		uint32 len = strlen(filename);

        if (len > 3) {
			
			
            strcpy(fullPath, filename);
            fullPath[len-3] = 'r';
            fullPath[len-2] = 'i';
            fullPath[len-1] = 'm';

			
            if (g_ImageMapPF && g_ImageMapPF->exists(fullPath)) {
				
                strcpy(path, filename);
                return path;
            }                
        }
    }

	
    if (!silent)
        c3errors_ErrorDialog("Paths", "'%s' not found in asset tree.", filename);

	return NULL;
}
Esempio n. 19
0
AUI_ERRCODE aui_Ldl::BuildObjectFromType(MBCHAR *typeString,
										 MBCHAR *ldlName,
										 aui_Region **theObject)
{
	AUI_ERRCODE		retval = AUI_ERRCODE_OK;
	aui_Region		*region = NULL;

	if (!stricmp(typeString, "C3Window")) {
		region = (aui_Region *) new C3Window(&retval, aui_UniqueId(), ldlName, 16);
	} else
	if(!stricmp(typeString, "ctp2_Window")) {
		region = (aui_Region *) new ctp2_Window(&retval, aui_UniqueId(), ldlName, 16);
	} else
	if (!stricmp(typeString, "C3Slider")) {
		region = (aui_Region *) new C3Slider(&retval, aui_UniqueId(), ldlName);
	} else
	if (!stricmp(typeString, "c3_Button")) {
		region = (aui_Region *) new c3_Button(&retval, aui_UniqueId(), ldlName);
	} else
	if (!stricmp(typeString, "c3_Static")) {
		region = (aui_Region *) new c3_Static(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_Static")) {
		region = (aui_Region *) new ctp2_Static(&retval, aui_UniqueId(), ldlName);
	} else
	if (!stricmp(typeString, "ctp2_Button")) {
		region = (aui_Region *) new ctp2_Button(&retval, aui_UniqueId(), ldlName);
	} else
	if (!stricmp(typeString, "ctp2_ListBox")) {
		region = (aui_Region *) new ctp2_ListBox(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_LineGraph")) {
		region = (aui_Region *) new LineGraph(&retval, aui_UniqueId(), ldlName);
	} else
	if (!stricmp(typeString, "ctp2_ListItem")) {
		region = (aui_Region *) new ctp2_ListItem(&retval, ldlName);
	} else
	if (!stricmp(typeString, "ctp2_DropDown")) {
		region = (aui_Region *) new ctp2_DropDown(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString,  "ctp2_Spinner")) {
		region = (aui_Region *) new ctp2_Spinner(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_HyperTextBox")) {
		region = (aui_Region *)new ctp2_HyperTextBox(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "c3_HyperTextBox")) {
		region = (aui_Region *)new c3_HyperTextBox(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_MenuBar")) {
		region = (aui_Region *) new ctp2_MenuBar(&retval, aui_UniqueId(), ldlName, 16);
	} else
	if(!stricmp(typeString, "aui_switch")) {
		region = (aui_Region *) new aui_Switch(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_Switch")) {
		region = (aui_Region *) new ctp2_Switch(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_TextField")) {
		region = (aui_Region *) new ctp2_TextField(&retval, aui_UniqueId(), ldlName);
	} else
	if(!stricmp(typeString, "ctp2_MenuButton")) {
		region = (aui_Region *) new ctp2_MenuButton(&retval, aui_UniqueId(), ldlName);
	}
	if(!stricmp(typeString, "ctp2_Tab")) {
		region = (aui_Region *) new ctp2_Tab(&retval, aui_UniqueId(), ldlName);
	}
	if(!stricmp(typeString, "ctp2_TabGroup")) {
		region = (aui_Region *) new ctp2_TabGroup(&retval, aui_UniqueId(), ldlName);
	}
	if(!stricmp(typeString, "ctp2_TabButton")) {
		region = (aui_Region *) new ctp2_TabButton(&retval, aui_UniqueId(), ldlName);
	}
	if(!stricmp(typeString, "RadarMap")) {
		region = (aui_Region *) new RadarMap(&retval, aui_UniqueId(), ldlName);
	}

	Assert(region);
	Assert(retval == AUI_ERRCODE_OK);
	if (!region || retval != AUI_ERRCODE_OK) {

		c3errors_ErrorDialog("aui_Ldl::BuildObjectFromType()",
							 "Auto-instantiate of '%s' failed on '%s'",
							 typeString,
							 ldlName);

		*theObject = NULL;

		return AUI_ERRCODE_INVALIDPARAM;
	}

	*theObject = region;

	return AUI_ERRCODE_OK;
}
Esempio n. 20
0
void UnitSpriteGroup::ExportScript(MBCHAR const * name)
{
	sint32				i;
	extern TokenData	g_allTokens[];
	
	FILE * file = fopen(name, "w");
	if (!file) {
		c3errors_ErrorDialog("Sprite Export", "Could not open '%s' for writing.", name);
		return;
	}

	char timebuf[100];
	time_t ltime;
	struct tm *now;

	time(&ltime);
	now = localtime(&ltime);
	strftime(timebuf, 100, "%I:%M%p %m/%d/%Y", now);

	fprintf(file, "#\n");
	fprintf(file, "# This file was automatically generated by Sprite-Test\n");
	fprintf(file, "#\n");
	fprintf(file, "# %s\n", timebuf);
	fprintf(file, "#\n\n");


	fprintf(file, "%d # %s\n\n", 0, name);
	fprintf(file, "%s\n", g_allTokens[TOKEN_UNIT_SPRITE].keyword);
	fprintf(file, "{\n");

	fprintf(file, "\t%s", g_allTokens[TOKEN_UNIT_SPRITE_MOVE].keyword);
	
	
	ExportSpriteGroup(file,(GAME_ACTION)UNITACTION_MOVE,TOKEN_UNIT_SPRITE_MOVE, TOKEN_MAX);








	ExportSpriteGroup(file,(GAME_ACTION)UNITACTION_MOVE,TOKEN_UNIT_SPRITE_ATTACK,TOKEN_UNIT_SPRITE_ATTACK_IS_DIRECTIONAL,HasDirectional());











	ExportSpriteGroup(file,(GAME_ACTION)UNITACTION_IDLE,TOKEN_UNIT_SPRITE_IDLE, TOKEN_MAX);









	ExportSpriteGroup(file,(GAME_ACTION)UNITACTION_VICTORY,TOKEN_UNIT_SPRITE_VICTORY,TOKEN_UNIT_SPRITE_IS_DEATH,HasDeath());










	ExportSpriteGroup(file,(GAME_ACTION)UNITACTION_WORK,TOKEN_UNIT_SPRITE_WORK, TOKEN_MAX);










	
 
 
 
 
 
 
 
	  
 
 
 
 

	
 
 
 
 
 
 
 
 
 
 

	
 
 
 
 
 
 

	
	fprintf(file, "\t%s\t1\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS].keyword);
	fprintf(file, "\t{\t\n");

	fprintf(file, "\t\t%s\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS_MOVE].keyword);
	for (i=0; i<k_NUM_FACINGS; i++) {
		fprintf(file, "\t\t\t%d %d\n", m_shieldPoints[UNITACTION_MOVE][i].x, m_shieldPoints[UNITACTION_MOVE][i].y);
	}
	fprintf(file, "\t\t%s\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS_ATTACK].keyword);
	for (i=0; i<k_NUM_FACINGS; i++) {
		fprintf(file, "\t\t\t%d %d\n", m_shieldPoints[UNITACTION_ATTACK][i].x, m_shieldPoints[UNITACTION_ATTACK][i].y);
	}
	fprintf(file, "\t\t%s\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS_IDLE].keyword);
	for (i=0; i<k_NUM_FACINGS; i++) {
		fprintf(file, "\t\t\t%d %d\n", m_shieldPoints[UNITACTION_IDLE][i].x, m_shieldPoints[UNITACTION_IDLE][i].y);
	}
	fprintf(file, "\t\t%s\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS_VICTORY].keyword);
	for (i=0; i<k_NUM_FACINGS; i++) {
		fprintf(file, "\t\t\t%d %d\n", m_shieldPoints[UNITACTION_VICTORY][i].x, m_shieldPoints[UNITACTION_VICTORY][i].y);
	}
	fprintf(file, "\t\t%s\n", g_allTokens[TOKEN_UNIT_SPRITE_SHIELDPOINTS_WORK].keyword);
	for (i=0; i<k_NUM_FACINGS; i++) {
		fprintf(file, "\t\t\t%d %d\n", m_shieldPoints[UNITACTION_WORK][i].x, m_shieldPoints[UNITACTION_WORK][i].y);
	}
	
	fprintf(file, "\t}\n\n");

	fprintf(file, "}\n");

	fclose(file);
}
Esempio n. 21
0
sint32 OzoneDatabase::ParseUVDeadTilesRecord(Token *uvToken)
	{
	if (!token_ParseAnOpenBraceNext(uvToken))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_DESERT)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead desert tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_DESERT], m_dead_shield[DEAD_TILE_TYPE_DESERT], m_dead_trade[DEAD_TILE_TYPE_DESERT]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_FORESTS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead forests tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_FORESTS], m_dead_shield[DEAD_TILE_TYPE_FORESTS], m_dead_trade[DEAD_TILE_TYPE_FORESTS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_GRASSLANDS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead grasslands tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_GRASSLANDS], m_dead_shield[DEAD_TILE_TYPE_GRASSLANDS], m_dead_trade[DEAD_TILE_TYPE_GRASSLANDS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_HILLS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead hills tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_HILLS], m_dead_shield[DEAD_TILE_TYPE_HILLS], m_dead_trade[DEAD_TILE_TYPE_HILLS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_MOUNTAINS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead mountains tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_MOUNTAINS], m_dead_shield[DEAD_TILE_TYPE_MOUNTAINS], m_dead_trade[DEAD_TILE_TYPE_MOUNTAINS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_PLAINS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead plains tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_PLAINS], m_dead_shield[DEAD_TILE_TYPE_PLAINS], m_dead_trade[DEAD_TILE_TYPE_PLAINS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_SWAMPS)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead swamps tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_SWAMPS], m_dead_shield[DEAD_TILE_TYPE_SWAMPS], m_dead_trade[DEAD_TILE_TYPE_SWAMPS]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_TUNDRA)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead tundra tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_TUNDRA], m_dead_shield[DEAD_TILE_TYPE_TUNDRA], m_dead_trade[DEAD_TILE_TYPE_TUNDRA]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_UV_DEAD_TILE_CONTINENTAL_SHELF)
		{
		c3errors_ErrorDialog (uvToken->ErrStr(), "expected dead continental shelf tile production not found") ;
		g_parse_uv_abort = TRUE ;

		return (FALSE) ;
		}

	if (!ParseDeadTileNumbers(uvToken, m_dead_food[DEAD_TILE_TYPE_CONTINENTAL_SHELF], m_dead_shield[DEAD_TILE_TYPE_CONTINENTAL_SHELF], m_dead_trade[DEAD_TILE_TYPE_CONTINENTAL_SHELF]))
		return (FALSE) ;

	if (uvToken->Next() != TOKEN_CLOSE_BRACE)
		return (FALSE) ;

	return (TRUE) ;
	}