Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "engines/obsolete.h"
00024
00025 #include "common/config-manager.h"
00026
00027
00028 namespace Engines {
00029
00030 void upgradeTargetIfNecessary(const ObsoleteGameID *obsoleteList) {
00031 if (obsoleteList == 0)
00032 return;
00033
00034 Common::String gameid = ConfMan.get("gameid");
00035
00036 for (const ObsoleteGameID *o = obsoleteList; o->from; ++o) {
00037 if (gameid.equalsIgnoreCase(o->from)) {
00038 gameid = o->to;
00039 ConfMan.set("gameid", gameid);
00040
00041 if (o->platform != Common::kPlatformUnknown)
00042 ConfMan.set("platform", Common::getPlatformCode(o->platform));
00043
00044 warning("Target upgraded from %s to %s", o->from, o->to);
00045
00046
00047
00048 if (ConfMan.hasKey("id_came_from_command_line")) {
00049 warning("Target came from command line. Skipping save");
00050 } else {
00051 ConfMan.flushToDisk();
00052 }
00053 break;
00054 }
00055 }
00056 }
00057
00058 PlainGameDescriptor findGameID(
00059 const char *gameid,
00060 const PlainGameDescriptor *gameids,
00061 const ObsoleteGameID *obsoleteList
00062 ) {
00063
00064 const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, gameids);
00065 if (g)
00066 return *g;
00067
00068
00069
00070 if (obsoleteList != 0) {
00071 const ObsoleteGameID *o = obsoleteList;
00072 while (o->from) {
00073 if (0 == scumm_stricmp(gameid, o->from)) {
00074 g = findPlainGameDescriptor(o->to, gameids);
00075 if (g && g->description)
00076 return PlainGameDescriptor::of(gameid, g->description);
00077 else
00078 return PlainGameDescriptor::of(gameid, "Obsolete game ID");
00079 }
00080 o++;
00081 }
00082 }
00083
00084
00085 return PlainGameDescriptor::empty();
00086 }
00087
00088 }