luminol_data/shared/
mapinfo.rs

1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol.  If not, see <http://www.gnu.org/licenses/>.
17
18#[derive(Default, Debug, serde::Deserialize, serde::Serialize, PartialEq, Eq)]
19#[derive(alox_48::Deserialize, alox_48::Serialize)]
20#[marshal(class = "RPG::MapInfo")]
21pub struct MapInfo {
22    pub name: String,
23    // because mapinfos is stored in a hash, we dont actually need to modify values! this can just stay as a usize.
24    // it would be slightly more accurate to store this as an option, but no other values (off the top of my head) are like this. maybe event tile ids.
25    // I'll need to think on this a bit.
26    pub parent_id: usize,
27    pub order: i32,
28    pub expanded: bool,
29    pub scroll_x: i32,
30    pub scroll_y: i32,
31}
32
33impl PartialOrd for MapInfo {
34    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
35        Some(self.cmp(other))
36    }
37}
38
39impl Ord for MapInfo {
40    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
41        self.order.cmp(&other.order)
42    }
43}