… | |
… | |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | * |
21 | * |
22 | * The maintainer of this code can be reached at <crossfire@schmorp.de> |
22 | * The maintainer of this code can be reached at <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
|
|
25 | |
24 | |
26 | #include <global.h> |
25 | #include <global.h> |
27 | #include <stdio.h> |
26 | #include <stdio.h> |
28 | |
27 | |
29 | #include "face.h" |
28 | #include "face.h" |
… | |
… | |
75 | } |
74 | } |
76 | |
75 | |
77 | faceidx |
76 | faceidx |
78 | face_find (const char *name, faceidx defidx) |
77 | face_find (const char *name, faceidx defidx) |
79 | { |
78 | { |
|
|
79 | if (!name) |
|
|
80 | return defidx; |
|
|
81 | |
80 | facehash_t::iterator i = facehash.find (name); |
82 | facehash_t::iterator i = facehash.find (name); |
81 | |
83 | |
82 | return i == facehash.end () |
84 | return i == facehash.end () |
83 | ? defidx : i->second; |
85 | ? defidx : i->second; |
84 | } |
86 | } |
85 | |
87 | |
86 | faceinfo * |
88 | faceinfo * |
87 | face_info (faceidx idx) |
89 | face_info (faceidx idx) |
88 | { |
90 | { |
|
|
91 | assert (0 < (faceidx)-1); // faceidx must be unsigned |
|
|
92 | |
89 | if (idx >= faces.size ()) |
93 | if (idx >= faces.size ()) |
90 | return 0; |
94 | return 0; |
91 | |
95 | |
92 | return &faces [idx]; |
96 | return &faces [idx]; |
93 | } |
97 | } |