1 //
2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2002, 2003 Gordon McNutt
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13 // more details.
14 //
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
18 //
19 // Gordon McNutt
20 // gmcnutt@users.sourceforge.net
21 //
22 #ifndef pinfo_h
23 #define pinfo_h
24 
25 // ----------------------------------------------------------------------------
26 // The ugly position_info struct is used by the algorithm which places party
27 // members on a map. It is unsightly, but not wholy foul, and will likely live
28 // on for a while until the placement algorithm is completely revisited.
29 // ----------------------------------------------------------------------------
30 
31 struct position_info {
32 
33         struct place *place; // The place where the members are getting
34                              // distributed.
35 
36         int x, y;            // The "home position". The placement rectangle
37                              // (see below) will be centered on this
38                              // location. If the placement algorithm fails to
39                              // find a safe place to put a member (due to
40                              // passability, etc) it will put the member
41                              // here. In extreme cases the whole party may get
42                              // stacked on this one location.
43 
44         int dx, dy;          // The orientation vector (most formations are
45                              // directional). Typically set to the last
46                              // direction the party was travelling in.
47 
48         int rx, ry, rw, rh;  // The placement rectangle.
49 
50         int px, py;          // The initial preferred location of a party
51                              // member (this is set just before running the
52                              // placement algorithm on a member). This depends
53                              // on the "order" of the member in the party, the
54                              // formation, and the direction vector.
55 
56         class Object *subject; // Use the subject being positioned instead of
57                                // the obsolete pmask.
58 
59         bool find_party;     // When running the placement algorithm, true iff
60                              // the party member must be able to pathfind back
61                              // to the party coordinates.
62 
63         int placed;          // Count of the number of party members actually
64                              // placed. Used to detect when none of a party
65                              // found a location.
66 
67         struct formation *formation;     // The formation to use when placing
68                                          // party members.
69 
70 
71 };
72 
73 #endif
74