• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン413 (tree)
日時2007-08-01 01:44:09
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 412)
+++ marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 413)
@@ -108,6 +108,7 @@
108108 annotation->location.y =
109109 worldLastMousePosition.y + selp->offset[1] * div;
110110 }
111+ Refresh();
111112 }
112113 }
113114 }else{
@@ -225,6 +226,9 @@
225226 if(sel->isSelected() && emgr->isGrabItems()){
226227 dmgr->push_back(
227228 hpl::aleph::map::ActionType::Move, *sel);
229+#ifdef __WXDEBUG__
230+// hpl::error::caution("undo index=%d", dmgr->getIndex());
231+#endif
228232 }
229233 if(sel->isSelectOneObject()){
230234 //オブジェクトを選択していたら
@@ -389,11 +393,12 @@
389393 }
390394 }
391395
396+ /*
392397 if(sel->isSelected()){
393398 //コピペ情報登録
394399 wxGetApp().getDoneHistoryManager()->push_back(hpl::aleph::map::ActionType::Move, *sel);
395400 }
396-
401+ */
397402 //離した
398403 emgr->setGrabItems(false);
399404 }
@@ -829,13 +834,13 @@
829834 //this->polyPropDialog.updateCombo();
830835
831836 //ポリゴン・線のFixを行う
832- for(int i = 0; i < LineList.size(); i ++){
837+ for(int i = 0; i < (int)LineList.size(); i ++){
833838 if(smgr->isDeleteLine(i)){
834839 continue;
835840 }
836841 hpl::aleph::map::fixLine(i, smgr);
837842 }
838- for(int i = 0; i < PolygonList.size(); i ++){
843+ for(int i = 0; i < (int)PolygonList.size(); i ++){
839844 if(smgr->isDeletePolygon(i)){
840845 continue;
841846 }
--- marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 412)
+++ marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 413)
@@ -103,7 +103,7 @@
103103 int my = ev.m_y;
104104
105105 //アンドゥ情報に追加しておきます
106- hpl::aleph::map::HPLDoneHistory* hmgr = wxGetApp().getDoneHistoryManager();
106+// hpl::aleph::map::HPLDoneHistory* hmgr = wxGetApp().getDoneHistoryManager();
107107 sel->setMousePosition(mx, my);
108108 hpl::aleph::HPLEventManager* emgr = wxGetApp().getEventManager();
109109
--- marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 412)
+++ marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 413)
@@ -221,46 +221,69 @@
221221 hpl::aleph::map::HPLDoneHistory* dmgr = wxGetApp().getDoneHistoryManager();
222222 hpl::aleph::HPLStockManager* smgr = wxGetApp().getStockManager();
223223
224- bool result = dmgr->back(&act);
225- if(result){
226- if(act.type == hpl::aleph::map::ActionType::None ||
227- act.type == hpl::aleph::map::ActionType::Move)
228- {
229- //移動を元に戻す
230- for(int i = 0; i < (int)act.selectData.getSelPoints()->size(); i ++){
231- int index = act.selectData.getSelPoints()->at(i).index;
232- endpoint_data* ep = get_endpoint_data(index);
233- //TODO 削除・追加のUndo機能も実装しよう。
234- //これだけだと削除されている場合エラーになる
235- if(smgr->isDeletePoint(index) || ep == NULL){
236- //TODO 応急処置!
237- continue;
224+ if(dmgr->getIndex() > 0){
225+ bool result = dmgr->back(&act);
226+ if(!result){
227+ dmgr->forward(&act);
228+ }
229+ result = dmgr->back(&act);
230+ if(result){
231+ if(act.type == hpl::aleph::map::ActionType::None ||
232+ act.type == hpl::aleph::map::ActionType::Move)
233+ {
234+ //移動を元に戻す
235+ for(int i = 0; i < (int)act.selectData.getSelPoints()->size(); i ++){
236+ int index = act.selectData.getSelPoints()->at(i).index;
237+ endpoint_data* ep = get_endpoint_data(index);
238+ //TODO 削除・追加のUndo機能も実装しよう。
239+ //これだけだと削除されている場合エラーになる
240+ if(smgr->isDeletePoint(index) || ep == NULL){
241+ //TODO 応急処置!
242+ continue;
243+ }
244+ ep->vertex = act.pointVertexMap[index];
238245 }
239- ep->vertex.x = act.pointVertexMap[index][0];
240- ep->vertex.y = act.pointVertexMap[index][1];
241- }
242- for(int i = 0; i < act.selectData.getSelObjects()->size(); i ++){
243- int index = act.selectData.getSelObjects()->at(i).index;
244- if(smgr->isDeleteObject(index) || index >= SavedObjectList.size()){
245- continue;
246+ for(int i = 0; i < (int)act.selectData.getSelObjects()->size(); i ++){
247+ int index = act.selectData.getSelObjects()->at(i).index;
248+ if(smgr->isDeleteObject(index) || index >= (int)SavedObjectList.size()){
249+ continue;
250+ }
251+ map_object* obj = &SavedObjectList[index];
252+ obj->location = act.objectLocationMap[index];
246253 }
247- map_object* obj = &SavedObjectList[index];
248- obj->location.x = act.objectLocationMap[index][0];
249- obj->location.y = act.objectLocationMap[index][1];
250- obj->location.z = act.objectLocationMap[index][2];
254+ //lines
255+ for(int i = 0; i < (int)act.selectData.getSelLines()->size(); i ++){
256+ int index = act.selectData.getSelLines()->at(i).index;
257+ line_data* line = get_line_data(index);
258+ for(int j = 0; j < 2; j ++){
259+ int epIndex = line->endpoint_indexes[j];
260+ get_endpoint_data(epIndex)->vertex = act.pointVertexMap[epIndex];
261+ }
262+ }
263+
264+ //polygons
265+ for(int i = 0; i < (int)act.selectData.getSelPolygons()->size(); i ++){
266+ int index = act.selectData.getSelPolygons()->at(i).index;
267+ polygon_data* poly = get_polygon_data(index);
268+ for(int j = 0; j < poly->vertex_count; j ++){
269+ int epIndex = poly->endpoint_indexes[j];
270+ get_endpoint_data(epIndex)->vertex = act.pointVertexMap[epIndex];
271+ }
272+ }
273+
274+ }else{
275+ hpl::error::halt("This function is disable");
251276 }
277+
252278 }else{
253- hpl::error::halt("This function is disable");
279+ #ifdef __WXDEBUG__
280+ hpl::error::caution("Undo失敗。index=%d", dmgr->getIndex());
281+ #endif
254282 }
255283
256- }else{
257-#ifdef __WXDEBUG__
258- hpl::error::caution("Undo失敗。index=%d", dmgr->getIndex());
259-#endif
284+ //更新
285+ this->updateMapItems();
260286 }
261-
262- //更新
263- this->updateMapItems();
264287 }
265288 void MapEditorMainFrame::OnRedo(wxCommandEvent& ev)
266289 {
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 412)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 413)
@@ -290,4 +290,6 @@
290290
291291 TODO ?I?u?W?F?N?g?lj?????
292292 TODO ?I?u?W?F?N?g?̍????ύX???Undo?v?f?ɒlj?????B
293-TODO ?I?u?W?F?N?g?̍????̓|???S???̏????烢?ŗp??
\ No newline at end of file
293+TODO ?I?u?W?F?N?g?̍????̓|???S???̏????烢?ŗp??
294+
295+TODO HPLRealMapData?̃C???f?b?N?X?L?????????v???b?g?t?H?[???̋L??
--- marathon/trunk/HPLLib/HPLMapTool.cpp (revision 412)
+++ marathon/trunk/HPLLib/HPLMapTool.cpp (revision 413)
@@ -575,7 +575,7 @@
575575 isClockwiseNeighbour = false;
576576 }
577577 if(adjacentPolyIndex != NONE){
578- if(smgr->delPolygons[adjacentPolyIndex]){
578+ if(smgr->isDeletePolygon(adjacentPolyIndex)){
579579 //削除されている
580580 adjacentPolyIndex = NONE;
581581 if(isClockwiseNeighbour){
@@ -605,12 +605,14 @@
605605
606606 //自分方向のSideもチェック
607607 if(isClockwiseNeighbour){
608- if(smgr->isDeleteSide(line->counterclockwise_polygon_side_index)){
608+ if(line->counterclockwise_polygon_side_index != NONE &&
609+ smgr->isDeleteSide(line->counterclockwise_polygon_side_index)){
609610 line->counterclockwise_polygon_side_index = NONE;
610611 }
611612 poly->side_indexes[i] = line->counterclockwise_polygon_side_index;
612613 }else{
613- if(smgr->isDeleteSide(line->clockwise_polygon_side_index)){
614+ if(line->clockwise_polygon_side_index != NONE &&
615+ smgr->isDeleteSide(line->clockwise_polygon_side_index)){
614616 line->clockwise_polygon_side_index = NONE;
615617 }
616618 poly->side_indexes[i] = line->clockwise_polygon_side_index;
--- marathon/trunk/HPLLib/HPLDoneHistory.h (revision 412)
+++ marathon/trunk/HPLLib/HPLDoneHistory.h (revision 413)
@@ -47,6 +47,10 @@
4747 class HPLActionItem{
4848 private:
4949 HPLActionItem(){}
50+ /**
51+ 点の位置を記憶
52+ */
53+ void storePointVertex(int index);
5054 public:
5155 /**
5256 @param t タイプ ActionType::
@@ -59,8 +63,8 @@
5963 int type;
6064 hpl::aleph::map::HPLSelectData selectData;
6165 //位置情報の記録
62- std::map<int, int[2]> pointVertexMap;
63- std::map<int, int[3]> objectLocationMap;
66+ std::map<int, world_point2d> pointVertexMap;
67+ std::map<int, world_point3d> objectLocationMap;
6468 hpl::aleph::map::HPLRealMapData realData;
6569 };
6670
--- marathon/trunk/HPLLib/HPLStockManager.cpp (revision 412)
+++ marathon/trunk/HPLLib/HPLStockManager.cpp (revision 413)
@@ -522,7 +522,7 @@
522522 bool hpl::aleph::HPLStockManager::isDeletePlatform(int index)
523523 {
524524 #ifdef _WXDEBUG_
525- wxASSERT(index >= 0 && index < this->del.size());
525+ wxASSERT(index >= 0 && index < this->delPlatforms.size());
526526 #endif
527527 return this->delPlatforms[index];
528528 }
--- marathon/trunk/HPLLib/HPLRealMapData.h (revision 412)
+++ marathon/trunk/HPLLib/HPLRealMapData.h (revision 413)
@@ -17,6 +17,15 @@
1717 namespace map{
1818 class HPLRealMapData{
1919 private:
20+ //TODO インデックスの記憶
21+ //こぴぺやUndo処理などで必要かもしれない
22+ std::map<int, int> originalPointIndexMap;
23+ std::map<int, int> originalLineIndexMap;
24+ std::map<int, int> originalObjectIndexMap;
25+ std::map<int, int> originalPolygonIndexMap;
26+ std::map<int, int> originalSideIndexMap;
27+ std::map<int, int> originalPlatformIndexMap;
28+
2029 //点データ<data_structure>
2130 std::vector<endpoint_data> realPoints;
2231 //オブジェクトデータ
@@ -27,6 +36,9 @@
2736 std::vector<side_data> realSides;
2837 //ポリゴンデータ
2938 std::vector<polygon_data> realPolygons;
39+
40+ //TODO platform
41+ std::vector<polygon_data> realPlatform;
3042 public:
3143 HPLRealMapData();
3244 ~HPLRealMapData();
--- marathon/trunk/HPLLib/HPLDoneHistory.cpp (revision 412)
+++ marathon/trunk/HPLLib/HPLDoneHistory.cpp (revision 413)
@@ -10,22 +10,58 @@
1010 this->realData = real;
1111
1212 //現在位置を覚えておきます
13- for(int i = 0; i < sel.getSelPoints()->size(); i ++){
14- int index = sel.getSelPoints()->at(i).index;
15- endpoint_data* ep = get_endpoint_data(index);
16- this->pointVertexMap[index][0] = ep->vertex.x;
17- this->pointVertexMap[index][1] = ep->vertex.y;
13+ //points
14+ for(int i = 0; i < (int)sel.getSelPoints()->size(); i ++){
15+ this->storePointVertex(sel.getSelPoints()->at(i).index);
1816 }
19- for(int i = 0; i < sel.getSelObjects()->size(); i ++){
17+
18+ //objects
19+ for(int i = 0; i < (int)sel.getSelObjects()->size(); i ++){
2020 int index = sel.getSelObjects()->at(i).index;
21+#ifdef __WXDEBUG__
22+ wxASSERT(index < (int)SavedObjectList.size());
23+#endif
2124 map_object* obj = &SavedObjectList[index];
22- this->objectLocationMap[index][0] = obj->location.x;
23- this->objectLocationMap[index][1] = obj->location.y;
24- this->objectLocationMap[index][2] = obj->location.z;
25+ this->objectLocationMap[index] = obj->location;
2526 }
27+
28+ //lines
29+ for(int i = 0; i < (int)sel.getSelLines()->size(); i ++){
30+ int index = sel.getSelLines()->at(i).index;
31+ line_data* line = get_line_data(index);
32+#ifdef __WXDEBUG__
33+ wxASSERT(line);
34+#endif
35+ for(int j = 0; j < 2; j ++){
36+ this->storePointVertex(line->endpoint_indexes[j]);
37+ }
38+ }
39+ //polygons
40+ for(int i = 0; i < (int)sel.getSelPolygons()->size(); i ++){
41+ int index = sel.getSelPolygons()->at(i).index;
42+ polygon_data* poly = get_polygon_data(index);
43+#ifdef __WXDEBUG__
44+ wxASSERT(poly);
45+#endif
46+ for(int j = 0; j < poly->vertex_count; j ++){
47+ this->storePointVertex(poly->endpoint_indexes[j]);
48+ }
49+ }
50+
2651 // memcpy(&this->selectData, &sel, sizeof(hpl::aleph::map::HPLSelectData));
2752 // memcpy(&this->realData, &real, sizeof(hpl::aleph::map::HPLRealMapData));
2853 }
54+/**
55+ 点の位置を記憶
56+*/
57+void hpl::aleph::map::HPLActionItem::storePointVertex(int index)
58+{
59+ endpoint_data* ep = get_endpoint_data(index);
60+#ifdef __WXDEBUG__
61+ wxASSERT(ep);
62+#endif
63+ this->pointVertexMap[index] = ep->vertex;
64+}
2965 hpl::aleph::map::HPLActionItem::~HPLActionItem()
3066 {
3167 int a = 0;
@@ -97,10 +133,19 @@
97133 bool hpl::aleph::map::HPLDoneHistory::back(hpl::aleph::map::HPLActionItem* act)
98134 {
99135 if(index < 0){
136+#ifdef __WXDEBUG__
137+ hpl::error::caution("undo index=%d cannot undo", index);
138+#endif
100139 return false;
101140 }
141+#ifdef __WXDEBUG__
142+// hpl::error::caution("undo back() index=%d", index);
143+#endif
102144 *act = this->actionList[index];
103145 index --;
146+#ifdef __WXDEBUG__
147+// hpl::error::caution("undo back() index=%d", index);
148+#endif
104149 return true;
105150 }
106151 bool hpl::aleph::map::HPLDoneHistory::forward(hpl::aleph::map::HPLActionItem* act)
旧リポジトリブラウザで表示