1 /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
2 /* city.c */
3 /* some functions to make the city level */
4 
5 #include "glob.h"
6 
7 
8 /* loads the city level */
load_city(populate)9 void load_city(populate)
10 int populate;
11 {
12   int i,j;
13   pml ml;
14   char site;
15 
16   FILE *fd;
17 
18   initrand(E_CITY, 0);
19 
20   strcpy(Str3,Omegalib);
21   strcat(Str3,"city.dat");
22   fd = checkfopen(Str3,"rb");
23   site = cryptkey("city.dat");
24 
25 
26   TempLevel = Level;
27   if (ok_to_free(TempLevel)) {
28 #ifndef SAVE_LEVELS
29     free_level(TempLevel);
30 #endif
31     TempLevel = NULL;
32   }
33 #ifndef SAVE_LEVELS
34   Level = ((plv) checkmalloc(sizeof(levtype)));
35 #else
36   msdos_changelevel(TempLevel,0,-1);
37   Level = &TheLevel;
38 #endif
39   clear_level(Level);
40   Level->depth = 0;
41   Level->environment = E_CITY;
42   for(j=0;j<LENGTH;j++) {
43     for(i=0;i<WIDTH;i++) {
44       lset(i,j,SEEN);
45       site = getc(fd)^site;
46       switch(site) {
47       case 'g':
48 	Level->site[i][j].locchar = FLOOR;
49 	Level->site[i][j].p_locf = L_GARDEN;
50 	break;
51       case 'y':
52 	Level->site[i][j].locchar = FLOOR;
53 	Level->site[i][j].p_locf = L_CEMETARY;
54 	break;
55       case 'x':
56 	assign_city_function(i,j);
57 	break;
58       case 't':
59 	Level->site[i][j].locchar = FLOOR;
60 	Level->site[i][j].p_locf = L_TEMPLE;
61 	CitySiteList[L_TEMPLE-CITYSITEBASE][0] = TRUE;
62 	CitySiteList[L_TEMPLE-CITYSITEBASE][1] = i;
63 	CitySiteList[L_TEMPLE-CITYSITEBASE][2] = j;
64 	break;
65       case 'T':
66 	Level->site[i][j].locchar = FLOOR;
67 	Level->site[i][j].p_locf = L_PORTCULLIS_TRAP;
68 	Level->site[i][j].aux = NOCITYMOVE;
69 	break;
70       case 'R':
71 	Level->site[i][j].locchar = FLOOR;
72 	Level->site[i][j].p_locf = L_RAISE_PORTCULLIS;
73 	Level->site[i][j].aux = NOCITYMOVE;
74 	break;
75       case '7':
76 	Level->site[i][j].locchar = FLOOR;
77 	Level->site[i][j].p_locf = L_PORTCULLIS;
78 	Level->site[i][j].aux = NOCITYMOVE;
79 	break;
80       case 'C':
81 	Level->site[i][j].locchar = OPEN_DOOR;
82 	Level->site[i][j].p_locf = L_COLLEGE;
83 	CitySiteList[L_COLLEGE-CITYSITEBASE][0] = TRUE;
84 	CitySiteList[L_COLLEGE-CITYSITEBASE][1] = i;
85 	CitySiteList[L_COLLEGE-CITYSITEBASE][2] = j;
86 	break;
87       case 's':
88 	Level->site[i][j].locchar = OPEN_DOOR;
89 	Level->site[i][j].p_locf = L_SORCERORS;
90 	CitySiteList[L_SORCERORS-CITYSITEBASE][0] = TRUE;
91 	CitySiteList[L_SORCERORS-CITYSITEBASE][1] = i;
92 	CitySiteList[L_SORCERORS-CITYSITEBASE][2] = j;
93 	break;
94       case 'M':
95 	Level->site[i][j].locchar = OPEN_DOOR;
96 	Level->site[i][j].p_locf = L_MERC_GUILD;
97 	CitySiteList[L_MERC_GUILD-CITYSITEBASE][0] = TRUE;
98 	CitySiteList[L_MERC_GUILD-CITYSITEBASE][1] = i;
99 	CitySiteList[L_MERC_GUILD-CITYSITEBASE][2] = j;
100 	break;
101       case 'c':
102 	Level->site[i][j].locchar = OPEN_DOOR;
103 	Level->site[i][j].p_locf = L_CASTLE;
104 	CitySiteList[L_CASTLE-CITYSITEBASE][0] = TRUE;
105 	CitySiteList[L_CASTLE-CITYSITEBASE][1] = i;
106 	CitySiteList[L_CASTLE-CITYSITEBASE][2] = j;
107 	break;
108       case '?':
109 	mazesite(i,j,populate);
110 	break;
111       case 'P':
112         Level->site[i][j].locchar = OPEN_DOOR;
113 	Level->site[i][j].p_locf = L_ORDER;
114 	CitySiteList[L_ORDER-CITYSITEBASE][0] = TRUE;
115 	CitySiteList[L_ORDER-CITYSITEBASE][1] = i;
116 	CitySiteList[L_ORDER-CITYSITEBASE][2] = j;
117 	break;
118       case 'H':
119         Level->site[i][j].locchar = OPEN_DOOR;
120 	Level->site[i][j].p_locf = L_CHARITY;
121 	CitySiteList[L_CHARITY-CITYSITEBASE][0] = TRUE;
122 	CitySiteList[L_CHARITY-CITYSITEBASE][1] = i;
123 	CitySiteList[L_CHARITY-CITYSITEBASE][2] = j;
124 	break;
125       case 'j':
126         Level->site[i][j].locchar = FLOOR;
127 	if (populate)
128 	  make_justiciar(i,j);
129         break;
130       case 'J':
131 	Level->site[i][j].locchar = CLOSED_DOOR;
132 	Level->site[i][j].p_locf = L_JAIL;
133 	break;
134       case 'A':
135 	Level->site[i][j].locchar = OPEN_DOOR;
136 	Level->site[i][j].p_locf = L_ARENA;
137 	CitySiteList[L_ARENA-CITYSITEBASE][0] = TRUE;
138 	CitySiteList[L_ARENA-CITYSITEBASE][1] = i;
139 	CitySiteList[L_ARENA-CITYSITEBASE][2] = j;
140 	break;
141       case 'B':
142 	Level->site[i][j].locchar = OPEN_DOOR;
143 	Level->site[i][j].p_locf = L_BANK;
144 	CitySiteList[L_BANK-CITYSITEBASE][0] = TRUE;
145 	CitySiteList[L_BANK-CITYSITEBASE][1] = i;
146 	CitySiteList[L_BANK-CITYSITEBASE][2] = j;
147 	lset(i,j+1,STOPS);
148 	lset(i+1,j,STOPS);
149 	lset(i-1,j,STOPS);
150 	lset(i,j-1,STOPS);
151 	break;
152       case 'X':
153 	Level->site[i][j].locchar = FLOOR;
154 	Level->site[i][j].p_locf = L_COUNTRYSIDE;
155 	CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][0] = TRUE;
156 	CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][1] = i;
157 	CitySiteList[L_COUNTRYSIDE-CITYSITEBASE][2] = j;
158 	break;
159       case 'v':
160 	Level->site[i][j].locchar = FLOOR;
161 	Level->site[i][j].p_locf = L_VAULT;
162 	Level->site[i][j].aux = NOCITYMOVE;
163 	lset(i,j,SECRET);
164 	break;
165       case 'S':
166 	Level->site[i][j].locchar = FLOOR;
167 	Level->site[i][j].aux = NOCITYMOVE;
168 	lset(i,j,SECRET);
169 	break;
170       case 'G':
171 	Level->site[i][j].locchar = FLOOR;
172 	if (populate) {
173 	  make_site_monster(i,j,GUARD);
174 	  Level->site[i][j].creature->aux1 = i;
175 	  Level->site[i][j].creature->aux2 = j;
176 	}
177 	break;
178       case 'u':
179 	Level->site[i][j].locchar = FLOOR;
180 	if (populate)
181 	  make_minor_undead(i,j);
182 	break;
183       case 'U':
184 	Level->site[i][j].locchar = FLOOR;
185 	if (populate)
186 	  make_major_undead(i,j);
187 	break;
188       case 'V':
189 	Level->site[i][j].showchar = WALL;
190 	Level->site[i][j].locchar = FLOOR;
191 	Level->site[i][j].p_locf = L_VAULT;
192 	if (populate)
193 	  make_site_treasure(i,j,5);
194 	Level->site[i][j].aux = NOCITYMOVE;
195 	lset(i,j,SECRET);
196 	break;
197       case '%':
198 	Level->site[i][j].showchar = WALL;
199 	Level->site[i][j].locchar = FLOOR;
200 	Level->site[i][j].p_locf = L_TRAP_SIREN;
201 	if (populate)
202 	  make_site_treasure(i,j,5);
203 	Level->site[i][j].aux = NOCITYMOVE;
204 	lset(i,j,SECRET);
205 	break;
206       case '$':
207 	Level->site[i][j].locchar = FLOOR;
208 	if (populate)
209 	  make_site_treasure(i,j,5);
210 	break;
211       case '2':
212 	Level->site[i][j].locchar = ALTAR;
213 	Level->site[i][j].p_locf = L_ALTAR;
214 	Level->site[i][j].aux = ODIN;
215 	break;
216       case '3':
217 	Level->site[i][j].locchar = ALTAR;
218 	Level->site[i][j].p_locf = L_ALTAR;
219 	Level->site[i][j].aux = SET;
220 	break;
221       case '4':
222 	Level->site[i][j].locchar = ALTAR;
223 	Level->site[i][j].p_locf = L_ALTAR;
224 	Level->site[i][j].aux = ATHENA;
225 	break;
226       case '5':
227 	Level->site[i][j].locchar = ALTAR;
228 	Level->site[i][j].p_locf = L_ALTAR;
229 	Level->site[i][j].aux = HECATE;
230 	break;
231       case '6':
232 	Level->site[i][j].locchar = ALTAR;
233 	Level->site[i][j].p_locf = L_ALTAR;
234 	Level->site[i][j].aux = DESTINY;
235 	break;
236       case '^':
237 	Level->site[i][j].showchar = WALL;
238 	Level->site[i][j].locchar = FLOOR;
239 	Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS);
240 	lset(i,j,SECRET);
241 	break;
242       case '"':
243 	Level->site[i][j].locchar = HEDGE;
244 	break;
245       case '~':
246 	Level->site[i][j].locchar = WATER;
247 	Level->site[i][j].p_locf = L_WATER;
248 	break;
249       case '=':
250 	Level->site[i][j].locchar = WATER;
251 	Level->site[i][j].p_locf = L_MAGIC_POOL;
252 	break;
253       case '*':
254 	Level->site[i][j].locchar = WALL;
255 	Level->site[i][j].aux = 10;
256 	break;
257       case '#':
258 	Level->site[i][j].locchar = WALL;
259 	Level->site[i][j].aux = 500;
260 	break;
261       case '.':
262 	Level->site[i][j].locchar = FLOOR;
263 	break;
264       case ',':
265 	Level->site[i][j].showchar = WALL;
266 	Level->site[i][j].locchar = FLOOR;
267 	Level->site[i][j].aux = NOCITYMOVE;
268 	lset(i,j,SECRET);
269 	break;
270       case '-':
271 	Level->site[i][j].locchar = CLOSED_DOOR;
272 	break;
273       case '1':
274 	Level->site[i][j].locchar = STATUE;
275 	break;
276       default:
277 	printf("\nOops... missed a case: '%c'   \n", site);
278 	morewait();
279       }
280 
281       if (loc_statusp(i,j,SEEN)) {
282 	if (loc_statusp(i,j,SECRET))
283 	  Level->site[i][j].showchar = WALL;
284 	else Level->site[i][j].showchar = Level->site[i][j].locchar;
285       }
286     }
287     site = getc(fd)^site;
288   }
289   City = Level;
290 
291   /* make all city monsters asleep, and shorten their wakeup range to 2 */
292   /* to prevent players from being molested by vicious monsters on */
293   /* the streets */
294   for(ml=Level->mlist;ml!=NULL;ml=ml->next) {
295     m_status_reset(ml->m,AWAKE);
296     ml->m->wakeup = 2;
297   }
298   fclose(fd);
299   initrand(E_RESTORE, 0);
300 }
301 
302 
assign_city_function(x,y)303 void assign_city_function(x,y)
304 int x,y;
305 {
306   static int setup=0;
307   static int next=0;
308   static int permutation[64]; /* number of x's in city map */
309   int i,j,k,l;
310 
311   Level->site[x][y].aux = TRUE;
312 
313   lset(x,y+1,STOPS);
314   lset(x+1,y,STOPS);
315   lset(x-1,y,STOPS);
316   lset(x,y-1,STOPS);
317   lset(x,y,STOPS); /* FIXED! 12/30/98 */
318 
319   if (setup == 0) {
320     setup = 1;
321     for(i=0;i<64;i++)
322       permutation[i] = i;
323     for(i=0;i<500;i++) {
324       j = random_range(64);
325       k = random_range(64);
326       l = permutation[j];
327       permutation[j] = permutation[k];
328       permutation[k] = l;
329     }
330   }
331   if (next > 63) { /* in case someone changes the no. of x's */
332     Level->site[x][y].locchar = CLOSED_DOOR;
333     Level->site[x][y].p_locf = L_HOUSE;
334     if(random_range(5)) Level->site[x][y].aux = LOCKED;
335   }
336   else switch(permutation[next]) {
337   case 0:
338     Level->site[x][y].locchar = OPEN_DOOR;
339     Level->site[x][y].p_locf = L_ARMORER;
340     CitySiteList[L_ARMORER-CITYSITEBASE][1] = x;
341     CitySiteList[L_ARMORER-CITYSITEBASE][2] = y;
342     break;
343   case 1:
344     Level->site[x][y].locchar = OPEN_DOOR;
345     Level->site[x][y].p_locf = L_CLUB;
346     CitySiteList[L_CLUB-CITYSITEBASE][1] = x;
347     CitySiteList[L_CLUB-CITYSITEBASE][2] = y;
348     break;
349   case 2:
350     Level->site[x][y].locchar = OPEN_DOOR;
351     Level->site[x][y].p_locf = L_GYM;
352     CitySiteList[L_GYM-CITYSITEBASE][1] = x;
353     CitySiteList[L_GYM-CITYSITEBASE][2] = y;
354     break;
355   case 3:
356     Level->site[x][y].locchar = CLOSED_DOOR;
357     Level->site[x][y].p_locf = L_THIEVES_GUILD;
358     CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][1] = x;
359     CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][2] = y;
360     break;
361   case 4:
362     Level->site[x][y].locchar = OPEN_DOOR;
363     Level->site[x][y].p_locf = L_HEALER;
364     CitySiteList[L_HEALER-CITYSITEBASE][1] = x;
365     CitySiteList[L_HEALER-CITYSITEBASE][2] = y;
366     break;
367   case 5:
368     Level->site[x][y].locchar = OPEN_DOOR;
369     Level->site[x][y].p_locf = L_CASINO;
370     CitySiteList[L_CASINO-CITYSITEBASE][1] = x;
371     CitySiteList[L_CASINO-CITYSITEBASE][2] = y;
372     break;
373   case 7:
374     Level->site[x][y].locchar = OPEN_DOOR;
375     Level->site[x][y].p_locf = L_DINER;
376     CitySiteList[L_DINER-CITYSITEBASE][1] = x;
377     CitySiteList[L_DINER-CITYSITEBASE][2] = y;
378     break;
379   case 8:
380     Level->site[x][y].locchar = OPEN_DOOR;
381     Level->site[x][y].p_locf = L_CRAP;
382     CitySiteList[L_CRAP-CITYSITEBASE][1] = x;
383     CitySiteList[L_CRAP-CITYSITEBASE][2] = y;
384     break;
385   case 6:
386   case 9:
387   case 20:
388     Level->site[x][y].locchar = OPEN_DOOR;
389     Level->site[x][y].p_locf = L_COMMANDANT;
390     CitySiteList[L_COMMANDANT-CITYSITEBASE][1] = x;
391     CitySiteList[L_COMMANDANT-CITYSITEBASE][2] = y;
392     break;
393   case 21:
394     Level->site[x][y].locchar = OPEN_DOOR;
395     Level->site[x][y].p_locf = L_TAVERN;
396     CitySiteList[L_TAVERN-CITYSITEBASE][1] = x;
397     CitySiteList[L_TAVERN-CITYSITEBASE][2] = y;
398     break;
399   case 10:
400     Level->site[x][y].locchar = OPEN_DOOR;
401     Level->site[x][y].p_locf = L_ALCHEMIST;
402     CitySiteList[L_ALCHEMIST-CITYSITEBASE][1] = x;
403     CitySiteList[L_ALCHEMIST-CITYSITEBASE][2] = y;
404     break;
405   case 11:
406     Level->site[x][y].locchar = OPEN_DOOR;
407     Level->site[x][y].p_locf = L_DPW;
408     CitySiteList[L_DPW-CITYSITEBASE][1] = x;
409     CitySiteList[L_DPW-CITYSITEBASE][2] = y;
410     break;
411   case 12:
412     Level->site[x][y].locchar = OPEN_DOOR;
413     Level->site[x][y].p_locf = L_LIBRARY;
414     CitySiteList[L_LIBRARY-CITYSITEBASE][1] = x;
415     CitySiteList[L_LIBRARY-CITYSITEBASE][2] = y;
416     break;
417   case 13:
418     Level->site[x][y].locchar = OPEN_DOOR;
419     Level->site[x][y].p_locf = L_PAWN_SHOP;
420     CitySiteList[L_PAWN_SHOP-CITYSITEBASE][1] = x;
421     CitySiteList[L_PAWN_SHOP-CITYSITEBASE][2] = y;
422     break;
423   case 14:
424     Level->site[x][y].locchar = OPEN_DOOR;
425     Level->site[x][y].p_locf = L_CONDO;
426     CitySiteList[L_CONDO-CITYSITEBASE][1] = x;
427     CitySiteList[L_CONDO-CITYSITEBASE][2] = y;
428     break;
429   case 15:
430     Level->site[x][y].locchar = CLOSED_DOOR;
431     Level->site[x][y].p_locf = L_BROTHEL;
432     CitySiteList[L_BROTHEL-CITYSITEBASE][1] = x;
433     CitySiteList[L_BROTHEL-CITYSITEBASE][2] = y;
434     break;
435   default:
436     Level->site[x][y].locchar = CLOSED_DOOR;
437     switch(random_range(6)) {
438     case 0: Level->site[x][y].p_locf = L_HOVEL; break;
439     case 1: case 2: case 3:
440     case 4: Level->site[x][y].p_locf = L_HOUSE; break;
441     case 5: Level->site[x][y].p_locf = L_MANSION; break;
442     }
443     if(random_range(5)) Level->site[x][y].aux = LOCKED;
444     break;
445   }
446   next++;
447 }
448 
449 
450 
451 
452 /* makes a hiscore npc for mansions */
make_justiciar(i,j)453 void make_justiciar(i,j)
454 int i,j;
455 {
456   pml ml = ((pml) checkmalloc(sizeof(mltype)));
457   ml->m = ((pmt) checkmalloc(sizeof(montype)));
458   *(ml->m) = Monsters[NPC];
459   make_hiscore_npc(ml->m,15);
460   ml->m->x = i;
461   ml->m->y = j;
462   Level->site[i][j].creature = ml->m;
463   ml->m->click = (Tick + 1) % 60;
464   ml->next = Level->mlist;
465   Level->mlist = ml;
466   m_status_reset(ml->m,AWAKE);
467 }
468 
469 
470 
471 /* loads the city level */
resurrect_guards()472 void resurrect_guards()
473 {
474   int i,j;
475   char site;
476 
477   FILE *fd;
478 
479   strcpy(Str3,Omegalib);
480   strcat(Str3,"city.dat");
481   fd = checkfopen(Str3,"rb");
482   site = cryptkey("city.dat");
483   for(j=0;j<LENGTH;j++) {
484     for(i=0;i<WIDTH;i++) {
485       site = getc(fd)^site;
486       if (site == 'G') {
487 	make_site_monster(i,j,GUARD);
488 	Level->site[i][j].creature->monstring = "undead guardsman";
489 	Level->site[i][j].creature->meleef = M_MELEE_SPIRIT;
490 	Level->site[i][j].creature->movef = M_MOVE_SPIRIT;
491 	Level->site[i][j].creature->strikef = M_STRIKE_MISSILE;
492 	Level->site[i][j].creature->immunity = EVERYTHING-pow2(NORMAL_DAMAGE);
493 	Level->site[i][j].creature->hp *= 2;
494 	Level->site[i][j].creature->hit *= 2;
495 	Level->site[i][j].creature->dmg *= 2;
496 	Level->site[i][j].creature->ac *= 2;
497 	m_status_set(Level->site[i][j].creature,HOSTILE);
498 	m_status_set(Level->site[i][j].creature,AWAKE);
499       }
500     }
501     site = getc(fd)^site;
502   }
503   fclose(fd);
504 }
505 
506 
mazesite(i,j,populate)507 void mazesite(i,j,populate)
508 int i,j,populate;
509 {
510   static FILE *fd=NULL;
511   static int k=0;
512   static char site;
513   if (fd==NULL) {
514     strcpy(Str2,Omegalib);
515     strcpy(Str4,"maze .dat");
516     Str4[4]='1'+random_range(4);
517     strcat(Str2,Str4);
518     fd = checkfopen(Str2,"rb");
519     site = cryptkey("mazes");
520   }
521   site = getc(fd)^site;
522   k++;
523   if (k == 286) fclose(fd);
524   switch(site) {
525   case '"':
526     Level->site[i][j].locchar = HEDGE;
527     if (random_range(10))
528       Level->site[i][j].p_locf = L_HEDGE;
529     else
530       Level->site[i][j].p_locf = L_TRIFID;
531     break;
532   case '-':
533     Level->site[i][j].locchar = CLOSED_DOOR;
534     break;
535   case '.':
536     Level->site[i][j].locchar = FLOOR;
537     break;
538   case '>':
539     Level->site[i][j].locchar = STAIRS_DOWN;
540     Level->site[i][j].p_locf = L_SEWER;
541     break;
542   case 'z':
543     Level->site[i][j].locchar = FLOOR;
544     Level->site[i][j].p_locf = L_MAZE;
545     break;
546   case 'O':
547     Level->site[i][j].locchar = OPEN_DOOR;
548     Level->site[i][j].p_locf = L_ORACLE;
549     CitySiteList[L_ORACLE-CITYSITEBASE][1] = i;
550     CitySiteList[L_ORACLE-CITYSITEBASE][2] = j;
551     break;
552   case '?':
553     randommazesite(i,j,populate);
554     break;
555   }
556   lreset(i,j,SEEN);
557 }
558 
randommazesite(i,j,populate)559 void randommazesite(i,j,populate)
560 int i,j,populate;
561 {
562   switch(random_range(7)) {
563   case 0: case 1:
564     Level->site[i][j].locchar = FLOOR;
565     Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS);
566     break;
567   case 2: case 3:
568     Level->site[i][j].locchar = FLOOR;
569     if (populate)
570       make_site_monster(i,j,-1);
571     break;
572   case 4: case 5:
573     Level->site[i][j].locchar = FLOOR;
574     if (populate)
575       make_site_treasure(i,j,5);
576     break;
577   default:
578     Level->site[i][j].locchar = FLOOR;
579   }
580 }
581 
582 
583 /* undead are not hostile unless disturbed.... */
make_minor_undead(i,j)584 void make_minor_undead(i,j)
585 int i,j;
586 {
587   int mid;
588   if (random_range(2)) mid = GHOST;
589   else mid = HAUNT;
590   make_site_monster(i,j,mid);
591   m_status_reset(Level->site[i][j].creature,AWAKE);
592   m_status_reset(Level->site[i][j].creature,HOSTILE);
593 }
594 
595 /* undead are not hostile unless disturbed.... */
make_major_undead(i,j)596 void make_major_undead(i,j)
597 int i,j;
598 {
599   int mid;
600   if (random_range(2)) mid = LICHE; /* lich */
601   else mid = VAMP_LORD; /*vampire lord*/
602   make_site_monster(i,j,mid);
603   m_status_reset(Level->site[i][j].creature,AWAKE);
604   m_status_reset(Level->site[i][j].creature,HOSTILE);
605 }
606 
607 
608 static char jail[5][11] =
609 {
610    { '#', '#', '*', '#', '#', '*', '#', '#', '*', '#', '#' },
611    { '#', '#', '*', '#', '#', '*', '#', '*', '#', '#', '#' },
612    { '#', '#', 'T', '#', 'T', '#', 'T', '#', 'T', '#', '#' },
613    { '#', '#', '7', '#', '7', '#', '7', '#', '7', '#', '#' },
614    { '#', '#', 'R', '#', 'R', '#', 'R', '#', 'R', '#', '#' }
615 };
616 
617 /* fixes up the jail in case it has been munged by player action */
repair_jail()618 void repair_jail()
619 {
620   int i,j;
621   for(i=0;i<11;i++)
622     for(j=0;j<5;j++) {
623       switch(jail[j][i]) {
624       case '#':
625 	City->site[i+35][j+52].locchar = WALL;
626 	City->site[i+35][j+52].p_locf = L_NO_OP;
627 	City->site[i+35][j+52].aux = NOCITYMOVE;
628 	break;
629       case '*':
630 	City->site[i+35][j+52].locchar = WALL;
631 	City->site[i+35][j+52].p_locf = L_NO_OP;
632 	City->site[i+35][j+52].aux = 10;
633 	break;
634       case 'T':
635 	City->site[i+35][j+52].locchar = FLOOR;
636 	City->site[i+35][j+52].p_locf = L_PORTCULLIS_TRAP;
637 	City->site[i+35][j+52].aux = NOCITYMOVE;
638 	break;
639       case '7':
640 	City->site[i+35][j+52].locchar = FLOOR;
641 	City->site[i+35][j+52].p_locf = L_PORTCULLIS;
642 	City->site[i+35][j+52].aux = NOCITYMOVE;
643 	break;
644       case 'R':
645 	City->site[i+35][j+52].locchar = FLOOR;
646 	City->site[i+35][j+52].p_locf = L_RAISE_PORTCULLIS;
647 	City->site[i+35][j+52].aux = NOCITYMOVE;
648 	break;
649       }
650       lreset(i+35, j+52, CHANGED);
651     }
652 }
653