1313#include "header.h"
1414#include "data.h"
1515#include <ctype.h>
16-
17- #ifdef SYSMAIL
16+ #ifdef CONQUER
1817#include <sys/types.h>
19- #endif SYSMAIL
18+ #include <sys/stat.h>
19+ #endif /*CONQUER*/
20+
2021extern long conq_mail_size ;
2122
2223extern FILE * fexe ; /*execute file pointer*/
@@ -93,16 +94,6 @@ desg_ok(prtflag, desg, sptr)
9394 }
9495 }
9596
96- /* have this for now... may be too harsh */
97- if (desg == DMILL || desg == DGRANARY ) {
98- if ((sptr -> tradegood != TG_none )
99- && (* (tg_stype + sptr -> tradegood ) != DFARM )
100- && (* (tg_stype + sptr -> tradegood ) != 'x' )) {
101- if (prtflag ) errormsg ("You can't have one of those here!" );
102- return (FALSE);
103- }
104- }
105-
10697 if (desg == DUNIVERSITY || desg == DLUMBERYD ) {
10798 if ((sptr -> tradegood != TG_none )
10899 && (* (tg_stype + sptr -> tradegood ) != desg )
@@ -149,7 +140,7 @@ redesignate()
149140 curntn = & ntn [country ];
150141
151142 clear_bottom (0 );
152- mvaddstr (LINES - 4 ,0 ,"SUPER USER: CHANGE (v)egetation , (e)levation , (d)esig, (o)wner, (t)radegood" );
143+ mvaddstr (LINES - 4 ,0 ,"SUPER USER: CHANGE (v)eg , (e)lev , (d)esig, (o)wner, (p)op , (t)radegood" );
153144 refresh ();
154145 switch (getch ()){
155146 case 'd' :
@@ -190,8 +181,8 @@ redesignate()
190181 }
191182 sptr -> vegetation = newdes ;
192183 if ( tofood (sptr ,0 ) < DESFOOD )
193- sptr -> designation = DNODESIG ;
194- else sptr -> designation = newdes ;
184+ sptr -> designation = newdes ;
185+ else sptr -> designation = DNODESIG ;
195186 reset_god ();
196187 return ;
197188 case 'o' :
@@ -201,6 +192,17 @@ redesignate()
201192 if (x < NTOTAL ) sptr -> owner = x ;
202193 reset_god ();
203194 return ;
195+ case 'p' :
196+ if (sptr -> altitude == WATER ) {
197+ errormsg ("Trying to build a colony of mermen?" );
198+ reset_god ();
199+ return ;
200+ }
201+ mvaddstr (LINES - 3 ,7 ,"new population for sector: " );
202+ refresh ();
203+ sptr -> people = (long ) get_number ();
204+ reset_god ();
205+ return ;
204206 case 't' :
205207 x = TRUE;
206208 while (x == TRUE) {
@@ -635,7 +637,7 @@ construct()
635637 return ;
636638 }
637639
638- if ( sct [XREAL ][YREAL ].people < amount * SHIPCREW ){
640+ if ( sct [XREAL ][YREAL ].people < amount * ( shipsize + 1 ) * SHIPCREW ){
639641 errormsg ("NOT ENOUGH CIVILIANS IN SECTOR" );
640642 if (isgod == TRUE) reset_god ();
641643 return ;
@@ -699,13 +701,15 @@ construct()
699701 /* construct fortification points*/
700702 else if (type == 'f' ){
701703 /* can only go into debt as much as the nation has jewels */
702- if ((curntn -> tgold - cost ) >= ((-1 )* 10 * curntn -> jewels )) {
704+ if (sct [XREAL ][YREAL ].fortress > 11 ) {
705+ errormsg ("That sector is as impregnable as you can make it" );
706+ } else if ((curntn -> tgold - cost ) >= ((-1 )* 10 * curntn -> jewels )) {
703707 mvprintw (LINES - 2 ,5 ,"you build +%d%% fort points for %ld gold" ,armbonus ,cost );
704708 curntn -> tgold -= cost ;
705709 sct [XREAL ][YREAL ].fortress ++ ;
706710 INCFORT ;
707711 errormsg ("" );
708- } else errormsg ("you are broke " );
712+ } else errormsg ("you may not spend that much " );
709713 }
710714 else errormsg ("invalid input error" );
711715
@@ -1038,6 +1042,7 @@ rmessage()
10381042 char mesgfile [FILELTH ];
10391043 char line [LINELTH + 1 ], inpch ;
10401044 char save [LINELTH ][LINELTH + 1 ];
1045+ struct stat fst ;
10411046
10421047 /*open file; used in mailopen() as well */
10431048 sprintf (tempfile ,"%s%hd.tmp" ,msgfile ,country );
@@ -1062,14 +1067,21 @@ rmessage()
10621067
10631068 /* check for people sending mail */
10641069 sprintf (line ,"send.%s%hd" ,msgfile ,country );
1065- if (access (line ,00 )== 0 ) {
1066- /* someone is sending mail to the country */
1067- (void ) unlink (tempfile ) ;
1068- clear_bottom (0 );
1069- errormsg ("Someone is sending you mail... please wait." );
1070- makebottom ();
1071- redraw = DONE ;
1072- return ;
1070+ if (stat (line ,& fst )== 0 ) {
1071+ long now ;
1072+ now = time (0 );
1073+ if (now - fst .st_mtime < TIME_DEAD ) {
1074+ /* someone is sending mail to the country */
1075+ (void ) unlink (tempfile ) ;
1076+ clear_bottom (0 );
1077+ errormsg ("Someone is sending you mail... please wait." );
1078+ makebottom ();
1079+ redraw = DONE ;
1080+ return ;
1081+ } else {
1082+ /* remove useless file */
1083+ (void ) unlink (line );
1084+ }
10731085 }
10741086
10751087 /*read in file a line at at time*/
@@ -1142,27 +1154,29 @@ wmessage()
11421154 char line [BIGLTH ];
11431155
11441156 /*what nation to send to*/
1145- clear ();
1146- mvaddstr (0 ,0 ,"To send a message to the administrator, send to 'god';" );
1147- mvaddstr (1 ,0 ,"To post to the news, send to 'news':" );
1148- mvaddstr (2 ,0 ,"Enter the name of the country to send to: " );
1157+ clear_bottom (0 );
1158+ mvaddstr (LINES - 4 ,0 ,"The Conquer Administrator is 'god'; To send to the News use 'news';" );
1159+ mvaddstr (LINES - 3 ,0 ,"Send mail to what nation? " );
11491160 refresh ();
11501161 temp = get_country ();
11511162
11521163 if ( temp == NEWSMAIL ) {
11531164 strcpy (name ,"news" );
11541165 } else {
11551166 /* quick return on bad input */
1156- if (temp == (-1 ) || temp >=NTOTAL
1157- || (!isntn (ntn [temp ].active ) && temp != 0 ))
1158- return ;
1167+ if (temp == (-1 ) || temp >=NTOTAL
1168+ || (!isntn (ntn [temp ].active ) && temp != 0 )) {
1169+ makebottom ();
1170+ return ;
1171+ }
11591172 strcpy (name ,ntn [temp ].name ); /* find nation name */
11601173 }
11611174
11621175 if (mailopen ( temp )== (-1 )) {
1176+ makebottom ();
11631177 return ;
11641178 }
1165-
1179+ redraw = FULL ;
11661180
11671181 if (temp != -2 ) {
11681182 if (country == 0 )
0 commit comments