From a015765d3983a060789ccb1c9a352b80a000053c Mon Sep 17 00:00:00 2001 From: danij Date: Wed, 29 Jan 2014 16:48:43 +0000 Subject: [PATCH] Refactor|libhexen: Switched p_pillar.c and p_waggle.c to C++ --- doomsday/plugins/hexen/hexen.pro | 4 +- doomsday/plugins/hexen/include/p_pillar.h | 46 +++--- doomsday/plugins/hexen/include/p_waggle.h | 40 +++-- .../hexen/src/{p_pillar.c => p_pillar.cpp} | 116 ++++++-------- doomsday/plugins/hexen/src/p_waggle.c | 142 ------------------ doomsday/plugins/hexen/src/p_waggle.cpp | 115 ++++++++++++++ 6 files changed, 201 insertions(+), 262 deletions(-) rename doomsday/plugins/hexen/src/{p_pillar.c => p_pillar.cpp} (59%) delete mode 100644 doomsday/plugins/hexen/src/p_waggle.c create mode 100644 doomsday/plugins/hexen/src/p_waggle.cpp diff --git a/doomsday/plugins/hexen/hexen.pro b/doomsday/plugins/hexen/hexen.pro index b4ba3db222..a0da71a23f 100644 --- a/doomsday/plugins/hexen/hexen.pro +++ b/doomsday/plugins/hexen/hexen.pro @@ -89,13 +89,13 @@ SOURCES += \ src/p_mapinfo.cpp \ src/p_maputl.c \ src/p_mobj.c \ - src/p_pillar.c \ + src/p_pillar.cpp \ src/p_pspr.c \ src/p_setup.c \ src/p_spec.c \ src/p_telept.c \ src/p_things.c \ - src/p_waggle.c \ + src/p_waggle.cpp \ src/sn_sonix.cpp \ src/st_stuff.c \ src/tables.c \ diff --git a/doomsday/plugins/hexen/include/p_pillar.h b/doomsday/plugins/hexen/include/p_pillar.h index 319520fc47..0749bdefeb 100644 --- a/doomsday/plugins/hexen/include/p_pillar.h +++ b/doomsday/plugins/hexen/include/p_pillar.h @@ -1,26 +1,22 @@ -/**\file p_pillar.h - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_pillar.h * - *\author Copyright © 2004-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2004-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #ifndef LIBHEXEN_P_PILLAR_H @@ -32,7 +28,7 @@ typedef struct { thinker_t thinker; - Sector* sector; + Sector *sector; float ceilingSpeed; float floorSpeed; coord_t floorDest; @@ -45,9 +41,11 @@ typedef struct { extern "C" { #endif -void T_BuildPillar(pillar_t* pillar); -int EV_BuildPillar(Line* line, byte* args, dd_bool crush); -int EV_OpenPillar(Line* line, byte* args); +void T_BuildPillar(pillar_t *pillar); + +int EV_BuildPillar(Line *line, byte *args, dd_bool crush); + +int EV_OpenPillar(Line *line, byte *args); #ifdef __cplusplus } // extern "C" diff --git a/doomsday/plugins/hexen/include/p_waggle.h b/doomsday/plugins/hexen/include/p_waggle.h index 7388f7dfe2..2cc6e28554 100644 --- a/doomsday/plugins/hexen/include/p_waggle.h +++ b/doomsday/plugins/hexen/include/p_waggle.h @@ -1,26 +1,22 @@ -/**\file p_waggle.h - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_waggle.h * - *\author Copyright © 2004-2013 Jaakko Keränen - *\author Copyright © 2005-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2004-2013 Jaakko Keränen + * @authors Copyright © 2005-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #ifndef LIBHEXEN_P_WAGGLE_H @@ -38,7 +34,7 @@ typedef enum { typedef struct { thinker_t thinker; - Sector* sector; + Sector *sector; coord_t originalHeight; coord_t accumulator; coord_t accDelta; @@ -53,7 +49,7 @@ typedef struct { extern "C" { #endif -void T_FloorWaggle(waggle_t* waggle); +void T_FloorWaggle(waggle_t *waggle); dd_bool EV_StartFloorWaggle(int tag, int height, int speed, int offset, int timer); #ifdef __cplusplus diff --git a/doomsday/plugins/hexen/src/p_pillar.c b/doomsday/plugins/hexen/src/p_pillar.cpp similarity index 59% rename from doomsday/plugins/hexen/src/p_pillar.c rename to doomsday/plugins/hexen/src/p_pillar.cpp index 6fe3a92a4f..06b7de1ba4 100644 --- a/doomsday/plugins/hexen/src/p_pillar.c +++ b/doomsday/plugins/hexen/src/p_pillar.cpp @@ -1,99 +1,71 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html +/** @file p_pillar.cpp * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 1999 Activision + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 1999 Activision * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * p_pillar.c: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ -// HEADER FILES ------------------------------------------------------------ - #include "jhexen.h" +#include "p_pillar.h" #include "dmu_lib.h" #include "p_mapspec.h" #include "p_iterlist.h" -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - void T_BuildPillar(pillar_t *pillar) { - result_e res1; - result_e res2; + DENG_ASSERT(pillar != 0); // First, raise the floor - res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floorDest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction + result_e res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floorDest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction // Then, lower the ceiling - res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingDest, pillar->crush, 1, -pillar->direction); + result_e res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingDest, pillar->crush, 1, -pillar->direction); if(res1 == pastdest && res2 == pastdest) { - P_ToXSector(pillar->sector)->specialData = NULL; + P_ToXSector(pillar->sector)->specialData = 0; SN_StopSequenceInSec(pillar->sector); P_ACScriptTagFinished(P_ToXSector(pillar->sector)->tag); Thinker_Remove(&pillar->thinker); } } -int EV_BuildPillar(Line* line, byte* args, dd_bool crush) +int EV_BuildPillar(Line *line, byte *args, dd_bool crush) { - int rtn = 0; - coord_t newHeight; - Sector* sec = NULL; - pillar_t* pillar; - iterlist_t* list; + iterlist_t *list = P_GetSectorIterListForTag((int) args[0], false); + if(!list) return 0; - list = P_GetSectorIterListForTag((int) args[0], false); - if(!list) return rtn; + int rtn = 0; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); - while((sec = IterList_MoveIterator(list)) != NULL) + + Sector *sec; + while((sec = (Sector *)IterList_MoveIterator(list))) { + // If already moving keep going... if(P_ToXSector(sec)->specialData) - continue; // Already moving, so keep going. + continue; if(FEQUAL(P_GetDoublep(sec, DMU_FLOOR_HEIGHT), P_GetDoublep(sec, DMU_CEILING_HEIGHT))) continue; // Pillar is already closed. rtn = 1; + coord_t newHeight = 0; if(!args[2]) { newHeight = P_GetDoublep(sec, DMU_FLOOR_HEIGHT) + @@ -105,7 +77,7 @@ int EV_BuildPillar(Line* line, byte* args, dd_bool crush) newHeight = P_GetDoublep(sec, DMU_FLOOR_HEIGHT) + (coord_t) args[2]; } - pillar = Z_Calloc(sizeof(*pillar), PU_MAP, 0); + pillar_t *pillar = (pillar_t *)Z_Calloc(sizeof(*pillar), PU_MAP, 0); pillar->thinker.function = (thinkfunc_t) T_BuildPillar; Thinker_Add(&pillar->thinker); @@ -137,28 +109,28 @@ int EV_BuildPillar(Line* line, byte* args, dd_bool crush) pillar->ceilingDest = newHeight; pillar->direction = 1; pillar->crush = crush * (int) args[3]; - SN_StartSequence(P_GetPtrp(pillar->sector, DMU_EMITTER), + SN_StartSequence((mobj_t *)P_GetPtrp(pillar->sector, DMU_EMITTER), SEQ_PLATFORM + P_ToXSector(pillar->sector)->seqType); } return rtn; } -int EV_OpenPillar(Line* line, byte* args) +int EV_OpenPillar(Line *line, byte *args) { - int rtn = 0; - Sector* sec = NULL; - pillar_t* pillar; - iterlist_t* list; + iterlist_t *list = P_GetSectorIterListForTag((int) args[0], false); + if(!list) return 0; - list = P_GetSectorIterListForTag((int) args[0], false); - if(!list) return rtn; + int rtn = 0; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); - while((sec = IterList_MoveIterator(list)) != NULL) + + Sector *sec; + while((sec = (Sector *)IterList_MoveIterator(list))) { + // If already moving keep going... if(P_ToXSector(sec)->specialData) - continue; // Already moving, so keep going... + continue; if(!FEQUAL(P_GetDoublep(sec, DMU_FLOOR_HEIGHT), P_GetDoublep(sec, DMU_CEILING_HEIGHT))) @@ -166,7 +138,7 @@ int EV_OpenPillar(Line* line, byte* args) rtn = 1; - pillar = Z_Calloc(sizeof(*pillar), PU_MAP, 0); + pillar_t *pillar = (pillar_t *)Z_Calloc(sizeof(*pillar), PU_MAP, 0); pillar->thinker.function = (thinkfunc_t) T_BuildPillar; Thinker_Add(&pillar->thinker); @@ -210,7 +182,7 @@ int EV_OpenPillar(Line* line, byte* args) } pillar->direction = -1; // Open the pillar. - SN_StartSequence(P_GetPtrp(pillar->sector, DMU_EMITTER), + SN_StartSequence((mobj_t *)P_GetPtrp(pillar->sector, DMU_EMITTER), SEQ_PLATFORM + P_ToXSector(pillar->sector)->seqType); } diff --git a/doomsday/plugins/hexen/src/p_waggle.c b/doomsday/plugins/hexen/src/p_waggle.c deleted file mode 100644 index a3eb8fb422..0000000000 --- a/doomsday/plugins/hexen/src/p_waggle.c +++ /dev/null @@ -1,142 +0,0 @@ -/**\file - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html - * - *\author Copyright © 2003-2013 Jaakko Keränen - *\author Copyright © 2006-2013 Daniel Swanson - *\author Copyright © 1999 Activision - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -/** - * p_waggle.c: - */ - -// HEADER FILES ------------------------------------------------------------ - -#include "jhexen.h" - -#include "dmu_lib.h" -#include "p_map.h" -#include "p_mapspec.h" -#include "p_iterlist.h" - -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// CODE -------------------------------------------------------------------- - -void T_FloorWaggle(waggle_t* waggle) -{ - coord_t fh; - - switch(waggle->state) - { - default: - case WS_STABLE: - if(waggle->ticker != -1) - { - if(!--waggle->ticker) - { - waggle->state = WS_REDUCE; - } - } - break; - - case WS_EXPAND: - if((waggle->scale += waggle->scaleDelta) >= waggle->targetScale) - { - waggle->scale = waggle->targetScale; - waggle->state = WS_STABLE; - } - break; - - case WS_REDUCE: - if((waggle->scale -= waggle->scaleDelta) <= 0) - { - // Remove. - P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, waggle->originalHeight); - P_ChangeSector(waggle->sector, 1 /*crush damage*/); - P_ToXSector(waggle->sector)->specialData = NULL; - P_ACScriptTagFinished(P_ToXSector(waggle->sector)->tag); - Thinker_Remove(&waggle->thinker); - return; - } - break; - } - - waggle->accumulator += waggle->accDelta; - fh = waggle->originalHeight + - FLOATBOBOFFSET(((int) waggle->accumulator) & 63) * waggle->scale; - P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, fh); - P_SetDoublep(waggle->sector, DMU_FLOOR_TARGET_HEIGHT, fh); - P_SetFloatp(waggle->sector, DMU_FLOOR_SPEED, 0); - P_ChangeSector(waggle->sector, 1 /*crush damage*/); -} - -dd_bool EV_StartFloorWaggle(int tag, int height, int speed, int offset, int timer) -{ - dd_bool retCode = false; - Sector* sec = NULL; - waggle_t* waggle; - iterlist_t* list; - - list = P_GetSectorIterListForTag(tag, false); - if(!list) return retCode; - - IterList_SetIteratorDirection(list, ITERLIST_FORWARD); - IterList_RewindIterator(list); - while((sec = IterList_MoveIterator(list)) != NULL) - { - if(P_ToXSector(sec)->specialData) - continue; // Already moving, so keep going... - - retCode = true; - - waggle = Z_Calloc(sizeof(*waggle), PU_MAP, 0); - waggle->thinker.function = (thinkfunc_t) T_FloorWaggle; - Thinker_Add(&waggle->thinker); - - P_ToXSector(sec)->specialData = waggle; - waggle->sector = sec; - waggle->originalHeight = P_GetDoublep(sec, DMU_FLOOR_HEIGHT); - waggle->accumulator = offset; - waggle->accDelta = FIX2FLT(speed << 10); - waggle->scale = 0; - waggle->targetScale = FIX2FLT(height << 10); - waggle->scaleDelta = - FIX2FLT(FLT2FIX(waggle->targetScale) / (TICSPERSEC + ((3 * TICSPERSEC) * height) / 255)); - waggle->ticker = timer ? timer * 35 : -1; - waggle->state = WS_EXPAND; - } - - return retCode; -} diff --git a/doomsday/plugins/hexen/src/p_waggle.cpp b/doomsday/plugins/hexen/src/p_waggle.cpp new file mode 100644 index 0000000000..11a1bd5600 --- /dev/null +++ b/doomsday/plugins/hexen/src/p_waggle.cpp @@ -0,0 +1,115 @@ +/** @file p_waggle.cpp + * + * @authors Copyright © 2003-2013 Jaakko Keränen + * @authors Copyright © 2006-2013 Daniel Swanson + * @authors Copyright © 1999 Activision + * + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "jhexen.h" +#include "p_waggle.h" + +#include "dmu_lib.h" +#include "p_map.h" +#include "p_mapspec.h" +#include "p_iterlist.h" + +void T_FloorWaggle(waggle_t *waggle) +{ + DENG_ASSERT(waggle != 0); + + switch(waggle->state) + { + default: + case WS_STABLE: + if(waggle->ticker != -1) + { + if(!--waggle->ticker) + { + waggle->state = WS_REDUCE; + } + } + break; + + case WS_EXPAND: + if((waggle->scale += waggle->scaleDelta) >= waggle->targetScale) + { + waggle->scale = waggle->targetScale; + waggle->state = WS_STABLE; + } + break; + + case WS_REDUCE: + if((waggle->scale -= waggle->scaleDelta) <= 0) + { + // Remove. + P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, waggle->originalHeight); + P_ChangeSector(waggle->sector, 1 /*crush damage*/); + P_ToXSector(waggle->sector)->specialData = NULL; + P_ACScriptTagFinished(P_ToXSector(waggle->sector)->tag); + Thinker_Remove(&waggle->thinker); + return; + } + break; + } + + waggle->accumulator += waggle->accDelta; + coord_t fh = waggle->originalHeight + + FLOATBOBOFFSET(((int) waggle->accumulator) & 63) * waggle->scale; + P_SetDoublep(waggle->sector, DMU_FLOOR_HEIGHT, fh); + P_SetDoublep(waggle->sector, DMU_FLOOR_TARGET_HEIGHT, fh); + P_SetFloatp(waggle->sector, DMU_FLOOR_SPEED, 0); + P_ChangeSector(waggle->sector, 1 /*crush damage*/); +} + +dd_bool EV_StartFloorWaggle(int tag, int height, int speed, int offset, int timer) +{ + iterlist_t *list = P_GetSectorIterListForTag(tag, false); + if(!list) return false; + + dd_bool retCode = false; + + IterList_SetIteratorDirection(list, ITERLIST_FORWARD); + IterList_RewindIterator(list); + + Sector *sec; + while((sec = (Sector *)IterList_MoveIterator(list))) + { + if(P_ToXSector(sec)->specialData) + continue; // Already moving, so keep going... + + retCode = true; + + waggle_t *waggle = (waggle_t *)Z_Calloc(sizeof(*waggle), PU_MAP, 0); + waggle->thinker.function = (thinkfunc_t) T_FloorWaggle; + Thinker_Add(&waggle->thinker); + + P_ToXSector(sec)->specialData = waggle; + waggle->sector = sec; + waggle->originalHeight = P_GetDoublep(sec, DMU_FLOOR_HEIGHT); + waggle->accumulator = offset; + waggle->accDelta = FIX2FLT(speed << 10); + waggle->scale = 0; + waggle->targetScale = FIX2FLT(height << 10); + waggle->scaleDelta = + FIX2FLT(FLT2FIX(waggle->targetScale) / + (TICSPERSEC + ((3 * TICSPERSEC) * height) / 255)); + waggle->ticker = timer ? timer * 35 : -1; + waggle->state = WS_EXPAND; + } + + return retCode; +}