@@ -155,22 +155,35 @@ function gamemgr.delete_mod(gamespec,modindex)
155
155
end
156
156
157
157
---- ----------------------------------------------------------------------------
158
- function gamemgr .get_game_mods (gamespec )
158
+ function gamemgr .find_by_gameid (gameid )
159
+ for i = 1 ,# gamemgr .games ,1 do
160
+ if gamemgr .games [i ].id == gameid then
161
+ return gamemgr .games [i ], i
162
+ end
163
+ end
164
+ return nil , nil
165
+ end
159
166
160
- local retval = " "
161
-
162
- if gamespec .gamemods_path ~= nil and
167
+ ---- ----------------------------------------------------------------------------
168
+ function gamemgr .get_game_mods (gamespec , retval )
169
+ if gamespec ~= nil and
170
+ gamespec .gamemods_path ~= nil and
163
171
gamespec .gamemods_path ~= " " then
164
- local game_mods = {}
165
- get_mods (gamespec .gamemods_path ,game_mods )
166
-
167
- for i = 1 ,# game_mods ,1 do
168
- if retval ~= " " then
169
- retval = retval .. " ,"
170
- end
171
- retval = retval .. game_mods [i ].name
172
- end
172
+ get_mods (gamespec .gamemods_path , retval )
173
173
end
174
+ end
175
+
176
+ ---- ----------------------------------------------------------------------------
177
+ function gamemgr .get_game_modlist (gamespec )
178
+ local retval = " "
179
+ local game_mods = {}
180
+ gamemgr .get_game_mods (gamespec , game_mods )
181
+ for i = 1 ,# game_mods ,1 do
182
+ if retval ~= " " then
183
+ retval = retval .. " ,"
184
+ end
185
+ retval = retval .. game_mods [i ].name
186
+ end
174
187
return retval
175
188
end
176
189
@@ -220,7 +233,7 @@ function gamemgr.tab()
220
233
" label[6,1.4;" .. fgettext (" Mods:" ) .. " ]" ..
221
234
" button[9.7,1.5;2,0.2;btn_game_mgr_edit_game;" .. fgettext (" edit game" ) .. " ]" ..
222
235
" textlist[6,2;5.5,3.3;game_mgr_modlist;"
223
- .. gamemgr .get_game_mods (current_game ) .. " ;0]" ..
236
+ .. gamemgr .get_game_modlist (current_game ) .. " ;0]" ..
224
237
" button[1,4.75;3.2,0.5;btn_game_mgr_new_game;" .. fgettext (" new game" ) .. " ]"
225
238
end
226
239
return retval
@@ -243,7 +256,7 @@ function gamemgr.dialog_edit_game()
243
256
244
257
retval = retval ..
245
258
" textlist[0.5,0.5;4.5,4.3;mods_current;"
246
- .. gamemgr .get_game_mods (current_game ) .. " ;0]"
259
+ .. gamemgr .get_game_modlist (current_game ) .. " ;0]"
247
260
248
261
249
262
retval = retval ..
0 commit comments