Skip to content

Commit

Permalink
Make code work again
Browse files Browse the repository at this point in the history
  • Loading branch information
kuviman committed Oct 8, 2020
1 parent 23f0106 commit 1a57e49
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
9 changes: 6 additions & 3 deletions app-src/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
[package]
name = "aicup2019"
version = "1.3.0"
version = "1.3.1"
authors = ["kuviman <[email protected]>"]
edition = "2018"
default-run = "aicup2019"

# [lib]
# crate-type = ["cdylib"]

[features]
default = ["rendering"]
rendering = ["codegame/rendering"]

[dependencies]
codegame = { git = "https://github.com/codeforces/codegame", default-features = false }
codegame = { version = "0.3", default-features = false }
serde = "1"
trans-gen = { git = "https://github.com/kuviman/trans-gen" }
trans-gen = "0.1"
structopt = "0.3"

[dev-dependencies]
Expand Down
5 changes: 5 additions & 0 deletions app-src/server.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM debian

RUN apt-get update && apt-get install -y libasound2 libgtk-3-0

COPY aicup2019 aicup2019
2 changes: 1 addition & 1 deletion app-src/src/bin/client_gen/rust/Cargo.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2018"

[dependencies]
model = { path = "model", package = "aicup2019-model" }
trans = { path = "model/trans" }
trans = "0.1"
2 changes: 0 additions & 2 deletions app-src/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ pub fn run() {
logger::init()
}
.expect("Failed to initialize logger");
#[cfg(feature = "rendering")]
logger::add_logger(Box::new(geng::logger()));
add_translations(include_str!("translations.txt"));
if let Some(lang) = &opt.lang {
set_locale(lang);
Expand Down
12 changes: 6 additions & 6 deletions app-src/src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ impl Default for ActionWrapper {
}

impl Trans for ActionWrapper {
fn read_from(mut reader: impl std::io::Read) -> std::io::Result<Self> {
let x = i32::read_from(&mut reader)?;
fn read_from(reader: &mut dyn std::io::Read) -> std::io::Result<Self> {
let x = i32::read_from(reader)?;
Ok(match x {
ActionWrapper::MAGIC => Self::V1 {
actions: Trans::read_from(&mut reader)?,
actions: Trans::read_from(reader)?,
},
_ => {
let mut actions = HashMap::new();
for _ in 0..x {
let key = Id::read_from(&mut reader)?;
let value = OldUnitAction::read_from(&mut reader)?;
let key = Id::read_from(reader)?;
let value = OldUnitAction::read_from(reader)?;
actions.insert(key, value);
}
Self::V0 { actions }
}
})
}
fn write_to(&self, mut writer: impl std::io::Write) -> std::io::Result<()> {
fn write_to(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> {
unimplemented!("Not used")
}
}
Expand Down
14 changes: 14 additions & 0 deletions app-src/test-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"options_preset": "Round1",
"players": [
"Quickstart",
{
"Tcp": {
"host": "0.0.0.0",
"port": 31001,
"accept_timeout": 30.0,
"timeout": 1.0
}
}
]
}

0 comments on commit 1a57e49

Please sign in to comment.