| 1059 | } |
| 1060 | |
| 1061 | void CWorldTexturesDialog::OnCheckin() { |
| 1062 | int n = D3EditState.texdlg_texture; |
| 1063 | mngs_Pagelock temp_pl; |
| 1064 | int r; |
| 1065 | |
| 1066 | if (!(GameTextures[n].flags & TF_TEXTURE_TYPES)) { |
| 1067 | OutrageMessageBox( |
| 1068 | "You need to select what type of texture this is before checking it in (ie robot, mine, terrain, etc)."); |
| 1069 | return; |
| 1070 | } |
| 1071 | |
| 1072 | if (!mng_MakeLocker()) |
| 1073 | return; |
| 1074 | |
| 1075 | strcpy(temp_pl.name, GameTextures[n].name); |
| 1076 | temp_pl.pagetype = PAGETYPE_TEXTURE; |
| 1077 | |
| 1078 | r = mng_CheckIfPageOwned(&temp_pl, TableUser); |
| 1079 | if (r < 0) |
| 1080 | OutrageMessageBox(ErrorString); |
| 1081 | else if (r == 0) |
| 1082 | OutrageMessageBox(InfoString); |
| 1083 | else { |
| 1084 | strcpy(temp_pl.holder, "UNLOCKED"); |
| 1085 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) { |
| 1086 | OutrageMessageBox(ErrorString, "Error!"); |
| 1087 | mng_EraseLocker(); |
| 1088 | return; |
| 1089 | } else { |
| 1090 | if (!mng_ReplacePage(GameTextures[n].name, GameTextures[n].name, n, PAGETYPE_TEXTURE, 0)) |
| 1091 | OutrageMessageBox(ErrorString); |
| 1092 | else { |
| 1093 | // Save this textures bitmap to the network for all |
| 1094 | |
| 1095 | std::filesystem::path fname; |
| 1096 | |
| 1097 | if (GameTextures[n].flags & TF_ANIMATED) { |
| 1098 | fname = ManageGraphicsDir / GameVClips[GameTextures[n].bm_handle].name; |
| 1099 | SaveVClip(fname, GameTextures[n].bm_handle); |
| 1100 | |
| 1101 | fname = LocalManageGraphicsDir / GameVClips[GameTextures[n].bm_handle].name; |
| 1102 | SaveVClip(fname, GameTextures[n].bm_handle); |
| 1103 | } else { |
| 1104 | fname = ManageGraphicsDir / GameBitmaps[GameTextures[n].bm_handle].name; |
| 1105 | bm_SaveFileBitmap(fname, GameTextures[n].bm_handle); |
| 1106 | |
| 1107 | fname = LocalManageGraphicsDir / GameBitmaps[GameTextures[n].bm_handle].name; |
| 1108 | bm_SaveFileBitmap(fname, GameTextures[n].bm_handle); |
| 1109 | } |
| 1110 | |
| 1111 | if (!AutoChecking) |
| 1112 | OutrageMessageBox("Texture checked in."); |
| 1113 | int dret = mng_DeletePage(GameTextures[n].name, PAGETYPE_TEXTURE, 1); |
| 1114 | ASSERT(dret == 1); |
| 1115 | mng_EraseLocker(); |
| 1116 | |
| 1117 | int p = mng_FindTrackLock(GameTextures[n].name, PAGETYPE_TEXTURE); |
| 1118 | ASSERT(p != -1); |
nothing calls this directly
no test coverage detected