aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2014-06-29 18:58:43 -0400
committerFranklin Wei <frankhwei536@gmail.com>2014-06-29 18:58:43 -0400
commit2ce6fea54fd1327c6744183600acd0fc5bd0f082 (patch)
treea13da2e40ed8d62e22c4280516921ca97c0027c0
parent18e379aabbfd6698605bca0c4ea8cd619ce3c3a1 (diff)
downloadwargames-server-2ce6fea54fd1327c6744183600acd0fc5bd0f082.zip
wargames-server-2ce6fea54fd1327c6744183600acd0fc5bd0f082.tar.gz
wargames-server-2ce6fea54fd1327c6744183600acd0fc5bd0f082.tar.bz2
wargames-server-2ce6fea54fd1327c6744183600acd0fc5bd0f082.tar.xz
Features, bugfixes...
-rw-r--r--GAMESPEC6
-rw-r--r--gtnw.c17
-rw-r--r--util.h2
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<sizeof(const_map)/sizeof(const char*);++i)
+ {
+ strcpy(map[i], const_map[i]);
+ }
+ /* print the map */
for(int i=0;i<sizeof(map)/sizeof(const char*);++i)
{
print_string(map[i]);
print_string("\n");
}
+
+ /* get the side the user wants to be on */
print_string("\nWHICH SIDE DO YOU WANT?\n\n 1. UNITED STATES\n 2. SOVIET UNION\n\n");
bool good=false;
unsigned int side=0;
diff --git a/util.h b/util.h
index 8b23979..f09ca51 100644
--- a/util.h
+++ b/util.h
@@ -18,7 +18,7 @@
* Contact the author at contact@fwei.tk
*/
-#define SLEEP_TIME 0
+#define SLEEP_TIME 5000
void allLower(char*);
void print_string(const char*);
void remove_punct(char*);