cc65 -t c128 $<
ca65 -t c128 $$(basename $< .c).s
-all: config.o kasse.o
- cl65 -t c128 kasse.o config.o -o kasse
+all: config.o kasse.o credit_manager.o general.o
+ cl65 -t c128 *.o -o kasse
clean:
rm -rf *.o *.s
unsigned long int money = 0;
unsigned long int num_items = 0;
+uc num_credit_items = 0;
unsigned long int items_sold = 0;
struct status_t status[MAX_ITEMS+1];
+struct credits_t credits[MAX_CREDIT_ITEMS+1];
-void load_config();
+void load_config() {
+}
-void load_items(){
- char c;
- num_items=3;
+void load_items() {
+ uc c;
+ num_items=2;
status[0].item_name = "cola";
status[0].price = 230;
status[0].times_sold = 0;
status[c].item_name = NULL;
}
-void load_state(){
+
+void load_state() {
status[0].times_sold=23;
status[1].times_sold=42;
}
-void save_state(){}
+
+void load_credits() {
+}
+
+void save_state() {
+}
+
+void save_credits() {
+}
/* Eingenommes Geld in Cent */
extern unsigned long int money;
extern unsigned long int num_items;
+extern unsigned char num_credit_items;
extern unsigned long int items_sold;
/* Datenstruktur der verkauften Einträge */
struct status_t {
- char key;
char *item_name;
/* Wieviel kostet der Eintrag (in Cent)? */
unsigned int price;
#define MAX_ITEMS 15
extern struct status_t* status;
-// unklar bis jetzt was das tun wird
-void load_config();
+/* Datenstruktur für die Guthaben */
+struct credits_t {
+ char *nickname;
+ /* Guthaben (in Cent) */
+ unsigned int credit;
+};
+
+#define MAX_CREDIT_ITEMS 75
+extern struct credits_t *credits;
+/* Lädt Dinge wie die Druckeradresse */
+void load_config();
void load_items();
void load_state();
+void load_credits();
+
void save_state();
+void save_credits();
#endif /*CONFIG_H_*/
#include "general.h"
#include "config.h"
#include "kasse.h"
-// conf
+#include "credit_manager.h"
// drucker 4 oder 5
-// pricee+getraenke
-//
// graphic 4,0,10
printf("Eingenommen: %d Euro, Verkauft: %d Flaschen\n\n", money * 100, items_sold);
for (; i < num_items; ++i)
printf("Item %x: %s (%d Cents, %d mal verkauft)\n", i, status[i].item_name, status[i].price, status[i].times_sold);
- printf("\nBefehle: s) Save Data\tp) Toggle Printing\n");
+ printf("\nBefehle: s) Save Data p) Toggle Printing\n");
}
/* Druckt eine entsprechende Zeile aus */
c = getchar();
if (c == 13)
break;
- else if (c == 45 && i == 0)
+ else if (c == '-'&& i == 0)
negative = -1;
else if (c > 47 && c < 58)
entered[i++] = c;
int main() {
static uc c;
+ /* Konfigurationsdatei laden */
+ load_config();
+ /* Einträge (=Getränke) laden */
+
+ load_items();
+ /* Zustand laden */
+ load_state();
+ /* Guthaben laden */
+ load_credits();
while (1) {
/* Bildschirm anzeigen */
print_screen();
if (c > 47 && c < 58)
buy(c - 48);
else if (c == 's') {
+ /* Zustandsdatei schreiben */
save_state();
- printf("Statefile saved, press ANYKEY to continue...\n");
+ save_credits();
+ printf("Statefile/Creditfile saved, press ANYKEY to continue...\n");
getchar();
} else if (c == 'p') {
+ /* Drucken an- oder ausschalten */
printing = (printing == 1 ? 0 : 1);
printf("Printing is now %s, press ANYKEY to continue...\n", (printing == 1 ? "on" : "off"));
getchar();
+ } else if (c == 'g') {
+ /* Guthabenverwalter aufrufen */
+ credit_manager();
} else if (c == 'q')
break;
}