File: signpost.h

package info (click to toggle)
powder 117-2
  • links: PTS
  • area: non-free
  • in suites: stretch
  • size: 10,576 kB
  • ctags: 3,545
  • sloc: cpp: 55,002; makefile: 541; sh: 258; objc: 245; ansic: 107; csh: 54
file content (65 lines) | stat: -rw-r--r-- 1,316 bytes parent folder | download | duplicates (7)
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
/*
 * PROPRIETARY INFORMATION.  This software is proprietary to POWDER
 * Development, and is not to be reproduced, transmitted, or disclosed
 * in any way without written permission.
 *
 * Produced by:	Jeff Lait
 *
 *      	POWDER Development
 *
 * NAME:        signpost.h ( POWDER Library, C++ )
 *
 * COMMENTS:
 *	Tracks signposts and their values.  Creates a heap of signposts
 *	which can be queried to get a sign at a position.  O(N) to
 *	access so be wary!
 */

#ifndef __signpost_h__
#define __signpost_h__

#include "glbdef.h"
#include "itemstack.h"

class SRAMSTREAM;

class SIGNPOSTDATA
{
public:
    SIGNPOSTDATA() {}
    SIGNPOSTDATA(int zero) {}

    void	init(SIGNPOST_NAMES sign, int x, int y);
    
    bool	isPos(int x, int y) const;
    void	getPos(int &x, int &y) const;
    SIGNPOST_NAMES	getSign() const;
    
    void	save(SRAMSTREAM &os) const;
    void	load(SRAMSTREAM &is);

protected:
    unsigned int		myPos:10;
    unsigned int		mySign:6;
};


class SIGNLIST
{
public:
    SIGNLIST();
    ~SIGNLIST();

    SIGNPOST_NAMES	find(int x, int y) const;
    void		append(SIGNPOST_NAMES sign, int x, int y);
    int			entries() const { return myPosts.entries(); }

    void	save(SRAMSTREAM &os) const;
    void	load(SRAMSTREAM &is);

protected:
    PTRSTACK<SIGNPOSTDATA>	myPosts;
};

#endif