mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
Namespace data/player/{edits,camera_state,saves} by city name. #326
This commit is contained in:
parent
8101c2a820
commit
5107b0f6c2
@ -165,26 +165,32 @@ pub fn parse_scenario_path(path: &str) -> (MapName, String) {
|
||||
// Player data (Players edit this)
|
||||
|
||||
pub fn path_camera_state(name: &MapName) -> String {
|
||||
path(format!("player/camera_state/{}.json", name.map))
|
||||
path(format!(
|
||||
"player/camera_state/{}/{}.json",
|
||||
name.city, name.map
|
||||
))
|
||||
}
|
||||
|
||||
pub fn path_edits(name: &MapName, edits_name: &str) -> String {
|
||||
path(format!("player/edits/{}/{}.json", name.map, edits_name))
|
||||
path(format!(
|
||||
"player/edits/{}/{}/{}.json",
|
||||
name.city, name.map, edits_name
|
||||
))
|
||||
}
|
||||
pub fn path_all_edits(name: &MapName) -> String {
|
||||
path(format!("player/edits/{}", name.map))
|
||||
path(format!("player/edits/{}/{}", name.city, name.map))
|
||||
}
|
||||
|
||||
pub fn path_save(name: &MapName, edits_name: &str, run_name: &str, time: String) -> String {
|
||||
path(format!(
|
||||
"player/saves/{}/{}_{}/{}.bin",
|
||||
name.map, edits_name, run_name, time
|
||||
"player/saves/{}/{}/{}_{}/{}.bin",
|
||||
name.city, name.map, edits_name, run_name, time
|
||||
))
|
||||
}
|
||||
pub fn path_all_saves(name: &MapName, edits_name: &str, run_name: &str) -> String {
|
||||
path(format!(
|
||||
"player/saves/{}/{}_{}",
|
||||
name.map, edits_name, run_name
|
||||
"player/saves/{}/{}/{}_{}",
|
||||
name.city, name.map, edits_name, run_name
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ are missing, etc. A summary of the commands available so far:
|
||||
hour since midnight, throughput for that one hour period).
|
||||
- **/map**
|
||||
- **GET /map/get-edits**: Returns the current map edits in JSON. You can save
|
||||
this to a file in `data/player/edits/map_name/` and later use it in-game
|
||||
normally. You can also later run the `headless` server with
|
||||
this to a file in `data/player/edits/city_name/map_name/` and later use it
|
||||
in-game normally. You can also later run the `headless` server with
|
||||
`--edits=name_of_edits`.
|
||||
- **GET /map/get-edit-road-command?id=123**: Returns an object that can be
|
||||
modified and then added to map edits.
|
||||
|
Loading…
Reference in New Issue
Block a user