summaryrefslogtreecommitdiffhomepage
path: root/Magic2/Selection.cpp
diff options
context:
space:
mode:
authorFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-05-28 16:44:39 +0000
committerFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-05-28 16:44:39 +0000
commit56a3380b46f406ffaf093405ac2db4515b0a4f80 (patch)
treee9e4c5553343f27e41d862c49b21fd69bf5161b9 /Magic2/Selection.cpp
parent41b40af36198fb013a2034a1954bbc4df50fea8b (diff)
downloadstarshatter-56a3380b46f406ffaf093405ac2db4515b0a4f80.zip
starshatter-56a3380b46f406ffaf093405ac2db4515b0a4f80.tar.gz
starshatter-56a3380b46f406ffaf093405ac2db4515b0a4f80.tar.bz2
Removes the ArrayList classes, and replaces all instances with std::vector implementations.
Diffstat (limited to 'Magic2/Selection.cpp')
-rw-r--r--Magic2/Selection.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/Magic2/Selection.cpp b/Magic2/Selection.cpp
index 1c69129..3db43db 100644
--- a/Magic2/Selection.cpp
+++ b/Magic2/Selection.cpp
@@ -63,7 +63,7 @@ Selection::Render(Video* video, DWORD flags)
}
if (model) {
- for (int i = 0; i < verts.size(); i++) {
+ for (size_t i = 0; i < verts.size(); i++) {
DWORD value = verts[i];
WORD index = (WORD) (value >> 16);
WORD vert = (WORD) (value & 0xffff);
@@ -152,20 +152,41 @@ Selection::AddVert(WORD s, WORD v)
{
DWORD value = (s << 16) | v;
- if (!verts.contains(value))
- verts.append(value);
+ bool contains = false;
+ for (auto vi = verts.begin(); vi != verts.end(); ++vi) {
+ if (*vi == value) {
+ contains = true;
+ break;
+ }
+ }
+
+ if (!contains)
+ verts.push_back(value);
}
void
Selection::RemoveVert(WORD s, WORD v)
{
DWORD value = (s << 16) | v;
- verts.remove(value);
+
+ for (auto vi = verts.begin(); vi != verts.end(); ++vi) {
+ if (*vi == value) {
+ verts.erase(vi);
+ return;
+ }
+ }
}
bool
Selection::Contains(WORD s, WORD v) const
{
- DWORD value = (s << 16) | v;
- return verts.contains(value);
+ DWORD value = (s << 16) | v;
+
+ for (auto vi = verts.begin(); vi != verts.end(); ++vi) {
+ if (*vi == value) {
+ return true;
+ }
+ }
+
+ return false;
} \ No newline at end of file