summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_isdefine_tile.cxx
blob: 6fb3c6136efbf19a3089d1e684a791e74df749b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

#include <Xw_Extension.h>

	/* ifdef then trace on */
#ifdef TRACE
#define TRACE_ISDEFINE_TILE
#endif

/*
   XW_STATUS Xw_isdefine_tile (atilemap,index):
   XW_EXT_TILEMAP *atilemap
   int index			tile index

	Returns XW_ERROR if BadTile Index or tile is not defined
	Returns XW_SUCCESS if Successful      

*/

#ifdef XW_PROTOTYPE
XW_STATUS Xw_isdefine_tile (void *atilemap,int index)
#else
XW_STATUS Xw_isdefine_tile (atilemap,index)
void *atilemap;
int index ;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap;
XW_STATUS status = XW_ERROR ;

	if( index ) {
	    if ( ptilemap && (index < ptilemap->maxtile) 
					&& ptilemap->tiles[index] ) {
	        status = XW_SUCCESS ;
	    }
	} else status = XW_SUCCESS ;


#ifdef  TRACE_ISDEFINE_TILE
if( Xw_get_trace() > 2 ) {
    printf (" %d = Xw_isdefine_tile(%lx,%d)\n",status,(long ) ptilemap,index) ;
}
#endif

	return (status);
}

#ifdef XW_PROTOTYPE
XW_STATUS Xw_isdefine_tileindex (XW_EXT_TILEMAP *atilemap,int index)
#else
XW_STATUS Xw_isdefine_tileindex (atilemap,index)
XW_EXT_TILEMAP *atilemap;
int index ;
#endif /*XW_PROTOTYPE*/
/*
	Verify Tile index Range Only
*/
{
XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap;
XW_STATUS status = XW_ERROR ;

	if( ptilemap && (index > 0 ) && (index < ptilemap->maxtile) ) {
	   status = XW_SUCCESS ;
	}

#ifdef  TRACE_ISDEFINE_TILE
if( Xw_get_trace() > 2 ) {
    printf (" %d = Xw_isdefine_tileindex(%lx,%d)\n",status,(long ) ptilemap,index) ;
}
#endif

	return (status) ;
}