From c68df329f2483d8fc9b75488c695787cd18c20a4 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 16 Aug 2008 21:00:29 +0000 Subject: - vsetky widegety pouzivaju widget_t ( priparava na kontajner s widgetmi ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@201 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/client/keyboardBuffer.c | 6 +++--- src/client/keyboardBuffer.h | 14 +++++++------- src/client/saveDialog.c | 15 ++++++++------- src/client/saveLoad.c | 10 +++++++++- 4 files changed, 27 insertions(+), 18 deletions(-) (limited to 'src/client') diff --git a/src/client/keyboardBuffer.c b/src/client/keyboardBuffer.c index 29cd9d4..1eb1ff2 100644 --- a/src/client/keyboardBuffer.c +++ b/src/client/keyboardBuffer.c @@ -21,7 +21,7 @@ static SDL_keysym emptyKey; /* * Inicializuje klavesovy buffer. Parametr udava pocet klaves. */ -void initKeyboardBuffer(uint32_t size){ +void initKeyboardBuffer(int size){ assert(size>0); assert(keyboardBuffer==NULL); @@ -103,7 +103,7 @@ SDL_keysym popKeyFromKeyboardBuffer(){ /* * Velikost bufferu. */ -uint32_t getKeyboardBufferSize(){ +int getKeyboardBufferSize(){ assert(keyboardBuffer!=NULL); return keyboardBuffer->size; } @@ -111,7 +111,7 @@ uint32_t getKeyboardBufferSize(){ /* * Pocet klaves v bufferu. */ -uint32_t KeyboardBufferCount(){ +int KeyboardBufferCount(){ assert(keyboardBuffer!=NULL); return keyboardBuffer->count; } diff --git a/src/client/keyboardBuffer.h b/src/client/keyboardBuffer.h index 13b1183..911eca7 100644 --- a/src/client/keyboardBuffer.h +++ b/src/client/keyboardBuffer.h @@ -16,18 +16,18 @@ typedef struct { SDL_keysym *buff; /* buffer klaves (kod dle SDLKey enumu) */ - uint32_t size; /* aktualni velikost alokovaneho bufferu (v poctu uchovatelnych klaves) */ - uint32_t count; /* pocet klaves aktualne v bufferu */ - uint32_t begin; /* ukazatel na zacatek bufferu (tj. kam se pridavaji klavesy) */ - uint32_t end; /* ukazatel na konec bufferu (tj. odkud se odebiraji klavesy) */ + int size; /* aktualni velikost alokovaneho bufferu (v poctu uchovatelnych klaves) */ + int count; /* pocet klaves aktualne v bufferu */ + int begin; /* ukazatel na zacatek bufferu (tj. kam se pridavaji klavesy) */ + int end; /* ukazatel na konec bufferu (tj. odkud se odebiraji klavesy) */ } keyboardBuffer_t; -extern void initKeyboardBuffer(uint32_t size); +extern void initKeyboardBuffer(int size); extern void clearKeyboardBuffer(); extern bool_t pushKeyToKeyboardBuffer(SDL_keysym key); extern SDL_keysym popKeyFromKeyboardBuffer(); -extern uint32_t getKeyboardBufferSize(); -extern uint32_t KeyboardBufferCount(); +extern int getKeyboardBufferSize(); +extern int KeyboardBufferCount(); extern bool_t isAnyKeyInKeyboardBuffer(); extern void quitKeyboardBuffer(); diff --git a/src/client/saveDialog.c b/src/client/saveDialog.c index 0595d1e..462c219 100644 --- a/src/client/saveDialog.c +++ b/src/client/saveDialog.c @@ -16,6 +16,7 @@ #include "font.h" #include "saveLoad.h" +#include "widget.h" #include "widget_label.h" #include "widget_button.h" #include "widget_textfield.h" @@ -24,11 +25,11 @@ static image_t *g_background; static bool_t activeSaveDialog; static my_time_t lastActive; -static widget_label_t *widgetLabelMsg; -static widget_textfield_t *widgetTextFieldName; +static widget_t *widgetLabelMsg; +static widget_t *widgetTextFieldName; -static widget_button_t *widgetButtonSave; -static widget_button_t *widgetButtonBack; +static widget_t *widgetButtonSave; +static widget_t *widgetButtonBack; static void switchTerm() { @@ -44,13 +45,13 @@ static void switchTerm() static void eventWidget(void *p) { - widget_button_t *button; + widget_t *button; - button = (widget_button_t *)p; + button = (widget_t *)p; if( button == widgetButtonSave ) { - saveArena(widgetTextFieldName->text, getCurrentArena()); + saveArena(getTextFromWidgetTextfield(widgetTextFieldName), getCurrentArena()); switchTerm(); } diff --git a/src/client/saveLoad.c b/src/client/saveLoad.c index a31bc64..475613d 100644 --- a/src/client/saveLoad.c +++ b/src/client/saveLoad.c @@ -12,6 +12,7 @@ #include "tux.h" #include "shot.h" #include "item.h" +#include "modules.h" #include "saveLoad.h" @@ -104,8 +105,9 @@ static arena_t* loadArenaFromLine(char *line) sscanf(line, "%s %s %d %d", cmd, name, &countRound, &max_countRound); setWorldArena( getArenaIdFormNetName(name) ); - setMaxCountRound(max_countRound); + arena = getCurrentArena(); + arena->max_countRound = max_countRound; arena->countRound = countRound; return arena; @@ -141,6 +143,12 @@ static void loadTuxFromLine(char *line, arena_t *arena) setControlTux(tux, TUX_CONTROL_KEYBOARD_LEFT); } + if( tux->control == TUX_CONTROL_AI ) + { + loadModule("libmodAI"); + setControlTux(tux, TUX_CONTROL_KEYBOARD_LEFT); + } + moveObjectInSpace(arena->spaceTux, tux, x, y); tux->status = status; tux->position = position; -- cgit v1.2.3