Commit Diff


commit - c0c6ae4a59ce0ecc749f0507f9ee44f8df7dfafc
commit + 361591bb0df5e8ab1da0523f8b5a6916574bea65
blob - 90765ca3185efc629a86bc5d1f857ae5035ee2dc
blob + 2e4f55fd846a5563558ecd8e64dbb0f2d70a532c
--- fight.c
+++ fight.c
@@ -23,9 +23,10 @@
 #include "isscrolls.h"
 
 void
-cmd_enter_the_fray(char *stat)
+cmd_enter_the_fray(char *cmd)
 {
 	struct character *curchar = get_current_character();
+	char stat[MAX_STAT_LEN];
 	int ival[2] = { -1, -1 };
 	int ret;
 
@@ -34,7 +35,8 @@ cmd_enter_the_fray(char *stat)
 		return;
 	}
 
-	if (strlen(stat) == 0) {
+	ret = get_args_from_cmd(cmd, stat, &ival[1]);
+	if (ret <= -10) {
 info:
 		printf("\nPlease specify the stat you'd like to use in this move\n\n");
 		printf("heart\t- You are facing off against your foe\n");
@@ -42,10 +44,12 @@ info:
 		printf("wits\t- You are ambushed\n");
 		printf("Example: enterthefray wits\n\n");
 		return;
+	} else if (ret <= -20) {
+		return;
 	}
 
 	if (strcmp(stat, "wits") == 0) {
-			ival[0] = curchar->wits;
+		ival[0] = curchar->wits;
 	} else if (strcmp(stat, "shadow") == 0) {
 		ival[0] = curchar->shadow;
 	} else if (strcmp(stat, "heart") == 0) {
@@ -176,9 +180,10 @@ cmd_endure_harm(char *cmd)
 }
 
 void
-cmd_strike(char *stat)
+cmd_strike(char *cmd)
 {
 	struct character *curchar = get_current_character();
+	char stat[MAX_STAT_LEN];
 	int ival[2] = { -1, -1 };
 	int ret;
 
@@ -192,14 +197,16 @@ cmd_strike(char *stat)
 		return;
 	}
 
-	if (strlen(stat) == 0) {
+	ret = get_args_from_cmd(cmd, stat, &ival[1]);
+	if (ret <= -10) {
 info:
 		printf("Please specify the stat you'd like to use in this move\n\n");
 		printf("iron\t- You attack in close quarters\n");
 		printf("edge\t- You attack at range\n");
 		printf("Example: strike iron\n");
 		return;
-	}
+	} else if (ret <= -20)
+		return;
 
 	if (strcmp(stat, "iron") == 0) {
 		ival[0] = curchar->iron;
@@ -226,9 +233,10 @@ info:
 }
 
 void
-cmd_clash(char *stat)
+cmd_clash(char *cmd)
 {
 	struct character *curchar = get_current_character();
+	char stat[MAX_STAT_LEN];
 	int ival[2] = { -1, -1 };
 	int ret;
 
@@ -242,14 +250,16 @@ cmd_clash(char *stat)
 		return;
 	}
 
-	if (strlen(stat) == 0) {
+	ret = get_args_from_cmd(cmd, stat, &ival[1]);
+	if (ret <= -10) {
 info:
 		printf("Please specify the stat you'd like to use in this move\n\n");
 		printf("iron\t- You fight in close quarters\n");
 		printf("edge\t- You fight at range\n");
 		printf("Example: clash iron\n");
 		return;
-	}
+	} else if (ret <= -20)
+		return;
 
 	if (strcmp(stat, "iron") == 0) {
 		ival[0] = curchar->iron;
@@ -275,9 +285,10 @@ info:
 }
 
 void
-cmd_battle(char *stat)
+cmd_battle(char *cmd)
 {
 	struct character *curchar = get_current_character();
+	char stat[MAX_STAT_LEN];
 	int ival[2] = { -1, -1 };
 	int ret;
 
@@ -291,7 +302,8 @@ cmd_battle(char *stat)
 		return;
 	}
 
-	if (strlen(stat) == 0) {
+	ret = get_args_from_cmd(cmd, stat, &ival[1]);
+	if (ret <= -10) {
 info:
 		printf("Please specify the stat you'd like to use in this move\n\n");
 		printf("edge\t- Fight at range, or using your speed and the terrain\n");
@@ -301,7 +313,8 @@ info:
 		printf("wits\t- Fight using careful tactics to outsmart your opponents\n\n");
 		printf("Example: battle iron\n");
 		return;
-	}
+	} else if (ret <= -20)
+		return;
 
 	if (strcmp(stat, "iron") == 0) {
 			ival[0] = curchar->iron;