-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinventorySorter.cpp
105 lines (57 loc) · 1.83 KB
/
inventorySorter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "ItemDeclaration.h"
//http://en.wikipedia.org/wiki/Variadic_function
//^This will be used in here, maybe...
//http://stackoverflow.com/questions/5386834/c-get-base-class-object-from-derived-class-pointer
//I'll test this later, as it has a low chance of working the way I want...
//The first item will be the one earlier in the sorted list, and first in alphabetical order.
int inventory::sortByBaseName(itemBaseType one, itemBaseType two)
{
int compareValue = one.singularName.compare(two.singularName);
if ((compareValue == -1) || (compareValue == 0)){
return 0; //No switch, the two items are good where they are.
}
return 1; //Switch required
//{
/*
std::string StringOne = "AAA";
std::string StringTwo = "BBB";
cout<<StringOne.compare(StringTwo)<<endl;
This returns -1.
*/
//}
};
//Orders by smallest to biggest
int inventory::sortByBaseSize(itemBaseType one, itemBaseType two)
{
if (one.size <= two.size){
return 0; //No switch, the two items are good where they are.
}
return 1; //Switch required
};
//Orders by smallest to biggest.
int inventory::sortByBaseWeight(itemBaseType one, itemBaseType two)
{
if (one.weight <= two.weight){
return 0; //No switch, the two items are good where they are.
}
return 1; //Switch required
};
//Orders by lowest value to highest.
int inventory::sortByBaseValue(itemBaseType one, itemBaseType two)
{
if (one.value <= two.value){
return 0; //No switch, the two items are good where they are.
}
return 1; //Switch required
};
int inventory::sortInventory (const char sortType)
{
int asdf;// = inputArray -> size();
for (int j = 0; j < asdf; j++){
//TODO
//http://www.algolist.net/Algorithms/Sorting/Quicksort
}
}
void inventory::reverseInventory ()
{
}