shiftdot515

empireFIX.ed

Apr 12th, 2020
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 16.17 KB | None | 0 0
  1. e Makefile
  2. w Makefile.original
  3. e Makefile
  4. 1,$d
  5. w
  6. e Makefile
  7. 0a
  8. # %W% %G% %U% - (c) Copyright 1987, 1988 Chuck Simmons
  9.  
  10. #
  11. #    Copyright (C) 1987, 1988 Chuck Simmons
  12. #
  13. # See the file COPYING, distributed with empire, for restriction
  14. # and warranty information.
  15.  
  16. VERS=$(shell sed <vms-empire.spec -n -e '/Version: \(.*\)/s//\1/p')
  17.  
  18. # Change the line below for your system.  If you are on a Sun or Vax,
  19. # you may want BSD.
  20.  
  21. SYS = LINUX
  22. #SYS = BSD
  23. #SYS = SYSV
  24.  
  25. # Use -g to compile the program for debugging.
  26.  
  27. ##DEBUG = -g -DDEBUG -Wall
  28. #DEBUG =  -Wall
  29.  
  30. # Use -p to profile the program.
  31. #PROFILE = -p -DPROFILE
  32. #PROFILE = -O0 -fno-omit-frame-pointer -fno-strict-aliasing
  33. #PROFILE = -Os -march=c3 --force-addr
  34. #PROFILE = -O3 -mcpu=G3
  35. ##PROFILE = -O2 -mcpu=G3
  36. #PROFILE = -Os -mcpu=G3
  37. ##PROFILE = -O1 -mcpu=G3
  38. #PROFILE = -O3 -mcpu=G4
  39. PROFILE = -Os
  40. # some of these options produce provable optimizing errors
  41. # meaning w/ certain CFLAGS the optimizer in the compiler
  42. # can be the culprit which is in fact a known feature
  43. # or attribute to Computer Science that VMS-Empire
  44. # is in the class of programs with that property
  45. # sadly I pruned any addtional info that was once here
  46. # thinking Id never share.  This simple game program makes
  47. # it even more provable since generally you dont have autosave
  48. # every turn.. so you recompile, make the same choices
  49. # when replayiing from saved game.. which the default
  50. # with empire  # also of course you keep those binaries
  51. # since this makefile produces only 1 one runnable object
  52. #LIBS = -lncurses
  53. # HANGING BRACE or CLOSING BRACE ERROR too
  54. # SEE IF CAN CATCH WHERE reading this script empireFIXED.ed
  55. # which naturally one applies appropiately with an  ed < empireFIXED.ed
  56. # 1st time Ive really cared to share
  57. # any want to haha email this to apple kernels dev that
  58. # were responsible at the time for darwin...
  59. # not me, I think Ill find more joy
  60. # making some kind of twitter slide show about
  61. # the journey... make my own lecture
  62. # part of a certain Computer Science meme
  63. #LIBS = -lncurses
  64. # fixing the braces resolved Id say about half the fighter landed crap
  65. # but resolved completely the cities that never complete a build
  66. # unless army for the computer and I think only half the time does the computer
  67. # get that luck.  AND TO BE PERFECTLY CLEAR ITS ALWAYS the SAME CITY
  68. # BUT the 1ST ELEMENT IN THE BIG STATIC ARRAY IS NO LONGER CONSTANTLY
  69. # CORRUPTED THANKS to me, and anyone RELATED TO GNU gdb , esp.
  70. # documentation, sellers of used or old books, NETBSD devs
  71. # esp. those who cared to provide enough features for a C3 that
  72. # watch-points will work w/o a doubt.  AND thats what it
  73. # took for me stop criticizing myself every time I considered
  74. # criticizing hamlet.  Seriously, except for  that
  75. # I could have solved it on this computer, a G3 ibook,
  76. # a G4 mystic, a 486 cryrix with linux with kernel 2.0.38
  77. # or any of few kind of early to mid ninetys sun workstation
  78. # at Hunter Creech Lab
  79. # Cant forget Chuck, either
  80. LIBS = -lcurses  
  81. # presently this is setup for a darwin tiger G3
  82. # you might find it easier to download color_console.term
  83. # as I  made a few changes to make a faster game as well
  84. # Also, better color by far imo
  85. # AI unchanged # quite a few fighter tweaks tho.
  86. # AI apparent personalty exactly the same imo
  87. # basically, no easy tweak left undone
  88. # fans should prefer mine!
  89. #
  90. # You shouldn't have to modify anything below this line.
  91.  
  92. CFLAGS += $(DEBUG) $(PROFILE) -D$(SYS) -DWITH_COLOR
  93.  
  94. FILES = \
  95.     attack.c \
  96.     compmove.c \
  97.     data.c \
  98.     display.c \
  99.     edit.c \
  100.     empire.c \
  101.     game.c \
  102.     main.c \
  103.     map.c \
  104.     math.c \
  105.     object.c \
  106.     term.c \
  107.     usermove.c \
  108.     util.c
  109.  
  110. HEADERS = empire.h extern.h
  111.  
  112. OFILES = \
  113.     attack.o \
  114.     compmove.o \
  115.     data.o \
  116.     display.o \
  117.     edit.o \
  118.     empire.o \
  119.     game.o \
  120.     main.o \
  121.     map.o \
  122.     math.o \
  123.     object.o \
  124.     term.o \
  125.     usermove.o \
  126.     util.o
  127.  
  128. all: vms-empire
  129.  
  130. vms-empire: $(OFILES)
  131.     $(CC) $(PROFILE) -o vms-empire $(OFILES) $(LIBS) $(LDFLAGS)
  132.  
  133. TAGS: $(HEADERS) $(FILES)
  134.     etags $(HEADERS) $(FILES)
  135.  
  136. lint: $(FILES)
  137.     lint -u -D$(SYS) $(FILES) -lcurses
  138.  
  139. clean:
  140.     rm -f *.o TAGS vms-empire
  141.  
  142. clobber: clean
  143.     rm -f vms-empire vms-empire-*.tar*
  144.  
  145. SOURCES = README NEWS vms-empire.6 COPYING Makefile BUGS AUTHORS $(FILES) $(HEADERS) MANIFEST vms-empire.spec
  146.  
  147. vms-empire-$(VERS).tar.gz: $(SOURCES) vms-empire.6
  148.     @ls $(SOURCES) | sed s:^:vms-empire-$(VERS)/: >MANIFEST
  149.     @(cd ..; ln -s vms-empire vms-empire-$(VERS))
  150.     (cd ..; tar -czvf vms-empire/vms-empire-$(VERS).tar.gz `cat vms-empire/MANIFEST`)
  151.     @(cd ..; rm vms-empire-$(VERS))
  152.  
  153. dist: vms-empire-$(VERS).tar.gz
  154.  
  155. release: vms-empire-$(VERS).tar.gz
  156.     shipper -f; rm -f CHANGES ANNOUNCE* *.6 *.html *.rpm *.lsm MANIFEST
  157. .
  158. w
  159. e attack.c
  160. 85c
  161.         }
  162. .
  163. 74a
  164.  
  165. .
  166. 69a
  167.       {  /* points to score for city */
  168.      
  169.         int points;
  170.  
  171.         points=cityp->work * 2;
  172.         if ( points < 10 )
  173.           points=10;
  174.         if (att_owner == USER)
  175.           user_score += points;
  176.         else
  177.           comp_score += points;
  178.       }
  179.      
  180. .
  181. w
  182. e compmove.c
  183. 1203c
  184.         automove = FALSE;
  185. .
  186. 1158c
  187.              && nuser_city == 0 && nuser_army == 0 ) {
  188. .
  189. 250a
  190. #if 0 /* moved satellite to production to here */
  191.     /* Now we need a SATELLITE. */
  192.     if (cityp->prod == NOPIECE && city_count[SATELLITE] == 0
  193.         &&  rndint(50,150) < date ) {
  194.       comp_set_prod (cityp, SATELLITE);
  195.       return;
  196.     }
  197.     if (cityp->prod == SATELLITE) return;
  198. #endif
  199.  
  200.  
  201. .
  202. 233c
  203. #if 0
  204. .
  205. w
  206. e display.c
  207. 286d
  208. 283d
  209. 281d
  210. 256d
  211. 56d
  212. 53c
  213.     init_pair(COLOR_BLUE, COLOR_WHITE, COLOR_BLUE);
  214. .
  215. 50c
  216.     init_pair(COLOR_CYAN, COLOR_BLACK, COLOR_BLUE);
  217. .
  218. 47,48c
  219.     init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_WHITE);
  220.     init_pair(COLOR_GREEN, COLOR_BLACK, COLOR_GREEN);
  221. .
  222. 42d
  223. w
  224. e edit.c
  225. 503a
  226.     case '*': /* set fighter to crash */
  227.       e_city_splat (cityp, type);
  228.       break;
  229.                    
  230. .
  231. 263a
  232. void
  233. e_city_splat (cityp, type)
  234. city_info_t *cityp;
  235. int type;
  236. {
  237.   if ( type == FIGHTER )
  238.     e_set_city_func (cityp, type, FIGHTERBURN);
  239.   else
  240.     huh ();
  241. }
  242.  
  243.  
  244.  
  245.  
  246.  
  247. .
  248. 181a
  249.   in_edit_kludge=FALSE; /* user is no longer in edit mode */
  250. .
  251. 113,132c
  252.         case '#':
  253.           extra( "Location = %d" , edit_cursor, 0,0,0,0,0,0,0);
  254.           break;
  255.         case '$': /* kludge to see city's work */
  256.          {
  257.            city_info_t * cityp;
  258.            long pos;
  259.            static city_info_t * lastcityp  = NULL;
  260.            static long prev_work;
  261.            
  262.  
  263.            cityp = find_city (edit_cursor);
  264.            if (!cityp ) /* cityp->owner != USER) */
  265.              break;
  266.  
  267.            pos=cityp - city;
  268.  
  269.            if ( cityp != lastcityp ) {
  270.              extra( "City #%d at %d making %d work= %d cost=%d",
  271.                     pos,
  272.                     cityp->loc,
  273.                     cityp->prod,
  274.                     cityp->work,
  275.                     piece_attr[(uchar)cityp->prod].build_time,
  276.                     0,0,0);
  277.              lastcityp=cityp;
  278.              prev_work=cityp->work;
  279.            } else {
  280.              extra( "City #%d at %d making %d work= %d cost=%d prev_work=%d",
  281.                     pos,
  282.                     cityp->loc,
  283.                     cityp->prod,
  284.                     cityp->work,
  285.                     piece_attr[(uchar)cityp->prod].build_time,
  286.                     prev_work,
  287.                     0,0);
  288.              prev_work=cityp->work;
  289.            }
  290.            break;
  291.          }
  292.        case '*': /* set fighter to crash */
  293.          e_splat (edit_cursor);
  294.          break;
  295.  
  296.        case '\034':  /* CTRL - \ */
  297.        case '_':  
  298.        {
  299.          city_info_t * cityp;
  300.          cityp = find_city (edit_cursor);
  301.          if (!cityp ) /* || cityp->owner != USER) */
  302.            break;
  303.          extra( "City at %d making %d work= %d cost=%d",
  304.                 cityp->loc,
  305.                 cityp->prod,
  306.                 cityp->work,
  307.                 piece_attr[(uchar)cityp->prod].build_time,
  308.                 0,0,0,0);
  309.  
  310.          kill(getpid(), SIGTRAP );
  311.        }
  312.        break;
  313.  
  314. .
  315. 43a
  316.    in_edit_kludge=TRUE ;
  317. .
  318. 27a
  319. int in_edit_kludge=TRUE ;
  320.  
  321. .
  322. 21a
  323. #include <unistd.h>
  324. #include <signal.h>
  325.  
  326. .
  327. w
  328. e empire.c
  329. 174,193c
  330.    case '$': /* current score, number of cities, number of armies */
  331.              /* number of enemies cites.. that you know ? , round */
  332.      
  333. #if 0
  334.     if ( win ==0 ) {
  335. #else
  336.       if (  1 == 0 ) {
  337. #endif
  338.        int num_cities, num_armies, i;
  339.        piece_info_t *p;
  340.  
  341.        num_cities=0;
  342.        num_armies=0;
  343.    
  344.        for (i = 0; i < NUM_CITY; i++) {
  345.          if (city[i].owner == USER)
  346.            num_cities++;
  347.        }
  348.    
  349.        for (p = user_obj[ARMY]; p != NULL; p = p->piece_link.next)
  350.          num_armies++;
  351.        comment("Round %d: You control %d/%d cities, and have %d armies.",
  352.                date,num_cities, NUM_CITY, num_armies,0,0,0,0);
  353.      } else {
  354.        int num_cities, num_armies, comp_cities,comp_armies,i;
  355.        piece_info_t *p;
  356.  
  357.        num_cities=comp_cities=0;
  358.        num_armies=comp_armies=0;
  359.    
  360.        for (i = 0; i < NUM_CITY; i++) {
  361.          if (city[i].owner == USER)
  362.            num_cities++;
  363.          else if ( city[i].owner == COMP )
  364.            comp_cities++;
  365.        }
  366.    
  367.        for (p = user_obj[ARMY]; p != NULL; p = p->piece_link.next)
  368.          num_armies++;
  369.        for (p = comp_obj[ARMY]; p != NULL; p = p->piece_link.next)
  370.          comp_armies++;
  371.  
  372.        comment( "You have %d/%d cities, and %d armies vs "\
  373.                 "computer's %d cities and %d armies.",
  374.               num_cities, NUM_CITY, num_armies,comp_cities,comp_armies,0,0,0);
  375.      }
  376.      break;
  377. .
  378. 95a
  379.        
  380. .
  381. 94a
  382. #else
  383.        c_examine();
  384. #endif        
  385. .
  386. 92a
  387. #if 0
  388. .
  389. w
  390. e empire.h
  391. 255,256c
  392. #define SECTOR_ROWS 2 /* 5 */ /* number of vertical sectors */ /* 52=max for 2 */
  393. #define SECTOR_COLS 1 /* 2 */ /* number of horizontal sectors */
  394. .
  395. 211,212c
  396. #define MAP_WIDTH  94 /*  148 -- 74 -- 80x40 */ /* 100 */
  397. #define MAP_HEIGHT 50 /*  31, 35--- 35 -- 80x40 */   /* 60  */
  398. .
  399. 80c
  400. #define LIST_SIZE 2000 /*5000==original*/ /* max number of pieces on board */
  401. .
  402. 62c
  403. #define NUM_CITY 60 /* 28, 25 -- original == 70 */
  404. .
  405. 56c
  406. #define NUMTOPS  3 /* 3 */ /* number of lines at top of screen for messages */
  407. .
  408. w
  409. e extern.h
  410. 175a
  411. int rndint(int minp, int maxp);
  412. .
  413. 157d
  414. 155d
  415. w
  416. e game.c
  417. 859a
  418. #else
  419.    switch(cell){
  420.    case '+':
  421.      attron(COLOR_PAIR(COLOR_GREEN));
  422.      break;
  423.    case '.':
  424.      attron(COLOR_PAIR(COLOR_CYAN));
  425.      break;
  426.    case 'a':
  427.    case 'f':
  428.    case 'p':
  429.    case 'd':
  430.    case 'b':
  431.    case 't':
  432.    case 'c':
  433.    case 's':
  434.    case 'z':
  435.    case 'X':
  436.      attron(COLOR_PAIR(COLOR_RED));
  437.      break;
  438.    default:
  439.      attron(COLOR_PAIR(COLOR_WHITE));
  440.      break;
  441.    }
  442.    addch ((chtype)cell);
  443.    attrset(0);
  444.    attron(COLOR_PAIR(COLOR_WHITE));
  445. #endif    
  446. .
  447. 858a
  448. #if 0
  449. .
  450. 562a
  451. #else
  452.    if(!xread (f, (char *)object, sizeof(piece_info_t[1000] ))) return (FALSE);
  453. #endif
  454. .
  455. 561a
  456. #if 1
  457. .
  458. 503d
  459. 345a
  460.  
  461.     compp->work = 0; /* 0 */
  462.     userp->work = 6; /* 0 */
  463.  
  464. .
  465. 343d
  466. 339d
  467. 335a
  468.    
  469.  
  470. .
  471. 333a
  472. #else
  473.     addprintf ("Your city is at %d. Computer city at %d", userp->loc,compp->loc,0,0,0,0,0,0);
  474. #endif
  475. .
  476. 332a
  477. #if 0
  478. .
  479. 324a
  480.    if ( comp_cont == user_cont ) {
  481.      addprintf("Player's continent == Computer's", 0,0,0,0,0,0,0,0);
  482.      delay(); /* let user see output */
  483.      goto REDO;
  484.    }
  485.  
  486. .
  487. 316a
  488. REDO:
  489. .
  490. 49c
  491.    print_info = FALSE;
  492. .
  493. w
  494. e main.c
  495. 81a
  496. #if 1
  497.        (void) printf ("%s = %li bytes\n",
  498.                       savefile,
  499.                       sizeof(map)+sizeof(comp_map)+sizeof(user_map)+
  500.                       sizeof(city)+sizeof(object)+sizeof(user_obj)+
  501.                       sizeof(comp_obj)+
  502.                       sizeof(free_list)+sizeof(date)+sizeof(automove)+
  503.                       sizeof(resigned)+sizeof(debug)+sizeof(win)+
  504.                       sizeof(save_movie)+sizeof(user_score)+
  505.                       sizeof(comp_score));
  506. #endif
  507. .
  508. 50,51c
  509.     dflg = 2000;
  510.     Sflg = 10;
  511. .
  512. w
  513. e object.c
  514. 735c
  515.          }
  516. .
  517. 733c
  518.             cityp->work = -(piece_attr[i].build_time / 5); /*was city->work! */
  519.  
  520. .
  521. 731c
  522.         else if ( cityp->prod == i )
  523.          return;
  524.        else
  525.          {
  526. .
  527. 636,637c
  528.     static unsigned int counter=0;
  529.     if ( counter++ % 100 == 0 )  /* cut down on the checks */
  530. .
  531. 593,609c
  532.    {
  533.    /*
  534.     * curses only updates the display if it is necessary, other
  535.     * this only rears it head when a piece of the same kind needs input at
  536.     * the same location -- so, output a number
  537.     * in those cases, I found two ways this, one works well in automove
  538.     * but doesn't work well in edit, the other works well in automove
  539.     * but not at all in edit, so...
  540.     */
  541.  
  542.      static long turn; /* current turn */
  543.      static long prev_loc;
  544.      static int prev_type=NOPIECE;
  545.      static piece_info_t *prev_obj;
  546.  
  547.      piece_info_t *ptr;
  548.      extern int in_edit_kludge ;
  549.  
  550.      if ( in_edit_kludge ) {
  551.        /* count pieces of this type, until we find this object */
  552.        for (num=0, ptr = map[obj->loc].objp; ptr; ptr = ptr->loc_link.next){
  553.          if (ptr->type == obj->type) num++;
  554.          if (ptr==obj) /* found ourselves */
  555.            break; /* with approach: numbers can appear out of order */
  556.        }
  557.      } else { /* count times here at this location */
  558.        if ( turn != date || prev_loc != obj->loc || prev_type != obj->type ){
  559.          turn=date;
  560.          prev_loc=obj->loc;
  561.          prev_type=obj->type;
  562.          prev_obj=obj;
  563.          num=1;
  564.        } else if ( obj != prev_obj )
  565.          num++;        
  566.      }
  567.    }
  568.  
  569.    if ( num <= 1 )
  570.      prompt2 ("%s at %d:  moves = %d; hits = %d; func = %s%s",
  571.               piece_attr[obj->type].name,
  572.               obj->loc,
  573.               obj_moves (obj) - obj->moved,
  574.               obj->hits,
  575.               func,
  576.               other,0,0);
  577.    else {
  578.      char namenum[STRSIZE];
  579.      sprintf(namenum, "%s #%d", piece_attr[obj->type].name,num);
  580.  
  581.       prompt2 ("%s at %d:  moves = %d; hits = %d; func = %s%s",
  582.                namenum,
  583.                obj->loc,
  584.                obj_moves (obj) - obj->moved,
  585.                obj->hits,
  586.                func,
  587.                other,
  588.                0,0);
  589.     }
  590.  
  591.  
  592. .
  593. 572a
  594.     static int num;
  595.  
  596. .
  597. w
  598. e usermove.c
  599. 1001c
  600.     void e_city_attack(), e_city_splat();
  601. .
  602. 781,783c
  603.  
  604.           break;
  605.  
  606. .
  607. 768,779c
  608. #if 1
  609.           extra( "Index = %d, Location = %d" ,
  610.                  obj-object,obj->loc,0,0,0,0,0,0);
  611. #else
  612.           extra( "Location = %d" , obj->loc, 0,0,0,0,0,0,0);
  613. .
  614. 692,694c
  615.      
  616.     case '.':
  617.     case '/':
  618.     case '=':
  619. .
  620. 690c
  621.  
  622.  
  623.     case '\014':  /* CTRL - L */
  624. .
  625. 647,657d
  626. 644a
  627.  
  628. .
  629. 620,643d
  630. 218,219c
  631.                             comment("Fighter landed on carrier at %d.",
  632.                                     obj->loc,0,
  633. .
  634. w
  635. e util.c
  636. 227a
  637. #if 1
  638.    {
  639.     /* how many items on freelist */
  640.     /* and how many objects in objectlist are untouched? */
  641.      piece_info_t *p;
  642.      long num_free, num_clean, i;
  643.  
  644.      num_free=0;
  645.      num_clean=0;
  646.      for (p = free_list; p != NULL; p = p->piece_link.next)
  647.          num_free++;
  648.  
  649.      for (i=0; i<=LIST_SIZE ;i++ ){
  650.        if (object[i].type == 0 &&
  651.            object[i].loc == 0 )
  652.          num_clean++;
  653.      }
  654.      printf("Objects: Free = %li , Untouched = %li, out of %i\n",
  655.             num_free, num_clean, LIST_SIZE);
  656.    }
  657. #endif  
  658. .
  659. 211a
  660. #else
  661.     abort();
  662.  
  663. #endif    
  664. .
  665. 208a
  666. #if 0
  667. .
  668. 74d
  669. 72d
  670. 15a
  671. #include <stdlib.h>
  672. .
  673. w
  674. q
  675. # can't pin this at top like I liked
  676. # June 20, 2018
  677. #! /bin/ed #the standard editor thx RMS! #/Users/daniel/src/vms-empire-1.7
  678. # naturally apply after unpacking
  679. # and nuking the Makefile is probably only useful to me
  680. # or possibly any using pkgsrc when in ->work/vms-empire-1.7 or similiar**?
  681. # after bmake
  682. # also console.term is a Terminal.app 100x37 TERM=rxvt, preferences=rxvt
  683. # which is
  684. # %g rxvt /Users/daniel/Library/Application\ Support/Terminal/color_console.term
  685. #                        <string>rxvt</string>
  686. # %#which isn't very useful , but I already know
  687. # if pedantically U cant tell what alias g=
  688. # is then please presume no warranty
Add Comment
Please, Sign In to add comment