rust/hedgewars-server/src/server/handlers/inroom.rs
changeset 14692 5122c584804e
parent 14691 9f98086de1b6
child 14693 4569d8d50286
--- a/rust/hedgewars-server/src/server/handlers/inroom.rs	Wed Feb 06 00:14:04 2019 +0300
+++ b/rust/hedgewars-server/src/server/handlers/inroom.rs	Wed Feb 06 00:57:01 2019 +0300
@@ -6,6 +6,7 @@
     server::{
         actions::{Action, Action::*},
         core::HWServer,
+        coretypes,
         coretypes::{ClientId, GameCfg, RoomId, VoteType, Voting, MAX_HEDGEHOGS_PER_TEAM},
         room::{HWRoom, RoomFlags},
     },
@@ -459,7 +460,14 @@
                     let room = &mut server.rooms[room_id];
                     room.voting = Some(voting);
                     response.add(server_chat(msg).send_all().in_room(room_id));
-                    super::common::add_vote(room, response, true, false);
+                    super::common::submit_vote(
+                        server,
+                        coretypes::Vote {
+                            is_pro: true,
+                            is_forced: false,
+                        },
+                        response,
+                    );
                 }
                 Some(msg) => {
                     response.add(server_chat(msg).send_self());
@@ -467,11 +475,25 @@
             }
         }
         Vote(vote) => {
-            super::common::add_vote(&mut server.rooms[room_id], response, vote, false);
+            super::common::submit_vote(
+                server,
+                coretypes::Vote {
+                    is_pro: vote,
+                    is_forced: false,
+                },
+                response,
+            );
         }
         ForceVote(vote) => {
             let is_forced = server.clients[client_id].is_admin();
-            super::common::add_vote(&mut server.rooms[room_id], response, vote, false);
+            super::common::submit_vote(
+                server,
+                coretypes::Vote {
+                    is_pro: vote,
+                    is_forced,
+                },
+                response,
+            );
         }
         ToggleRestrictJoin | ToggleRestrictTeams | ToggleRegisteredOnly => {
             let client = &server.clients[client_id];