void CSuperscape::FindLayerIndices( int z )
{
	TS.GetLayerLimits( is0 = 0, isN );

	while( isN != -1 && TS.vtil[is0].z != z )
		TS.GetLayerLimits( is0 = isN, isN );
}
// Loop over layers, creating all: subdirs, scripts, work files.
//
static void ForEachLayer()
{
	int	is0, isN;

	TS.GetLayerLimits( is0 = 0, isN );

	while( isN != -1 ) {

		char	lyrdir[2048];

		CreateLayerDir( lyrdir, TS.vtil[is0].z );

		TS.WriteTileToImage( gtopdir, false, ismrc, is0, isN );

		if( gArgs.NoFolds ) {

			if( ismrc )
				Make_MakeFM( lyrdir, is0, isN );
			else
				Make_fmsame( lyrdir, is0, isN );
		}
		else {
			Make_TileToFM( lyrdir, "TileToFM",  "fm",  is0, isN );
			Make_TileToFM( lyrdir, "TileToFMD", "fmd", is0, isN );
			Make_MakeFM( lyrdir, is0, isN );
		}

		TS.GetLayerLimits( is0 = isN, isN );
	}
}