1 /**************************************************************************
2 * tilemgr.c -- routines to handle dynamic management of scenery tiles
4 * Written by Curtis Olson, started January 1998.
6 * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
24 **************************************************************************/
32 #include "../XGL/xgl.h"
34 #include "tileutils.h"
36 #include "../Aircraft/aircraft.h"
37 #include "../Include/constants.h"
40 /* here's where we keep the array of closest (potentially viewable) tiles */
41 static long int tile[49];
44 /* Initialize the Tile Manager subsystem */
45 void fgTileMgrInit() {
46 printf("Initializing Tile Manager subsystem.\n");
47 /* fgTileCacheInit(); */
51 /* given the current lon/lat, fill in the array of local chunks. If
52 * the chunk isn't already in the cache, then read it from disk. */
53 void fgTileMgrUpdate() {
57 f = ¤t_aircraft.flight;
59 find_bucket(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
60 printf("Updating Tile list for %d,%d %d,%d\n", p.lon, p.lat, p.x, p.y);
62 gen_idx_array(&p, tile, 7, 7);
67 /* Revision 1.2 1998/01/08 02:22:27 curt
68 /* Continue working on basic features.
70 * Revision 1.1 1998/01/07 23:50:51 curt
71 * "area" renamed to "tile"
73 * Revision 1.2 1998/01/07 03:29:29 curt
74 * Given an arbitrary lat/lon, we can now:
75 * generate a unique index for the chunk containing the lat/lon
76 * generate a path name to the chunk file
77 * build a list of the indexes of all the nearby areas.
79 * Revision 1.1 1998/01/07 02:05:48 curt