Author: sveinung
Date: Tue Oct 18 14:13:01 2016
New Revision: 34168

URL: http://svn.gna.org/viewcvs/freeciv?rev=34168&view=rev
Log:
ruledit: keep req vec order on req deletion.

See patch #7836

Modified:
    trunk/tools/ruledit/req_edit.cpp

Modified: trunk/tools/ruledit/req_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/req_edit.cpp?rev=34168&r1=34167&r2=34168&view=diff
==============================================================================
--- trunk/tools/ruledit/req_edit.cpp    (original)
+++ trunk/tools/ruledit/req_edit.cpp    Tue Oct 18 14:13:01 2016
@@ -349,17 +349,14 @@
 void req_edit::delete_now()
 {
   if (selected != nullptr) {
-    int end = requirement_vector_size(req_vector) - 1;
-    struct requirement *last = requirement_vector_get(req_vector, end);
-
-    requirement_vector_iterate(req_vector, new_req) {
-      if (new_req == selected) {
-        *new_req = *last;
+    size_t i;
+
+    for (i = 0; i < requirement_vector_size(req_vector); i++) {
+      if (requirement_vector_get(req_vector, i) == selected) {
+        requirement_vector_remove(req_vector, i);
         break;
       }
-    } requirement_vector_iterate_end;
-
-    requirement_vector_reserve(req_vector, end);
+    }
 
     selected = nullptr;
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to