summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-17 13:12:28 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-17 13:12:28 +0000
commit727e15323c6f1a902495d9b155ddbdbfa95f2f46 (patch)
tree41d64011a95c659d7353f7f2a5cd86c1494261a5
parent7efb51e2cb64a417d9d18ba0064c84abad265dad (diff)
- maximalny pocet ID je 1 000 000
- maximalny pocet item sa nastavuje v configu MAX_ITEM ( parameter --max-item ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@152 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
-rw-r--r--CMakeLists.txt6
-rw-r--r--config.h2
-rw-r--r--data/conf/server.conf4
-rw-r--r--src/base/arenaFile.c5
-rw-r--r--src/base/idManager.c6
-rw-r--r--src/base/idManager.h2
-rw-r--r--src/base/item.c8
-rw-r--r--src/base/proto.c1
-rw-r--r--src/base/shot.c10
-rw-r--r--src/client/chat.c32
-rw-r--r--src/server/heightScore.c2
-rw-r--r--src/server/publicServer.c2
-rw-r--r--src/server/publicServer.h1
-rw-r--r--src/widget/widget_textfield.c37
14 files changed, 97 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1e5322..1710553 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,8 +70,8 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# nazev projektu
PROJECT ( tuxanci )
IF ( Debug )
- SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -pipe")
- SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -pipe")
+ SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -Wall -pipe")
+ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -pipe")
SET ( CMAKE_VERBOSE_MAKEFILE on )
ENDIF ( Debug)
MESSAGE ( "EXTRA Cflags:${CMAKE_C_FLAGS}" )
@@ -132,4 +132,4 @@ CONFIGURE_FILE(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
-ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") \ No newline at end of file
+ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
diff --git a/config.h b/config.h
index 5308a87..dfeccd6 100644
--- a/config.h
+++ b/config.h
@@ -1 +1 @@
-#define TUXANCI_NG_VERSION "svn151"
+#define TUXANCI_NG_VERSION "svn152"
diff --git a/data/conf/server.conf b/data/conf/server.conf
index e34a73b..45ac0f4 100644
--- a/data/conf/server.conf
+++ b/data/conf/server.conf
@@ -5,3 +5,7 @@ PORTv4 2200
#PORTv6 2206
MAX_CLIENTS 32
ARENA BAIACO8B
+
+ITEM 10
+MAX_ITEM 10
+
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;
}