Forum Discussion
9 years ago
Also, as a side note:
Why do that, when you can do this?
The case instances fall through by default; that's why the "break" statements exist.
"Triplis;c-15778196" wrote:
Adding in another case:
protected function ShowOccultContent(param1:int) : *
{
switch(param1)
{
case OccultTypes.OCCULT_VAMPIRE:
this.mcVampireContent.visible = true;
this.mcVampireContent.HandleSimActivated(mSimId);
this.mcVampireContent.y = this.mcMotives.y + this.mcMotives.CalculateCommoditiesHeight() + SimInfoMotivePanelTunables.OCCULT_CONTENT_MARGIN.mTop;
break;
case OccultTypes.OCCULT_SORCERER:
this.mcVampireContent.visible = true;
this.mcVampireContent.HandleSimActivated(mSimId);
this.mcVampireContent.y = this.mcMotives.y + this.mcMotives.CalculateCommoditiesHeight() + SimInfoMotivePanelTunables.OCCULT_CONTENT_MARGIN.mTop;
break;
default:
this.mcVampireContent.visible = false;
}
this.RefreshPanelHeight();
}
Why do that, when you can do this?
protected function ShowOccultContent(param1:int) : *
{
switch(param1)
{
case OccultTypes.OCCULT_SORCERER:
case OccultTypes.OCCULT_VAMPIRE:
this.mcVampireContent.visible = true;
this.mcVampireContent.HandleSimActivated(mSimId);
this.mcVampireContent.y = this.mcMotives.y + this.mcMotives.CalculateCommoditiesHeight() + SimInfoMotivePanelTunables.OCCULT_CONTENT_MARGIN.mTop;
break;
default:
this.mcVampireContent.visible = false;
}
this.RefreshPanelHeight();
}
The case instances fall through by default; that's why the "break" statements exist.