ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/treasure.C
(Generate patch)

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.42 by root, Mon Apr 16 10:14:25 2007 UTC vs.
Revision 1.46 by root, Tue Apr 17 10:06:32 2007 UTC

76 76
77 warn_archetypes = prev_warn; 77 warn_archetypes = prev_warn;
78} 78}
79 79
80/* 80/*
81 * Searches for the given treasurelist in the globally linked list 81 * Searches for the given treasurelist
82 * of treasurelists which has been built by load_treasures().
83 */ 82 */
84treasurelist * 83treasurelist *
85treasurelist::find (const char *name) 84treasurelist::find (const char *name)
86{ 85{
87 if (!name) 86 if (!name)
88 return 0; 87 return 0;
89 88
90 AUTODECL (i, tl_map.find (name)); 89 auto (i, tl_map.find (name));
91 90
92 if (i == tl_map.end ()) 91 if (i == tl_map.end ())
93 return 0; 92 return 0;
94 93
95 return i->second; 94 return i->second;
125 if (tl->items) 124 if (tl->items)
126 { 125 {
127 free_treasurestruct (tl->items); 126 free_treasurestruct (tl->items);
128 tl->items = 0; 127 tl->items = 0;
129 } 128 }
129
130 tl->total_chance = 0;
130} 131}
131 132
132/* 133/*
133 * Reads the lib/treasure file from disk, and parses the contents 134 * Reads the lib/treasure file from disk, and parses the contents
134 * into an internal treasure structure (very linked lists) 135 * into an internal treasure structure (very linked lists)
141 142
142 nroftreasures++; 143 nroftreasures++;
143 144
144 for (;;) 145 for (;;)
145 { 146 {
146 coroapi::cede_every (10); 147 coroapi::cede_to_tick_every (10);
147 148
148 f.next (); 149 f.next ();
149 150
150 switch (f.kw) 151 switch (f.kw)
151 { 152 {
205/* 206/*
206 * Opens LIBDIR/treasure and reads all treasure-declarations from it. 207 * Opens LIBDIR/treasure and reads all treasure-declarations from it.
207 * Each treasure is parsed with the help of load_treasure(). 208 * Each treasure is parsed with the help of load_treasure().
208 */ 209 */
209bool 210bool
210load_treasures () 211load_treasure_file (const char *filename)
211{ 212{
212 treasure *t; 213 treasure *t;
213 int comp, line = 0; 214 int comp, line = 0;
214
215 char filename[MAX_BUF];
216 sprintf (filename, "%s/%s", settings.datadir, settings.treasures);
217 215
218 object_thawer f (filename); 216 object_thawer f (filename);
219 217
220 if (!f) 218 if (!f)
221 { 219 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines