Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/scripting/MessageTypeConversions.cpp
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | CMessage* CMessageTerritoryPositionChanged::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val) | ||||
FROMJSVAL_SETUP(); | FROMJSVAL_SETUP(); | ||||
GET_MSG_PROPERTY(entity_id_t, entity); | GET_MSG_PROPERTY(entity_id_t, entity); | ||||
GET_MSG_PROPERTY(player_id_t, newTerritory); | GET_MSG_PROPERTY(player_id_t, newTerritory); | ||||
return new CMessageTerritoryPositionChanged(entity, newTerritory); | return new CMessageTerritoryPositionChanged(entity, newTerritory); | ||||
} | } | ||||
//////////////////////////////// | //////////////////////////////// | ||||
JS::Value CMessageTerritoryInfluenceChanged::ToJSVal(const ScriptInterface& scriptInterface) const | |||||
{ | |||||
TOJSVAL_SETUP(); | |||||
SET_MSG_PROPERTY(entity); | |||||
return JS::ObjectValue(*obj); | |||||
} | |||||
CMessage* CMessageTerritoryInfluenceChanged::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val) | |||||
{ | |||||
FROMJSVAL_SETUP(); | |||||
GET_MSG_PROPERTY(entity_id_t, entity); | |||||
return new CMessageTerritoryInfluenceChanged(entity); | |||||
} | |||||
//////////////////////////////// | |||||
const std::array<const char*, CMessageMotionUpdate::UpdateType::LENGTH> CMessageMotionUpdate::UpdateTypeStr = { { | const std::array<const char*, CMessageMotionUpdate::UpdateType::LENGTH> CMessageMotionUpdate::UpdateTypeStr = { { | ||||
"likelySuccess", "likelyFailure", "obstructed", "veryObstructed" | "likelySuccess", "likelyFailure", "obstructed", "veryObstructed" | ||||
} }; | } }; | ||||
JS::Value CMessageMotionUpdate::ToJSVal(const ScriptInterface& scriptInterface) const | JS::Value CMessageMotionUpdate::ToJSVal(const ScriptInterface& scriptInterface) const | ||||
{ | { | ||||
TOJSVAL_SETUP(); | TOJSVAL_SETUP(); | ||||
JS::RootedValue prop(rq.cx); | JS::RootedValue prop(rq.cx); | ||||
▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator