home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume6 / conquer4 / patch7c < prev    next >
Text File  |  1989-12-21  |  14KB  |  529 lines

  1. Subject:  v08i078:  conquer4 - middle earth multi-player game (V4), Patch7c
  2. Newsgroups: comp.sources.games
  3. Approved: billr@saab.CNA.TEK.COM
  4.  
  5. Submitted-by: Adam Bryant <adb@cs.bu.edu>
  6. Posting-number: Volume 8, Issue 78
  7. Archive-name: conquer4/Patch7c
  8. Patch-To: conquer4: Volume 6, Issue 83-96
  9.  
  10.  
  11. #!/bin/sh
  12. # this is part 3 of a multipart archive
  13. # do not concatenate these parts, unpack them in order with /bin/sh
  14. # file patchV4.7 continued
  15. #
  16. CurArch=3
  17. if test ! -r s2_seq_.tmp
  18. then echo "Please unpack part 1 first!"
  19.      exit 1; fi
  20. ( read Scheck
  21.   if test "$Scheck" != $CurArch
  22.   then echo "Please unpack part $Scheck next!"
  23.        exit 1;
  24.   else exit 0; fi
  25. ) < s2_seq_.tmp || exit 1
  26. echo "x - Continuing file patchV4.7"
  27. sed 's/^X//' << 'SHAR_EOF' >> patchV4.7
  28. X+         {
  29. X+ #ifdef DEBUG
  30. X+         printf("\t need %d monster troops\n",neededtroops);
  31. X+ #endif 
  32. X+         if ( (rand()%8)<5 && nomad_space)
  33. X+         {
  34. X+         while(!is_habitable((x=(rand()%(MAPX-8))+4),
  35. X+                     (y=(rand()%(MAPY-8))+4)))
  36. X+             ;
  37. X+         for(i=0;i<MAXARM;i++)
  38. X+             if ( ntn[nomads].arm[i].sold <=0 )
  39. X+             goto found_free_nomad_army;
  40. X+ 
  41. X+ #ifdef DEBUG
  42. X+         printf("\t\t Out of nomad space\n");
  43. X+ #endif
  44. X+         nomad_space=0;
  45. X+         continue;
  46. X+         
  47. X+         found_free_nomad_army:
  48. X+ 
  49. X+         ntn[nomads].arm[i].xloc=x;
  50. X+         ntn[nomads].arm[i].yloc=y;
  51. X+         ntn[nomads].arm[i].sold=100+100*(rand()%6);
  52. X+         ntn[nomads].arm[i].unittyp=A_LT_CAV;
  53. X+         ntn[nomads].arm[i].stat=ATTACK;
  54. X+         neededtroops -= ntn[nomads].arm[i].sold;
  55. X+ #ifdef DEBUG
  56. X+         printf("\t\tAdding nomad army %d size %d at (%d,%d)\n",i,
  57. X+                ntn[nomads].arm[i].sold,x,y);
  58. X+ #endif
  59. X+         }
  60. X+         else
  61. X+         {
  62. X+         do {
  63. X+         x=(rand()%(MAPX-8))+4;
  64. X+         y=(rand()%(MAPY-8))+4;
  65. X+         } while ( sct[x][y].altitude == PEAK ||
  66. X+               sct[x][y].altitude == WATER ||
  67. X+              ( sct[x][y].owner !=0 &&
  68. X+                sct[x][y].owner != savages &&
  69. X+                sct[x][y].people >= 50 ) );
  70. X+ 
  71. X+         for(i=0;i<MAXARM;i++)
  72. X+             if ( ntn[savages].arm[i].sold <=0 )
  73. X+             goto found_free_savage_army;
  74. X+ 
  75. X+ #ifdef DEBUG
  76. X+         printf("\t\t Out of savage space\n");
  77. X+ #endif
  78. X+         savage_space=0;
  79. X+         continue;
  80. X+         
  81. X+         found_free_savage_army:
  82. X+ 
  83. X+         ntn[savages].arm[i].xloc=x;
  84. X+         ntn[savages].arm[i].yloc=y;
  85. X+         ntn[savages].arm[i].sold=100+100*(rand()%3);
  86. X+         ntn[savages].arm[i].unittyp=defaultunit(savages);
  87. X+         ntn[savages].arm[i].stat=ATTACK;
  88. X+         neededtroops -= ntn[savages].arm[i].sold;
  89. X+ #ifdef DEBUG
  90. X+         printf("\t\tAdding savage army %d size %d at (%d,%d)\n",i,
  91. X+                ntn[savages].arm[i].sold,x,y);
  92. X+ #endif
  93. X+         }
  94. X+         }
  95. X+     }
  96. X+ #endif /* MORE_MONST */
  97. X+ 
  98. X  }
  99. X  
  100. X  void
  101. X***************
  102. X*** 177,197 ****
  103. X              break;
  104. X          }
  105. X      }
  106. X- #ifdef MORE_MONST
  107. X-     /* place a few new Nomad armies */
  108. X-     for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD<=0){
  109. X-         if(rand()%4!=0) continue;
  110. X-         x=(rand()%(MAPX-8))+4;
  111. X-         y=(rand()%(MAPY-8))+4;
  112. X-         if(is_habitable(x,y)) {
  113. X-             P_AXLOC=x;
  114. X-             P_AYLOC=y;
  115. X-             P_ASOLD=100+100*(rand()%6);
  116. X-             P_ATYPE=A_LT_CAV;
  117. X-             P_ASTAT=ATTACK;
  118. X-         }
  119. X-     }
  120. X- #endif /* MORE_MONST */
  121. X  }
  122. X  
  123. X  void
  124. X--- 293,298 ----
  125. X***************
  126. X*** 227,251 ****
  127. X              }
  128. X          }
  129. X      }
  130. X- #ifdef MORE_MONST
  131. X-     /* place a few new savage armies */
  132. X-     for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD<=0){
  133. X-         x=(rand()%(MAPX-8))+4;
  134. X-         y=(rand()%(MAPY-8))+4;
  135. X-         if((rand()%4!=0) 
  136. X-         ||( sct[x][y].altitude == PEAK)
  137. X-         ||( sct[x][y].altitude == WATER))
  138. X-             continue;
  139. X-         if(sct[x][y].owner==0 || sct[x][y].owner==country 
  140. X-         ||(sct[x][y].people< 50)) {
  141. X-             P_AXLOC=x;
  142. X-             P_AYLOC=y;
  143. X-             P_ASOLD=100+100*(rand()%3);
  144. X-             P_ATYPE=defaultunit(country);
  145. X-             P_ASTAT=ATTACK;
  146. X-         }
  147. X-     }
  148. X- #endif /* MORE_MONST */
  149. X  }
  150. X  
  151. X  void
  152. X--- 328,333 ----
  153. X***************
  154. X*** 389,395 ****
  155. X  {
  156. X      short x,y,armynum,nvynum;
  157. X      int i, free, done;
  158. X!     long militia=0l,ideal;
  159. X      long diff=0l;
  160. X      int ok;
  161. X  
  162. X--- 471,477 ----
  163. X  {
  164. X      short x,y,armynum,nvynum;
  165. X      int i, free, done;
  166. X!     long ideal;
  167. X      long diff=0l;
  168. X      int ok;
  169. X  
  170. X***************
  171. X*** 401,409 ****
  172. X--- 483,495 ----
  173. X              if(rand()%2==0) P_NCREW = SHIPCREW;
  174. X      }
  175. X      check();
  176. X+     curntn->tmil = 0L;
  177. X      for(armynum=1;armynum<MAXARM;armynum++) if(P_ASOLD>0){
  178. X          /* move army back if too far out */
  179. X          ok = 0;
  180. X+         if (P_ASOLD < MINLEADER && P_ASOLD!=A_MILITIA) {
  181. X+             curntn->tmil += P_ASOLD;
  182. X+         }
  183. X          for(x=(int)P_AXLOC-3;x<=(int)P_AXLOC+3;x++)
  184. X              for(y=(int)P_AYLOC-3;y<=(int)P_AYLOC+3;y++)
  185. X                  if((ONMAP(x,y))&&(sct[x][y].owner==country)) ok=1;
  186. X***************
  187. X*** 412,418 ****
  188. X              P_AYLOC=curntn->capy;
  189. X          }
  190. X  
  191. X!         /* count and verify militia */
  192. X          if(P_ATYPE==A_MILITIA) {
  193. X              /* eliminate invalid militia */
  194. X              if(((sct[P_AXLOC][P_AYLOC].designation!=DTOWN)
  195. X--- 498,504 ----
  196. X              P_AYLOC=curntn->capy;
  197. X          }
  198. X  
  199. X!         /* verify militia */
  200. X          if(P_ATYPE==A_MILITIA) {
  201. X              /* eliminate invalid militia */
  202. X              if(((sct[P_AXLOC][P_AYLOC].designation!=DTOWN)
  203. X***************
  204. X*** 426,432 ****
  205. X                      sct[P_AXLOC][P_AYLOC].people+=P_ASOLD;
  206. X                  else sct[curntn->capx][curntn->capy].people+=P_ASOLD;
  207. X                  P_ASOLD=0;
  208. X!             } else militia+=P_ASOLD;
  209. X          }
  210. X  
  211. X          /* set default status */
  212. X--- 512,518 ----
  213. X                      sct[P_AXLOC][P_AYLOC].people+=P_ASOLD;
  214. X                  else sct[curntn->capx][curntn->capy].people+=P_ASOLD;
  215. X                  P_ASOLD=0;
  216. X!             }
  217. X          }
  218. X  
  219. X          /* set default status */
  220. X***************
  221. X*** 442,453 ****
  222. X              break;
  223. X          }
  224. X      }
  225. X-     curntn->tmil -= militia;
  226. X  
  227. X      /*make sure enough men in army 0 -- garrison duty in capitol*/
  228. X      armynum=0;
  229. X!     P_ASTAT=GARRISON;
  230. X      P_ATYPE=defaultunit(country);
  231. X      P_AXLOC=curntn->capx;
  232. X      P_AYLOC=curntn->capy;
  233. X  
  234. X--- 528,544 ----
  235. X              break;
  236. X          }
  237. X      }
  238. X  
  239. X      /*make sure enough men in army 0 -- garrison duty in capitol*/
  240. X      armynum=0;
  241. X!     /* find lowest army of non-leader type */
  242. X!     while (armynum < MAXARM && (P_ATYPE>=MINLEADER && P_ASOLD>0)) {
  243. X!         armynum++;
  244. X!     }
  245. X!     /* oh well... wipe out army zero; c'est la vie */
  246. X!     if (armynum == MAXARM) armynum = 0;
  247. X      P_ATYPE=defaultunit(country);
  248. X+     P_ASTAT=GARRISON;
  249. X      P_AXLOC=curntn->capx;
  250. X      P_AYLOC=curntn->capy;
  251. X  
  252. X***************
  253. X*** 470,481 ****
  254. X  
  255. X      /*too few soldiers on garrison*/
  256. X      /*diff is number to change mil in cap (>0)*/
  257. X!     if(curntn->tgold<0L) diff=0;
  258. X!     else diff = (long) min(ideal-P_ASOLD,(int) (curntn->metals / *(u_enmetal + (P_ATYPE%UTYPE))));
  259. X  
  260. X      diff=(long) min((int) diff, sct[curntn->capx][curntn->capy].people/2L);
  261. X  
  262. X!     if(curntn->tgold<0L || curntn->metals<0L) if(diff > 0L) diff=0;
  263. X  
  264. X  #ifdef DEBUG
  265. X      printf("\tadding %d men to garrison (too few men on garrison)\n",diff);
  266. X--- 561,572 ----
  267. X  
  268. X      /*too few soldiers on garrison*/
  269. X      /*diff is number to change mil in cap (>0)*/
  270. X!     diff = (long) min(ideal-P_ASOLD,(int) (curntn->metals / *(u_enmetal + (P_ATYPE%UTYPE))));
  271. X  
  272. X      diff=(long) min((int) diff, sct[curntn->capx][curntn->capy].people/2L);
  273. X  
  274. X!     if ((curntn->tgold<0L || curntn->metals<0L) && (diff > 0L)) diff=0L;
  275. X!     if (sct[curntn->capx][curntn->capy].owner != country) diff=0L;
  276. X  
  277. X  #ifdef DEBUG
  278. X      printf("\tadding %d men to garrison (too few men on garrison)\n",diff);
  279. X***************
  280. X*** 690,695 ****
  281. X--- 781,787 ----
  282. X              for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD==0){
  283. X                  P_AXLOC=x;
  284. X                  P_AYLOC=y;
  285. X+                 P_ATYPE=A_MILITIA;
  286. X                  free=TRUE;
  287. X                  break;
  288. X              }
  289. X***************
  290. X*** 711,727 ****
  291. X              }
  292. X              }
  293. X  #ifdef DEBUG
  294. X!         printf("\tadding %ld troops to %s army %d (now %ld men - populace %ld)\n",ideal-P_ASOLD,unittype[P_ATYPE],armynum,ideal,sct[x][y].people);
  295. X  #endif DEBUG
  296. X              P_ASOLD=ideal;
  297. X-             P_ATYPE=A_MILITIA;
  298. X              P_ASTAT=MILITIA;
  299. X          }
  300. X      }
  301. X      check();
  302. X  
  303. X!       /* setup default units */
  304. X!       for(armynum=1;armynum<MAXARM;armynum++) 
  305. X      if((P_ASOLD>0)&&(P_ATYPE!=A_MILITIA)&&(P_ATYPE<MINLEADER)) 
  306. X          P_ATYPE=defaultunit(country);
  307. X  }
  308. X--- 803,822 ----
  309. X              }
  310. X              }
  311. X  #ifdef DEBUG
  312. X!         printf("\tnow in sector %d,%d\n",x,y);
  313. X!         printf("\tadding %ld troops to %s army %d (now %ld men - populace %ld)\n",ideal-P_ASOLD,unittype[P_ATYPE%UTYPE],armynum,ideal,sct[x][y].people);
  314. X  #endif DEBUG
  315. X              P_ASOLD=ideal;
  316. X              P_ASTAT=MILITIA;
  317. X          }
  318. X      }
  319. X      check();
  320. X+ #ifdef DEBUG
  321. X+     printf("\tnow setting all units to default type of %s\n",unittype[defaultunit(country)]);
  322. X+ #endif /*DEBUG*/
  323. X  
  324. X!     /* setup default units */
  325. X!     for(armynum=1;armynum<MAXARM;armynum++) 
  326. X      if((P_ASOLD>0)&&(P_ATYPE!=A_MILITIA)&&(P_ATYPE<MINLEADER)) 
  327. X          P_ATYPE=defaultunit(country);
  328. X  }
  329. X***************
  330. X*** 1089,1095 ****
  331. X  
  332. X          spreadsheet(country);
  333. X  
  334. X!         hunger = spread.food/((float)(spread.civilians+2*curntn->tmil));
  335. X          if(hunger < P_EATRATE ) {
  336. X              goldthresh++;
  337. X              metalthresh++;
  338. X--- 1184,1192 ----
  339. X  
  340. X          spreadsheet(country);
  341. X  
  342. X!         if (spread.civilians+2*curntn->tmil > 0) {
  343. X!             hunger = spread.food/((float)(spread.civilians+2*curntn->tmil));
  344. X!         } else hunger = 0.0;
  345. X          if(hunger < P_EATRATE ) {
  346. X              goldthresh++;
  347. X              metalthresh++;
  348. X*** otrade.c    Tue Dec 12 21:19:37 1989
  349. X--- trade.c    Tue Dec 12 21:20:12 1989
  350. X***************
  351. X*** 113,119 ****
  352. X  
  353. X          /* go through list of commodities */
  354. X          for (holdint=0;holdint<itemnum;holdint++) {
  355. X!             if (deal[holdint]==SELL) {
  356. X                  count++;
  357. X                  mvprintw(count,0,"%2d) %-20s",
  358. X                      holdint+1,
  359. X--- 113,121 ----
  360. X  
  361. X          /* go through list of commodities */
  362. X          for (holdint=0;holdint<itemnum;holdint++) {
  363. X!             if ((deal[holdint]==SELL) && ((country==0) ||
  364. X!             (ntn[natn[holdint]].dstatus[country] != UNMET)
  365. X!             || (natn[holdint] == country))) {
  366. X                  count++;
  367. X                  mvprintw(count,0,"%2d) %-20s",
  368. X                      holdint+1,
  369. X***************
  370. X*** 197,203 ****
  371. X                  inloop=FALSE;
  372. X                  done=FALSE;
  373. X                  break;
  374. X!             } else if (holdint<1 || holdint>itemnum) {
  375. X                  tradeerr("Invalid Item Number");
  376. X                  return;
  377. X              }
  378. X--- 199,206 ----
  379. X                  inloop=FALSE;
  380. X                  done=FALSE;
  381. X                  break;
  382. X!             } else if (holdint<1 || holdint>itemnum
  383. X!                 || ntn[natn[holdint - 1]].dstatus[country]==UNMET) {
  384. X                  tradeerr("Invalid Item Number");
  385. X                  return;
  386. X              }
  387. X*** ocheck.c    Tue Dec 12 21:19:34 1989
  388. X--- check.c    Tue Dec 12 21:20:12 1989
  389. X***************
  390. X*** 50,65 ****
  391. X                      __file__, __line__, country, i, a->yloc );
  392. X                  a->yloc = 0;
  393. X              }
  394. X-             if( sct[a->xloc][a->yloc].altitude==PEAK ) {
  395. X-                 fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (peak)\n",
  396. X-                 __file__,__line__,country,i,a->xloc,a->yloc);
  397. X-                 a->sold = 0;
  398. X-             }
  399. X              if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) {
  400. X                  fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n",
  401. X                  __file__,__line__,country,i,a->xloc,a->yloc,a->sold);
  402. X                  a->sold = 0;
  403. X              }
  404. X          } /* for */
  405. X  
  406. X          for( i = 0; i < NTOTAL; i++ ) {
  407. X--- 50,65 ----
  408. X                      __file__, __line__, country, i, a->yloc );
  409. X                  a->yloc = 0;
  410. X              }
  411. X              if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) {
  412. X                  fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n",
  413. X                  __file__,__line__,country,i,a->xloc,a->yloc,a->sold);
  414. X                  a->sold = 0;
  415. X              }
  416. X+             if( a->stat == ONBOARD && a->smove > 0) {
  417. X+                 /* don't echo since this is still getting */
  418. X+                 /* set some place someplace I can't find yet */
  419. X+                 a->smove = 0;
  420. X+             }
  421. X          } /* for */
  422. X  
  423. X          for( i = 0; i < NTOTAL; i++ ) {
  424. X***************
  425. X*** 147,154 ****
  426. X  int    line;
  427. X  char    *file;
  428. X  {
  429. X!     /* fprintf(stderr,"file %s line %d\n",file,line);  */
  430. X!     /* verifydata(file,line); */
  431. X  }
  432. X  #endif DEBUG
  433. X  
  434. X--- 147,154 ----
  435. X  int    line;
  436. X  char    *file;
  437. X  {
  438. X!     fprintf(stderr,"file %s line %d\n",file,line);
  439. X!     verifydata(file,line);
  440. X  }
  441. X  #endif DEBUG
  442. X  
  443. X***************
  444. X*** 158,163 ****
  445. X--- 158,164 ----
  446. X  #    include <unistd.h>
  447. X  #    define do_lock(fd) lockf(fd,F_TLOCK,0)
  448. X  #else
  449. X+ #    include <sys/types.h>
  450. X  #    include <sys/file.h>
  451. X  #    define do_lock(fd) flock(fd,LOCK_EX|LOCK_NB)
  452. X  #endif
  453. X***************
  454. X*** 192,199 ****
  455. X          exit(FAIL);
  456. X      }
  457. X  #else
  458. X!     if( access( filename, 00 ) == 0 ) {
  459. X!         hold=TRUE;
  460. X      }
  461. X      if (hold==FALSE && keeplock==TRUE) {
  462. X          /* create lock file */
  463. X--- 193,209 ----
  464. X          exit(FAIL);
  465. X      }
  466. X  #else
  467. X!     struct stat fst;
  468. X! 
  469. X!     if( stat( filename, &fst ) == 0 ) {
  470. X!         long now;
  471. X!         now = time(0);
  472. X!         if (now - fst.st_mtime < TIME_DEAD*3) {
  473. X!             hold=TRUE;
  474. X!         } else {
  475. X!             /* remove useless file */
  476. X!             unlink(filename);
  477. X!         }
  478. X      }
  479. X      if (hold==FALSE && keeplock==TRUE) {
  480. X          /* create lock file */
  481. X*** otxt5    Tue Dec 12 21:19:38 1989
  482. X--- txt5    Tue Dec 12 21:20:14 1989
  483. X***************
  484. X*** 216,221 ****
  485. X--- 216,222 ----
  486. X                    between 25%-125% of the tax rate [randomly determined]
  487. X                    plus (poverty - 50)/2 and is then adjusted by the ratio of
  488. X                    military to civilians.
  489. X+               Money lost due to inflation will be indicated in the budget.
  490. X  wealth      = see elsewhere.
  491. X  END
  492. X                  ADDITIONAL MODIFIERS TO NATIONAL ATTRIBUTES
  493. X***************
  494. X*** 222,234 ****
  495. X  
  496. X  MAGIC POWERS ADD OR SUBTRACT 10 FROM POWERS AS FOLLOWS:
  497. X          SLAVER.....terror      ARCHITECT..storerate
  498. X!         RELIGION...popularity  URBAN......-popularity 
  499. X          DEMOCRACY..-terror     ROADS......communication
  500. X          KNOWALL....knowledge   DESTROYER..terror
  501. X          VAMPIRE....terror      
  502. X  
  503. X  CLASSES ADD 30 TO POWERS AS FOLLOWS:
  504. X!         kingdom....popularity    dragon.....terror        
  505. X          wizard.....knowledge     priest.....popularity
  506. X          pirate.....terror        shadow.....terror
  507. X          warlord....prestige      demon......terror
  508. X--- 223,235 ----
  509. X  
  510. X  MAGIC POWERS ADD OR SUBTRACT 10 FROM POWERS AS FOLLOWS:
  511. X          SLAVER.....terror      ARCHITECT..storerate
  512. X!         RELIGION...popularity  URBAN......-popularity
  513. X          DEMOCRACY..-terror     ROADS......communication
  514. X          KNOWALL....knowledge   DESTROYER..terror
  515. X          VAMPIRE....terror      
  516. X  
  517. X  CLASSES ADD 30 TO POWERS AS FOLLOWS:
  518. X!         kingdom....popularity    dragon.....terror
  519. X          wizard.....knowledge     priest.....popularity
  520. X          pirate.....terror        shadow.....terror
  521. X          warlord....prestige      demon......terror
  522. SHAR_EOF
  523. echo "File patchV4.7 is complete"
  524. chmod 0644 patchV4.7 || echo "restore of patchV4.7 fails"
  525. rm -f s2_seq_.tmp
  526. echo "You have unpacked the last part"
  527. exit 0
  528.  
  529.