[teeworlds] couple of updates/fixes

  • From: Tom Adams <Tom_Adams@xxxxxx>
  • To: teeworlds@xxxxxxxxxxxxx
  • Date: Sat, 18 Jul 2009 14:46:45 +0200

Hi,

here are some small patches for the trunk 0.5 version r1984.

1.
Ticket #711: GUI lock when selecting a region while another refreshes

Description:
It occurs if an entry within the server browser list is selected while it's 
refreshing. If that one gets out of the view before the mouse button is 
released, it won't change its status from "active_item" to "hot_item", cause 
the function aborts before. 
Fixed by waiting till the selected "active_item" becomes a "hot_item".

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/menus_browser.cpp gui 
lock #711/trunk/src/game/client/components/menus_browser.cpp
--- trunk r1984/trunk/src/game/client/components/menus_browser.cpp      
2009-06-15 09:46:24.000000000 +0200
+++ gui lock #711/trunk/src/game/client/components/menus_browser.cpp    
2009-07-17 20:33:50.000000000 +0200
@@ -213,7 +213,7 @@
                }
                
                // check if we need to do more
-               if(row.y > original_view.y+original_view.h)
+               if(row.y > original_view.y+original_view.h && !ui_active_item())
                        break;
 
                for(int c = 0; c < num_cols; c++)


------------------------------------------------
------------------------------------------------

2.
Ticket #723: When round is reset pickups are reset before players

Description:
There is no check if the picking player is alive or not. Added it.

Patch:
diff -Nru trunk r1984/trunk/src/game/server/entities/pickup.cpp pickup reset 
#723/trunk/src/game/server/entities/pickup.cpp
--- trunk r1984/trunk/src/game/server/entities/pickup.cpp       2008-10-08 
18:36:50.000000000 +0200
+++ pickup reset #723/trunk/src/game/server/entities/pickup.cpp 2009-07-18 
00:12:39.000000000 +0200
@@ -45,7 +45,7 @@
        }
        // Check if a player intersected us
        CHARACTER *chr = game.world.closest_character(pos, 20.0f, 0);
