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

Comparing deliantra/server/random_maps/standalone.C (file contents):
Revision 1.11 by root, Sat Dec 30 18:45:28 2006 UTC vs.
Revision 1.13 by pippijn, Sat Jan 6 14:42:30 2007 UTC

1
1/* 2/*
2 CrossFire, A Multiplayer game for X-windows 3 CrossFire, A Multiplayer game for X-windows
3 4
5 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 6 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 7 Copyright (C) 1992 Frank Tore Johansen
6 8
7 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
88 object *tmp = NULL; 90 object *tmp = NULL;
89 int i; 91 int i;
90 92
91 switch (op->type) 93 switch (op->type)
92 { 94 {
93 case SHOP_FLOOR: 95 case SHOP_FLOOR:
94 if (!op->has_random_items ()) 96 if (!op->has_random_items ())
95 return 0; 97 return 0;
96 do 98 do
97 { 99 {
98 i = 10; /* let's give it 10 tries */ 100 i = 10; /* let's give it 10 tries */
99 while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i); 101 while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i);
100 if (tmp == NULL) 102 if (tmp == NULL)
101 return 0; 103 return 0;
102 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 104 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))
103 { 105 {
104 tmp->destroy (); 106 tmp->destroy ();
105 tmp = NULL; 107 tmp = NULL;
106 } 108 }
107 } 109 }
108 while (!tmp); 110 while (!tmp);
109 111
110 tmp->x = op->x, tmp->y = op->y; 112 tmp->x = op->x, tmp->y = op->y;
111 SET_FLAG (tmp, FLAG_UNPAID); 113 SET_FLAG (tmp, FLAG_UNPAID);
112 insert_ob_in_map (tmp, op->map, NULL, 0); 114 insert_ob_in_map (tmp, op->map, NULL, 0);
113 CLEAR_FLAG (op, FLAG_AUTO_APPLY); 115 CLEAR_FLAG (op, FLAG_AUTO_APPLY);
114 identify (tmp); 116 identify (tmp);
115 break; 117 break;
116 118
117 case TREASURE: 119 case TREASURE:
118 if (op->has_random_items ()) 120 if (op->has_random_items ())
119 while ((op->stats.hp--) > 0) 121 while ((op->stats.hp--) > 0)
120 create_treasure (op->randomitems, op, GT_ENVIRONMENT, 122 create_treasure (op->randomitems, op, GT_ENVIRONMENT,
121 op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); 123 op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0);
122 op->remove (); 124 op->remove ();
123 op->destroy (); 125 op->destroy ();
124 break; 126 break;
125 } 127 }
126 128
127 return tmp ? 1 : 0; 129 return tmp ? 1 : 0;
128} 130}
129 131

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines