From 2ce6fea54fd1327c6744183600acd0fc5bd0f082 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 29 Jun 2014 18:58:43 -0400 Subject: Features, bugfixes... --- GAMESPEC | 6 +++--- gtnw.c | 17 ++++++++++++----- util.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/GAMESPEC b/GAMESPEC index 13200a0..371aef8 100644 --- a/GAMESPEC +++ b/GAMESPEC @@ -15,9 +15,9 @@ ICBM launch: - The USSR can launch 6 at a time. - When an ICBM is launched, there are 5 possible results: - Miss: 0 casualties - - Marginal: 20%+100 casualties - - Minor: 40%+200 casualties - - Major: 60%+400 casualties + - Marginal: 20%+1000 casualties + - Minor: 40%+2500 casualties + - Major: 60%+5000 casualties - Critical: 100% casualties - The probabilities of each of these options is outlined below: - Miss - 10% diff --git a/gtnw.c b/gtnw.c index f86766c..c2450f3 100644 --- a/gtnw.c +++ b/gtnw.c @@ -49,17 +49,17 @@ static void fire_missile(struct location_t* city) else if(random>=60) /* major */ { map[y][x]='X'; - city->population=max((double)city->population*(double).4-400, 0); + city->population=max((double)city->population*(double).4-5000, 0); } else if(random>=30) /* minor */ { map[y][x]='*'; - city->population=max((double)city->population*(double).6-200, 0); + city->population=max((double)city->population*(double).6-2500, 0); } else if(random>=10) /* marginal */ { map[y][x]='x'; - city->population=max((double)city->population*(double).8-100, 0); + city->population=max((double)city->population*(double).8-1000, 0); } else /* miss */ { @@ -235,7 +235,7 @@ static void do_first_strike(int side) /** TODO: refactor into do_first_strike (or vice-versa) **/ static void do_missile_launch(int side) { - clear(); + print_string("\n\n"); attr_on(WA_UNDERLINE, 0); print_string("AWAITING STRIKE COMMAND"); attr_off(WA_UNDERLINE, 0); @@ -356,14 +356,21 @@ static void do_human_move(int side) /* play a game of Global Thermonuclear War! */ void global_thermonuclear_war(void) { - srand(time(0)); + srand(time(0)); // might want to move to main()... surrender=false; clear(); + for(int i=0;i