-       if(chr)
+       if(chr && chr->alive)
        {
                // player picked us up, is someone was hooking us, let them go
                int respawntime = -1;


------------------------------------------------
------------------------------------------------

3.
Ticket #440: ui_scale is not affected on server's name

Description:
The server names in the server browser list aren'T scaled by the variable 
"ui_scale".

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/menus_browser.cpp 
ui_scale server name #440/trunk/src/game/client/components/menus_browser.cpp
--- trunk r1984/trunk/src/game/client/components/menus_browser.cpp      
2009-06-15 09:46:24.000000000 +0200
+++ ui_scale server name 
#440/trunk/src/game/client/components/menus_browser.cpp        2009-07-18 
00:00:10.000000000 +0200
@@ -255,7 +255,7 @@
                        else if(id == COL_NAME)
                        {
                                TEXT_CURSOR cursor;
-                               gfx_text_set_cursor(&cursor, button.x, 
button.y, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
+                               gfx_text_set_cursor(&cursor, button.x, 
button.y, 12.0f * ui_scale(), TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
                                cursor.line_width = button.w;
                                
                                if(config.b_filter_string[0] && 
(item->quicksearch_hit&BROWSEQUICK_SERVERNAME))


------------------------------------------------
------------------------------------------------

4.
Ticket #670: double clicking in the demo menu should start the demo

Description:
Starts playing a demo from the demo-list with a double click.

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/menus_demo.cpp double 
click starts demo #670/trunk/src/game/client/components/menus_demo.cpp
--- trunk r1984/trunk/src/game/client/components/menus_demo.cpp 2009-06-15 
14:01:36.000000000 +0200
+++ double click starts demo 
#670/trunk/src/game/client/components/menus_demo.cpp       2009-07-17 
23:30:32.000000000 +0200
@@ -373,6 +373,12 @@
                        ui_do_label(&item.rect, r.front().name, 
item.rect.h*fontmod_height, -1);
        }
        selected_item = ui_do_listbox_end();
+
+       if(selected_item >= 0 && selected_item < num_demos && 
inp_mouse_doubleclick())
+       {
+               ui_set_active_item(0);
+               client_demoplayer_play(demos[selected_item].filename);
+       }
        
        RECT refresh_rect, play_rect;
        ui_vsplit_r(&buttonbar, 250.0f, &buttonbar, &refresh_rect);



------------------------------------------------
------------------------------------------------

5.
Ticket #712: Add a clear button next to the quick search

Description:
Added a clear button to the quick search fild in the server browser.

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/menus_browser.cpp clear 
button in server browser #712/trunk/src/game/client/components/menus_browser.cpp
--- trunk r1984/trunk/src/game/client/components/menus_browser.cpp      
2009-06-15 09:46:24.000000000 +0200
+++ clear button in server browser 
#712/trunk/src/game/client/components/menus_browser.cpp      2009-07-18 
11:59:11.000000000 +0200
@@ -321,13 +321,18 @@
        ui_margin(&status, 5.0f, &status);
        
        // render quick search
-       RECT quicksearch;
+       RECT quicksearch, button;
        ui_vsplit_l(&status, 250.0f, &quicksearch, &status);
        const char *label = localize("Quick search");
        ui_do_label(&quicksearch, label, 14.0f, -1);
        ui_vsplit_l(&quicksearch, gfx_text_width(0, 14.0f, label, -1), 0, 
&quicksearch);
        ui_vsplit_l(&quicksearch, 5, 0, &quicksearch);
        ui_do_edit_box(&config.b_filter_string, &quicksearch, 
config.b_filter_string, sizeof(config.b_filter_string), 14.0f);
+       ui_vsplit_l(&quicksearch, 135.0f, &quicksearch, &button);
+       ui_vmargin(&button, 0.0f, &button);
+       static int clear_button = 0;
+       if(ui_do_button(&clear_button, "x", 0, &button, ui_draw_menu_button, 0))
+               config.b_filter_string[0] = 0;
        
        // render status
        char buf[128];


------------------------------------------------
------------------------------------------------

6.
Ticket #713: Remember last tab active between Filter and Serverinfo tab

Description:
Remembers the last active tab of the toolbox in the server browser. Stores it 
in the config variable "ui_toolbox_page".

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/menus_browser.cpp 
remember last toolbox page 
#713/trunk/src/game/client/components/menus_browser.cpp
--- trunk r1984/trunk/src/game/client/components/menus_browser.cpp      
2009-06-15 09:46:24.000000000 +0200
+++ remember last toolbox page 
#713/trunk/src/game/client/components/menus_browser.cpp  2009-07-17 
20:38:22.000000000 +0200
@@ -563,7 +563,7 @@
 
        render_serverbrowser_serverlist(view);
        
-       static int toolbox_page = 0;
+       int toolbox_page = config.ui_toolbox_page;
        
        ui_vsplit_l(&toolbox, 5.0f, 0, &toolbox);
 
@@ -586,6 +586,8 @@
                        toolbox_page = 1;
        }
 
+       config.ui_toolbox_page = toolbox_page;
+
        ui_draw_rect(&toolbox, vec4(0,0,0,0.15f), 0, 0);
        
        ui_hsplit_t(&toolbox, 5.0f, 0, &toolbox);
diff -Nru trunk r1984/trunk/src/game/variables.hpp remember last toolbox page 
#713/trunk/src/game/variables.hpp
--- trunk r1984/trunk/src/game/variables.hpp    2009-06-15 08:15:52.000000000 
+0200
+++ remember last toolbox page #713/trunk/src/game/variables.hpp        
2009-07-17 20:38:54.000000000 +0200
@@ -35,6 +35,7 @@
 MACRO_CONFIG_STR(player_skin, 64, "default", CFGFLAG_CLIENT|CFGFLAG_SAVE, 
"Player skin")
 
 MACRO_CONFIG_INT(ui_page, 5, 0, 9, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface 
page")
+MACRO_CONFIG_INT(ui_toolbox_page, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, 
"Toolbox page")
 MACRO_CONFIG_STR(ui_server_address, 128, "localhost:8303", 
CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address")
 MACRO_CONFIG_INT(ui_scale, 100, 1, 100000, CFGFLAG_CLIENT|CFGFLAG_SAVE, 
"Interface scale")

 
------------------------------------------------
------------------------------------------------

7.
Ticket #721: Impersonating to make someone else kicked

Description:
Based on the fact that the server stores the player names within 32 Bytes and 
the client in 24 Bytes. So the client doesn't see if 2 names differ within the 
characters 24-31.
Fixed by trimming the names always to the clients largest possible length (23).

Patch:
diff -Nru trunk r1984/trunk/src/engine/server/es_server.c trim player nicks 
#721/trunk/src/engine/server/es_server.c
--- trunk r1984/trunk/src/engine/server/es_server.c     2009-06-15 
13:04:34.000000000 +0200
+++ trim player nicks #721/trunk/src/engine/server/es_server.c  2009-07-17 
21:25:52.000000000 +0200
@@ -221,12 +221,13 @@
 
 static void str_rtrim(char *str)
 {
-       int i = str_length(str);
+       int i = str_length(str) - 1;
        while(i >= 0)
        {
-               if(str[i] > 32)
+               if(i > 23 || str[i] <= 32)
+                       str[i] = 0;
+               else
                        break;
-               str[i] = 0;
                i--;
        }
 }


------------------------------------------------
------------------------------------------------

8.
Ticket #719: The wrong player can be kicked/banned

Description:
The "abort_vote_kick_on_disconnect"-function didn't consider that a vote-kick 
bans a player if config.sv_vote_kick_bantime is set.

Patch:
diff -Nru trunk r1984/trunk/src/game/server/gamecontext.cpp abort vote kick on 
leave #719/trunk/src/game/server/gamecontext.cpp
--- trunk r1984/trunk/src/game/server/gamecontext.cpp   2009-06-15 
13:01:04.000000000 +0200
+++ abort vote kick on leave #719/trunk/src/game/server/gamecontext.cpp 
2009-07-18 00:42:49.000000000 +0200
@@ -307,7 +307,8 @@
 
 void GAMECONTEXT::abort_vote_kick_on_disconnect(int client_id)
 {
-       if(vote_closetime && !strncmp(vote_command, "kick ", 5) && 
atoi(&vote_command[5]) == client_id)
+       if(vote_closetime && ((!strncmp(vote_command, "kick ", 5) && 
atoi(&vote_command[5]) == client_id) ||
+         (!strncmp(vote_command, "ban ", 4) && atoi(&vote_command[4]) == 
client_id)))
                vote_closetime = -1;
 }
 
diff -Nru trunk r1984/trunk/src/game/server/hooks.cpp abort vote kick on leave 
#719/trunk/src/game/server/hooks.cpp
--- trunk r1984/trunk/src/game/server/hooks.cpp 2009-01-25 13:25:52.000000000 
+0100
+++ abort vote kick on leave #719/trunk/src/game/server/hooks.cpp       
2009-07-18 00:42:01.000000000 +0200
@@ -259,7 +259,6 @@
                        
                        str_format(chatmsg, sizeof(chatmsg), "%s called for 
vote to kick '%s'", server_clientname(client_id), server_clientname(kick_id));
                        str_format(desc, sizeof(desc), "Kick '%s'", 
server_clientname(kick_id));
-                       str_format(cmd, sizeof(cmd), "kick %d", kick_id);
                        if (!config.sv_vote_kick_bantime)
                                str_format(cmd, sizeof(cmd), "kick %d", 
kick_id);
                        else


------------------------------------------------
------------------------------------------------

9.
Ticket #714: Support bans in server configuration


Description:
When the server processes the server config, the netserver "net" isn't 
initialized yet. So adding bans wouldn't work/crash the server.
Fixed by storing the ban addresses in a temporary list and adding them later, 
when the net server ist active.

Patch:
diff -Nru trunk r1984/trunk/src/engine/server/es_server.c support bans in 
server config #714/trunk/src/engine/server/es_server.c
--- trunk r1984/trunk/src/engine/server/es_server.c     2009-06-15 
13:04:34.000000000 +0200
+++ support bans in server config #714/trunk/src/engine/server/es_server.c      
2009-07-18 02:11:26.000000000 +0200
@@ -58,6 +58,15 @@
        int timeout;
 } SNAP_ID;
 
+struct BAN_ITEM
+{
+       NETADDR addr;
+       int seconds;
+       struct BAN_ITEM *next;
+};
+
+struct BAN_ITEM *ban_init_list;
+
 static const int MAX_IDS = 16*1024; /* should be lowered */
 static SNAP_ID snap_ids[16*1024];
 static int snap_first_free_id;
@@ -863,9 +872,35 @@
        }
 }
 
+static void server_init_bans()
+{
+       struct BAN_ITEM *item;
+
+       while(ban_init_list)
+       {
+               //      add item to ban list
+               server_ban_add(ban_init_list->addr, ban_init_list->seconds);
+
+               item = ban_init_list;
+               ban_init_list = ban_init_list->next;
+
+               //      delete item
+               free(item);
+       }
+}
 
 int server_ban_add(NETADDR addr, int seconds)
 {
+       if(!net)
+       {
+               struct BAN_ITEM *item = (struct BAN_ITEM *)malloc(sizeof(struct 
BAN_ITEM));
+               item->addr = addr;
+               item->seconds = seconds;
+               item->next = !ban_init_list ? 0 : ban_init_list;
+               ban_init_list = item;
+
+               return -1;
+       }
        return netserver_ban_add(net, addr, seconds);   
 }
 
@@ -1058,6 +1093,8 @@
        mods_init();
        dbg_msg("server", "version %s", mods_net_version());
 
+       server_init_bans();
+
        /* start game */
        {
                int64 reporttime = time_get();


------------------------------------------------
------------------------------------------------

10.
Ticket #572: walk animation should be reworked

Description:
The tee's feet aren't resetted when it doesn't move.
Because of roundings etc. the players velocity becomes a value of 1 even if it 
doesn't move. Fixed by regarding this.

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/players.cpp 
../../../../../sdc1/diff/reset walk animation 
#572/trunk/src/game/client/components/players.cpp
--- trunk r1984/trunk/src/game/client/components/players.cpp    2009-05-27 
16:51:24.000000000 +0200
+++ ../../../../../sdc1/diff/reset walk animation 
#572/trunk/src/game/client/components/players.cpp     2009-07-18 
11:31:37.000000000 +0200
@@ -191,7 +191,7 @@
        if(prev.health < 0) // Don't flicker from previous position
                position = vec2(player.x, player.y);
 
-       bool stationary = player.vx < 1 && player.vx > -1;
+       bool stationary = player.vx <= 1 && player.vx >= -1;
        bool inair = col_check_point(player.x, player.y+16) == 0;
        bool want_other_dir = (player.direction == -1 && vel.x > 0) || 
(player.direction == 1 && vel.x < 0);
 

------------------------------------------------
------------------------------------------------

11.
Ticket #620: weapon switch on start bug

Description:
The clients "wanted_weapon" variable always keeps its last value. So when the 
player dies and respawns it will send the old "wanted_weapon" value.
Fixed by setting its value to 0 (no-change), after the corresponding button got 
released.

Patch:
diff -Nru trunk r1984/trunk/src/game/client/components/controls.cpp weapon 
switch on start #620/trunk/src/game/client/components/controls.cpp
--- trunk r1984/trunk/src/game/client/components/controls.cpp   2009-06-07 
14:36:54.000000000 +0200
+++ weapon switch on start #620/trunk/src/game/client/components/controls.cpp   
2009-07-17 16:59:22.000000000 +0200
@@ -35,8 +35,7 @@
 static void con_key_input_set(void *result, void *user_data)
 {
        INPUTSET *set = (INPUTSET *)user_data;
-       if(console_arg_int(result, 0))
-               *set->variable = set->value;
+       *set->variable = console_arg_int(result, 0) ? *set->variable = 
set->value : 0;
 }
 
 static void con_key_input_nextprev_weapon(void *result, void *user_data)


------------------------------------------------
------------------------------------------------

12.
Ticket #677: Fix messages on teamchange

Description:
There is no unnecessary message anymore, when a player wants to join his own 
team in a team-based game.

Patch:
diff -Nru trunk r1984/trunk/src/game/server/hooks.cpp teamchange message 
#677/trunk/src/game/server/hooks.cpp
--- trunk r1984/trunk/src/game/server/hooks.cpp 2009-01-25 13:25:52.000000000 
+0100
+++ teamchange message #677/trunk/src/game/server/hooks.cpp     2009-07-17 
17:12:53.000000000 +0200
@@ -292,7 +292,7 @@
        {
                NETMSG_CL_SETTEAM *msg = (NETMSG_CL_SETTEAM *)rawmsg;
                
-               if(config.sv_spamprotection && p->last_setteam+time_freq()*3 > 
time_get())
+               if(p->team == msg->team || config.sv_spamprotection && 
p->last_setteam+time_freq()*3 > time_get())
                        return;
 
                // Switch team on given client and kill/respawn him


------------------------------------------------
------------------------------------------------

13.
Ticket #659: Move explosions to front layer

Description:
Moved the explosions in front of the terrain layers.

Patch:
diff -Nru trunk r1984/trunk/src/game/client/gameclient.cpp move explosion to 
front layer #659/trunk/src/game/client/gameclient.cpp
--- trunk r1984/trunk/src/game/client/gameclient.cpp    2009-06-15 
14:01:36.000000000 +0200
+++ move explosion to front layer #659/trunk/src/game/client/gameclient.cpp     
2009-07-18 02:54:49.000000000 +0200
@@ -200,10 +200,10 @@
        
        all.add(&maplayers_background); // first to render
        all.add(&particles->render_trail);
-       all.add(&particles->render_explosions);
        all.add(&items);
        all.add(&players);
        all.add(&maplayers_foreground);
+       all.add(&particles->render_explosions);
        all.add(&nameplates);
        all.add(&particles->render_general);
        all.add(damageind);


------------------------------------------------
------------------------------------------------

kind regards,

Oy
________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/


Other related posts: