forked from devsam/core
refac: Constraint의 generalObj destGeneralObj로 General 객체 입력
This commit is contained in:
@@ -5,6 +5,7 @@ use \sammo\{
|
|||||||
Util, JosaUtil, DB,
|
Util, JosaUtil, DB,
|
||||||
General, GameConst,
|
General, GameConst,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
|
Json,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
NotInheritedMethodException,
|
NotInheritedMethodException,
|
||||||
RandUtil
|
RandUtil
|
||||||
@@ -170,6 +171,10 @@ abstract class BaseCommand{
|
|||||||
else{
|
else{
|
||||||
$this->nation = $nation;
|
$this->nation = $nation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(key_exists('aux', $this->nation) && is_string($this->nation['aux'])){
|
||||||
|
$this->nation['aux'] = Json::decode($this->nation['aux']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setDestGeneral(General $destGeneralObj){
|
protected function setDestGeneral(General $destGeneralObj){
|
||||||
@@ -312,12 +317,12 @@ abstract class BaseCommand{
|
|||||||
|
|
||||||
$this->generalObj->unpackAux();
|
$this->generalObj->unpackAux();
|
||||||
$constraintInput = [
|
$constraintInput = [
|
||||||
'general'=>$this->generalObj->getRaw(),
|
'general'=>$this->generalObj,
|
||||||
'city'=>$this->city,
|
'city'=>$this->city,
|
||||||
'nation'=>$this->nation,
|
'nation'=>$this->nation,
|
||||||
'cmd_arg'=>$this->arg,
|
'cmd_arg'=>$this->arg,
|
||||||
|
|
||||||
'destGeneral'=>$this->destGeneralObj?$this->destGeneralObj->getRaw():null,
|
'destGeneral'=>$this->destGeneralObj??null,
|
||||||
'destCity'=>$this->destCity,
|
'destCity'=>$this->destCity,
|
||||||
'destNation'=>$this->destNation,
|
'destNation'=>$this->destNation,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace sammo\Constraint;
|
namespace sammo\Constraint;
|
||||||
|
|
||||||
|
use sammo\General;
|
||||||
|
|
||||||
abstract class Constraint
|
abstract class Constraint
|
||||||
{
|
{
|
||||||
private function __construct()
|
private function __construct()
|
||||||
@@ -24,6 +26,8 @@ abstract class Constraint
|
|||||||
|
|
||||||
const REQ_VALUES = 0;
|
const REQ_VALUES = 0;
|
||||||
|
|
||||||
|
/** @var ?General */
|
||||||
|
protected $generalObj = null;
|
||||||
protected $general = null;
|
protected $general = null;
|
||||||
protected $city = null;
|
protected $city = null;
|
||||||
protected $nation = null;
|
protected $nation = null;
|
||||||
@@ -33,6 +37,8 @@ abstract class Constraint
|
|||||||
|
|
||||||
protected $cmd_arg = null;
|
protected $cmd_arg = null;
|
||||||
|
|
||||||
|
/** @var ?General */
|
||||||
|
protected $destGeneralObj = null;
|
||||||
protected $destGeneral = null;
|
protected $destGeneral = null;
|
||||||
protected $destCity = null;
|
protected $destCity = null;
|
||||||
protected $destNation = null;
|
protected $destNation = null;
|
||||||
@@ -48,9 +54,10 @@ abstract class Constraint
|
|||||||
return static::REQ_VALUES;
|
return static::REQ_VALUES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setGeneral(array $general)
|
public function setGeneral(General $general)
|
||||||
{
|
{
|
||||||
$this->general = $general;
|
$this->generalObj = $general;
|
||||||
|
$this->general = $general->getRaw();
|
||||||
$this->tested = false;
|
$this->tested = false;
|
||||||
$this->reason = null;
|
$this->reason = null;
|
||||||
}
|
}
|
||||||
@@ -85,9 +92,10 @@ abstract class Constraint
|
|||||||
$this->reason = null;
|
$this->reason = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDestGeneral(array $general)
|
public function setDestGeneral(General $general)
|
||||||
{
|
{
|
||||||
$this->destGeneral = $general;
|
$this->destGeneralObj = $general;
|
||||||
|
$this->destGeneral = $general->getRaw();
|
||||||
$this->tested = false;
|
$this->tested = false;
|
||||||
$this->reason = null;
|
$this->reason = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user