This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9609 for ps


Ignore:
Timestamp:
06/10/11 01:47:20 (14 years ago)
Author:
ben
Message:
 
Location:
ps/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/build/premake/premake.lua

    r9607 r9609  
    824824        "ScenarioEditor/Sections/Map",
    825825        "ScenarioEditor/Sections/Object",
     826        "ScenarioEditor/Sections/Player",
    826827        "ScenarioEditor/Sections/Terrain",
    827828        "ScenarioEditor/Sections/Trigger",
  • ps/trunk/source/graphics/MapReader.cpp

    r9366 r9609  
    849849    XMBElementList entities = parent.GetChildNodes();
    850850
     851    CSimulation2& sim = *m_MapReader.pSimulation2;
     852    CmpPtr<ICmpPlayerManager> cmpPlayerManager(sim.GetSimContext(), SYSTEM_ENTITY);
     853
    851854    while (entity_idx < entities.Count)
    852855    {
     
    904907        }
    905908
    906         CSimulation2& sim = *m_MapReader.pSimulation2;
    907909        entity_id_t ent = sim.AddEntity(TemplateName, EntityUid);
    908910        if (ent == INVALID_ENTITY)
     911        {
    909912            LOGERROR(L"Failed to load entity template '%ls'", TemplateName.c_str());
    910         else
    911         {
     913        }
     914        else if (cmpPlayerManager->GetPlayerByID(PlayerID) != INVALID_ENTITY)
     915        {   // Don't add entities with invalid player IDs
     916            // TODO: Is a warning OK or should it just silently fail?
     917
    912918            CmpPtr<ICmpPosition> cmpPosition(sim, ent);
    913919            if (!cmpPosition.null())
  • ps/trunk/source/simulation2/Simulation2.cpp

    r9550 r9609  
    593593std::string CSimulation2::GetPlayerDefaults()
    594594{
    595     VfsPath path = VfsPath(L"simulation/data/player_defaults.json");
    596 
     595    return ReadJSON(L"simulation/data/player_defaults.json");
     596}
     597
     598std::string CSimulation2::GetMapSizes()
     599{
     600    return ReadJSON(L"simulation/data/map_sizes.json");
     601}
     602
     603std::string CSimulation2::ReadJSON(VfsPath path)
     604{
    597605    std::string data;
    598606
  • ps/trunk/source/simulation2/Simulation2.h

    r9410 r9609  
    227227    std::string GetPlayerDefaults();
    228228
     229    /**
     230     * Get map sizes data
     231     *
     232     * @return string containing JSON format data
     233     */
     234    std::string GetMapSizes();
     235
    229236private:
    230237    CSimulation2Impl* m;
    231238
     239    // Helper for reading JSON files
     240    std::string ReadJSON(VfsPath path);
     241
    232242    NONCOPYABLE(CSimulation2);
    233243};
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h

    r9566 r9609  
    6565    ScriptInterface& GetScriptInterface() const { return m_ScriptInterface; }
    6666    Observable<ObjectSettings>& GetObjectSettings() { return m_ObjectSettings; }
     67    Observable<AtObj>& GetMapSettings() { return m_MapSettings; }
    6768
    6869    ToolManager& GetToolManager() { return m_ToolManager; }
     
    7879
    7980    Observable<ObjectSettings> m_ObjectSettings;
     81    Observable<AtObj> m_MapSettings;
    8082
    8183    void SetOpenFilename(const wxString& filename);
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/SectionLayout.cpp

    r9569 r9609  
    3232#include "Sections/Map/Map.h"
    3333#include "Sections/Object/Object.h"
     34#include "Sections/Player/Player.h"
    3435#include "Sections/Terrain/Terrain.h"
    3536#include "Sections/Trigger/Trigger.h"
     
    289290   
    290291    ADD_SIDEBAR(MapSidebar,             _T("map.png"),         _("Map"));
     292    ADD_SIDEBAR(PlayerSidebar,          _T("player.png"),      _("Player"));
    291293    ADD_SIDEBAR(TerrainSidebar,         _T("terrain.png"),     _("Terrain"));
    292294    ADD_SIDEBAR(ObjectSidebar,          _T("object.png"),      _("Object"));
  • ps/trunk/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp

    r9566 r9609  
    140140}
    141141
    142 MESSAGEHANDLER(SetMapSettings)
    143 {
    144     g_Game->GetSimulation2()->SetMapSettings(*msg->settings);
    145 }
     142QUERYHANDLER(GetMapSizes)
     143{
     144    msg->sizes = g_Game->GetSimulation2()->GetMapSizes();
     145}
     146
     147BEGIN_COMMAND(SetMapSettings)
     148{
     149    void Do()
     150    {
     151        Redo();
     152    }
     153
     154    void Undo()
     155    {
     156        // TODO
     157        debug_warn(L"Can't undo SetMapSettings");
     158    }
     159
     160    void Redo()
     161    {
     162        g_Game->GetSimulation2()->SetMapSettings(*msg->settings);
     163    }
     164};
     165END_COMMAND(SetMapSettings)
    146166
    147167QUERYHANDLER(GetRMSData)
  • ps/trunk/source/tools/atlas/GameInterface/Messages.h

    r9566 r9609  
    153153        );
    154154
    155 MESSAGE(SetMapSettings,
     155QUERY(GetMapSizes,
     156        ,
     157        ((std::string, sizes))
     158        );
     159
     160COMMAND(SetMapSettings, NOMERGE,
    156161        ((std::string, settings))
    157162        );
Note: See TracChangeset for help on using the changeset viewer.