Makes EAlign more consistent with other enums by CC.

This was SVN commit r25142.
This commit is contained in:
vladislavbelov
2021-03-27 12:07:38 +00:00
parent 6332760528
commit fa3e501f8f
6 changed files with 49 additions and 38 deletions
+15 -15
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -259,15 +259,15 @@ template<> void ScriptInterface::ToJSVal<EVAlign>(const ScriptRequest& rq, JS::M
std::string word;
switch (val)
{
case EVAlign_Top:
case EVAlign::TOP:
word = "top";
break;
case EVAlign_Bottom:
case EVAlign::BOTTOM:
word = "bottom";
break;
case EVAlign_Center:
case EVAlign::CENTER:
word = "center";
break;
@@ -285,14 +285,14 @@ template<> bool ScriptInterface::FromJSVal<EVAlign>(const ScriptRequest& rq, JS:
FromJSVal(rq, v, word);
if (word == "top")
out = EVAlign_Top;
out = EVAlign::TOP;
else if (word == "bottom")
out = EVAlign_Bottom;
out = EVAlign::BOTTOM;
else if (word == "center")
out = EVAlign_Center;
out = EVAlign::CENTER;
else
{
out = EVAlign_Top;
out = EVAlign::TOP;
LOGERROR("Invalid alignment (should be 'left', 'right' or 'center')");
return false;
}
@@ -304,13 +304,13 @@ template<> void ScriptInterface::ToJSVal<EAlign>(const ScriptRequest& rq, JS::Mu
std::string word;
switch (val)
{
case EAlign_Left:
case EAlign::LEFT:
word = "left";
break;
case EAlign_Right:
case EAlign::RIGHT:
word = "right";
break;
case EAlign_Center:
case EAlign::CENTER:
word = "center";
break;
default:
@@ -327,14 +327,14 @@ template<> bool ScriptInterface::FromJSVal<EAlign>(const ScriptRequest& rq, JS::
FromJSVal(rq, v, word);
if (word == "left")
out = EAlign_Left;
out = EAlign::LEFT;
else if (word == "right")
out = EAlign_Right;
out = EAlign::RIGHT;
else if (word == "center")
out = EAlign_Center;
out = EAlign::CENTER;
else
{
out = EAlign_Left;
out = EAlign::LEFT;
LOGERROR("Invalid alignment (should be 'left', 'right' or 'center')");
return false;
}