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.96 by root, Sun Nov 29 09:41:28 2009 UTC vs.
Revision 1.103 by root, Sat Apr 10 01:06:21 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
33 33
34//#define TREASURE_VERBOSE 34//#define TREASURE_VERBOSE
35 35
36#include <global.h> 36#include <global.h>
37#include <treasure.h> 37#include <treasure.h>
38#include <loader.h>
39 38
40extern char *spell_mapping[]; 39extern char *spell_mapping[];
41 40
42static treasurelist *first_treasurelist; 41static treasurelist *first_treasurelist;
43 42
256 return; 255 return;
257 } 256 }
258 257
259 op->expand_tail (); 258 op->expand_tail ();
260 259
260 if (!creator->is_on_map ()
261 if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) 261 || (op->weight && op->blocked (creator->map, creator->x, creator->y)))
262 op->destroy (); 262 op->destroy ();
263 else 263 else
264 { 264 {
265 SET_FLAG (op, FLAG_OBJ_ORIGINAL); 265 op->flag [FLAG_OBJ_ORIGINAL] = true;
266 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); 266 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON);
267 } 267 }
268 } 268 }
269 else 269 else
270 { 270 {
310 } 310 }
311 else 311 else
312 { 312 {
313 if (t->item && (t->item->invisible != 0 || !(flag & GT_INVISIBLE))) 313 if (t->item && (t->item->invisible != 0 || !(flag & GT_INVISIBLE)))
314 { 314 {
315 object *tmp = arch_to_object (t->item); 315 object *tmp = t->item->instance ();
316 316
317 if (t->nrof && tmp->nrof <= 1) 317 if (t->nrof && tmp->nrof <= 1)
318 tmp->nrof = rndm (t->nrof) + 1; 318 tmp->nrof = rndm (t->nrof) + 1;
319 319
320 fix_generated_item (tmp, op, difficulty, t->magic, flag); 320 fix_generated_item (tmp, op, difficulty, t->magic, flag);
367 else if (t->nrof) 367 else if (t->nrof)
368 create_one_treasure (tl, op, flag, difficulty, tries); 368 create_one_treasure (tl, op, flag, difficulty, tries);
369 } 369 }
370 else if (t->item && (t->item->invisible != 0 || flag != GT_INVISIBLE)) 370 else if (t->item && (t->item->invisible != 0 || flag != GT_INVISIBLE))
371 { 371 {
372 if (object *tmp = arch_to_object (t->item)) 372 if (object *tmp = t->item->instance ())
373 { 373 {
374 if (t->nrof && tmp->nrof <= 1) 374 if (t->nrof && tmp->nrof <= 1)
375 tmp->nrof = rndm (t->nrof) + 1; 375 tmp->nrof = rndm (t->nrof) + 1;
376 376
377 fix_generated_item (tmp, op, difficulty, t->magic, flag); 377 fix_generated_item (tmp, op, difficulty, t->magic, flag);
1144 1144
1145/* 1145/*
1146 * Allocate and return the pointer to an empty artifactlist structure. 1146 * Allocate and return the pointer to an empty artifactlist structure.
1147 */ 1147 */
1148static artifactlist * 1148static artifactlist *
1149get_empty_artifactlist (void) 1149get_empty_artifactlist ()
1150{ 1150{
1151 return salloc0<artifactlist> (); 1151 return salloc0<artifactlist> ();
1152} 1152}
1153 1153
1154/* 1154/*
1155 * Allocate and return the pointer to an empty artifact structure. 1155 * Allocate and return the pointer to an empty artifact structure.
1156 */ 1156 */
1157static artifact * 1157static artifact *
1158get_empty_artifact (void) 1158get_empty_artifact ()
1159{ 1159{
1160 return salloc0<artifact> (); 1160 return salloc0<artifact> ();
1161} 1161}
1162 1162
1163/* 1163/*
1176 1176
1177/* 1177/*
1178 * Builds up the lists of artifacts from the file in the libdir. 1178 * Builds up the lists of artifacts from the file in the libdir.
1179 */ 1179 */
1180void 1180void
1181init_artifacts (void) 1181init_artifacts ()
1182{ 1182{
1183 static int has_been_inited = 0; 1183 static int has_been_inited = 0;
1184 char filename[MAX_BUF]; 1184 char filename[MAX_BUF];
1185 artifact *art = NULL; 1185 artifact *art = NULL;
1186 artifactlist *al; 1186 artifactlist *al;
1210 1210
1211 const char *cp = f.get_str (); 1211 const char *cp = f.get_str ();
1212 char *next; 1212 char *next;
1213 do 1213 do
1214 { 1214 {
1215 if ((next = strchr (cp, ','))) 1215 if ((next = (char *)strchr (cp, ',')))
1216 *next++ = '\0'; 1216 *next++ = '\0';
1217 1217
1218 linked_char *tmp = new linked_char; 1218 linked_char *tmp = new linked_char;
1219 1219
1220 tmp->name = cp; 1220 tmp->name = cp;
1367 if (op->type == HORN || op->type == POTION) 1367 if (op->type == HORN || op->type == POTION)
1368 { 1368 {
1369 /* Remove any spells this object currently has in it */ 1369 /* Remove any spells this object currently has in it */
1370 op->destroy_inv (false); 1370 op->destroy_inv (false);
1371 1371
1372 object *tmp = arch_to_object (change->other_arch); 1372 object *tmp = change->other_arch->instance ();
1373 insert_ob_in_ob (tmp, op); 1373 insert_ob_in_ob (tmp, op);
1374 } 1374 }
1375
1375 /* No harm setting this for potions/horns */ 1376 /* No harm setting this for potions/horns */
1376 op->other_arch = change->other_arch; 1377 op->other_arch = change->other_arch;
1377 } 1378 }
1378 1379
1379 if (change->stats.hp < 0) 1380 if (change->stats.hp < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines