summary refs log tree commit diff
path: root/freecell.c
diff options
context:
space:
mode:
Diffstat (limited to 'freecell.c')
-rw-r--r--freecell.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/freecell.c b/freecell.c
index 2d1b97c..39bdb12 100644
--- a/freecell.c
+++ b/freecell.c
@@ -20,9 +20,9 @@
 #include <stdlib.h>
 #include <time.h>
 
+#include "asset.h"
 #include "cards.h"
 #include "layout.h"
-#include "path.h"
 #include "stack.h"
 
 #define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
@@ -360,11 +360,8 @@ int main(void) {
 	if (SDL_Init(SDL_INIT_VIDEO) < 0) err("SDL_Init");
 	atexit(SDL_Quit);
 
-	char *basePath = SDL_GetBasePath();
-	if (!basePath) err("SDL_GetBasePath");
-
-	char *prefPath = SDL_GetPrefPath("Causal Agency", "Cards");
-	if (!prefPath) err("SDL_GetPrefPath");
+	struct Paths paths;
+	if (assetPaths(&paths) < 0) err("SDL_GetPrefPath");
 
 	bool kings = false;
 	struct {
@@ -372,7 +369,7 @@ int main(void) {
 		SDL_Surface *kings[Cards_FreeCellCount];
 	} surfaces;
 
-	SDL_RWops *rw = pathCards(basePath, prefPath);
+	SDL_RWops *rw = assetOpenCards(&paths);
 	if (!rw) return EXIT_FAILURE;
 	int error = Cards_LoadCards(
 		surfaces.cards, Cards_Empty,
@@ -381,7 +378,7 @@ int main(void) {
 	if (error) err("Cards_LoadCards");
 	SDL_RWclose(rw);
 
-	rw = pathFreeCell(basePath, prefPath);
+	rw = assetOpenFreeCell(&paths);
 	if (rw) {
 		kings = true;
 		int error = Cards_LoadFreeCell(