adb@cs.bu.edu (Adam Bryant) (03/04/90)
Here is the latest and hopefully last patch to conquer version 4. [But, hey, didn't I say that with patch number 8?] Anyway, don't have to much time to say much about it, but in summary: - this patch enhances god powers and fixes a number of errors in god routines. - this patch takes care of a number of bug fixes, most especially the grouped troops bug. - this patch fixes a number of bugs with the trading code thanks to Charles C. Fu. - I believe that this is a much cleaner version than any of the proceeding ones... and the feel seems a bit better as well. Enjoy, adam ----------------------------cut-here------------------------------------ *** opatchlevel.h Sat Mar 3 15:27:42 1990 --- patchlevel.h Sat Mar 3 15:27:52 1990 *************** *** 1 **** ! #define PATCHLEVEL 8 --- 1 ---- ! #define PATCHLEVEL 9 *** onotes.v4 Sat Mar 3 15:27:42 1990 --- notes.v4 Sat Mar 3 15:27:52 1990 *************** *** 314,319 **** --- 314,383 ---- defend mode this way; even when they had marched too far). 255. allow recombination of troops with same status and same type unless the type is TRADED or ON_BOARD. + ===4.0 patch number eight released => 4.8 =============================== + 256. made sure that minor leaders lived before becoming major leaders. + 257. fixed major bug on not resetting status of moved grouped unit. + 258. set a grouped movement to be equal to the movement of the leader. + 259. added missing return to commands.c (1341) [Paul Waterman] + 260. made sure only to ask for splitting warships when warships are there. + 261. no longer ask to split ships that are not in fleet. + 262. allow god to manipulate a fleet up for trade. + 263. fixed bug that -1 population may accidently be set by god. + 264. fixed bug that caused missetting of gold/jewel value by god. + 265. allow god to manipulate an army that is up for trade. + 266. added check to assure that navies do not carry invalid troops. + 267. added check for onboard armies to be sure they were actually on fleets. + 268. reformated the bottom of the display on the read message display. + 269. made sure that stones had the designation of '?' to allow them to work. + 270. increased reduction on movement in desert for DERVISH to avoid confusion. + 271. made sure that blank input would not be taken on redesignate owner. + 272. fiddled and diddled (sorry Johnny!) with the charity change check. + 273. fixed bug with providing movement to unmovable when having ROADS power. + 274. added ifdef's around srand declarations for ANSI compilers. [C. Fu] + 275. removed error message for people relocation. too common an occurance. + 276. allow naval battles along shore. [Charles C. Fu] + 277. prevent sailors or marines from retreating. [Charles C. Fu] + 278. redid the retreat code... made the test much simpler. + 279. slight adjustment to ONMAP macro [Charles C. Fu] + 280. keep random value of army sizes the same for when seen. [Charles C. Fu] + 281. keep random value of ship sizes the same when seen. [Charles C. Fu] + 282. keep random value of people in sector the same. [Charles C. Fu] + 283. do not allow navies to pass into impassible land [partial fix: C. Fu] + 284. make it harder to unload armies in enemy cities [Charles C. Fu] + 285. make it harder to load armies in enemy cities [Charles C. Fu] + 286. fixed mistype "P_ASOLD" => "P_ATYPE" npc.c [Charles C. Fu] + 287. check for division by zero with metals cost for troops + 288. make NPC pay metal for troops. [Charles C. Fu] + 289. have NPC nations adjust tax rates as appropriate. [Charles C. Fu] + 290. give rebel nations a tax rate of 10. [Charles C. Fu] + 291. extend view of tradeing list for long screens [Charles C. Fu] + 292. refresh() added to end of trade input routine [Charles C. Fu] + 293. do not process invalid country is takeback [Charles C. Fu] + 294. cause trade to fail for destroyed army or fleet. [Charles C. Fu] + 295. fixed mistype which prevented sale of land. [Charles C. Fu] + {Darn!, My sabotage was caught! :-) adam} + 296. fixed missetting of curntn which blocked ship trades [Charles C. Fu] + {Foiled Again! :-) Actually that code predated curntn use, so + we were bound to miss some in the conversion, adam} + 297. fixed bug with returning bids to losing nations [Charles C. Fu] + 298. let land trades fail during trade, not before [Charles C. Fu] (whatever) + 299. convert to doubles for calculation of treasury overflow. [C. Fu] + 300. relocated adjustment to MARCHer movment when changing statuses. + 301. added in a routine to give the items up for trade to a nation if + it captures a nations capitol. [David Soleno] + 302. fixed error messages generated by the orc takeover routine. + 303. made the rules file be read in from the default directory. + 304. made spell point gain for MONST powers additive. + 305. put a 25% cap on user defined charity. + 306. adjusted the combat routine to separate naval and army combat checks. + 307. added in a check to assure that combining overlarge fleets is checked. + 308. verified input checks in various locations in report.c. + 309. made god adjustment of ships to allow keeping of previous values on '\n'. + 310. gave god the ability to adjust army unit types. + 311. gave god the ability to adjust army move values. + 312. gave god the ability to adjust navy move values. + 313. fixed bug in reporting side during newspaper for naval battles. + 314. gave god the ability to adjust an army status. ------------------------------------------------------------------------- | 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V5 | *** oREADME Sat Mar 3 15:27:38 1990 --- README Sat Mar 3 15:27:53 1990 *************** *** 94,99 **** --- 94,106 ---- unreferenced symbol errors occur, try adding "-ltermcap" after the "-lcurses" line in the makefile. + Note2: With some versions of 'make' the SHELL environment variable is + read to determine under what shell jobs should be spawned. The + Makefile for conquer was written with '/bin/sh' in mind, so if + any "command not found" errors appear, doing a: + setenv SHELL /bin/sh + before typing 'make', might alleviate the problem. + ----------------------------------------------------------- V administration instructions ----------------------------------------------------------- *************** *** 109,115 **** -a add new player -x execute program -d DIR to use play different game - -p print a map -r SCENARIO read map while making a new world uses SCENARIO.ele, SCENARIO.veg, & SCENARIO.nat --- 116,121 ---- *** odata.h Sat Mar 3 15:27:39 1990 --- data.h Sat Mar 3 15:27:53 1990 *************** *** 581,587 **** /* magic macro: returns TRUE if the nation has that power*/ #define magic(NATION,POWER) ((ntn[NATION].powers&(POWER))!=0) ! #define ONMAP(x,y) (x>=0 && y>=0 && x<MAPX && y<MAPY) #ifndef HILIGHT #define standout() --- 581,587 ---- /* magic macro: returns TRUE if the nation has that power*/ #define magic(NATION,POWER) ((ntn[NATION].powers&(POWER))!=0) ! #define ONMAP(x,y) ((x)>=0 && (y)>=0 && (x)<MAPX && (y)<MAPY) #ifndef HILIGHT #define standout() *************** *** 610,616 **** #define check() checkout(__FILE__,__LINE__) #endif DEBUG ! #define GOLDTHRESH 10 /* min ratio of gold:jewels */ #define SALT "aa" /* seed for crypt() encryption */ --- 610,616 ---- #define check() checkout(__FILE__,__LINE__) #endif DEBUG ! #define GOLDTHRESH 10L /* min ratio of gold:jewels */ #define SALT "aa" /* seed for crypt() encryption */ *** oadmin.c Sat Mar 3 15:27:39 1990 --- admin.c Sat Mar 3 15:27:53 1990 *************** *** 53,59 **** --- 53,61 ---- int geteuid(), getuid(), setuid(), realuser, l; register int i,j; char *name; + #ifndef __STDC__ void srand(); + #endif int getopt(); long time(); /* mflag = make world, a=add player, x=execute, p=print */ *** oextcmds.c Sat Mar 3 15:27:40 1990 --- extcmds.c Sat Mar 3 15:27:54 1990 *************** *** 178,192 **** errormsg("Uh, sir. Aren't we doing that already?"); return; } - /* eliminate half starting movement if start out on march */ - if( P_ASTAT==MARCH && new_stat!=MARCH ) { - if(P_AMOVE<(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50){ - errormsg("That troop has gone too far to stop marching"); - return; - } - P_AMOVE-=(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50; - AADJMOV; - } if(new_stat == SCOUT) { if(( P_ATYPE != A_SCOUT )&&( P_ASOLD >= 25)) { errormsg("Need less than 25 men to scout"); --- 178,183 ---- *************** *** 232,237 **** --- 223,238 ---- errormsg("Sorry, but you can't rule in that sector"); return; } + } + + /* eliminate half starting movement if start out on march */ + if( P_ASTAT==MARCH && new_stat!=MARCH ) { + if(P_AMOVE<(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50){ + errormsg("That troop has gone too far to stop marching"); + return; + } + P_AMOVE-=(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50; + AADJMOV; } /* location dependent statuses make armies stay in place */ *** orandeven.c Sat Mar 3 15:27:43 1990 --- randeven.c Sat Mar 3 15:27:54 1990 *************** *** 207,212 **** --- 207,213 ---- ntn[new].powers= ntn[target].powers; ntn[new].tships= 0; ntn[new].tsctrs = split; + ntn[new].tax_rate = 10; /* first check first letter of name */ if( markok(toupper(ntn[new].name[0]),FALSE) ) *** ocexecute.c Sat Mar 3 15:27:39 1990 --- cexecute.c Sat Mar 3 15:27:55 1990 *************** *** 197,203 **** back into your capitol */ if((sct[x][y].owner!=country)&&(country!=0)) { sct[curntn->capx][curntn->capy].people+=armynum; - fprintf(stderr,"ERROR: <%s> told to put %d civilians in sector %d,%d not owned - placed in capitol\n",curntn->name,armynum,x,y); break; } sct[x][y].people=armynum; --- 197,202 ---- *************** *** 206,212 **** /* if you dont own it, put people in your capitol */ if((sct[x][y].owner!=country)&&(country!=0)) { sct[curntn->capx][curntn->capy].people+=armynum; - fprintf(stderr,"SACIV3: <%s> told to put %d civilians in sector %d,%d not owned - placed in capitol\n",curntn->name,armynum,x,y); } else { --- 205,210 ---- *************** *** 258,264 **** case DESTRY: sct[ntn[armynum].capx][ntn[armynum].capy].owner=savectry; country=armynum; ! destroy(country); country=savectry; break; case CHG_MGK: --- 256,262 ---- case DESTRY: sct[ntn[armynum].capx][ntn[armynum].capy].owner=savectry; country=armynum; ! if (isupdate) destroy(country); country=savectry; break; case CHG_MGK: *** oforms.c Sat Mar 3 15:27:40 1990 --- forms.c Sat Mar 3 15:27:55 1990 *************** *** 579,595 **** intval = get_number(); if (intval < 0) { break; ! } else if( intval > 100 ) errormsg("ERROR - invalid charity rate"); /* this will protect from both underflow and overflow */ ! else if((int)curntn->popularity + 2*(intval - (int)curntn->charity)>100) ! errormsg("ERROR - you may not increase charity that much"); ! else if((int)curntn->popularity + 2*(intval - (int)curntn->charity)<0) ! errormsg("ERROR - you may not decrease charity that much"); ! else { ! curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity); ! curntn->charity = intval; ! NADJNTN; } break; case '5': /* terror */ --- 579,607 ---- intval = get_number(); if (intval < 0) { break; ! } else if( intval > 100 ) { errormsg("ERROR - invalid charity rate"); + } else if (intval > 25) { + errormsg("You are kidding, right?"); /* this will protect from both underflow and overflow */ ! } else if(intval > curntn->charity) { ! if (2 * (intval - (int)curntn->charity) + (int) curntn->popularity > 100) { ! errormsg("ERROR - you may not increase charity that much"); ! } else { ! curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity); ! curntn->charity = intval; ! NADJNTN; ! NADJNTN2; ! } ! } else { ! if (2 * (intval - (int)curntn->charity) < - (int) curntn->popularity) { ! errormsg("ERROR - you may not decrease charity that much"); ! } else { ! curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity); ! curntn->charity = intval; ! NADJNTN; ! NADJNTN2; ! } } break; case '5': /* terror */ *** omisc.c Sat Mar 3 15:27:41 1990 --- misc.c Sat Mar 3 15:27:55 1990 *************** *** 886,891 **** --- 886,894 ---- /* advertise */ fprintf(fnews,"1.\tCapitol of %s sacked by %s\n",ntn[cntry].name,ntn[nation].name); + /* Remove goods from trade board */ + fixtrade(cntry); + /* first give all prizes to the conquerer */ if(curntn->tgold > 0) { /* all gold */ ntn[nation].tgold += curntn->tgold; *************** *** 1088,1096 **** } /* switch */ } /* for */ ! if((magic(cntry,DERVISH)==1) ||(magic(cntry,DESTROYER)==1)) { ! veg_cost[ ICE ] = 1; ! veg_cost[ DESERT ] = 1; } for( j = 0; ele[j] != '0'; j++ ) { --- 1091,1099 ---- } /* switch */ } /* for */ ! if(magic(cntry,DERVISH) || magic(cntry,DESTROYER)) { ! veg_cost[ ICE ] = 0; ! veg_cost[ DESERT ] = 0; } for( j = 0; ele[j] != '0'; j++ ) { *** oreports.c Sat Mar 3 15:27:43 1990 --- reports.c Sat Mar 3 15:27:55 1990 *************** *** 143,149 **** continue; } #ifdef TRADE ! if(P_ASTAT==TRADED) { errormsg("May not change traded army"); continue; } --- 143,149 ---- continue; } #ifdef TRADE ! if(isgod==FALSE && P_ASTAT==TRADED) { errormsg("May not change traded army"); continue; } *************** *** 154,160 **** ypos++; clrtoeol(); #ifdef OGOD ! if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS: 6) LOCATION 7) SOLDIERS"); clrtoeol(); #endif OGOD ypos++; --- 154,160 ---- ypos++; clrtoeol(); #ifdef OGOD ! if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS: 6) LOCATION 7) SOLDIERS 8) MOVE 9) UNITTYPE 0) STATUS "); clrtoeol(); #endif OGOD ypos++; *************** *** 272,283 **** mvaddstr(ypos++,0,"What is the New Total Soldiers: "); refresh(); men = get_number(); ! if (men>0) { P_ASOLD=men; AADJMEN; } } break; #endif OGOD default: errormsg("Invalid Input"); --- 272,328 ---- mvaddstr(ypos++,0,"What is the New Total Soldiers: "); refresh(); men = get_number(); ! if (men>=0) { P_ASOLD=men; AADJMEN; } } break; + case '8': + if (isgod == TRUE) { + mvaddstr(ypos, 0, "What is the new movement value?"); + refresh(); + men = get_number(); + + if (men >=0 && men <= 100) { + P_AMOVE = men; + } + } + break; + case '9': + if (isgod == TRUE) { + mvaddstr(ypos++, 0, "Change unit type; Normal 0-26, Leader 27-44, Monster 45-59"); + mvaddstr(ypos++, 0, "[MajorHackEH?] New Type is? "); + refresh(); + men = get_number(); + + if (men < 0 || men > MAXMONSTER) break; + if (men > 44) men += TWOUTYPE; + else if (men > NOUNITTYPES) men += UTYPE; + + P_ATYPE = men; + } + break; + case '0': + if (isgod == TRUE) { + mvprintw(ypos++, 0, "1) Mar 2) Sct 3) Garr 4) Trade 5) Mil 6) Fly 7) Def 8) MDef 9) Att 10) MAtt"); + mvprintw(ypos++, 0, "11) Genrl 12) Sort 13) Sieg 14) Sgd 15) Onb 16) Rule 17+) Group (leader-=17)"); + mvaddstr(ypos++, 0, "Set what status? "); + refresh(); + men = get_number(); + + if (men < 0 || men > NUMSTATUS+MAXARM) + break; + if (men >= NUMSTATUS) { + i = curntn->arm[men-NUMSTATUS].unittyp; + if (i < MINLEADER || i >= MINMONSTER) { + errormsg("There is no such leader to group under"); + break; + } + } + P_ASTAT = men; + } + break; #endif OGOD default: errormsg("Invalid Input"); *************** *** 585,593 **** clrtoeol(); refresh(); nvynum = get_number(); ! if(nvynum<0) break; #ifdef TRADE ! if (curntn->nvy[nvynum].commodity==TRADED) { errormsg("Sorry - That Navy is up for trade"); continue; } --- 630,638 ---- clrtoeol(); refresh(); nvynum = get_number(); ! if(nvynum<0) continue; #ifdef TRADE ! if (isgod == FALSE && curntn->nvy[nvynum].commodity==TRADED) { errormsg("Sorry - That Navy is up for trade"); continue; } *************** *** 599,605 **** mvaddstr(ypos++,0,"OPTIONS: 1) TRANSFER / MERGE, 2) SPLIT NAVY, 3) DISBAND NAVY"); clrtoeol(); #ifdef OGOD ! if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS: 4) ADJUST SHIPS, 5) LOCATION, 6) CREW"); ypos++; clrtoeol(); #endif OGOD --- 644,650 ---- mvaddstr(ypos++,0,"OPTIONS: 1) TRANSFER / MERGE, 2) SPLIT NAVY, 3) DISBAND NAVY"); clrtoeol(); #ifdef OGOD ! if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS: 4) ADJUST SHIPS, 5) LOCATION, 6) CREW 7) MOVE"); ypos++; clrtoeol(); #endif OGOD *************** *** 630,635 **** --- 675,699 ---- errormsg("Sorry -- One of the two Armies must be unloaded"); } else if((newx==P_NXLOC)&&(newy==P_NYLOC)) { + /* first check sizes */ + for(i=N_LIGHT;i<=N_HEAVY;i++) { + if (P_NGAL(i) + SHIPS(curntn->nvy[newnavy].galleys,i) > N_MASK) { + i = (-1); + break; + } + if (P_NMER(i) + SHIPS(curntn->nvy[newnavy].merchant,i) > N_MASK) { + i = (-1); + break; + } + if (P_NWAR(i) + SHIPS(curntn->nvy[newnavy].warships,i) > N_MASK) { + i = (-1); + break; + } + } + if (i == (-1)) { + errormsg("That would cause you to have too many ships of one type"); + break; + } crew = flthold(nvynum)*P_NCREW; people = fltmhold(nvynum)*P_NPEOP; crew += flthold(newnavy)*curntn->nvy[newnavy].crew; *************** *** 691,699 **** curntn->nvy[navy].people=P_NPEOP; curntn->nvy[navy].smove=P_NMOVE; mvaddstr(LINES-2,0,"Do you wish to separate warships from remainder of fleet?"); refresh(); ! if(getch()=='y') { curntn->nvy[navy].warships=P_NWSHP; P_NWSHP=0; NADJWAR; --- 755,764 ---- curntn->nvy[navy].people=P_NPEOP; curntn->nvy[navy].smove=P_NMOVE; + if (P_NWSHP != 0) mvaddstr(LINES-2,0,"Do you wish to separate warships from remainder of fleet?"); refresh(); ! if(P_NWSHP!=0 && getch()=='y') { curntn->nvy[navy].warships=P_NWSHP; P_NWSHP=0; NADJWAR; *************** *** 715,720 **** --- 780,786 ---- break; } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { + if (P_NWAR(shipsize) == 0) continue; mvprintw(ypos,0,"How Many %s Warships To Split?",fltstr[shipsize]); clrtoeol(); refresh(); *************** *** 724,729 **** --- 790,796 ---- (void) addwships(navy,shipsize,newnavy); } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { + if (P_NMER(shipsize) == 0) continue; mvprintw(ypos,0,"How Many %s Merchants To Split?",fltstr[shipsize]); clrtoeol(); refresh(); *************** *** 733,738 **** --- 800,806 ---- (void) addmships(navy,shipsize,newnavy); } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { + if (P_NGAL(shipsize) == 0) continue; mvprintw(ypos,0,"How Many %s Galleys To Split?",fltstr[shipsize]); clrtoeol(); refresh(); *************** *** 791,822 **** case '4': if (isgod==TRUE) { /* ADJUST SHIPS */ - P_NWSHP=0; - P_NMSHP=0; - P_NGSHP=0; for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Warships?",fltstr[shipsize]); clrtoeol(); refresh(); newnavy = get_number(); ! if(newnavy>N_MASK||newnavy<0) newnavy=0; ! (void) NADD_WAR(newnavy); } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Merchants?",fltstr[shipsize]); clrtoeol(); refresh(); newnavy = get_number(); ! if(newnavy>N_MASK||newnavy<0) newnavy=0; ! (void) NADD_MER(newnavy); } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Galleys?",fltstr[shipsize]); clrtoeol(); refresh(); newnavy = get_number(); ! if(newnavy>N_MASK||newnavy<0) newnavy=0; ! (void) NADD_GAL(newnavy); } NADJWAR; NADJMER; --- 859,908 ---- case '4': if (isgod==TRUE) { /* ADJUST SHIPS */ for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Warships? [%d] ", ! fltstr[shipsize],P_NWAR(shipsize)); clrtoeol(); refresh(); newnavy = get_number(); ! if (newnavy < 0 || newnavy > N_MASK) continue; ! newnavy -= P_NWAR(shipsize); ! if (newnavy > 0) { ! (void) NADD_WAR(newnavy); ! } else if (newnavy < 0) { ! newnavy = -newnavy; ! (void) NSUB_WAR(newnavy); ! } } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Merchants? [%d] ", ! fltstr[shipsize], P_NMER(shipsize)); clrtoeol(); refresh(); newnavy = get_number(); ! if(newnavy>N_MASK||newnavy<0) continue; ! newnavy -= P_NMER(shipsize); ! if (newnavy > 0) { ! (void) NADD_MER(newnavy); ! } else if (newnavy < 0) { ! newnavy = -newnavy; ! (void) NSUB_MER(newnavy); ! } } for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) { ! mvprintw(ypos,0,"How Many %s Galleys? [%d]", ! fltstr[shipsize], P_NGAL(shipsize)); clrtoeol(); refresh(); newnavy = get_number(); ! if(newnavy>N_MASK||newnavy<0) continue; ! newnavy -= P_NGAL(shipsize); ! if (newnavy > 0) { ! (void) NADD_GAL(newnavy); ! } else if (newnavy < 0) { ! newnavy = -newnavy; ! (void) NSUB_GAL(newnavy); ! } } NADJWAR; NADJMER; *************** *** 850,855 **** --- 936,951 ---- if (crew>=0 && crew<=SHIPCREW) { P_NCREW = crew; NADJCRW; + } + } + break; + case '7': + if (isgod == TRUE) { + mvaddstr(ypos, 0, "Set what move value? "); + refresh(); + newnavy = get_number(); + if (newnavy <= 100 && newnavy >= 0) { + P_NMOVE = newnavy; } } break; *** ocombat.c Sat Mar 3 15:27:39 1990 --- combat.c Sat Mar 3 15:27:56 1990 *************** *** 37,42 **** --- 37,47 ---- int dnation; /*one nation defending in this fight*/ int count=0; /*number of armies or navies in sector*/ + /* indicators of naval or army combat */ + #define COMBAT_X 0 + #define COMBAT_A 1 + #define COMBAT_N 2 + /************************************************************************/ /* COMBAT() run all combat on the map */ /* for each sector, determine if armies in with attack mode */ *************** *** 45,51 **** combat() { register int i,j; ! char **fought; /* TRUE if already fought in sctr */ int temp,ctry; int initialized=FALSE; /* TRUE if arrays initialized */ short armynum,nvynum; --- 50,56 ---- combat() { register int i,j; ! char **fought; /* SET: if already fought in sctr */ int temp,ctry; int initialized=FALSE; /* TRUE if arrays initialized */ short armynum,nvynum; *************** *** 60,66 **** /*for each nation, if in attack mode run a check*/ /* no sectors have been fought in yet */ ! for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) fought[i][j]=FALSE; for(ctry=NTOTAL-1;ctry>0;ctry--) if(isactive(ntn[ctry].active)) { --- 65,71 ---- /*for each nation, if in attack mode run a check*/ /* no sectors have been fought in yet */ ! for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) fought[i][j]=COMBAT_X; for(ctry=NTOTAL-1;ctry>0;ctry--) if(isactive(ntn[ctry].active)) { *************** *** 72,83 **** if((aptr->sold>0) &&(aptr->stat>=ATTACK) &&(aptr->stat<=SORTIE||aptr->stat>=NUMSTATUS) ! &&(!fought[aptr->xloc][aptr->yloc])){ /* someone can initiate combat in xspot,yspot */ xspot=aptr->xloc; yspot=aptr->yloc; ! fought[xspot][yspot]=TRUE; /*initialize matrix*/ if( !initialized ) { --- 77,88 ---- if((aptr->sold>0) &&(aptr->stat>=ATTACK) &&(aptr->stat<=SORTIE||aptr->stat>=NUMSTATUS) ! &&(!(fought[aptr->xloc][aptr->yloc]&COMBAT_A))){ /* someone can initiate combat in xspot,yspot */ xspot=aptr->xloc; yspot=aptr->yloc; ! fought[xspot][yspot]|=COMBAT_A; /*initialize matrix*/ if( !initialized ) { *************** *** 131,142 **** /*navy combat*/ for(j=0;j<MAXNAVY;j++) if((nptr->nvy[j].warships!=0) ! &&(fought[nptr->nvy[j].xloc][nptr->nvy[j].yloc]==0) ! &&(sct[nptr->nvy[j].xloc][nptr->nvy[j].yloc].altitude==WATER)){ xspot=nptr->nvy[j].xloc; yspot=nptr->nvy[j].yloc; ! fought[xspot][yspot]=1; /*initialize matrix*/ if( !initialized ){ --- 136,146 ---- /*navy combat*/ for(j=0;j<MAXNAVY;j++) if((nptr->nvy[j].warships!=0) ! &&(!(fought[nptr->nvy[j].xloc][nptr->nvy[j].yloc]&COMBAT_N))) { xspot=nptr->nvy[j].xloc; yspot=nptr->nvy[j].yloc; ! fought[xspot][yspot]|=COMBAT_N; /*initialize matrix*/ if( !initialized ){ *************** *** 156,166 **** if(isactive(ntn[country].active)) for(nvynum=0;nvynum<MAXNAVY;nvynum++) if((NWSHP+NMSHP+NGSHP!=0) ! &&(abs(NXLOC-xspot)<=2) ! &&(abs(NYLOC-yspot)<=2) ! &&(sct[NXLOC][NYLOC].altitude==WATER) &&(count<MGKNUM)) { ! fought[NXLOC][NYLOC]=1; if((country!=ctry) &&(nptr->dstatus[country]>HOSTILE)){ valid=TRUE; --- 160,171 ---- if(isactive(ntn[country].active)) for(nvynum=0;nvynum<MAXNAVY;nvynum++) if((NWSHP+NMSHP+NGSHP!=0) ! &&(((NXLOC==xspot) && (NYLOC==yspot)) || ! (sct[NXLOC][NYLOC].altitude==WATER ! &&(abs(NXLOC-xspot)<=2) ! &&(abs(NYLOC-yspot)<=2))) &&(count<MGKNUM)) { ! fought[NXLOC][NYLOC]|=COMBAT_N; if((country!=ctry) &&(nptr->dstatus[country]>HOSTILE)){ valid=TRUE; *************** *** 804,817 **** for(cnum=0;cnum<count;cnum++) if(owner[cnum]>(-1)){ if( unitnum != (-1) ) cnum=unitnum; ! if((side[cnum]==ATKR)&&(retreatside==ATKR)){ ! ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx; ! ntn[owner[cnum]].arm[unit[cnum]].yloc = retreaty; } - else if((side[cnum]==DFND)&&(retreatside==DFND)){ - ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx; - ntn[owner[cnum]].arm[unit[cnum]].yloc = retreaty; - } if( unitnum != (-1) ) return; } } --- 809,824 ---- for(cnum=0;cnum<count;cnum++) if(owner[cnum]>(-1)){ if( unitnum != (-1) ) cnum=unitnum; ! if(side[cnum] == retreatside){ ! if ((ntn[owner[cnum]].arm[unit[cnum]].unittyp==A_MARINES)|| ! (ntn[owner[cnum]].arm[unit[cnum]].unittyp==A_SAILOR)){ ! ntn[owner[cnum]].arm[unit[cnum]].sold *= 85; ! ntn[owner[cnum]].arm[unit[cnum]].sold /= 100; ! } else { ! ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx; ! ntn[owner[cnum]].arm[unit[cnum]].yloc = retreaty; ! } } if( unitnum != (-1) ) return; } } *************** *** 868,875 **** * galley crew 2 * merchant crew 4 * soldiers onboard: ! * SAILOR/ARCHER 3/4 ! * MARINE 1/3 * others 4/3 */ for(j=0;j<count;j++) if(owner[j]!=(-1)){ --- 875,882 ---- * galley crew 2 * merchant crew 4 * soldiers onboard: ! * SAILOR/ARCHER 3/4 ! * MARINE 1/3 * others 4/3 */ for(j=0;j<count;j++) if(owner[j]!=(-1)){ *************** *** 959,967 **** /* calculate capture percentages */ /* * This formula produces: ! * 0% capture for 1:100 odds * 2% capture for 1:10 odds ! * 15% capture for 1:1 odds * 60% capture for 10:1 odds * 100% capture for >60:1 odds * with linear progression between each. --- 966,974 ---- /* calculate capture percentages */ /* * This formula produces: ! * 0% capture for 1:100 odds * 2% capture for 1:10 odds ! * 15% capture for 1:1 odds * 60% capture for 10:1 odds * 100% capture for >60:1 odds * with linear progression between each. *************** *** 1240,1249 **** k=0; for(i=0;i<j;i++) if(owner[j]==owner[i]) k=1; if(k==0) { ! if(side[i]==DFND) fprintf(fnews,", attacker %s",ntn[owner[j]].name); ! else if(side[i]==ATKR) fprintf(fnews,", defender %s",ntn[owner[j]].name); } } fprintf(fnews,"\n"); --- 1247,1257 ---- k=0; for(i=0;i<j;i++) if(owner[j]==owner[i]) k=1; if(k==0) { ! if(side[j]==ATKR) fprintf(fnews,", attacker %s",ntn[owner[j]].name); ! else if(side[j]==DFND) fprintf(fnews,", defender %s",ntn[owner[j]].name); + else fprintf(fnews,", neutral %s",ntn[owner[j]].name); } } fprintf(fnews,"\n"); *** omove.c Sat Mar 3 15:27:41 1990 --- move.c Sat Mar 3 15:27:56 1990 *************** *** 63,68 **** --- 63,72 ---- } else { /*army*/ mvprintw(LINES-4,0,"ARMY %d: ",armynum); clrtoeol(); + if (P_ASTAT>=NUMSTATUS) { + groupmen = P_ASTAT - NUMSTATUS; + P_AMOVE = curntn->arm[groupmen].smove; + } if(P_AMOVE==0){ errormsg("That Unit is Not Able to Move"); redraw=DONE; *************** *** 74,81 **** if(P_ASTAT>=NUMSTATUS) { mvprintw(LINES-4,10,"Member of Army Group %d!! Continue? ",P_ASTAT-NUMSTATUS); refresh(); ! if( getch() == 'y' ) P_ASTAT=ATTACK; ! else { redraw=DONE; armornvy=AORN; return; --- 78,87 ---- if(P_ASTAT>=NUMSTATUS) { mvprintw(LINES-4,10,"Member of Army Group %d!! Continue? ",P_ASTAT-NUMSTATUS); refresh(); ! if( getch() == 'y' ) { ! P_ASTAT=ATTACK; ! AADJSTAT; ! } else { redraw=DONE; armornvy=AORN; return; *************** *** 261,267 **** valid=FALSE; xcurs=oldxcurs; ycurs=oldycurs; ! } else if(movecost[XREAL][YREAL] >= 0){ /* LAND OF SOME TYPE */ valid=FALSE; /* check for nearby water */ --- 267,274 ---- valid=FALSE; xcurs=oldxcurs; ycurs=oldycurs; ! } else if(movecost[XREAL][YREAL] >= 0 ! || movecost[XREAL][YREAL] == -2){ /* LAND OF SOME TYPE */ valid=FALSE; /* check for nearby water */ *** oupdate.c Sat Mar 3 15:27:45 1990 --- update.c Sat Mar 3 15:27:59 1990 *************** *** 27,32 **** --- 27,42 ---- int **attr; /* sector attractiveness */ long **newpop; /* storage for old population */ + long + dtol(d) double d; + { + char tempstr[BIGLTH]; + long l; + sprintf(tempstr,"%-60.0lf",d); + sscanf(tempstr,"%ld",&l); + return(l); + } + /****************************************************************/ /* UPDATE() - updates the whole world */ /****************************************************************/ *************** *** 625,631 **** if(rand()%100 < 30) { /* new leader takes over */ x++; for(armynum=0;armynum<MAXARM;armynum++) ! if(P_ATYPE == x) break; if( armynum<MAXARM) { P_ATYPE=x-1; P_ASOLD= *(unitminsth+(x-1)%UTYPE); --- 635,641 ---- if(rand()%100 < 30) { /* new leader takes over */ x++; for(armynum=0;armynum<MAXARM;armynum++) ! if(P_ATYPE == x && P_ASOLD > 0) break; if( armynum<MAXARM) { P_ATYPE=x-1; P_ASOLD= *(unitminsth+(x-1)%UTYPE); *************** *** 699,706 **** ntn[country].spellpts+=3; } if(magic(country,MA_MONST)==TRUE) ntn[country].spellpts+=2; ! else if(magic(country,AV_MONST)==TRUE) ntn[country].spellpts+=1; ! else if((magic(country,MI_MONST)==TRUE) &&( rand()%2==0)) ntn[country].spellpts+=1; } free(attr); --- 709,716 ---- ntn[country].spellpts+=3; } if(magic(country,MA_MONST)==TRUE) ntn[country].spellpts+=2; ! if(magic(country,AV_MONST)==TRUE) ntn[country].spellpts+=1; ! if((magic(country,MI_MONST)==TRUE) &&( rand()%2==0)) ntn[country].spellpts+=1; } free(attr); *************** *** 1212,1221 **** &&( A->stat<NUMSTATUS )) A->stat=FLIGHT; ! if((magic(country,ROADS)==1) &&(sct[AX][AY].owner!=country)){ if(A->smove>7) A->smove-=4; ! else A->smove=4; } if((magic(country,SAPPER)==1) --- 1222,1231 ---- &&( A->stat<NUMSTATUS )) A->stat=FLIGHT; ! if((magic(country,ROADS)==TRUE) &&(sct[AX][AY].owner!=country)){ if(A->smove>7) A->smove-=4; ! else if (A->smove>4) A->smove=4; } if((magic(country,SAPPER)==1) *************** *** 1411,1417 **** tempflt = (float) curntn->tfood * (100-curntn->spoilrate); curntn->tfood = (long) (tempflt / 100.0); ! if(curntn->tgold > GOLDTHRESH*curntn->jewels){ /* buy jewels off commodities board */ xx=curntn->tgold-GOLDTHRESH*curntn->jewels; if (ispc(curntn->active)) { --- 1421,1427 ---- tempflt = (float) curntn->tfood * (100-curntn->spoilrate); curntn->tfood = (long) (tempflt / 100.0); ! if((0.0+curntn->tgold) - GOLDTHRESH*(0.0+curntn->jewels) > 0.0){ /* buy jewels off commodities board */ xx=curntn->tgold-GOLDTHRESH*curntn->jewels; if (ispc(curntn->active)) { *************** *** 1419,1429 **** fprintf(fm,"Message from Conquer\n\n"); fprintf(fm,"Gold imbalance forced your treasury to purchase\n"); fprintf(fm,"%ld jewels for %ld gold talons to compensate.\n", ! xx/GODPRICE*GODJEWL,xx); mailclose(country); } } ! curntn->jewels += (xx/GODPRICE*GODJEWL); curntn->tgold -= xx; } --- 1429,1440 ---- fprintf(fm,"Message from Conquer\n\n"); fprintf(fm,"Gold imbalance forced your treasury to purchase\n"); fprintf(fm,"%ld jewels for %ld gold talons to compensate.\n", ! dtol((double)xx*GODJEWL/GODPRICE) ! ,xx); mailclose(country); } } ! curntn->jewels += dtol((double)xx*GODJEWL/GODPRICE); curntn->tgold -= xx; } *** ocommands.c Sat Mar 3 15:27:39 1990 --- commands.c Sat Mar 3 15:28:00 1990 *************** *** 189,195 **** mvaddstr(LINES-3,7,"What nation owner:"); refresh(); x = get_country(); ! if (x<NTOTAL) sptr->owner=x; reset_god(); return; case 'p': --- 189,195 ---- mvaddstr(LINES-3,7,"What nation owner:"); refresh(); x = get_country(); ! if (x>0 && x<NTOTAL) sptr->owner=x; reset_god(); return; case 'p': *************** *** 200,206 **** } mvaddstr(LINES-3,7,"new population for sector: "); refresh(); ! sptr->people = (long) get_number(); reset_god(); return; case 't': --- 200,208 ---- } mvaddstr(LINES-3,7,"new population for sector: "); refresh(); ! metal = get_number(); ! if (metal <= (-1)) return; ! sptr->people = metal; reset_god(); return; case 't': *************** *** 222,228 **** mvaddstr(LINES-1,7,"new sector value: "); refresh(); x = get_number(); ! if(x<100 && x>=0) if(y>END_MINE) { sptr->jewels = (char)x; sptr->metal = 0; --- 224,230 ---- mvaddstr(LINES-1,7,"new sector value: "); refresh(); x = get_number(); ! if(x<100 && x>0) { if(y>END_MINE) { sptr->jewels = (char)x; sptr->metal = 0; *************** *** 230,235 **** --- 232,241 ---- sptr->metal = (char)x; sptr->jewels = 0; } + } else { + sptr->jewels = 0; + sptr->metal = 0; + } } else { sptr->jewels=0; sptr->metal=0; *************** *** 1119,1126 **** if(strncmp(line,"END",3)==0) contd=TRUE; } standout(); ! mvaddstr(LINES-3,(COLS/2)-22,"HIT ANY KEY TO CONTINUE"); ! mvaddstr(LINES-2,(COLS/2)-22,"HIT RETURN TO DELETE MESSAGE"); standend(); refresh(); inpch=getch(); --- 1125,1132 ---- if(strncmp(line,"END",3)==0) contd=TRUE; } standout(); ! mvaddstr(LINES-3,(COLS/2)-13,"HIT ANY KEY TO CONTINUE"); ! mvaddstr(LINES-2,(COLS/2)-16,"HIT RETURN TO DELETE MESSAGE"); standend(); refresh(); inpch=getch(); *** odata.c Sat Mar 3 15:27:39 1990 --- data.c Sat Mar 3 15:28:01 1990 *************** *** 93,99 **** 100,50,100,50,250,125, 250,50,500,100,250,125, 50, 50, 50, 75, 75, ! 100, 50, 150, 150, 150, 175, 150, 500, 500, 1000 }; --- 93,99 ---- 100,50,100,50,250,125, 250,50,500,100,250,125, 50, 50, 50, 75, 75, ! 75, 50, 150, 150, 150, 175, 150, 500, 500, 1000 }; *************** *** 262,268 **** /* 0 0 0 0 0 0 */ /* a value of x means any designation is possible */ /* fwbcwmhpgcfshfrwdpbcpstgponpmldpllpiopshmtpbcltismasspdsgridp*/ ! char *tg_stype="xffffttttffffffffffftxlxllttuuctcccfffxxtccmmmmmmmm$$$$$$$$$$0"; char *tg_value="13335157911433442331131135734567789123937571111111111111111110"; char *tg_name[] = { --- 262,268 ---- /* 0 0 0 0 0 0 */ /* a value of x means any designation is possible */ /* fwbcwmhpgcfshfrwdpbcpstgponpmldpllpiopshmtpbcltismasspdsgridp*/ ! char *tg_stype="xffffttttffffffffffftxlxllttuuctcccfff?xtccmmmmmmmm$$$$$$$$$$0"; char *tg_value="13335157911433442331131135734567789123937571111111111111111110"; char *tg_name[] = { *** omagic.c Sat Mar 3 15:27:40 1990 --- magic.c Sat Mar 3 15:28:01 1990 *************** *** 628,636 **** } } else { if (ntn[i].race==ORC) ! mvaddstr((*count)++,0," Wrong Race"); ! else mvaddstr((*count)++,0," That Nation is Outside Your Influence"); } } return(done); } --- 628,638 ---- } } else { if (ntn[i].race==ORC) ! mvaddstr((*count)++,0," That Nation is Outside Your Influence"); ! else mvaddstr((*count)++,0," Wrong Race"); } + refresh(); + sleep(2); } return(done); } *** omain.c Sat Mar 3 15:27:41 1990 --- main.c Sat Mar 3 15:28:02 1990 *************** *** 61,67 **** int geteuid(), getuid(), setuid(); register int i,j; char name[NAMELTH+1],filename[FILELTH]; ! void srand(),init_hasseen(),mapprep(); int getopt(); char passwd[PASSLTH+1]; long time(); --- 61,70 ---- int geteuid(), getuid(), setuid(); register int i,j; char name[NAMELTH+1],filename[FILELTH]; ! #ifdef __STDC__ ! void srand(); ! #endif ! void init_hasseen(),mapprep(); int getopt(); char passwd[PASSLTH+1]; long time(); *************** *** 1119,1125 **** mvprintw(nfound2*2+count,COLS-20,"%s: %d men ",ntn[i].name,enemy); else if(magic(i,THE_VOID)==TRUE) mvprintw(nfound2*2+count,COLS-20,"%s: ?? men ",ntn[i].name); ! else mvprintw(nfound2*2+count,COLS-20,"%s: %ld men ",ntn[i].name,(enemy*(rand()%60+70)/100)); count++; } enemy=0; --- 1122,1132 ---- mvprintw(nfound2*2+count,COLS-20,"%s: %d men ",ntn[i].name,enemy); else if(magic(i,THE_VOID)==TRUE) mvprintw(nfound2*2+count,COLS-20,"%s: ?? men ",ntn[i].name); ! else { ! srand(i*17+enemy+TURN*3); ! mvprintw(nfound2*2+count,COLS-20,"%s: %ld men ",ntn[i].name,(enemy*(rand()%60+70)/100)); ! srand((unsigned) time((long *) 0)); ! } count++; } enemy=0; *************** *** 1137,1143 **** mvprintw(nfound2*2+count,COLS-20,"%s: %d ships",ntn[i].name,enemy); else if(magic(i,THE_VOID)==TRUE) mvprintw(nfound2*2+count,COLS-20,"%s: ?? ships",ntn[i].name); ! else mvprintw(nfound2*2+count,COLS-20,"%s: %ld ships",ntn[i].name,(enemy*(rand()%60+70)/100)); count++; } } --- 1144,1154 ---- mvprintw(nfound2*2+count,COLS-20,"%s: %d ships",ntn[i].name,enemy); else if(magic(i,THE_VOID)==TRUE) mvprintw(nfound2*2+count,COLS-20,"%s: ?? ships",ntn[i].name); ! else { ! srand(i*17+enemy+TURN*3); ! mvprintw(nfound2*2+count,COLS-20,"%s: %ld ships",ntn[i].name,(enemy*(rand()%60+70)/100)); ! srand((unsigned) time((long *) 0)); ! } count++; } } *************** *** 1177,1184 **** if((sptr->owner==country)||(country==0)||(magic(country,NINJA)==TRUE)) mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people); ! else ! mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people*(rand()%60+70)/100); clrtoeol(); if((sptr->owner==country) ||(sptr->owner==0) --- 1188,1198 ---- if((sptr->owner==country)||(country==0)||(magic(country,NINJA)==TRUE)) mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people); ! else { ! srand(country*17+TURN*3+sptr->people); ! mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people*(rand()%60+70)/100); ! srand((unsigned) time((long *) 0)); ! } clrtoeol(); if((sptr->owner==country) ||(sptr->owner==0) *** onpc.c Sat Mar 3 15:27:42 1990 --- npc.c Sat Mar 3 15:28:02 1990 *************** *** 487,493 **** for(armynum=1;armynum<MAXARM;armynum++) if(P_ASOLD>0){ /* move army back if too far out */ ok = 0; ! if (P_ASOLD < MINLEADER && P_ASOLD!=A_MILITIA) { curntn->tmil += P_ASOLD; } for(x=(int)P_AXLOC-3;x<=(int)P_AXLOC+3;x++) --- 487,493 ---- for(armynum=1;armynum<MAXARM;armynum++) if(P_ASOLD>0){ /* move army back if too far out */ ok = 0; ! if (P_ATYPE < MINLEADER && P_ASOLD!=A_MILITIA) { curntn->tmil += P_ASOLD; } for(x=(int)P_AXLOC-3;x<=(int)P_AXLOC+3;x++) *************** *** 562,567 **** --- 562,568 ---- /*too few soldiers on garrison*/ /*diff is number to change mil in cap (>0)*/ + if (*(u_enmetal + (P_ATYPE%UTYPE)) > 0) diff = (long) min(ideal-P_ASOLD,(int) (curntn->metals / *(u_enmetal + (P_ATYPE%UTYPE)))); diff=(long) min((int) diff, sct[curntn->capx][curntn->capy].people/2L); *************** *** 636,641 **** --- 637,643 ---- &&( P_ATYPE<MINLEADER ) &&( P_ASOLD < TAKESECTOR ) &&( curntn->tgold > 0 ) + &&(curntn->metals >= (TAKESECTOR+20-P_ASOLD)* *(u_enmetal + (P_ATYPE%UTYPE))) &&( fort_val(&sct[P_AXLOC][P_AYLOC]) > 0) &&( sct[P_AXLOC][P_AYLOC].owner == country )) { #ifdef DEBUG *************** *** 647,652 **** --- 649,655 ---- else curntn->tgold-=(TAKESECTOR+20-P_ASOLD)* *(u_encost + (P_ATYPE%UTYPE)); curntn->tmil += TAKESECTOR+20-P_ASOLD; + curntn->metals -= ((TAKESECTOR+20-P_ASOLD)* *(u_enmetal + (P_ATYPE%UTYPE))); P_ASOLD = TAKESECTOR+20; } *************** *** 1160,1165 **** --- 1163,1177 ---- if( curntn->tgold > curntn->tciv ) curntn->charity=10; else curntn->charity=0; + if( (curntn->tsctrs < 20) || (curntn->score < 20) ) { + if( curntn->tax_rate < 10 ) + curntn->tax_rate = 10; + } else { + curntn->tax_rate = (int)min((int)(curntn->prestige/5),(int)((curntn->popularity+curntn->terror+3*curntn->charity)/10)); + curntn->tax_rate = (int)min(curntn->tax_rate,20); + if(curntn->tax_rate < 4) + curntn->tax_rate = 4; + } /* INTELLIGENT SECTOR REDESIGNATION */ /* note that only redesignate pc's if not designated yet */ *** otrade.c Sat Mar 3 15:27:44 1990 --- trade.c Sat Mar 3 15:28:03 1990 *************** *** 51,57 **** #ifdef ADMIN char *tradefail[NUMPRODUCTS] = { "lack of gold", "lack of food", "lack of metal", "lack of jewels", "land not owned", ! "no available armies", "no available navies"}; #endif ADMIN #ifdef CONQUER /* Use this when you wish to bid something */ --- 51,58 ---- #ifdef ADMIN char *tradefail[NUMPRODUCTS] = { "lack of gold", "lack of food", "lack of metal", "lack of jewels", "land not owned", ! "unavailable or destroyed armies", ! "unavailable or destoryed navies"}; #endif ADMIN #ifdef CONQUER /* Use this when you wish to bid something */ *************** *** 145,151 **** lvar2[holdint], commodities[type2[holdint]]); } ! if (count>16) { standout(); mvaddstr(LINES-2,30,"Hit Any Key to Continue"); standend(); --- 146,152 ---- lvar2[holdint], commodities[type2[holdint]]); } ! if (count>LINES-8) { standout(); mvaddstr(LINES-2,30,"Hit Any Key to Continue"); standend(); *************** *** 571,576 **** --- 572,578 ---- } } mvprintw((*count)++,0," JUST ENTERED %c so food value is %d", entered,temp); + refresh(); return(temp); } *************** *** 659,664 **** --- 661,667 ---- int cntry,item,isup,extint; long longval; { + if (cntry == -1) return; switch(item) { case TDGOLD: *************** *** 722,727 **** --- 725,731 ---- case TDARMY: /* find army number for cntry2 */ /* give army to cntry2 */ + if(ntn[cntry1].arm[extra].sold <= 0) return -1; while(unitnum==(-1)&&unitcount<MAXARM) { if (ntn[cntry2].arm[unitcount].sold<=0) { /* give army to cntry2 */ *************** *** 743,748 **** --- 747,755 ---- break; case TDSHIP: /* give navy to cntry1 */ + if(!(ntn[cntry1].nvy[extra].merchant!=0 + && ntn[cntry1].nvy[extra].warships!=0 + && ntn[cntry1].nvy[extra].galleys!=0) ) return -1; while(unitnum==(-1)&&unitcount<MAXARM){ if ((int)ntn[cntry2].nvy[unitcount].merchant+ntn[cntry2].nvy[unitcount].warships+ntn[cntry2].nvy[unitcount].galleys == 0) { /* give navy to cntry2 */ *************** *** 787,793 **** returnval=longval; break; case TDLAND: ! if (cntry2!=sct[(int)longval][extint].owner) returnval=(long)tofood( &sct[(int)longval][extint],cntry1); break; case TDARMY: --- 794,800 ---- returnval=longval; break; case TDLAND: ! if (cntry2 == sct[(int)longval][extint].owner) returnval=(long)tofood( &sct[(int)longval][extint],cntry1); break; case TDARMY: *************** *** 795,800 **** --- 802,808 ---- returnval=armyvalue(cntry2,extint); break; case TDSHIP: + curntn = &ntn[cntry2]; if (flthold(extint)>0) returnval = (long)flthold(extint); break; *************** *** 976,982 **** whobuy[type1[itemnum]]=natn[itemnum]; } else { /* return bid */ ! takeback(whobuy[itemnum], type2[type1[itemnum]], lvar1[itemnum],(int)lvar2[itemnum],FALSE); } --- 984,990 ---- whobuy[type1[itemnum]]=natn[itemnum]; } else { /* return bid */ ! takeback(natn[itemnum], type2[type1[itemnum]], lvar1[itemnum],(int)lvar2[itemnum],FALSE); } *************** *** 995,1000 **** --- 1003,1009 ---- for (count=0;count<itemnum;count++) { if (deal[count]==SELL) { /* adjust the displayed value */ + if (type1[count] != TDLAND) lvar1[count]=gettval(0,natn[count],type1[count],lvar1[count],extra[count]); /* keep unsold items up for sale */ if(lvar1[count]>=0) fprintf(tfile,"%d %d %d %d %ld %ld %d\n", deal[count], natn[count],type1[count],type2[count],lvar1[count],lvar2[count],extra[count]); *************** *** 1013,1018 **** --- 1022,1029 ---- ntn[whobuy[count]].name,ntn[natn[count]].name,tradefail[type2[count]]); /* place it on the list for next turn */ /* adjust the displayed value */ + /* let land fail during trade */ + if (type1[count] != TDLAND) lvar1[count]=gettval(0,natn[count],type1[count],lvar1[count],extra[count]); if(lvar1[count]>=0) fprintf(tfile,"%d %d %d %d %ld %ld %d\n", SELL, natn[count],type1[count],type2[count],lvar1[count],lvar2[count],extra[count]); } else { *************** *** 1026,1031 **** --- 1037,1108 ---- } } fclose(tfile); + } + + /* remove a nations items from the trading board */ + void + fixtrade (cntry) + int cntry; + { + FILE *tfile; + int holdint, notopen=FALSE; + int type1[MAXITM], type2[MAXITM], deal[MAXITM], extra[MAXITM]; + int natn[MAXITM], itemnum, getland(), gettrade(), checkland(); + long lvar1[MAXITM], lvar2[MAXITM], armyvalue(); + void setaside(), takeback(); + + /* open trading file */ + if ((tfile=fopen(tradefile,"r")) == NULL ) { + notopen=TRUE; + } + itemnum = 0; + + /* read in all of the data */ + while (notopen==FALSE && !feof(tfile)) + { + if (fscanf(tfile,"%d %d %d %d %ld %ld %d\n",&deal[itemnum], + &natn[itemnum],&type1[itemnum],&type2[itemnum], + &lvar1[itemnum],&lvar2[itemnum],&extra[itemnum]) == 7){ + if (deal[itemnum]==NOSALE) { + /* remove item from sales list */ + deal[type1[itemnum]]=NOSALE; + } else if (deal[itemnum]==SELL) { + itemnum++; + } + } + } + if (notopen==FALSE) fclose(tfile); + + /* go through list of commodities */ + + for ( holdint=0; holdint<itemnum; holdint++) + { + if ( deal[holdint]==SELL ) + { + + if ( natn[holdint] == cntry ) + { + /* remove it from market */ + + if ( (tfile = fopen(tradefile,"a+"))==NULL) + { + printf("Error opening file for trading"); + abrt(); + } + + fprintf(tfile, "%d %d %d %d %ld %ld %d\n", + NOSALE, natn[holdint], holdint, 0, 0L, 0L, 0); + + fclose(tfile); + + takeback( natn[holdint], type1[holdint], lvar1[holdint], + extra[holdint], FALSE); + + } /* natn == cntry */ + + } /* SELL order */ + + } /* loop through commodities */ } #endif ADMIN #endif TRADE *** ocheck.c Sat Mar 3 15:27:39 1990 --- check.c Sat Mar 3 15:28:03 1990 *************** *** 18,29 **** register struct s_nation *nptr; register int i; register int country; struct army *a; for( country = 0; country < NTOTAL; country++ ) { nptr = &ntn[country]; ! if(nptr->active == 0) continue; if( nptr->metals < 0.0 ) { fprintf( stderr, "file %s: line %d: nation[%d] metal = %ld\n", __file__, __line__, country, nptr->metals ); --- 18,30 ---- register struct s_nation *nptr; register int i; register int country; + int j, k; struct army *a; for( country = 0; country < NTOTAL; country++ ) { nptr = &ntn[country]; ! if(country !=0 && nptr->active == 0) continue; if( nptr->metals < 0.0 ) { fprintf( stderr, "file %s: line %d: nation[%d] metal = %ld\n", __file__, __line__, country, nptr->metals ); *************** *** 54,68 **** __file__, __line__, country, i, a->yloc ); a->yloc = 0; } if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) { fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n", __file__,__line__,country,i,a->xloc,a->yloc,a->sold); a->sold = 0; } ! if( a->stat == ONBOARD && a->smove != 0) { ! /* don't echo since this is still getting */ ! /* set some place someplace I can't find yet */ ! a->smove = 0; } } /* for */ --- 55,101 ---- __file__, __line__, country, i, a->yloc ); a->yloc = 0; } + if( a->stat == ONBOARD) { + if (a->smove != 0) { + fprintf( stderr, "file %s: line %d: nation[%d] army[%d] onboard move = %d\n", + __file__, __line__, country, i, a->smove ); + a->smove = 0; + } + k = 0; + for (j = 0; j < MAXNAVY; j++) { + if (nptr->nvy[j].warships == 0 + && nptr->nvy[j].merchant == 0 + && nptr->nvy[j].galleys == 0) + continue; + if (nptr->nvy[j].armynum == i) { + k = 1; + } + } + if (k == 0) { + fprintf(stderr, "files %s: line %d: nation[%d] army[%d] onboard nothing\n", + __file__,__line__,country,i); + a->stat = DEFEND; + } + } if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) { fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n", __file__,__line__,country,i,a->xloc,a->yloc,a->sold); a->sold = 0; } ! } /* for */ ! ! for( i = 0; i < MAXNAVY; i++ ) { ! if (nptr->nvy[i].warships == 0 ! && nptr->nvy[i].merchant == 0 ! && nptr->nvy[i].galleys == 0) ! continue; ! if (nptr->nvy[i].armynum != MAXARM) { ! a = &(nptr->arm[nptr->nvy[i].armynum]); ! if (a->sold == 0 || a->stat != ONBOARD) { ! fprintf(stderr, "file %s: line %d: nation[%d] navy[%d] carrying invalid troop\n", ! __file__,__line__,country,i); ! nptr->nvy[i].armynum = MAXARM; ! } } } /* for */ *** onavy.c Sat Mar 3 15:27:42 1990 --- navy.c Sat Mar 3 15:28:03 1990 *************** *** 423,430 **** } P_ASTAT=DEFEND; P_NARMY=MAXARM; ! if ((sct[XREAL][YREAL].designation!=DCITY ! && sct[XREAL][YREAL].designation!=DCAPITOL) || P_NMOVE < N_CITYCOST) { P_NMOVE=0; } else { --- 423,433 ---- } P_ASTAT=DEFEND; P_NARMY=MAXARM; ! if (!((sct[XREAL][YREAL].designation==DCITY ! || sct[XREAL][YREAL].designation==DCAPITOL) ! && (sct[XREAL][YREAL].owner==country ! || (!ntn[sct[XREAL][YREAL].owner].dstatus[country]!=UNMET ! && ntn[sct[XREAL][YREAL].owner].dstatus[country]<=NEUTRAL))) || P_NMOVE < N_CITYCOST) { P_NMOVE=0; } else { *************** *** 495,502 **** P_ASTAT=ONBOARD; P_AMOVE=0; P_NARMY=armynum; ! if ((sct[XREAL][YREAL].designation!=DCITY ! && sct[XREAL][YREAL].designation!=DCAPITOL) || P_NMOVE < N_CITYCOST) { P_NMOVE=0; } else { --- 498,508 ---- P_ASTAT=ONBOARD; P_AMOVE=0; P_NARMY=armynum; ! if (!((sct[XREAL][YREAL].designation==DCITY ! || sct[XREAL][YREAL].designation==DCAPITOL) ! && (sct[XREAL][YREAL].owner==country ! || (!ntn[sct[XREAL][YREAL].owner].dstatus[country]!=UNMET ! && ntn[sct[XREAL][YREAL].owner].dstatus[country]<=NEUTRAL))) || P_NMOVE < N_CITYCOST) { P_NMOVE=0; } else { *** otxt3 Sat Mar 3 15:27:44 1990 --- txt3 Sat Mar 3 15:28:04 1990 *************** *** 1,25 **** ! MAGIC POWERS ! Magic powers differentiate your nation from all the other nations in the ! world. There are three types of powers - truly MAGICAL powers, which ! usually involve summoning or spell use, CIVILIAN powers, which are related ! to civilization and trade, and MILITARY powers, which measure your ability ! to make war. ! All nations start with at least one power (based on race or class) and can ! purchase additional powers by expending jewels. On the Magic Screen ('M'), ! if you have enough jewels, you will be asked if you wish to buy a magic power. ! ! The magic screen also permits you to see what powers you have, and to ! takeover ORC nations if you are an ORC nation with the appropriate powers. END ! HOW TO GET MAGIC ! Magic powers cost jewels to obtain; the chance to obtain a power is based on ! your nations magic ability. The formulae for this is to take two to the ! power of the sum of the number of powers you have from that type and half ! the number of other powers times your base value: jewel cost for civilian power = Base * 2**( #mgk/2 + #civ + #mil/2 ) --- 1,25 ---- ! MAGIC POWERS ! Magic powers differentiate your nation from all the other nations in the ! world. There are three types of powers - truly MAGICAL powers, which usually ! involve summoning or spell use, CIVILIAN powers, which are related to civili- ! zation and trade, and MILITARY powers, which measure your ability to make ! war. ! All nations start with at least one power (based on race or class) and can ! purchase additional powers by expending jewels. On the Magic Screen ('M'), ! if you have enough jewels, you will be asked if you wish to buy a magic power. ! ! The magic screen also permits you to see what powers you have, and to take- ! over ORC nations if you are an ORC nation with the appropriate powers. END ! HOW TO GET MAGIC ! Magic powers cost jewels to obtain; the cost to obtain a power is based on ! your nations magic ability. The formulae for this is to take two to the ! power of the sum of the number of powers you have from that type and half the ! number of other powers times your base value: jewel cost for civilian power = Base * 2**( #mgk/2 + #civ + #mil/2 ) *************** *** 102,145 **** Enhance Attack -- 30% increase in attack at a cost of 1 spell pt / 300 men Enhance Defense -- 30% increase in defense at a cost of 1 spell pt / 300 men ! All of the above spells except summoning have an effect area of one army ! unit and a duration of one turn. Flight and the Combat Enhancements each ! cause the unit to lose one movement point due to the change in status. END ! SUMMONED MONSTERS ! A monster unit represents one monster, but is the equivalent in combat of an army of the given number of men. When summoned, they appear in your Capitol, ! and are yours to command until you disband them or can not afford to pay ! their per/turn jewel cost *and* 5x that cost in gold. Monsters may be ! wounded in combat as can normal army units. Wounded monsters have a percent chance of dying based on the percent damage taken (a dragon (1000 men) taking ! 200 equivalent men of damage has a 20% chance of dying). Next turn, however ! its strength will be fully restored (1000 men again). A number of the ! monsters will also have the ability of flight. ! Spell points can accumulate from turn to turn, but there is a 25% chance ! that half your unused spell points disappear each turn... this gives you ! some incentive to use them. END SUMMONED MONSTER TYPES spell combat jewels power points bonus move men turn prerequisites ! SPIRIT 2 +0 x1 50 1000 ! ASSASSIN 2 +20 x1 50 400 NINJA ! EFREET 2 +10 x1.5 50 400 DERVISH ! GARGOYLE 2 +10 x1 75 450 MI_MONST ! WRAITH 2 +10 x1 75 450 VAMPIRE ! HERO 2 +0 x1 100 200 WARRIOR ! CENTAUR 2 +10 x1.5 50 200 CAVALRY ! GIANT 5 +0 x1 150 2100 ! SUPERHERO 5 +15 x1 150 450 WARLORD ! MUMMY 5 +15 x1 150 1000 VAMPIRE ! ELEMENTAL 5 +5 x1.5 175 1900 SORCERER ! MINOTAUR 5 +20 x1 150 2100 DESTROYER ! DEMON 10 +50 x1 500 6000 DESTROYER ! BALROG 10 +40 x1.5 500 6000 WIZARD & VAMPIRE ! DRAGON 15 +50 x2 1000 10000 MA_MONST & WIZARD END DONE --- 102,162 ---- Enhance Attack -- 30% increase in attack at a cost of 1 spell pt / 300 men Enhance Defense -- 30% increase in defense at a cost of 1 spell pt / 300 men ! All of the above spells except summoning have an effect area of one army unit ! and a duration of one turn. Flight and the Combat Enhancements each cause ! the unit to lose one movement point due to the change in status. END ! SUMMONED MONSTERS ! A monster unit represents one monster, but is the equivalent in combat of an army of the given number of men. When summoned, they appear in your Capitol, ! and are yours to command until you disband them or can not afford to pay ! their per/turn jewel cost *and* 5x that cost in gold. Monsters may be ! wounded in combat as can normal army units. Wounded monsters have a percent chance of dying based on the percent damage taken (a dragon (1000 men) taking ! 200 equivalent men of damage has a 20% chance of dying). Next turn, however ! its strength will be fully restored (1000 men again). A number of the mon- ! sters will also have the ability of flight. ! Spell points can accumulate from turn to turn, but there is a 25% chance that ! half your unused spell points disappear each turn.... This gives you some ! incentive to use them. END SUMMONED MONSTER TYPES spell combat jewels power points bonus move men turn prerequisites ! Spirit 2 +0 x1 50 1000 ! Assasin 2 +20 x1 50 400 NINJA ! Efreet 2 +10 x1.5 50 400 DERVISH ! Gargoyl 2 +10 x1 75 450 MI_MONST ! Wraith 2 +10 x1 75 450 VAMPIRE ! Hero 2 +0 x1 75 200 WARLORD ! Centaur 2 +10 x1.5 50 200 CAVALRY ! Giant 5 +0 x1 150 2100 ! Suphero 5 +15 x1 150 450 WARRIOR ! Mummy 5 +15 x1 150 1000 VAMPIRE ! Elmentl 5 +5 x1.5 175 1900 SORCERER ! Mintaur 5 +20 x1 150 2100 DESTROYER ! Daemon 10 +50 x1 500 6000 DESTROYER ! Balrog 10 +40 x1.5 500 6000 WIZARD & VAMPIRE ! Dragon 15 +50 x2 1000 10000 MA_MONST & WIZARD ! END ! FURTHER RESTRICTIONS ON ACQUIRING MAGIC ! ! Note: This applies only to powers acquired during the course of the game and ! not to innate powers of nations. Further, extra random powers bought by new ! nations are considered to be bought on their first turn as their first ! action. ! ! God only: KNOWALL ! Orc only: MI_MONST, AV_MONST, MA_MONST, BREEDER ! PC only: ARMOR, AVIAN, SAPPER, ! DEMOCRACY, NINJA, ROADS, SAILOR, SLAVER, ! SUMMON, WYZARD, SORCEROR ! Forbidden to Dwarves: SUMMON, WYZARD, SORCEROR ! Forbidden to Elves: DESTROYER, VAMPIRE, MINER ! Forbidden to Orcs: RELIGION, CAVALRY ! Forbidden to NPC's: CAVALRY END DONE *** ospew.c Sat Mar 3 15:27:43 1990 --- spew.c Sat Mar 3 15:28:05 1990 *************** *** 95,106 **** int n; FILE *fp; { ! char *fname; char main_class[20]; int i; HowMany = n; ! fname = DEFFILE; InFile = fopen( fname, "r" ); if( InFile == NULL ){ fprintf( stderr, "Can\'t open: %s\n", fname ); --- 95,107 ---- int n; FILE *fp; { ! char fname[BIGLTH]; char main_class[20]; int i; HowMany = n; ! /* read in only the rules file in defaultdir */ ! sprintf(fname, "%s/%s", DEFAULTDIR, DEFFILE); InFile = fopen( fname, "r" ); if( InFile == NULL ){ fprintf( stderr, "Can\'t open: %s\n", fname );