Ticket #1163: 1163.7.diff
File 1163.7.diff, 5.4 KB (added by , 9 years ago) |
---|
-
source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 366 359 { 367 360 if (evt.LeftUp()) 368 361 { 362 POST_MESSAGE(ResetSelectionColor, ()); 369 363 SET_STATE(Waiting); 370 364 return true; 371 365 } -
source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 36 36 #include "renderer/Renderer.h" 37 37 #include "simulation2/Simulation2.h" 38 38 #include "simulation2/components/ICmpSoundManager.h" 39 #include "ps/Filesystem.h" 39 40 40 41 extern void (*Atlas_GLSwapBuffers)(void* context); 41 42 … … 225 226 in_dispatch_event(&ev); 226 227 } 227 228 229 MESSAGEHANDLER(VFSUpdateFile) 230 { 231 ReloadChangedFilesFromAtlas(*msg->filePath); 228 232 } 233 234 } -
source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 41 41 #include "renderer/Renderer.h" 42 42 #include "renderer/WaterManager.h" 43 43 #include "simulation2/Simulation2.h" 44 #include "simulation2/components/ICmpObstruction.h" 44 45 #include "simulation2/components/ICmpOwnership.h" 45 46 #include "simulation2/components/ICmpPosition.h" 46 47 #include "simulation2/components/ICmpPlayer.h" … … 61 62 } 62 63 } 63 64 65 // Helpers for object constraints 66 bool CanPlaceObjectEntityHelper(entity_id_t ent) 67 { 68 CmpPtr<ICmpObstruction> cmpObstruction(*g_Game->GetSimulation2(), ent); 69 if (cmpObstruction) 70 { 71 ICmpObstruction::EFoundationCheck result = cmpObstruction->CheckFoundation("default"); 72 if (result != ICmpObstruction::FOUNDATION_CHECK_SUCCESS) 73 return false; 74 } 75 return true; 76 } 77 78 void CheckObstructionAndUpdateVisual(entity_id_t id) 79 { 80 CmpPtr<ICmpVisual> cmpVisual(*g_Game->GetSimulation2(), id); 81 if (cmpVisual) 82 { 83 if (!CanPlaceObjectEntityHelper(id)) 84 cmpVisual->SetShadingColour(fixed::FromDouble(1.4), fixed::FromDouble(0.4), fixed::FromDouble(0.4), fixed::FromDouble(1)); 85 else 86 cmpVisual->SetShadingColour(fixed::FromDouble(1), fixed::FromDouble(1), fixed::FromDouble(1), fixed::FromDouble(1)); 87 } 88 } 89 64 90 QUERYHANDLER(GetObjectsList) 65 91 { 66 92 std::vector<sObjectsListItem> objects; … … 473 499 posFinal = posFixed + dir; 474 500 } 475 501 cmpPosition->JumpTo(posFinal.X, posFinal.Z); 502 503 CheckObstructionAndUpdateVisual(id); 476 504 } 477 505 } 478 506 … … 543 571 CmpPtr<ICmpOwnership> cmpOwnership(*g_Game->GetSimulation2(), g_PreviewEntityID); 544 572 if (cmpOwnership) 545 573 cmpOwnership->SetOwner((player_id_t)msg->settings->player); 574 575 CheckObstructionAndUpdateVisual(g_PreviewEntityID); 546 576 } 547 577 } 548 578 … … 680 710 msg->ids = EntitySelection::PickSimilarEntities(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), templateName, owner, false, true, true, false); 681 711 } 682 712 713 MESSAGEHANDLER(ResetSelectionColor) 714 { 715 UNUSED(msg); 716 if (g_Selection.empty()) 717 return; 683 718 719 for (size_t i = 0; i < g_Selection.size(); ++i) 720 { 721 CmpPtr<ICmpVisual> cmpVisual(*g_Game->GetSimulation2(), g_Selection[i]); 722 if (cmpVisual) 723 cmpVisual->SetShadingColour(fixed::FromDouble(1), fixed::FromDouble(1), fixed::FromDouble(1), fixed::FromDouble(1)); 724 } 725 } 726 684 727 BEGIN_COMMAND(MoveObjects) 685 728 { 686 729 // Mapping from object to position … … 736 779 ObjectPositionMap::iterator it; 737 780 for (it = map.begin(); it != map.end(); ++it) 738 781 { 739 CmpPtr<ICmpPosition> cmpPosition(*g_Game->GetSimulation2(), (entity_id_t)it->first); 782 entity_id_t id = (entity_id_t)it->first; 783 CmpPtr<ICmpPosition> cmpPosition(*g_Game->GetSimulation2(), id); 740 784 if (!cmpPosition) 741 785 return; 742 786 … … 743 787 // Set 2D position, ignoring height 744 788 CVector3D pos = it->second; 745 789 cmpPosition->JumpTo(entity_pos_t::FromFloat(pos.X), entity_pos_t::FromFloat(pos.Z)); 790 791 CheckObstructionAndUpdateVisual(id); 746 792 } 747 793 } 748 794 -
source/tools/atlas/GameInterface/Messages.h
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 573 577 ((std::vector<ObjectID>, ids)) 574 578 ); 575 579 580 MESSAGE(ResetSelectionColor, ); 581 576 582 COMMAND(MoveObjects, MERGE, 577 583 ((std::vector<ObjectID>, ids)) 578 584 ((ObjectID, pivot))