From d670383f3a6f6f4c2a55bcff65e4e51bf67de18e Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Fri, 29 Mar 2024 16:21:39 -0300 Subject: [PATCH] add const accessor to Inventory --- Tactical/Soldier Control.cpp | 4 ++++ Tactical/Soldier Control.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index dacb8dfc..46a09d69 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -378,6 +378,10 @@ unsigned int Inventory::size( ) const { return inv.size( ); } +auto Inventory::get() const -> const std::vector& { + return inv; +} + // Assignment operator Inventory& Inventory::operator=(const Inventory& src) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 74c08462..7545ce6b 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -772,6 +772,9 @@ public: // How any slots are there in this inventory? unsigned int size() const; + // const-only accessor + auto get() const -> const std::vector&; + //temporarily? public std::vector bNewItemCount; std::vector bNewItemCycleCount;