diff options
author | B. Watson <yalhcru@gmail.com> | 2016-01-30 05:56:28 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-01-30 05:56:28 -0500 |
commit | fee72cdb3651d2e5bfd5fe525c6498dc01fbbe01 (patch) | |
tree | e1b63c375d38f1db6a8a0db95bfbfe8780ee73da | |
parent | a8f3491099463de93f15b710e98671037fcde072 (diff) | |
download | taipan-fee72cdb3651d2e5bfd5fe525c6498dc01fbbe01.tar.gz |
use loop in set_prices(), save 142 bytes
-rw-r--r-- | taipan.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1290,7 +1290,6 @@ void cash_or_guns(void) // cash = 3500000L; #ifdef BIGNUM big_copy(bank, big1M); - // memcpy(bank, big1M, 6); big_mul(bank, bank, big1M); #else bank = 1000000000L; @@ -1319,13 +1318,18 @@ void cash_or_guns(void) return; } -void set_prices(void) -{ +void set_prices(void) { + char i; + for(i = 0; i < 4; ++i) + price[i] = base_price[i][port] / 2 * (randi()%3 + 1) * base_price[i][0]; + + /* + // using above for loop instead of the below, saves 142 bytes! price[0] = base_price[0][port] / 2 * (randi()%3 + 1) * base_price[0][0]; price[1] = base_price[1][port] / 2 * (randi()%3 + 1) * base_price[1][0]; price[2] = base_price[2][port] / 2 * (randi()%3 + 1) * base_price[2][0]; price[3] = base_price[3][port] / 2 * (randi()%3 + 1) * base_price[3][0]; - return; + */ } |