--- a/CMakeLists.txt Tue Jan 02 23:20:50 2018 +0300
+++ b/CMakeLists.txt Tue Jan 02 16:59:04 2018 -0500
@@ -80,8 +80,8 @@
#versioning
set(CPACK_PACKAGE_VERSION_MAJOR 0)
set(CPACK_PACKAGE_VERSION_MINOR 9)
-set(CPACK_PACKAGE_VERSION_PATCH 23)
-set(HEDGEWARS_PROTO_VER 53)
+set(CPACK_PACKAGE_VERSION_PATCH 24)
+set(HEDGEWARS_PROTO_VER 54)
set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
include(${CMAKE_MODULE_PATH}/revinfo.cmake)
--- a/gameServer2/src/main.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/main.rs Tue Jan 02 16:59:04 2018 -0500
@@ -11,7 +11,7 @@
//use std::io::*;
//use rand::Rng;
//use std::cmp::Ordering;
-use mio::tcp::*;
+use mio::net::*;
use mio::*;
mod utils;
@@ -36,24 +36,24 @@
poll.poll(&mut events, None).unwrap();
for event in events.iter() {
- if event.kind().is_readable() {
+ if event.readiness() & Ready::readable() == Ready::readable() {
match event.token() {
utils::SERVER => server.accept(&poll).unwrap(),
- tok => server.client_readable(&poll, tok).unwrap(),
+ Token(tok) => server.client_readable(&poll, tok).unwrap(),
}
}
- if event.kind().is_writable() {
+ if event.readiness() & Ready::writable() == Ready::writable() {
match event.token() {
utils::SERVER => unreachable!(),
- tok => server.client_writable(&poll, tok).unwrap(),
+ Token(tok) => server.client_writable(&poll, tok).unwrap(),
}
}
- if event.kind().is_hup() || event.kind().is_error() {
- match event.token() {
- utils::SERVER => unreachable!(),
- tok => server.client_error(&poll, tok).unwrap(),
- }
- }
+// if event.kind().is_hup() || event.kind().is_error() {
+// match event.token() {
+// utils::SERVER => unreachable!(),
+// Token(tok) => server.client_error(&poll, tok).unwrap(),
+// }
+// }
}
}
}
--- a/gameServer2/src/server/actions.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/actions.rs Tue Jan 02 16:59:04 2018 -0500
@@ -22,12 +22,12 @@
use self::Action::*;
-pub fn run_action(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, action: Action) {
+pub fn run_action(server: &mut HWServer, token: usize, poll: &mio::Poll, action: Action) {
match action {
SendMe(msg) =>
server.send(token, &msg),
SendAllButMe(msg) => {
- for c in server.clients.iter_mut() {
+ for (_i, c) in server.clients.iter_mut() {
if c.id != token {
c.send_string(&msg)
}
@@ -57,7 +57,7 @@
let joined_msg;
{
let mut lobby_nicks: Vec<&str> = Vec::new();
- for c in server.clients.iter() {
+ for (_, c) in server.clients.iter() {
if c.room_id.is_some() {
lobby_nicks.push(&c.nick);
}
@@ -71,7 +71,7 @@
]);
},
AddRoom(name, password) => {
- let room_id = server.rooms.insert(HWRoom::new()).ok().expect("Cannot add room");
+ let room_id = server.rooms.insert(HWRoom::new());
{
let r = &mut server.rooms[room_id];
let c = &mut server.clients[token];
--- a/gameServer2/src/server/client.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/client.rs Tue Jan 02 16:59:04 2018 -0500
@@ -1,4 +1,4 @@
-use mio::tcp::*;
+use mio::net::TcpStream;
use mio::*;
use std::io::Write;
use std::io;
@@ -15,8 +15,8 @@
decoder: ProtocolDecoder,
buf_out: netbuf::Buf,
- pub id: Token,
- pub room_id: Option<Token>,
+ pub id: usize,
+ pub room_id: Option<usize>,
pub nick: String,
pub protocol_number: u32,
pub is_master: bool,
@@ -31,7 +31,7 @@
decoder: ProtocolDecoder::new(),
buf_out: netbuf::Buf::new(),
room_id: None,
- id: Token(0),
+ id: 0,
nick: String::new(),
protocol_number: 0,
@@ -42,7 +42,7 @@
}
pub fn register(&mut self, poll: &Poll, token: Token) {
- poll.register(&self.sock, token, Ready::all(),
+ poll.register(&self.sock, token, Ready::readable() | Ready::writable(),
PollOpt::edge())
.ok().expect("could not register socket with event loop");
@@ -72,7 +72,7 @@
self.sock.flush();
}
- pub fn readable(&mut self, poll: &Poll) -> Vec<Action> {
+ pub fn readable(&mut self, _poll: &Poll) -> Vec<Action> {
let v = self.decoder.read_from(&mut self.sock).unwrap();
debug!("Read {} bytes", v);
let mut response = Vec::new();
@@ -85,13 +85,13 @@
response
}
- pub fn writable(&mut self, poll: &Poll) -> io::Result<()> {
+ pub fn writable(&mut self, _poll: &Poll) -> io::Result<()> {
self.buf_out.write_to(&mut self.sock)?;
Ok(())
}
- pub fn error(&mut self, poll: &Poll) -> Vec<Action> {
+ pub fn error(&mut self, _poll: &Poll) -> Vec<Action> {
return vec![ByeClient("Connection reset".to_string())]
}
}
--- a/gameServer2/src/server/handlers/inroom.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/handlers/inroom.rs Tue Jan 02 16:59:04 2018 -0500
@@ -6,7 +6,7 @@
use protocol::messages::HWProtocolMessage;
use protocol::messages::HWServerMessage::*;
-pub fn handle(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, message: HWProtocolMessage) {
+pub fn handle(server: &mut HWServer, token: usize, _poll: &mio::Poll, message: HWProtocolMessage) {
match message {
_ => warn!("Unimplemented!"),
}
--- a/gameServer2/src/server/handlers/lobby.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/handlers/lobby.rs Tue Jan 02 16:59:04 2018 -0500
@@ -6,14 +6,14 @@
use protocol::messages::HWProtocolMessage;
use protocol::messages::HWServerMessage::*;
-pub fn handle(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, message: HWProtocolMessage) {
+pub fn handle(server: &mut HWServer, token: usize, poll: &mio::Poll, message: HWProtocolMessage) {
match message {
HWProtocolMessage::Chat(msg) => {
let chat_msg = ChatMsg(&server.clients[token].nick, &msg).to_raw_protocol();
server.react(token, poll, vec![SendAllButMe(chat_msg)]);
},
HWProtocolMessage::CreateRoom(name, password) => {
- let room_exists = server.rooms.iter().find(|&r| r.name == name).is_some();
+ let room_exists = server.rooms.iter().find(|&(_, r)| r.name == name).is_some();
if room_exists {
server.react(token, poll, vec![Warn("Room exists".to_string())]);
} else {
--- a/gameServer2/src/server/handlers/loggingin.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/handlers/loggingin.rs Tue Jan 02 16:59:04 2018 -0500
@@ -6,7 +6,7 @@
use protocol::messages::HWProtocolMessage;
use protocol::messages::HWServerMessage::*;
-pub fn handle(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, message: HWProtocolMessage) {
+pub fn handle(server: &mut HWServer, token: usize, poll: &mio::Poll, message: HWProtocolMessage) {
match message {
HWProtocolMessage::Nick(nick) =>
if server.clients[token].room_id == None {
--- a/gameServer2/src/server/handlers/mod.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/handlers/mod.rs Tue Jan 02 16:59:04 2018 -0500
@@ -12,7 +12,7 @@
mod lobby;
mod inroom;
-pub fn handle(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, message: HWProtocolMessage) {
+pub fn handle(server: &mut HWServer, token: usize, poll: &mio::Poll, message: HWProtocolMessage) {
match message {
HWProtocolMessage::Ping =>
server.react(token, poll, vec![SendMe(Pong.to_raw_protocol())]),
--- a/gameServer2/src/server/server.rs Tue Jan 02 23:20:50 2018 +0300
+++ b/gameServer2/src/server/server.rs Tue Jan 02 16:59:04 2018 -0500
@@ -1,5 +1,5 @@
use slab;
-use mio::tcp::*;
+use mio::net::*;
use mio::*;
use std::io;
@@ -7,19 +7,19 @@
use super::client::HWClient;
use super::actions;
-type Slab<T> = slab::Slab<T, Token>;
+type Slab<T> = slab::Slab<T>;
pub struct HWServer {
listener: TcpListener,
pub clients: Slab<HWClient>,
pub rooms: Slab<HWRoom>,
- pub lobby_id: Token,
+ pub lobby_id: usize,
}
impl HWServer {
pub fn new(listener: TcpListener, clients_limit: usize, rooms_limit: usize) -> HWServer {
let mut rooms = Slab::with_capacity(rooms_limit);
- let token = rooms.insert(HWRoom::new()).ok().expect("Cannot create lobby");
+ let token = rooms.insert(HWRoom::new());
HWServer {
listener: listener,
clients: Slab::with_capacity(clients_limit),
@@ -38,17 +38,16 @@
info!("Connected: {}", addr);
let client = HWClient::new(sock);
- let token = self.clients.insert(client)
- .ok().expect("could not add connection to slab");
+ let token = self.clients.insert(client);
self.clients[token].id = token;
- self.clients[token].register(poll, token);
+ self.clients[token].register(poll, Token(token));
Ok(())
}
pub fn client_readable(&mut self, poll: &Poll,
- token: Token) -> io::Result<()> {
+ token: usize) -> io::Result<()> {
let actions;
{
actions = self.clients[token].readable(poll);
@@ -60,14 +59,14 @@
}
pub fn client_writable(&mut self, poll: &Poll,
- token: Token) -> io::Result<()> {
+ token: usize) -> io::Result<()> {
self.clients[token].writable(poll)?;
Ok(())
}
pub fn client_error(&mut self, poll: &Poll,
- token: Token) -> io::Result<()> {
+ token: usize) -> io::Result<()> {
let actions;
{
actions = self.clients[token].error(poll);
@@ -78,11 +77,11 @@
Ok(())
}
- pub fn send(&mut self, token: Token, msg: &String) {
+ pub fn send(&mut self, token: usize, msg: &String) {
self.clients[token].send_string(msg);
}
- pub fn react(&mut self, token: Token, poll: &Poll, actions: Vec<actions::Action>) {
+ pub fn react(&mut self, token: usize, poll: &Poll, actions: Vec<actions::Action>) {
for action in actions {
actions::run_action(self, token, poll, action);
}
@@ -91,7 +90,7 @@
pub struct HWRoom {
- pub id: Token,
+ pub id: usize,
pub name: String,
pub password: Option<String>,
pub protocol_number: u32,
@@ -101,7 +100,7 @@
impl HWRoom {
pub fn new() -> HWRoom {
HWRoom {
- id: Token(0),
+ id: 0,
name: String::new(),
password: None,
protocol_number: 0,
--- a/hedgewars/uCommandHandlers.pas Tue Jan 02 23:20:50 2018 +0300
+++ b/hedgewars/uCommandHandlers.pas Tue Jan 02 16:59:04 2018 -0500
@@ -533,7 +533,7 @@
cSeed:= s;
InitStepsFlags:= InitStepsFlags or cifRandomize
end
- end;
+end;
procedure chAmmoMenu(var s: shortstring);
begin
--- a/hedgewars/uGearsRender.pas Tue Jan 02 23:20:50 2018 +0300
+++ b/hedgewars/uGearsRender.pas Tue Jan 02 16:59:04 2018 -0500
@@ -1243,17 +1243,17 @@
gtShell: DrawSpriteRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
gtGrave: begin
- DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 15, 1, 32, 32);
+ DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (RealTicks shr 7+Gear^.uid) and 15, 1, 32, 32);
if Gear^.Health > 0 then
begin
//Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
- Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
+ Tint($f5, $db, $35, max($40, round($FF * abs(1 - (RealTicks mod 1500) / (750 + Gear^.Health)))));
//Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
DrawSprite(sprVampiric, x - 24, y - 24, 0);
untint
end
end;
- gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
+ gtBee: DrawSpriteRotatedF(sprBee, x, y, (RealTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
gtRope: DrawRope(Gear);
@@ -1293,7 +1293,7 @@
DrawSprite(sprCase, x - 24, y - 28, 0)
else
begin
- i:= (GameTicks shr 6) mod 64;
+ i:= (RealTicks shr 6) mod 64;
if i > 18 then i:= 0;
DrawSprite(sprCase, x - 24, y - 24, i)
end
@@ -1304,7 +1304,7 @@
DrawSprite(sprFAid, x - 24, y - 28, 0)
else
begin
- i:= ((GameTicks shr 6) + 38) mod 64;
+ i:= ((RealTicks shr 6) + 38) mod 64;
if i > 13 then i:= 0;
DrawSprite(sprFAid, x - 24, y - 24, i)
end
@@ -1315,7 +1315,7 @@
DrawSprite(sprUtility, x - 24, y - 28, 0)
else
begin
- i:= (GameTicks shr 6) mod 70;
+ i:= (RealTicks shr 6) mod 70;
if i > 23 then i:= 0;
i:= i mod 12;
DrawSprite(sprUtility, x - 24, y - 24, i)
@@ -1333,7 +1333,7 @@
DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
else if Gear^.State and gstAnimation = 0 then
begin
- i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
+ i:= (RealTicks shr 6 + Gear^.uid*3) mod 64;
if i > 18 then
i:= 0;
DrawSprite(sprExplosives, x - 24, y - 24, i)
@@ -1369,8 +1369,8 @@
gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
gtFlame: if Gear^.Tag and 1 = 0 then
- DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
- else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
+ DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
+ else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
gtParachute: begin
DrawSprite(sprParachute, x - 24, y - 48, 0);
DrawAltWeapon(Gear, x + 1, y - 3)
@@ -1391,7 +1391,7 @@
DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0)
end
end;
- gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
+ gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (RealTicks shr 6) mod 12);
gtTarget: begin
Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
DrawSprite(sprTarget, x - 16, y - 16, 0);
@@ -1548,7 +1548,9 @@
end
end
end;
- gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag, Gear^.DirAngle);
+ gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag,
+ // replace with something based on dx/dy?
+ Gear^.DirAngle + 10-round(20 * abs(1 - (RealTicks mod round(0.1/max(0.00005,cWindSpeedf))) / round(0.05/max(0.00005,cWindSpeedf))) ));
gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF); // debug
end;
if Gear^.State and gstFrozen <> 0 then untint
--- a/hedgewars/uScript.pas Tue Jan 02 23:20:50 2018 +0300
+++ b/hedgewars/uScript.pas Tue Jan 02 16:59:04 2018 -0500
@@ -3059,6 +3059,7 @@
var mybuf: PChar;
i: LongInt;
begin
+ SetRandomSeed(cSeed,true);
mybuf := physfsReader(L, f, sz);
if (mybuf <> nil) and ((sz^) > 0) then
begin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/CMakeLists.txt Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(qmlfrontend LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+find_package(Qt5 COMPONENTS Core Quick REQUIRED)
+
+add_executable(${PROJECT_NAME} "main.cpp" "qml.qrc")
+
+target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/Page1.qml Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,7 @@
+import QtQuick 2.7
+
+Page1Form {
+ button1.onClicked: {
+ console.log("Button Pressed. Entered text: " + textField1.text);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/Page1Form.ui.qml Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,24 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+
+Item {
+ property alias textField1: textField1
+ property alias button1: button1
+
+ RowLayout {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 20
+ anchors.top: parent.top
+
+ TextField {
+ id: textField1
+ placeholderText: qsTr("Text Field")
+ }
+
+ Button {
+ id: button1
+ text: qsTr("Press Me")
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/main.cpp Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,15 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QLatin1String("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/main.qml Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,37 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("Hello World")
+
+ SwipeView {
+ id: swipeView
+ anchors.fill: parent
+ currentIndex: tabBar.currentIndex
+
+ Page1 {
+ }
+
+ Page {
+ Label {
+ text: qsTr("Second page")
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ footer: TabBar {
+ id: tabBar
+ currentIndex: swipeView.currentIndex
+ TabButton {
+ text: qsTr("First")
+ }
+ TabButton {
+ text: qsTr("Second")
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/qml.qrc Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,9 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>Page1.qml</file>
+ <file>Page1Form.ui.qml</file>
+ <file>qtquickcontrols2.conf</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/qtquickcontrols2.conf Tue Jan 02 16:59:04 2018 -0500
@@ -0,0 +1,15 @@
+; This file can be edited to change the style of the application
+; See Styling Qt Quick Controls 2 in the documentation for details:
+; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
+
+[Controls]
+Style=Default
+
+[Universal]
+Theme=Light
+;Accent=Steel
+
+[Material]
+Theme=Light
+;Accent=BlueGrey
+;Primary=BlueGray
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw_base.png has changed
Binary file share/hedgewars/Data/Graphics/BigDigitsGray.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/armenia.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/cm_soviet.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/ireland.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/nepal.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/suisse.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/sweden.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/turkey.png has changed
Binary file share/hedgewars/Data/Graphics/Graves/Simple_reversed.png has changed
Binary file share/hedgewars/Data/Graphics/Progress.png has changed
Binary file share/hedgewars/Data/Graphics/missions.png has changed