Skip to content

Commit

Permalink
Ajoutez des fichiers projet.
Browse files Browse the repository at this point in the history
  • Loading branch information
RallardM committed Jun 22, 2023
1 parent 0794840 commit 8ab912c
Show file tree
Hide file tree
Showing 9 changed files with 336 additions and 0 deletions.
31 changes: 31 additions & 0 deletions InventorySystem.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InventorySystem", "InventorySystem\InventorySystem.vcxproj", "{4967C813-5179-4A22-AD91-A318FC405E56}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4967C813-5179-4A22-AD91-A318FC405E56}.Debug|x64.ActiveCfg = Debug|x64
{4967C813-5179-4A22-AD91-A318FC405E56}.Debug|x64.Build.0 = Debug|x64
{4967C813-5179-4A22-AD91-A318FC405E56}.Debug|x86.ActiveCfg = Debug|Win32
{4967C813-5179-4A22-AD91-A318FC405E56}.Debug|x86.Build.0 = Debug|Win32
{4967C813-5179-4A22-AD91-A318FC405E56}.Release|x64.ActiveCfg = Release|x64
{4967C813-5179-4A22-AD91-A318FC405E56}.Release|x64.Build.0 = Release|x64
{4967C813-5179-4A22-AD91-A318FC405E56}.Release|x86.ActiveCfg = Release|Win32
{4967C813-5179-4A22-AD91-A318FC405E56}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1FE42732-7D22-4AB6-A833-94BAA9606BFA}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions InventorySystem/Inventory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "Inventory.h"
#include <iostream>

void Inventory::AddItem(string itemName, int itemCost /* = 0 */)
{
m_inventoryObjectsList.push_back(InventoryObject(itemName, itemCost));
if (m_inventoryObjectsList.size() == 1)
{
m_currentItem = &m_inventoryObjectsList.front();
}
}

void Inventory::DisplaySelectedItem()
{
system("CLS");
if (!m_currentItem)
{
cout << endl << "There is no item in this inventory!";
return;
}
cout << endl << "Current item: " << endl << m_currentItem->ToString();
}
20 changes: 20 additions & 0 deletions InventorySystem/Inventory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "InventoryObject.h"
#include <list>

using namespace std;

class Inventory
{
//Methods
public:
void AddItem(string itemName, int itemCost = 0);
void DisplaySelectedItem();
private:

//Member variables
public:
list<InventoryObject> m_inventoryObjectsList;
private:
InventoryObject* m_currentItem = NULL;
};
15 changes: 15 additions & 0 deletions InventorySystem/InventoryObject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "InventoryObject.h"

InventoryObject::InventoryObject(string name, int cost)
{
m_name = name;
m_cost = cost;
}

string InventoryObject::ToString()
{
string returnValue = "";
returnValue += "\nItem name: " + m_name + "\nItem cost: " + to_string(m_cost);

return returnValue;
}
18 changes: 18 additions & 0 deletions InventorySystem/InventoryObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include <string>

using namespace std;

class InventoryObject
{
//Methods
public:
InventoryObject(string name, int cost = 0);
string ToString();

//Member variables
private:
string m_name = "nameless object";

int m_cost = 0;
};
38 changes: 38 additions & 0 deletions InventorySystem/InventorySaveFile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
BaseObject
{
Name: Broken urn
Cost: 5
}

Consumable
{
Name: Health Potion
Cost: 15
Stacks: 5
}

Consumable
{
Name: Mana Potion

Cost: 25
Stacks: 2
}
Equipment
{
Cost: 150
Name: Cool Helmet
CurrentDurability: 50
MaxDurability: 50


EquipmentSlot: Head
}
Equipment
{
Name: Rusty Sword
Cost: 30
CurrentDurability: 12
MaxDurability: 30
EquipmentSlot: Weapon1
}
141 changes: 141 additions & 0 deletions InventorySystem/InventorySystem.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{4967c813-5179-4a22-ad91-a318fc405e56}</ProjectGuid>
<RootNamespace>InventorySystem</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Inventory.h" />
<ClInclude Include="InventoryObject.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Inventory.cpp" />
<ClCompile Include="InventoryObject.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
36 changes: 36 additions & 0 deletions InventorySystem/InventorySystem.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Fichiers sources">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Fichiers d%27en-tête">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Fichiers de ressources">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="InventoryObject.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Inventory.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="InventoryObject.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Inventory.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions InventorySystem/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "Inventory.h"

int main()
{
Inventory* inventory = new Inventory();

inventory->DisplaySelectedItem();
//TODO: Remove this part. These are examples of item instantiations
inventory->AddItem("Test", 30);
inventory->AddItem("Test2");
inventory->AddItem("Test3", 3);
inventory->AddItem("Test4", 10);

inventory->DisplaySelectedItem();
}

0 comments on commit 8ab912c

Please sign in to comment.