Skip to content

Commit fba6244

Browse files
author
Conquer
committed
Conquer v4.08, from usenet
1 parent 251dbf8 commit fba6244

16 files changed

Lines changed: 189 additions & 102 deletions

admin.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ char **argv;
204204
printf(".\n");
205205
exit(FAIL);
206206
}
207-
#ifdef REMAKE
208207
remake=TRUE;
209-
#endif /*REMAKE*/
210208
printf("************* WARNING!!!! *******************\n\n");
211209
printf(" There is already a game in progress.\n\n");
212210
printf("*********************************************\n\n");
@@ -227,7 +225,7 @@ char **argv;
227225
}
228226
#else
229227
/* check for god permissions */
230-
if(realuser!=(getpwnam(LOGIN)->pw_uid)) {
228+
if(realuser!=(getpwnam(LOGIN))->pw_uid) {
231229
printf("Sorry -- you can not create a world\n");
232230
printf("you need to be logged in as %s.\n",LOGIN);
233231
exit(FAIL);

cexecute.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "data.h"
1616
extern long startgold;
1717
extern short country;
18-
extern FILE *fexe;
18+
extern FILE *fexe, *fnews;
1919
extern char fison[];
2020

2121
#ifdef CONQUER
@@ -161,6 +161,14 @@ int isupdate; /* 0 if not update, 1 if update */
161161
curntn->reputation = y;
162162
break;
163163
case NTAX: /* set nations tax rate */
164+
#ifdef ADMIN
165+
if (ispc(curntn->active) && !ispc(x)) {
166+
fprintf(fnews, "1.\tNation %s is now being run by the computer.\n", curntn->name);
167+
}
168+
if (ispc(x) && !ispc(curntn->active)) {
169+
fprintf(fnews, "1.\tNation %s is no longer being run by the computer.\n", curntn->name);
170+
}
171+
#endif /*ADMIN*/
164172
curntn->tax_rate = armynum;
165173
curntn->active = x;
166174
curntn->charity = y;

check.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#include <ctype.h>
55
#include <stdio.h>
6+
#ifndef FILELOCK
7+
#include <sys/types.h>
8+
#include <sys/stat.h>
9+
#endif
610
#include "header.h"
711
#include "data.h"
812

@@ -55,7 +59,7 @@ int __line__;
5559
__file__,__line__,country,i,a->xloc,a->yloc,a->sold);
5660
a->sold = 0;
5761
}
58-
if( a->stat == ONBOARD && a->smove > 0) {
62+
if( a->stat == ONBOARD && a->smove != 0) {
5963
/* don't echo since this is still getting */
6064
/* set some place someplace I can't find yet */
6165
a->smove = 0;

data.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ char *unittype[]= {
6262
"Knights", "Gryfins","Elephants","Zombies","Spy","Scout",
6363
"King","Baron","Emperor","Prince","Wizard","Mage",
6464
"Pope","Bishop","Admiral","Captain","Warlord","Lord",
65-
"Demon","Devil","Dragon","Wyrm","Shadow","Nazgul",
65+
"Demon","Devil","Dragyn","Wyrm","Shadow","Nazgul",
6666
"Spirit", "Assasin", "Efreet", "Gargoyl", "Wraith",
6767
"Hero", "Centaur", "Giant", "Suphero", "Mummy",
68-
"Elmentl", "Mintaur", "Demon", "Balrog", "Dragon"
68+
"Elmentl", "Mintaur", "Daemon", "Balrog", "Dragon"
6969
};
7070

7171
#ifdef CONQUER
@@ -80,7 +80,7 @@ char *shunittype[]= {
8080
"Demn","Devl","Drag","Wyrm","Shad","Nazg",
8181
"spir", "Assn", "efr", "Garg", "Wra",
8282
"Hero", "Cent", "gt", "Shro", "Mumm",
83-
"Elem", "mino", "dem", "Bal", "Drag"
83+
"Elem", "mino", "daem", "Bal", "Drgn"
8484
};
8585
#endif CONQUER
8686
int unitminsth[]= /* min strength of a unit */

display.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ get_display_for(x,y,dmode)
220220
break;
221221
case DI_DESI: /*designation*/
222222
if(sct[x+xoffset][y+yoffset].owner==0){
223-
if(tofood( &sct[x+xoffset][y+yoffset],sct[x+xoffset][y+yoffset].owner)!=0)
223+
if(tofood( &sct[x+xoffset][y+yoffset],country)!=0)
224224
ch=sct[x+xoffset][y+yoffset].altitude;
225225
else ch=sct[x+xoffset][y+yoffset].vegetation;
226226
}
@@ -408,11 +408,11 @@ highlight(x,y,hmode)
408408
void
409409
coffmap()
410410
{
411-
if((xcurs<=0)||(ycurs<=0)||(xcurs>=SCREEN_X_SIZE-1)
412-
||((ycurs>=SCREEN_Y_SIZE-1))||((XREAL)>=MAPX)
413-
||((YREAL)>=MAPY)) {
414-
centermap();
415-
redraw=PART;
411+
if( xcurs<0 || (XREAL!=0 && xcurs==0) || (ycurs<0) ||
412+
(YREAL!=0 && ycurs==0) || xcurs>=SCREEN_X_SIZE-1 ||
413+
ycurs>=SCREEN_Y_SIZE-1 || XREAL>=MAPX || YREAL>=MAPY) {
414+
centermap();
415+
redraw=PART;
416416
}
417417

418418
if(redraw!=DONE) {

extcmds.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,25 @@ int armynum, army2;
113113
{
114114
int nocomb_stat();
115115

116-
if (armynum < 0 || armynum >= MAXARM ||
117-
army2 < 0 || army2 >= MAXARM ||
118-
armynum == army2 ||
119-
(nocomb_stat(P_ASTAT) == TRUE) ||
116+
if (armynum < 0 || armynum >= MAXARM
117+
|| army2 < 0 || army2 >= MAXARM || P_ASOLD == 0
118+
|| curntn->arm[army2].sold == 0) {
119+
errormsg("Selected unit doesn't exist");
120+
return;
121+
}
122+
if (P_ASTAT != curntn->arm[army2].stat
123+
|| P_ATYPE != curntn->arm[army2].unittyp
124+
|| P_ATYPE >= MINLEADER
125+
|| P_ASTAT == ONBOARD || P_ASTAT == TRADED) {
126+
if ((nocomb_stat(P_ASTAT) == TRUE) ||
120127
(nocomb_stat(curntn->arm[army2].stat) == TRUE) ||
121128
curntn->arm[army2].stat == SIEGE || /* may not jump out */
122129
curntn->arm[army2].stat == SORTIE || /* of these statuses */
123130
P_ATYPE >= MINLEADER ||
124131
P_ATYPE!=curntn->arm[army2].unittyp) {
125132
errormsg("Selected armies not legal");
126133
return;
134+
}
127135
}
128136
if((curntn->arm[army2].xloc!=P_AXLOC)
129137
||(curntn->arm[army2].yloc!=P_AYLOC)) {
@@ -350,6 +358,10 @@ int armynum;
350358
errormsg("Your Zombies just don't seem inspired");
351359
return;
352360
}
361+
if(P_ASTAT==MARCH) {
362+
errormsg("Your troops must stop marching before they can be lead");
363+
return;
364+
}
353365
if(armynum<0 || armynum >= MAXARM || P_ASTAT==SCOUT ||
354366
P_ASTAT==TRADED || P_ASTAT==ONBOARD || P_ATYPE==A_MILITIA ){
355367
errormsg("Selected army not groupable");

forms.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,10 @@ change()
413413
mvprintw(5,0,"active is %d",curntn->active);
414414
mvprintw(6,0,"tax_rate...... %2d%%",curntn->tax_rate);
415415
mvprintw(7,0,"inflation..... %2d%%",curntn->inflation);
416-
i=10*curntn->tax_rate-curntn->popularity-curntn->terror-3*curntn->charity;
416+
i=(int)10*curntn->tax_rate-curntn->popularity-curntn->terror-3*curntn->charity;
417417
if( i<0 ) i=0;
418418
mvprintw(8,0,"peasant revolt %2d%%",(i*PREVOLT)/100);
419-
i=5*curntn->tax_rate - curntn->prestige;
419+
i=(int)5*curntn->tax_rate - curntn->prestige;
420420
if( i<0 ) i=0;
421421
mvprintw(9,0,"other revolt.. %2d%%",(i*PREVOLT)/100);
422422
standend();
@@ -441,7 +441,7 @@ change()
441441
temp = P_EATRATE;
442442
mvprintw(7,COLS/2-12, "eatrate.......%3.2f",temp);
443443
mvprintw(8,COLS/2-12, "wealth........ %3d",curntn->wealth);
444-
mvprintw(9,COLS/2-12,"charity....... %2d%%",curntn->charity);
444+
mvprintw(9,COLS/2-12, "charity....... %2d%%",curntn->charity);
445445
mvprintw(10,COLS/2-12,"communication.%3.2f",(float) P_NTNCOM);
446446
mvprintw(11,COLS/2-12,"reputation.... %3d",curntn->reputation);
447447
mvprintw(12,COLS/2-12,"spoilrate.....%3d%%",curntn->spoilrate);

main.c

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ parse(ch)
574574
case 'b': /*move south west*/
575575
pager=0;
576576
selector=0;
577-
xcurs--;
578-
ycurs++;
577+
if (XREAL > 0) xcurs--;
578+
if (YREAL < MAPY - 1) ycurs++;
579579
break;
580580
case 'B': /*budget*/
581581
redraw=FULL;
@@ -620,13 +620,14 @@ parse(ch)
620620
case 'H': /*scroll west*/
621621
pager=0;
622622
selector=0;
623-
xcurs-=((COLS-22)/4);
623+
if (XREAL > (COLS-22)/4) xcurs-=((COLS-22)/4);
624+
else xcurs = -xoffset;
624625
break;
625626
case '4':
626627
case 'h': /*move west*/
627628
pager=0;
628629
selector=0;
629-
xcurs--;
630+
if (XREAL > 0) xcurs--;
630631
break;
631632
case 'I': /*campaign information*/
632633
camp_info();
@@ -635,35 +636,39 @@ parse(ch)
635636
case 'J': /*scroll down*/
636637
pager=0;
637638
selector=0;
638-
ycurs+=((SCREEN_Y_SIZE)/2);
639+
if (YREAL + (SCREEN_Y_SIZE)/2 < MAPY)
640+
ycurs+=((SCREEN_Y_SIZE)/2);
641+
else ycurs = MAPY - yoffset - 1;
639642
break;
640643
case '2':
641644
case 'j': /*move down*/
642645
pager=0;
643646
selector=0;
644-
ycurs++;
647+
if (YREAL < MAPY - 1) ycurs++;
645648
break;
646649
case '8':
647650
case 'k': /*move up*/
648651
pager=0;
649652
selector=0;
650-
ycurs--;
653+
if (YREAL > 0) ycurs--;
651654
break;
652655
case 'K': /*scroll up*/
653656
pager=0;
654657
selector=0;
655-
ycurs-=((SCREEN_Y_SIZE)/2);
658+
if (YREAL > (SCREEN_Y_SIZE)/2) ycurs-=((SCREEN_Y_SIZE)/2);
659+
else ycurs = -yoffset;
656660
break;
657661
case '6':
658662
case 'l': /*move east*/
659663
pager=0;
660664
selector=0;
661-
xcurs++;
665+
if (XREAL < MAPX - 1) xcurs++;
662666
break;
663667
case 'L': /*scroll east*/
664668
pager=0;
665669
selector=0;
666-
xcurs+=((COLS-22)/4);
670+
if (XREAL + (COLS-22)/4 < MAPX) xcurs+=((COLS-22)/4);
671+
else xcurs = MAPX - xoffset - 1;
667672
break;
668673
case 'm': /*move selected item to new x,y */
669674
mymove();
@@ -680,8 +685,8 @@ parse(ch)
680685
case 'n': /*move south-east*/
681686
pager=0;
682687
selector=0;
683-
ycurs++;
684-
xcurs++;
688+
if (YREAL < MAPY - 1) ycurs++;
689+
if (XREAL < MAPX - 1) xcurs++;
685690
break;
686691
case 'N': /*read newspaper */
687692
redraw=PART;
@@ -762,14 +767,16 @@ parse(ch)
762767
case 'u': /*move north-east*/
763768
pager=0;
764769
selector=0;
765-
ycurs--;
766-
xcurs++;
770+
if (YREAL > 0) ycurs--;
771+
if (XREAL < MAPX - 1) xcurs++;
767772
break;
768773
case 'U': /* scroll north-east */
769774
pager=0;
770775
selector=0;
771-
xcurs+=((COLS-22)/4);
772-
ycurs-=((SCREEN_Y_SIZE)/2);
776+
if (XREAL + (COLS-22)/4 < MAPX) xcurs+=((COLS-22)/4);
777+
else xcurs = MAPX - xoffset - 1;
778+
if (YREAL > (SCREEN_Y_SIZE)/2) ycurs-=((SCREEN_Y_SIZE)/2);
779+
else ycurs = -yoffset;
773780
break;
774781
case 'v': /* version credits */
775782
credits();
@@ -801,14 +808,16 @@ parse(ch)
801808
case 'y': /*move north-west*/
802809
pager=0;
803810
selector=0;
804-
ycurs--;
805-
xcurs--;
811+
if (YREAL > 0) ycurs--;
812+
if (XREAL > 0) xcurs--;
806813
break;
807814
case 'Y': /* scroll north-west */
808815
pager=0;
809816
selector=0;
810-
xcurs-=((COLS-22)/4);
811-
ycurs-=((SCREEN_Y_SIZE)/2);
817+
if (XREAL < (COLS-22)/4) xcurs = -xoffset;
818+
else xcurs-=((COLS-22)/4);
819+
if (YREAL < (SCREEN_Y_SIZE)/2) ycurs = -yoffset;
820+
else ycurs-=((SCREEN_Y_SIZE)/2);
812821
break;
813822
case 'Z': /*move civilians up to 2 spaces*/
814823
moveciv();

newlogin.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ newlogin()
849849
break;
850850
}
851851
}
852-
check();
853852

854853
/* check for save */
855854
newmsg("Save this nation? [ny]");

notes.v4

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,37 @@
283283
227. misc.c[498]: fixed overflow on gold scoring [Kenneth J Dalka]
284284
228. adjusted inflation calculation in update.c and reports.c.
285285
229. added the inflation estimation to the budget report.
286-
230. fixed bug with division of charity by population. [Dave F.]
286+
230. fixed bug with division of charity by population. [Charles C. Fu]
287287
231. prevent passage of fleets through hostile cities.
288288
232. added some checks in npc.c for ownership in drafting in some sectors.
289289
233. removed destruction of troops on peaks, now that flight is possible.
290290
234. changed to min zero in attractiveness, now drift will no longer occur
291291
for sectors with "zero" attractiveness. [Dave F.]
292+
===4.0 patch number seven released => 4.7 ===============================
293+
235. update.c[1327]: "ispc(country)" => "ispc(curntn->active)"
294+
236. added a note to README and fixed credit in notes.v4 file.
295+
237. made sure npcs do not change scout status.
296+
238. fixed bug with include files in check.c. [J. Bayer]
297+
239. update.c[1073]: declare items as unsigned char [Rodney Orr]
298+
240. update.c[1541]: rewrote move_people() routine to avoid memory leak
299+
and to use only 5 / MAPX as much memory.
300+
241. adjusted casting in propuction screen for food consumption.
301+
242. trade.c: added check for unexpected end of file in trade [R. Orr]
302+
243. newlogin.c: removed the check() in the routine.
303+
244. added news notification during update if npc/pc mode is changed.
304+
245. removed useless ifdef REMAKE statement in admin.c.
305+
246. added check for edge of screen unnecessarily redrawing.
306+
247. added check for motion beyond edge of screen.
307+
248. added stoppage for going beyond map edges.
308+
249. checked for invalid reads of commerce file in trade.c.
309+
250. changed float casting back to longs at line 1052 of update.c.
310+
251. did the same for the calculations in function budget() of report.c.
311+
252. fixed display.c designation to show tofood(sctptr, country).
312+
253. made Dragyn the nation leader name and Dragon the monster name.
313+
254. restricted marching troops from being grouped. (could get into
314+
defend mode this way; even when they had marched too far).
315+
255. allow recombination of troops with same status and same type
316+
unless the type is TRADED or ON_BOARD.
292317

293318
-------------------------------------------------------------------------
294319
| 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V5 |

0 commit comments

Comments
 (0)