Open kevintakeda opened 2 years ago
npc will have coins, they will give it to you if you give them specific items they ask for?
@jinc0930 that's one idea, but i recommend we do #49 first and create a separate issue for functionalities around the coin. This issue is just about the coin itself, we can use the coin to do all sorts of stuff after coin impl is finished.
see updates.
@jinc0930
This line add the purchase
to the coins_count
. It should not add anything if the purchase
is negative. And then it adds again on the second line, if the purchase
is positive, meaning you are duplicating the amount that is adding. ( also is ambiguous if should be negative vs positive, the purchase arg)
https://github.com/jinc0930/Clue/blob/82b42f83242ab40e49b0f27e9d43eb812e87c740/character.c#L54
We also need a transaction
function between 2 characters to transfer coins from one to another one.
I created some tests for the 2 functions, which is failing for now, you can modify the tests as you wish, type: mingw32-make test && ./test.exe
if you are on windows to test. Or you can use full command: gcc -o test utils.c pool.c character.c rooms.c items.c game.c tests/test.c -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
Tests are here: https://github.com/jinc0930/Clue/blob/82b42f83242ab40e49b0f27e9d43eb812e87c740/tests/test.c#L424-L444
Small tip:
When this error happens after testing,
click holding ctrl on tests/test.c:403
, to find the exact line that didn't pass
Coin because you can trade stuff. Buy necessary items to help find the clues!
coins_count
field