X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fsv_cmd.qc;h=8c1f88d688905b26189d80fe44a9a73115b118e3;hb=daca069cca73a8d436258e284cb1aade919cb799;hp=4d61a3962268b62df4e64fa3d108d7a9ee174b34;hpb=19f872df1509cd39707e48364af1428d0b907627;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 4d61a39622..8c1f88d688 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -775,30 +776,12 @@ void GameCommand_gametype(int request, int argc) if (argv(1) != "") { string s = argv(1); - Gametype t = MapInfo_Type_FromString(s, false, false), tsave = MapInfo_CurrentGametype(); + Gametype t = MapInfo_Type_FromString(s, false, false); if (t) - { - MapInfo_SwitchGameType(t); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); - if (MapInfo_count > 0) - { - // update lsmaps in case the gametype changed, this way people can easily list maps for it - if (lsmaps_reply != "") strunzone(lsmaps_reply); - lsmaps_reply = strzone(getlsmaps()); - bprint("Game type successfully switched to ", s, "\n"); - } - else - { - bprint("Cannot use this game type: no map for it found\n"); - MapInfo_SwitchGameType(tsave); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); - } - } + GameTypeVote_SetGametype(t); else - { bprint("Failed to switch to ", s, ": this game type does not exist!\n"); - } return; }