diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/base/arenaFile.c | 5 | ||||
| -rw-r--r-- | src/base/idManager.c | 6 | ||||
| -rw-r--r-- | src/base/idManager.h | 2 | ||||
| -rw-r--r-- | src/base/item.c | 8 | ||||
| -rw-r--r-- | src/base/proto.c | 1 | ||||
| -rw-r--r-- | src/base/shot.c | 10 | ||||
| -rw-r--r-- | src/client/chat.c | 32 | ||||
| -rw-r--r-- | src/server/heightScore.c | 2 | ||||
| -rw-r--r-- | src/server/publicServer.c | 2 | ||||
| -rw-r--r-- | src/server/publicServer.h | 1 | ||||
| -rw-r--r-- | src/widget/widget_textfield.c | 37 |
11 files changed, 89 insertions, 17 deletions
diff --git a/src/base/arenaFile.c b/src/base/arenaFile.c index f64cc1c..06aaa50 100644 --- a/src/base/arenaFile.c +++ b/src/base/arenaFile.c @@ -238,8 +238,9 @@ void initArenaFile() isArenaFileInit = TRUE; listArenaFile = newList(); + p = loadDirector(PATH_ARENA); - printf ("Pocet aren: %d\n", p->list->count); + for( i = 0 ; i < p->list->count ; i++ ) { char *line; @@ -259,6 +260,8 @@ void initArenaFile() } } + printf("pocet aren: %d\n", listArenaFile->count); + destroyDirector(p); } diff --git a/src/base/idManager.c b/src/base/idManager.c index ee77239..b4217ae 100644 --- a/src/base/idManager.c +++ b/src/base/idManager.c @@ -68,6 +68,11 @@ static int findNewID() assert( listID != NULL ); + if( listID->count >= MAX_ID-1 ) + { + assert( ! "ziaden ID uz nie je volny !" ); + } + do{ ret = random() % MAX_ID; @@ -138,6 +143,7 @@ void delID(int id) if( this->count <= 0 ) { delListItem(listID, index, free); + //printf("listID->count = %d\n", listID->count); } return; diff --git a/src/base/idManager.h b/src/base/idManager.h index cdd51e9..c80ff7c 100644 --- a/src/base/idManager.h +++ b/src/base/idManager.h @@ -4,7 +4,7 @@ #define ID_MANAGER_H -#define MAX_ID 1000 +#define MAX_ID 1000000 #define ID_UNKNOWN -1 #ifdef __WIN32__ diff --git a/src/base/item.c b/src/base/item.c index d5ca081..ef83066 100644 --- a/src/base/item.c +++ b/src/base/item.c @@ -29,6 +29,7 @@ #ifdef PUBLIC_SERVER #include "publicServer.h" +#include "publicServer.h" #endif #ifndef PUBLIC_SERVER @@ -173,6 +174,13 @@ void addNewItem(space_t *spaceItem, int author_id) int new_x, new_y; int type; +#ifdef PUBLIC_SERVER + if( spaceItem->list->count >= atoi( getSetting("MAX_ITEM", "--max-item", "100") ) ) + { + return; + } +#endif + #ifndef PUBLIC_SERVER if( isSettingAnyItem() == FALSE || getNetTypeGame() == NET_GAME_TYPE_CLIENT ) diff --git a/src/base/proto.c b/src/base/proto.c index 1de5ad4..6d4c2f2 100644 --- a/src/base/proto.c +++ b/src/base/proto.c @@ -676,7 +676,6 @@ void proto_recv_shot_client(char *msg) sscanf(msg, "%s %d %d %d %d %d %d %d %d %d", cmd, &shot_id, &x, &y, &px, &py, &position, &gun, &author_id, &isCanKillAuthor); - if( ( shot = getObjectFromSpaceWithID(getCurrentArena()->spaceShot, shot_id) ) != NULL ) { delObjectFromSpaceWithObject(getCurrentArena()->spaceShot, shot, destroyShot); diff --git a/src/base/shot.c b/src/base/shot.c index 1b657c2..c631a26 100644 --- a/src/base/shot.c +++ b/src/base/shot.c @@ -70,11 +70,6 @@ shot_t* newShot(int x,int y, int px, int py, int gun, int author_id) new->gun = gun; new->author_id = author_id; - if( author_id != ID_UNKNOWN ) - { - incID(author_id); - } - new->position = POSITION_UNKNOWN; author = getObjectFromSpaceWithID(getCurrentArena()->spaceTux, author_id); @@ -363,11 +358,6 @@ void destroyShot(shot_t *p) delID(p->id); - if( p->author_id != ID_UNKNOWN ) - { - delID(p->author_id); - } - free(p); } diff --git a/src/client/chat.c b/src/client/chat.c index b599853..bad3826 100644 --- a/src/client/chat.c +++ b/src/client/chat.c @@ -91,6 +91,22 @@ static void readKey() int len; int i; + const int len_shift_map = 20; + + char shift_map[] = + { + '-', '_', + '=', '+', + '[', '{', + ']', '}', + ';', ':', + '/', '\"', + '\\', '|', + ',', '<', + '.', '>', + '/', '?' + }; + if (line_atime < 100) line_atime ++; @@ -149,6 +165,22 @@ static void readKey() if( mapa[SDLK_LSHIFT] == SDL_PRESSED || mapa[SDLK_RSHIFT] == SDL_PRESSED) { + int i; + + for( i = 0 ; i < len_shift_map ; i+= 2 ) + { + if( c == shift_map[i] ) + { + line[len] = shift_map[i+1]; + } + } + + return; + } + + if( mapa[SDLK_LSHIFT] == SDL_PRESSED || + mapa[SDLK_RSHIFT] == SDL_PRESSED) + { line[len] -= 32; } diff --git a/src/server/heightScore.c b/src/server/heightScore.c index a236439..aebe4f2 100644 --- a/src/server/heightScore.c +++ b/src/server/heightScore.c @@ -67,7 +67,7 @@ int addPlayerInHighScore(char *name, int score) sprintf(new, "%s %d", name, score); insList(textFile->text, i, strdup(new) ); delListItem(textFile->text, HEIGHTSCORE_MAX_PLAYERS, free); - printTextFile(textFile); + //printTextFile(textFile); saveTextFile(textFile); return 0; diff --git a/src/server/publicServer.c b/src/server/publicServer.c index 315fdd2..e3c0212 100644 --- a/src/server/publicServer.c +++ b/src/server/publicServer.c @@ -54,7 +54,7 @@ void countRoundInc() { } -static char *getSetting(char *env, char *param, char *default_val) +char *getSetting(char *env, char *param, char *default_val) { return getParamElse(param, getServerConfigFileValue(env, default_val) ); } diff --git a/src/server/publicServer.h b/src/server/publicServer.h index 7fb22da..c8ab7f4 100644 --- a/src/server/publicServer.h +++ b/src/server/publicServer.h @@ -7,6 +7,7 @@ #define WORLD_COUNT_ROUND_UNLIMITED -1 +extern char *getSetting(char *env, char *param, char *default_val); extern void countRoundInc(); extern int initPublicServer(); extern int getChoiceArenaId(); diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c index 8dd68f6..2a8a02c 100644 --- a/src/widget/widget_textfield.c +++ b/src/widget/widget_textfield.c @@ -128,7 +128,7 @@ static void checkText(widget_textfield_t *p) if( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || - c == '-' ) + ( c == '_' || c == '-' ) ) { isDel = FALSE; } @@ -302,6 +302,22 @@ static void readKey(widget_textfield_t *p) int len; int i; + const int len_shift_map = 20; + + char shift_map[] = + { + '-', '_', + '=', '+', + '[', '{', + ']', '}', + ';', ':', + '/', '\"', + '\\', '|', + ',', '<', + '.', '>', + '/', '?' + }; + if( p->active == FALSE ) { return; @@ -321,7 +337,7 @@ static void readKey(widget_textfield_t *p) char c = '\0'; if( name == NULL )continue; - printf("name %s\n", name); + //printf("name %s\n", name); if( strlen(name) == 1 )c = name[0]; if( strlen(name) == 3 )c = name[1]; @@ -365,6 +381,23 @@ static void readKey(widget_textfield_t *p) if( mapa[SDLK_LSHIFT] == SDL_PRESSED || mapa[SDLK_RSHIFT] == SDL_PRESSED) { + int i; + + for( i = 0 ; i < len_shift_map ; i+= 2 ) + { + if( c == shift_map[i] ) + { + p->text[len] = shift_map[i+1]; + } + } + + checkText(p); + return; + } + + if( mapa[SDLK_LSHIFT] == SDL_PRESSED || + mapa[SDLK_RSHIFT] == SDL_PRESSED) + { p->text[len] -= 32; } |