]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapinfo.qc
Network impulse triggers
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapinfo.qc
index d010729610ef848085ac5f4b952df3326f935569..c3f15d1937e4963b06a1f6343c0d896c6ac44ce4 100644 (file)
@@ -9,7 +9,6 @@
 #elif defined(SVQC)
        #include "../dpdefs/progsdefs.qh"
     #include "../dpdefs/dpextensions.qh"
-    #include "../server/sys-post.qh"
     #include "util.qh"
     #include "buffs.qh"
     #include "monsters/monsters.qh"
@@ -18,9 +17,9 @@
 
 // generic string stuff
 
-float _MapInfo_Cache_Active;
-float _MapInfo_Cache_DB_NameToIndex;
-float _MapInfo_Cache_Buf_IndexToMapData;
+int _MapInfo_Cache_Active;
+int _MapInfo_Cache_DB_NameToIndex;
+int _MapInfo_Cache_Buf_IndexToMapData;
 
 void MapInfo_Cache_Destroy()
 {
@@ -273,7 +272,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        mapMins = '0 0 0';
        mapMaxs = '0 0 0';
 
-       for(0;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
@@ -311,12 +310,12 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
                        if(k == "origin")
                        {
                                o = stov(strcat("'", v, "'"));
-                               mapMins_x = min(mapMins.x, o.x);
-                               mapMins_y = min(mapMins.y, o.y);
-                               mapMins_z = min(mapMins.z, o.z);
-                               mapMaxs_x = max(mapMaxs.x, o.x);
-                               mapMaxs_y = max(mapMaxs.y, o.y);
-                               mapMaxs_z = max(mapMaxs.z, o.z);
+                               mapMins.x = min(mapMins.x, o.x);
+                               mapMins.y = min(mapMins.y, o.y);
+                               mapMins.z = min(mapMins.z, o.z);
+                               mapMaxs.x = max(mapMaxs.x, o.x);
+                               mapMaxs.y = max(mapMaxs.y, o.y);
+                               mapMaxs.z = max(mapMaxs.z, o.z);
                        }
                        else if(k == "race_place")
                        {
@@ -807,7 +806,7 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                                print("Map ", pFilename, " references not existing config file ", s, "\n");
                        else
                        {
-                               for(0;;)
+                               for (;;)
                                {
                                        if (!((s = fgets(fh))))
                                                break;
@@ -950,7 +949,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                        {
                                n = tokenize_console(cvar_string("g_cdtracks_remaplist"));
                                s = strcat(" ", cvar_string("g_cdtracks_dontusebydefault"), " ");
-                               for(0;;)
+                               for (;;)
                                {
                                        i = floor(random() * n);
                                        if(strstrofs(s, strcat(" ", argv(i), " "), 0) < 0)
@@ -998,7 +997,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
        }
 
        _MapInfo_Map_Reset();
-       for(0;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
@@ -1091,12 +1090,12 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                                                print("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
                                        else
                                        {
-                                               MapInfo_Map_mins_x = a;
-                                               MapInfo_Map_mins_y = b;
-                                               MapInfo_Map_mins_z = c;
-                                               MapInfo_Map_maxs_x = d;
-                                               MapInfo_Map_maxs_y = e;
-                                               MapInfo_Map_maxs_z = f;
+                                               MapInfo_Map_mins.x = a;
+                                               MapInfo_Map_mins.y = b;
+                                               MapInfo_Map_mins.z = c;
+                                               MapInfo_Map_maxs.x = d;
+                                               MapInfo_Map_maxs.y = e;
+                                               MapInfo_Map_maxs.z = f;
                                        }
                                }
                        }
@@ -1248,7 +1247,7 @@ string MapInfo_FixName(string s)
        return MapInfo_FindName_match;
 }
 
-float MapInfo_CurrentFeatures()
+int MapInfo_CurrentFeatures()
 {
        int req = 0;
        if(!(cvar("g_lms") || cvar("g_instagib") || cvar("g_overkill") || cvar("g_nix") || cvar("g_weaponarena") || !cvar("g_pickup_items") || cvar("g_race") || cvar("g_cts") || cvar("g_nexball")))
@@ -1256,7 +1255,7 @@ float MapInfo_CurrentFeatures()
        return req;
 }
 
-float MapInfo_CurrentGametype()
+int MapInfo_CurrentGametype()
 {
        entity e;
        int prev = cvar("gamecfg");
@@ -1288,11 +1287,11 @@ float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with th
        return r;
 }
 
-void MapInfo_SwitchGameType(float t)
+void MapInfo_SwitchGameType(int t)
 {
-       entity e;
-       for(e = MapInfo_Type_first; e; e = e.enemy)
+       for (entity e = MapInfo_Type_first; e; e = e.enemy) {
                cvar_set(e.netname, (t == e.items) ? "1" : "0");
+       }
 }
 
 void MapInfo_LoadMap(string s, float reinit)
@@ -1416,7 +1415,7 @@ void MapInfo_Shutdown()
        }
 }
 
-float MapInfo_ForbiddenFlags()
+int MapInfo_ForbiddenFlags()
 {
        int f = MAPINFO_FLAG_FORBIDDEN;
 
@@ -1431,7 +1430,7 @@ float MapInfo_ForbiddenFlags()
        return f;
 }
 
-float MapInfo_RequiredFlags()
+int MapInfo_RequiredFlags()
 {
        int f = 0;