Work for 7/2

This commit is contained in:
David Meyer 2020-07-03 00:00:40 +09:00
parent 5e8093e845
commit 5519fadc1c
1 changed files with 44 additions and 20 deletions

View File

@ -32,6 +32,14 @@ v BUG: buying land resulted in REDUCTION of land held
|___________________|
(___________________@
.______________________________________________________________________________.
| _ _ _ _ _ _ _ _ _ _ |
| /} \/}/ /} \/}/ /} \/}/ /} \/}/ /} \/}/ /} |
|_/|\_ |_ _/|\_ |_ _/|\_ |_ _/|\_ |_ _/|\_ |_ _/|\_|
| / \ | \ / \ | \ / \ | \ / \ | \ / \ | \ / \ |
|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv|
*/
#include <u.h>
#include <libc.h>
@ -67,7 +75,7 @@ char MSGMENU[]=
";
char MSGPLTOT[] =
" ------------------------------ | ------------------------------\n";
" ------------------------------- | -------------------------------\n";
char MSGSPLASH[] =
" ___ ___ ___. .__ \n\
@ -241,7 +249,7 @@ inputbuy(void)
grainbal = Grain - foodgrain - (plantland / 2);
do
{
print("The price of land is %d bushels per acre.\n", landprice);
print("\nThe price of land is %d bushels per acre.\n", landprice);
print("How many acres do you wish to buy? ");
buy = inputiexpr();
price = buy * landprice;
@ -264,7 +272,7 @@ inputfood(void)
grainbal = Grain + (landsale * landprice) - (plantland / 2);
do
{
print("How much grain do you wish to give your people for food? ");
print("\nHow much grain do you wish to give your people for food? ");
food = inputiexpr();
if(food < 0)
print("Sire, it is impossible to give the people a negative amount of grain.\nEnter \"0\" to return to the menu.\n");
@ -339,7 +347,7 @@ inputplant(void)
landbal = Land - landsale;
do
{
print("How many acres do you wish to plant? ");
print("\nHow many acres do you wish to plant? ");
plant = inputiexpr();
if(plant < 0)
print("Sire, it is impossible to plant a negative amount of land.\nEnter \"0\" to return to the menu.\n");
@ -361,7 +369,7 @@ inputsell(void)
landbal = Land - plantland;
do
{
print("The price of land is %d bushels per acre.\n", landprice);
print("\nThe price of land is %d bushels per acre.\n", landprice);
print("How many acres do you wish to sell? ");
sell = inputiexpr();
if(sell < 0)
@ -399,7 +407,7 @@ planmenu(void)
print("%s Balance %7d | Fallow acres %7d\n", MSGPLTOT,
Grain + (landsale * landprice) - foodgrain - (plantland / 2),
Land - landsale - plantland);
print("\n Population: %6d (need food: %6d; can farm: %6d)\n", Pop, Pop * 20, Pop * 10);
print("\n Population: %d (need food: %d; can farm: %d)\n", Pop, Pop * 20, Pop * 10);
print(MSGMENU);
if(write(CONSCTL, "rawon", 5) != 5) exits("\ncan't turn off echo\n");
@ -468,7 +476,7 @@ planyear(void)
foodgrain = landsale = plantland = 0;
break;
case EXEC:
print("So it shall be written, so it shall be done.\n");
print("\nSo it shall be written, so it shall be done.\n");
break;
case CALC:
// microcalc();
@ -490,8 +498,8 @@ printdeposed(void)
void
printgreeting(void)
{
print(MSGDIV);
print("O %s One, I beg to report,\n", HONORIFIC[nrand(MAXHONOR + 1)]);
// print(MSGDIV);
print("\nO %s One, I beg to report,\n", HONORIFIC[nrand(MAXHONOR + 1)]);
}
void
@ -511,6 +519,22 @@ printstatus(void)
void
printyearrept(void)
{
print(" ____________________________________________________________________\n");
print(" ( YEAR %2d @\n", Year);
print(" | Harvest yield %1d bushels per acre | (Land price %2d bushels per acre) |\n", harvyield, landprice);
print(" /}_ _ | In Year %d\n", Year);
print(" \\/\\/ | %d bushels were harvested per acre, for a total harvest of %d bushels\n",
harvyield, plantland * harvyield);
print(" |\\ |");
if(ratgrain > 0) print(" Rats ate %d bushels of grain.", ratgrain);
print("\n |\\ |");
if(newpop > 0) print(" The population increased by %d.", newpop);
print("\n |_\\_ |");
if(starvedeath > 0) print(" %d people starved!", starvedeath);
print("\n |");
if(plaguedeath > 0) print(" A horrible plague struck! %d people have died!", plaguedeath);
print("\n |________________________________________________50\n");
print(" (________________________________________________50\n");
print("In Year %d,\n", Year);
print("%d bushels were harvested per acre, for a total harvest of %d bushels.\n",
harvyield, plantland * harvyield);