Skip to content

Commit

Permalink
added script variables to map object
Browse files Browse the repository at this point in the history
  • Loading branch information
Robosturm committed Oct 3, 2023
1 parent 6234656 commit 9ff3616
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions game/gamemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,7 @@ void GameMap::serializeObject(QDataStream& pStream, bool forHash) const
pStream << m_recordFile;
pStream << m_replayActionCount;
}
m_Variables.serializeObject(pStream, forHash);
}

void GameMap::updateMapFlags() const
Expand Down Expand Up @@ -1768,6 +1769,10 @@ void GameMap::deserializer(QDataStream& pStream, bool fast)
pStream >> m_recordFile;
pStream >> m_replayActionCount;
}
if (m_headerInfo.m_Version > 13)
{
m_Variables.deserializeObject(pStream);
}
}
if (showLoadingScreen)
{
Expand Down
11 changes: 10 additions & 1 deletion game/gamemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class GameMap final : public QObject, public FileSerializable, public oxygine::A
*/
inline virtual qint32 getVersion() const override
{
return 13;
return 14;
}
/**
* @brief clearMap
Expand Down Expand Up @@ -917,6 +917,14 @@ class GameMap final : public QObject, public FileSerializable, public oxygine::A
* @brief showDamageCalculator
*/
Q_INVOKABLE void showDamageCalculator();
/**
* @brief getVariables
* @return
*/
Q_INVOKABLE inline ScriptVariables* getVariables()
{
return &m_Variables;
}
private slots:
void zoomChanged();
private:
Expand Down Expand Up @@ -954,6 +962,7 @@ private slots:
spCampaign m_Campaign;
spGameRecorder m_Recorder{MemoryManagement::create<GameRecorder>(this)};
spGameScript m_GameScript{MemoryManagement::create<GameScript>(this)};
ScriptVariables m_Variables;
static const char* const m_GameAnimationFactory;
bool m_loaded{false};
QString m_mapMusic;
Expand Down

0 comments on commit 9ff3616

Please sign in to comment.