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.21 by root, Mon Oct 12 14:00:58 2009 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
8 it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
9 the Free Software Foundation; either version 2 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
10 (at your option) any later version. 11 * option) any later version.
11 12 *
12 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
18 along with this program; if not, write to the Free Software 19 * and the GNU General Public License along with this program. If not, see
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * <http://www.gnu.org/licenses/>.
20 21 *
21 The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22*/ 23 */
23 24
24#define LO_NEWFILE 2 25#define LO_NEWFILE 2
25 26
26/* the main routine for making a standalone version. */ 27/* the main routine for making a standalone version. */
27 28
44 if (argc < 3) 45 if (argc < 3)
45 { 46 {
46 printf ("\nUsage: %s inputfile outputfile\n", argv[0]); 47 printf ("\nUsage: %s inputfile outputfile\n", argv[0]);
47 exit (0); 48 exit (0);
48 } 49 }
50
49 strcpy (InFileName, argv[1]); 51 strcpy (InFileName, argv[1]);
50 strcpy (OutFileName, argv[2]); 52 strcpy (OutFileName, argv[2]);
51 53
52 init_globals (); 54 init_globals ();
53 init_library (); 55 init_library ();
77{ 79{
78} /* doesn't need to do anything */ 80} /* doesn't need to do anything */
79 81
80#include <global.h> 82#include <global.h>
81 83
82
83/* some plagarized code from apply.c--I needed just these two functions 84/* some plagarized code from apply.c--I needed just these two functions
84without all the rest of the junk, so.... */ 85without all the rest of the junk, so.... */
85int 86int
86auto_apply (object *op) 87auto_apply (object *op)
87{ 88{
88 object *tmp = NULL; 89 object *tmp = NULL;
89 int i; 90 int i;
90 91
91 switch (op->type) 92 switch (op->type)
92 { 93 {
93 case SHOP_FLOOR: 94 case SHOP_FLOOR:
94 if (!op->has_random_items ()) 95 if (!op->has_random_items ())
95 return 0; 96 return 0;
96 do 97 do
97 { 98 {
98 i = 10; /* let's give it 10 tries */ 99 i = 10; /* let's give it 10 tries */
100
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))
102 && --i)
103 ;
104
100 if (tmp == NULL) 105 if (tmp == NULL)
101 return 0; 106 return 0;
107
102 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 108 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))
103 { 109 {
104 tmp->destroy (); 110 tmp->destroy ();
105 tmp = NULL; 111 tmp = NULL;
106 } 112 }
107 } 113 }
108 while (!tmp); 114 while (!tmp);
109 115
110 tmp->x = op->x, tmp->y = op->y; 116 tmp->x = op->x, tmp->y = op->y;
111 SET_FLAG (tmp, FLAG_UNPAID); 117 SET_FLAG (tmp, FLAG_UNPAID);
112 insert_ob_in_map (tmp, op->map, NULL, 0); 118 insert_ob_in_map (tmp, op->map, NULL, 0);
113 CLEAR_FLAG (op, FLAG_AUTO_APPLY); 119 CLEAR_FLAG (op, FLAG_AUTO_APPLY);
114 identify (tmp); 120 identify (tmp);
115 break; 121 break;
116 122
117 case TREASURE: 123 case TREASURE:
118 if (op->has_random_items ()) 124 if (op->has_random_items ())
119 while ((op->stats.hp--) > 0) 125 while ((op->stats.hp--) > 0)
120 create_treasure (op->randomitems, op, GT_ENVIRONMENT, 126 create_treasure (op->randomitems, op, GT_ENVIRONMENT,
121 op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); 127 op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0);
122 op->remove (); 128
123 op->destroy (); 129 op->destroy ();
124 break; 130 break;
125 } 131 }
126 132
127 return tmp ? 1 : 0; 133 return tmp ? 1 : 0;
128} 134}
129 135
130/* fix_auto_apply goes through the entire map (only the first time 136/* fix_auto_apply goes through the entire map (only the first time
131 * when an original map is loaded) and performs special actions for 137 * when an original map is loaded) and performs special actions for
132 * certain objects (most initialization of chests and creation of 138 * certain objects (most initialization of chests and creation of
133 * treasures and stuff). Calls auto_apply if appropriate. 139 * treasures and stuff). Calls auto_apply if appropriate.
134 */ 140 */
135
136void 141void
137fix_auto_apply (maptile *m) 142fix_auto_apply (maptile *m)
138{ 143{
139 object *tmp, *above = NULL; 144 object *tmp, *above = NULL;
140 int x, y; 145 int x, y;
167 } 172 }
168 for (x = 0; x < m->width; x++) 173 for (x = 0; x < m->width; x++)
169 for (y = 0; y < m->height; y++) 174 for (y = 0; y < m->height; y++)
170 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) 175 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above)
171 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) 176 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL))
172 check_trigger (tmp, tmp->above); 177 check_trigger (tmp, tmp->above, tmp->above);
173} 178}
174 179
175/** 180/**
176 * Those are dummy functions defined to resolve all symboles. 181 * Those are dummy functions defined to resolve all symboles.
177 * Added as part of glue cleaning. 182 * Added as part of glue cleaning.
273 278
274void 279void
275trap_adjust (object *ob, int x) 280trap_adjust (object *ob, int x)
276{ 281{
277} 282}
283

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines