diff options
| author | Tomas Chvatal <scarabeus@gentoo.org> | 2009-04-16 01:04:20 +0200 |
|---|---|---|
| committer | Tomas Chvatal <scarabeus@gentoo.org> | 2009-04-16 01:04:20 +0200 |
| commit | d902c78327acdc5ec4a35119be2eb92399fdb43d (patch) | |
| tree | beb666312726f0d3762e5b6aea2d1022265f040e /src | |
| parent | 75e3e2c04b1d2b324dc8d2314e570bcba215c93f (diff) | |
Revert "new path API ( need old path.h )"
This reverts commit 75e3e2c04b1d2b324dc8d2314e570bcba215c93f.
-- CZECH SECTION --
Dusane kdyz rikam ze to ma podporovat PREDEFINOVANI pomoci cmake promennejch jako to delalo tak to neznamena
ze danou cast kodu proste odstranis a cmake si to bude generovat do /dev/null
Tim commitem si rozbil vsechny architektury ktery nepouzivaj strukturu v jednom hlavnim adresari.
Gentoo, Slackware pro zacatek dalsi nevim.
Fakt to vubec nedelej takhle, je to zbytecna prace.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/audio/music.c | 7 | ||||
| -rw-r--r-- | src/base/arenaFile.c | 7 | ||||
| -rw-r--r-- | src/base/modules.c | 6 | ||||
| -rw-r--r-- | src/base/my_path.c | 110 | ||||
| -rw-r--r-- | src/base/my_path.h | 27 | ||||
| -rw-r--r-- | src/client/game.c | 7 | ||||
| -rw-r--r-- | src/client/image.c | 8 | ||||
| -rw-r--r-- | src/server/publicServer.c | 3 |
9 files changed, 15 insertions, 162 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f6a2d83..fed8130 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ SET ( SRC_base ${WORKDIR}/base/homeDirector ${WORKDIR}/base/proto ${WORKDIR}/base/shareFunction ${WORKDIR}/base/buffer ${WORKDIR}/base/archive ${WORKDIR}/base/downServer - ${WORKDIR}/base/my_path ${WORKDIR}/net/dns + ${WORKDIR}/net/dns ) SET ( SRC_client diff --git a/src/audio/music.c b/src/audio/music.c index 4e811e1..1b526c6 100644 --- a/src/audio/music.c +++ b/src/audio/music.c @@ -9,7 +9,6 @@ #include "interface.h" #include "audio.h" #include "music.h" -#include "my_path.h" static list_t *listStorage; @@ -59,7 +58,11 @@ static Mix_Music *loadMixMusic(char *file) DEBUG_MSG(_("Loading a file with music: %s\n"), file); - path_set_prefix(str, STR_PATH_SIZE, PATH_PREFIX_MUSIC, file); + if (isFillPath(file)) { + strcpy(str, file); + } else { + sprintf(str, PATH_MUSIC "%s", file); + } accessExistFile(str); diff --git a/src/base/arenaFile.c b/src/base/arenaFile.c index 36b172a..45ba4ac 100644 --- a/src/base/arenaFile.c +++ b/src/base/arenaFile.c @@ -16,7 +16,6 @@ #include "modules.h" #include "archive.h" #include "homeDirector.h" -#include "my_path.h" #ifndef PUBLIC_SERVER # include "configFile.h" @@ -372,17 +371,13 @@ static void load_arenaFromDirector(char *director) void arena_file_init() { - char path[STR_PATH_SIZE]; - #ifndef PUBLIC_SERVER assert(image_is_inicialized() == TRUE); #endif isArenaFileInit = TRUE; listArenaFile = list_new(); - path_set_prefix(path, STR_PATH_SIZE, PATH_PREFIX_ARENA, ""); - - load_arenaFromDirector(path); + load_arenaFromDirector(PATH_ARENA); #ifndef PUBLIC_SERVER load_arenaFromDirector(home_director_get()); diff --git a/src/base/modules.c b/src/base/modules.c index ea4d450..7b0b7c2 100644 --- a/src/base/modules.c +++ b/src/base/modules.c @@ -16,7 +16,6 @@ #include "arenaFile.h" #include "proto.h" #include "shareFunction.h" -#include "my_path.h" #ifndef PUBLIC_SERVER # include "interface.h" @@ -124,10 +123,7 @@ static void unmapImage(void *image) static void setModulePath(char *name, char *path) { - path_set_prefix(path, STR_PATH_SIZE, PATH_PREFIX_MODULE, name); - strcat(path, ".so"); - - //sprintf(path, PATH_MODULES "%s" MODULE_TYPE_UNIX, name); // linux + sprintf(path, PATH_MODULES "%s" MODULE_TYPE_UNIX, name); // linux #ifdef __WIN32__ sprintf(path, PATH_MODULES "%s" MODULE_TYPE_WIN, name); // windows #endif diff --git a/src/base/my_path.c b/src/base/my_path.c deleted file mode 100644 index 2cf25f8..0000000 --- a/src/base/my_path.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "main.h" -#include "homeDirector.h" -#include "textFile.h" -#include "path.h" -#include "my_path.h" - -static char *path_prefix; - -int path_init() -{ -#if 0 - char str[STR_PATH_SIZE]; - textFile_t *text_file; - - sprintf(str, "%s/path", home_director_get()); - - text_file = text_file_load(str); - - if( text_file == NULL ) - { - fprintf(stderr, "I dont load path\n"); - exit(-1); - } - - if( text_file->text->count == 0 ) - { - fprintf(stderr, "%s is empty\n", str); - exit(-1); - } - - path_prefix = strdup(text_file->text->list[0]); - - text_file_destroy(text_file); - -#endif - - path_prefix = malloc((strlen(PREFIX)+1)* sizeof(char)); - strcpy(path_prefix, PREFIX); - strcat(path_prefix, "/"); - - printf("use prefix:%s\n", path_prefix); - - return 0; -} - -char* path_get_prefix() -{ - return path_prefix; -} - -int path_set_prefix(char *path, int size, const char *subpath, const char *name) -{ - char *prefix; - char *slash; - int len; - - prefix = path_prefix; - -/* - printf("subpath = %s\n", subpath); - printf("name = %s\n", name); -*/ - if( isFillPath(name) ) - { - snprintf(path, size, "%s", name); - //printf("%s\n", path); - return 1; - } - - if( isFillPath(subpath) ) - { - snprintf(path, size, "%s", subpath); - //printf("%s\n", path); - return 1; - } - - len = strlen(subpath); - - slash = "/"; - - if( subpath[len-1] == '/' ) - { - slash = ""; - } - -/* - printf("slash = %s\n", slash); - printf("prefix = %s\n", prefix); -*/ - snprintf(path, size, "%s%s%s%s", prefix, subpath, slash, name); - //printf("file %s\n", path); - - return 1; -} - -int path_quit() -{ - if( path_prefix != NULL ) - { - free(path_prefix); - } - - return 0; -} diff --git a/src/base/my_path.h b/src/base/my_path.h deleted file mode 100644 index 18e2c92..0000000 --- a/src/base/my_path.h +++ /dev/null @@ -1,27 +0,0 @@ - -#ifndef MY_PATH_H - -#define MY_PATH_H - -#ifdef PUBLIC_SERVER -#define PATH_PREFIX "share/tuxanci-server" -#define PATH_PREFIX_MODULE "lib/tuxanci-server" -#endif - -#ifndef PUBLIC_SERVER -#define PATH_PREFIX "share/tuxanci" -#define PATH_PREFIX_MODULE "lib/tuxanci" -#endif - -#define PATH_PREFIX_IMAGE PATH_PREFIX "/images" -#define PATH_PREFIX_ARENA PATH_PREFIX "/arena" -#define PATH_PREFIX_MUSIC PATH_PREFIX "/music" -#define PATH_PREFIX_SOUND PATH_PREFIX "/sound" - -extern int path_init(); -extern char* path_get_prefix(); -extern int path_set_prefix(char *path, int size, const char *subpath, const char *name); -extern int path_quit(); - -#endif - diff --git a/src/client/game.c b/src/client/game.c index 42a5868..8e0c30a 100644 --- a/src/client/game.c +++ b/src/client/game.c @@ -14,7 +14,6 @@ #include "item.h" #include "shot.h" #include "arenaFile.h" -#include "my_path.h" #include "image.h" #include "layer.h" @@ -46,8 +45,7 @@ static void initGame() { home_director_create(); - - path_init(); + interface_init(); font_init(); layer_init(); @@ -79,7 +77,6 @@ static void initGame() void game_quit() { - interface_quit(); main_menu_quit(); @@ -109,8 +106,6 @@ void game_quit() audio_quit(); #endif - path_quit(); - DEBUG_MSG(_("Quitting TUXANCI...\n")); exit(0); diff --git a/src/client/image.c b/src/client/image.c index b17e471..fa34760 100644 --- a/src/client/image.c +++ b/src/client/image.c @@ -6,7 +6,6 @@ #include "main.h" #include "list.h" #include "storage.h" -#include "my_path.h" #include "interface.h" #include "image.h" @@ -40,7 +39,12 @@ static SDL_Surface *loadImage(const char *filename, int alpha) char str[STR_PATH_SIZE]; - path_set_prefix(str, STR_PATH_SIZE, PATH_PREFIX_IMAGE, filename); + + if (isFillPath(filename)) { + strcpy(str, filename); + } else { + sprintf(str, PATH_IMAGE "%s", filename); + } accessExistFile(str); diff --git a/src/server/publicServer.c b/src/server/publicServer.c index 8004e49..19e2f75 100644 --- a/src/server/publicServer.c +++ b/src/server/publicServer.c @@ -31,7 +31,6 @@ #include "proto.h" #include "modules.h" #include "net_multiplayer.h" -#include "my_path.h" #include "publicServer.h" #include "serverConfigFile.h" @@ -242,7 +241,6 @@ int public_server_init() int ret; int i; - path_init(); id_init_list(); module_init(); arena_file_init(); @@ -340,7 +338,6 @@ void public_server_quit() id_quit_list(); high_score_quit(); log_quit(); - path_quit(); exit(0); } |