diff --git a/src/c/encounter.c b/src/c/encounter.c index c5c8984..a4bbc22 100644 --- a/src/c/encounter.c +++ b/src/c/encounter.c @@ -82,20 +82,19 @@ int fight(int playerH, int playerDamage, int playerArmor, int playerAttack, enem // Getter/Setter Funktionen -void *setEnemyHealth(int *num, int health) +void setEnemyHealth(enemy* enemy, int newhealth) { - *num = health; - // return health; + enemy->health = newhealth; } -void *setEnemyDamage(int *num, int damage) +void setEnemyDamage(enemy* enemy, int newdamage) { - *num = damage; + enemy->damage = newdamage; } -void *setEnemyArmor(int *num, int armor) +void setEnemyArmor(enemy* enemy, int newarmor) { - *num = armor; + enemy->armor = newarmor; } int getEnemyHealth(enemy* enemy) diff --git a/src/c/encounter.h b/src/c/encounter.h index 0a3031b..9e2e3df 100644 --- a/src/c/encounter.h +++ b/src/c/encounter.h @@ -20,13 +20,13 @@ int fight(int playerH, int playerDamage, int playerArmor, int playerAttack, enem //Getter/Setter Funktionen -//setEnemyHealth(&enemy.health, health); -void *setEnemyHealth(int *num, int health); +//setEnemyHealth(&enemy, health); +void setEnemyHealth(enemy* enemy, int newhealth); //setEnemyDamage(&enemy.damage, damage); -void *setEnemyDamage(int *num, int damage); +void setEnemyDamage(enemy* enemy, int newdamage); //setEnemyArmor(&enemy.armor, armor); -void *setEnemyArmor(int *num, int damage); +void setEnemyArmor(enemy* enemy, int newarmor); //Function to get the value of Data in a struct, needs a pointer to the struct int getEnemyAttack(enemy* enemy); int getEnemyHealth(enemy* enemy); diff --git a/src/c/playerinput.c b/src/c/playerinput.c new file mode 100644 index 0000000..26a0a8b --- /dev/null +++ b/src/c/playerinput.c @@ -0,0 +1,6 @@ +#include "playerinput.h" + +char playerInput(){ + char c; + return c; +} \ No newline at end of file diff --git a/src/c/playerinput.h b/src/c/playerinput.h new file mode 100644 index 0000000..66f4325 --- /dev/null +++ b/src/c/playerinput.h @@ -0,0 +1,6 @@ +#ifndef PLAYERINPUT_H +#define PLAYERINPUT_H + +char playerInput(); + +#endif \ No newline at end of file diff --git a/test/c/test_encounter.c b/test/c/test_encounter.c index df41cdc..eec8a3f 100644 --- a/test/c/test_encounter.c +++ b/test/c/test_encounter.c @@ -66,7 +66,7 @@ void test_setEnemyHealth(void){ int health = 50, result; //act enemy test = {health*2}; - setEnemyHealth(&test.health, health); + setEnemyHealth(&test, health); result = test.health; //assert TEST_ASSERT_EQUAL(health, result); @@ -87,7 +87,7 @@ void test_setEnemyDamage(void){ int damage = 4, result; enemy test = {50, damage*2}; //act - setEnemyDamage(&test.damage, damage); + setEnemyDamage(&test, damage); result = test.damage; //assert TEST_ASSERT_EQUAL(damage, result); @@ -108,7 +108,7 @@ void test_get_setEnemyArmor(void){ int armor = 4, result; enemy test = {50, 4, armor*2}; //act - setEnemyArmor(&test.armor, armor); + setEnemyArmor(&test, armor); result = getEnemyArmor(&test); //assert TEST_ASSERT_EQUAL(armor, result);