parent
65114c6dd9
commit
8cff9973b9
Binary file not shown.
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 364 B |
Binary file not shown.
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 364 B |
|
@ -771,7 +771,7 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
|
|||
buffer += sizeof(uint32_t);
|
||||
|
||||
// Copy 32bit large big endian numbers
|
||||
*(uint32_t*)buffer = htonl(ourgamestruct->pureMap);
|
||||
*(uint32_t*)buffer = htonl(ourgamestruct->pureGame);
|
||||
buffer += sizeof(uint32_t);
|
||||
|
||||
// Copy 32bit large big endian numbers
|
||||
|
@ -914,7 +914,7 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
|
|||
buffer += sizeof(uint32_t);
|
||||
ourgamestruct->privateGame = ntohl(*(uint32_t*)buffer);
|
||||
buffer += sizeof(uint32_t);
|
||||
ourgamestruct->pureMap = ntohl(*(uint32_t*)buffer);
|
||||
ourgamestruct->pureGame = ntohl(*(uint32_t*)buffer);
|
||||
buffer += sizeof(uint32_t);
|
||||
ourgamestruct->Mods = ntohl(*(uint32_t*)buffer);
|
||||
buffer += sizeof(uint32_t);
|
||||
|
@ -2698,7 +2698,7 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
|
|||
gamestruct.game_version_major = NETCODE_VERSION_MAJOR; // Netcode Major version
|
||||
gamestruct.game_version_minor = NETCODE_VERSION_MINOR; // NetCode Minor version
|
||||
// gamestruct.privateGame = 0; // if true, it is a private game
|
||||
gamestruct.pureMap = game.isMapMod; // If map-mod...
|
||||
gamestruct.pureGame = 0; // NO mods allowed if true
|
||||
gamestruct.Mods = 0; // number of concatenated mods?
|
||||
gamestruct.gameId = 0;
|
||||
gamestruct.limits = 0x0; // used for limits
|
||||
|
|
|
@ -167,7 +167,7 @@ struct GAMESTRUCT
|
|||
uint32_t game_version_major; //
|
||||
uint32_t game_version_minor; //
|
||||
uint32_t privateGame; // if true, it is a private game
|
||||
uint32_t pureMap; // If this map has mods in it.
|
||||
uint32_t pureGame; // NO mods allowed if true
|
||||
uint32_t Mods; // number of concatenated mods?
|
||||
// Game ID, used on the lobby server to link games with multiple address families to eachother
|
||||
uint32_t gameId;
|
||||
|
|
78
src/init.cpp
78
src/init.cpp
|
@ -456,7 +456,7 @@ static MapFileList listMapFiles()
|
|||
continue;
|
||||
}
|
||||
|
||||
std::string realFileName = std::string("maps/") + *i;//+ std::string(PHYSFS_getDirSeparator())
|
||||
std::string realFileName = std::string("maps/") + *i;
|
||||
ret.push_back(realFileName);
|
||||
}
|
||||
PHYSFS_freeList(subdirlist);
|
||||
|
@ -513,39 +513,6 @@ static MapFileList listMapFiles()
|
|||
return filtered;
|
||||
}
|
||||
|
||||
// Map processing
|
||||
struct WZmaps
|
||||
{
|
||||
std::string MapName;
|
||||
bool isMapMod;
|
||||
};
|
||||
|
||||
std::vector<struct WZmaps> WZ_Maps;
|
||||
|
||||
struct FindMap
|
||||
{
|
||||
const std::string map;
|
||||
FindMap(const std::string& name) : map(name) {};
|
||||
bool operator()(const WZmaps& wzm) const { return wzm.MapName == map; };
|
||||
};
|
||||
|
||||
bool CheckForMod(char *theMap)
|
||||
{
|
||||
std::vector<struct WZmaps>::iterator it;
|
||||
if (theMap == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
it = std::find_if(WZ_Maps.begin(), WZ_Maps.end(), FindMap(theMap));
|
||||
if(it != WZ_Maps.end())
|
||||
{
|
||||
return it->isMapMod;
|
||||
}
|
||||
debug(LOG_ERROR, "Couldn't find map %s", theMap);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool buildMapList()
|
||||
{
|
||||
|
@ -554,20 +521,16 @@ bool buildMapList()
|
|||
return false;
|
||||
}
|
||||
loadLevFile("addon.lev", mod_multiplay, false, NULL);
|
||||
WZ_Maps.clear();
|
||||
|
||||
MapFileList realFileNames = listMapFiles();
|
||||
for (MapFileList::iterator realFileName = realFileNames.begin(); realFileName != realFileNames.end(); ++realFileName)
|
||||
{
|
||||
bool mapmod = false;
|
||||
struct WZmaps CurrentMap;
|
||||
std::string realFilePathAndName = PHYSFS_getRealDir(realFileName->c_str()) + *realFileName;
|
||||
|
||||
PHYSFS_addToSearchPath(realFilePathAndName.c_str(), PHYSFS_APPEND);
|
||||
|
||||
char **filelist = PHYSFS_enumerateFiles("");
|
||||
for (char **file = filelist; *file != NULL; ++file)
|
||||
{
|
||||
std::string checkfile = *file;
|
||||
size_t len = strlen(*file);
|
||||
if (len > 10 && !strcasecmp(*file + (len - 10), ".addon.lev")) // Do not add addon.lev again
|
||||
{
|
||||
|
@ -578,44 +541,11 @@ bool buildMapList()
|
|||
{
|
||||
loadLevFile(*file, mod_multiplay, true, realFileName->c_str());
|
||||
}
|
||||
|
||||
}
|
||||
PHYSFS_freeList(filelist);
|
||||
|
||||
if (PHYSFS_removeFromSearchPath(realFilePathAndName.c_str()) == 0)
|
||||
{
|
||||
debug(LOG_ERROR, "Could not unmount %s",PHYSFS_getLastError());
|
||||
}
|
||||
// check what kind of map it is
|
||||
if (!PHYSFS_mount(realFilePathAndName.c_str(),"WZMap",PHYSFS_APPEND))
|
||||
{
|
||||
debug(LOG_FATAL,"Could not mount %s, game will exit.", realFilePathAndName.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
filelist = PHYSFS_enumerateFiles("WZMap");
|
||||
for (char **file = filelist; *file != NULL; ++file)
|
||||
{
|
||||
std::string checkfile = *file;
|
||||
if (checkfile.compare("wrf")==0 || checkfile.compare("stats")==0 ||checkfile.compare("components")==0
|
||||
|| checkfile.compare("anims")==0 || checkfile.compare("effects")==0 ||checkfile.compare("messages")==0
|
||||
|| checkfile.compare("audio")==0 || checkfile.compare("sequenceaudio")==0 ||checkfile.compare("misc")==0
|
||||
|| checkfile.compare("features")==0 || checkfile.compare("script")==0 ||checkfile.compare("structs")==0
|
||||
|| checkfile.compare("tileset")==0 || checkfile.compare("images")==0 || checkfile.compare("texpages")==0 )
|
||||
{
|
||||
mapmod = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
PHYSFS_freeList(filelist);
|
||||
|
||||
CurrentMap.MapName = realFileName->c_str();
|
||||
CurrentMap.isMapMod = mapmod;
|
||||
WZ_Maps.push_back(CurrentMap);
|
||||
|
||||
if (PHYSFS_removeFromSearchPath(realFilePathAndName.c_str()) == 0)
|
||||
{
|
||||
debug(LOG_ERROR, "Could not unmount %s",PHYSFS_getLastError());
|
||||
}
|
||||
PHYSFS_removeFromSearchPath(realFilePathAndName.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -61,7 +61,6 @@ void registerSearchPath( const char path[], unsigned int priority );
|
|||
bool rebuildSearchPath( searchPathMode mode, bool force );
|
||||
|
||||
bool buildMapList(void);
|
||||
bool CheckForMod(char *theMap);
|
||||
|
||||
extern IMAGEFILE *FrontImages;
|
||||
|
||||
|
|
|
@ -1496,21 +1496,12 @@ static void addGameOptions()
|
|||
addMultiEditBox(MULTIOP_OPTIONS, MULTIOP_GNAME, MCOL0, MROW2, _("Select Game Name"), game.name, IMAGE_EDIT_GAME, IMAGE_EDIT_GAME_HI, MULTIOP_GNAME_ICON);
|
||||
}
|
||||
widgSetButtonState(psWScreen, MULTIOP_GNAME_ICON, WBUT_DISABLE);
|
||||
|
||||
// map chooser
|
||||
//addMultiEditBox(MULTIOP_OPTIONS, MULTIOP_MAP , MCOL0, MROW3, _("Select Map"), game.map, IMAGE_EDIT_MAP, IMAGE_EDIT_MAP_HI, MULTIOP_MAP_ICON);
|
||||
|
||||
addBlueForm(MULTIOP_OPTIONS, MULTIOP_MAP, game.map, MCOL0, MROW3, MULTIOP_BLUEFORMW, 29);
|
||||
addMultiBut(psWScreen, MULTIOP_MAP, MULTIOP_MAP_ICON, MCOL4, 2, 20, MULTIOP_BUTH, _("Select Map"), IMAGE_EDIT_MAP, IMAGE_EDIT_MAP_HI, true);
|
||||
addMultiBut(psWScreen, MULTIOP_MAP, MULTIOP_MAP_MOD, MCOL3+11, 10, 12, 12, _("Map-Mod!"), IMAGE_LAMP_RED, IMAGE_LAMP_AMBER, false);
|
||||
if (!game.isMapMod)
|
||||
{
|
||||
widgHide(psWScreen, MULTIOP_MAP_MOD);
|
||||
}
|
||||
addMultiEditBox(MULTIOP_OPTIONS, MULTIOP_MAP , MCOL0, MROW3, _("Select Map"), game.map, IMAGE_EDIT_MAP, IMAGE_EDIT_MAP_HI, MULTIOP_MAP_ICON);
|
||||
// disable for challenges
|
||||
if (challengeActive)
|
||||
{
|
||||
//widgSetButtonState(psWScreen, MULTIOP_MAP, WEDBS_DISABLE);
|
||||
widgSetButtonState(psWScreen, MULTIOP_MAP, WEDBS_DISABLE);
|
||||
widgSetButtonState(psWScreen, MULTIOP_MAP_ICON, WBUT_DISABLE);
|
||||
}
|
||||
// password box
|
||||
|
@ -2711,6 +2702,7 @@ static void disableMultiButs(void)
|
|||
|
||||
// edit boxes
|
||||
widgSetButtonState(psWScreen,MULTIOP_GNAME,WEDBS_DISABLE);
|
||||
widgSetButtonState(psWScreen,MULTIOP_MAP,WEDBS_DISABLE);
|
||||
|
||||
if (!NetPlay.isHost)
|
||||
{
|
||||
|
@ -2808,8 +2800,7 @@ static void processMultiopWidgets(UDWORD id)
|
|||
break;
|
||||
|
||||
case MULTIOP_MAP:
|
||||
widgSetString(psWScreen, MULTIOP_MAP+1 ,game.map); //What a horrible hack! FIX ME! (See addBlueForm())
|
||||
widgReveal(psWScreen, MULTIOP_MAP_MOD);
|
||||
widgSetString(psWScreen, MULTIOP_MAP,game.map);
|
||||
break;
|
||||
|
||||
case MULTIOP_GNAME_ICON:
|
||||
|
@ -3017,12 +3008,6 @@ static void processMultiopWidgets(UDWORD id)
|
|||
// these work all the time.
|
||||
switch(id)
|
||||
{
|
||||
case MULTIOP_MAP_MOD:
|
||||
char buf[256];
|
||||
ssprintf(buf, _("This is a map-mod, it can change your playing experience!"));
|
||||
addConsoleMessage(buf, DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
||||
break;
|
||||
|
||||
case MULTIOP_LIMITS_BUT:
|
||||
changeTitleMode(MULTILIMIT);
|
||||
break;
|
||||
|
@ -3729,7 +3714,6 @@ void runMultiOptions(void)
|
|||
sstrcpy(game.map, mapData->pName);
|
||||
game.hash = levGetFileHash(mapData);
|
||||
game.maxPlayers = mapData->players;
|
||||
game.isMapMod = CheckForMod(mapData->realFileName);
|
||||
loadMapPreview(!isHoverPreview);
|
||||
|
||||
if (isHoverPreview)
|
||||
|
@ -3739,7 +3723,7 @@ void runMultiOptions(void)
|
|||
game.maxPlayers = oldMaxPlayers;
|
||||
}
|
||||
|
||||
widgSetString(psWScreen, MULTIOP_MAP+1, mapData->pName); //What a horrible, horrible way to do this! FIX ME! (See addBlueForm)
|
||||
widgSetString(psWScreen, MULTIOP_MAP, mapData->pName);
|
||||
addGameOptions();
|
||||
break;
|
||||
}
|
||||
|
@ -3837,7 +3821,7 @@ bool startMultiOptions(bool bReenter)
|
|||
game.skDiff[i] = (DIFF_SLIDER_STOPS / 2); // reset AI (turn it on again)
|
||||
setPlayerColour(i,i); //reset all colors as well
|
||||
}
|
||||
game.isMapMod = false; // reset map-mod status
|
||||
|
||||
game.mapHasScavengers = true; // FIXME, should default to false
|
||||
if(!NetPlay.bComms) // force skirmish if no comms.
|
||||
{
|
||||
|
@ -4082,14 +4066,6 @@ void displayRemoteGame(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGH
|
|||
}
|
||||
iV_DrawText(name, x + GAMES_GAMENAME_START, y + 12);
|
||||
|
||||
if (NetPlay.games[gameID].pureMap)
|
||||
{
|
||||
iV_SetTextColour(WZCOL_RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
iV_SetTextColour(WZCOL_FORM_TEXT);
|
||||
}
|
||||
// draw map name, chop when we get a too long name
|
||||
sstrcpy(name, NetPlay.games[gameID].mapname);
|
||||
// box size in pixels
|
||||
|
@ -4099,7 +4075,6 @@ void displayRemoteGame(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGH
|
|||
}
|
||||
iV_DrawText(name, x + GAMES_MAPNAME_START, y + 12); // map name
|
||||
|
||||
iV_SetTextColour(WZCOL_FORM_TEXT);
|
||||
iV_SetFont(font_small);
|
||||
// draw mod name (if any)
|
||||
if (strlen(NetPlay.games[gameID].modlist))
|
||||
|
|
|
@ -186,7 +186,6 @@ void loadMapPreview(bool hideInterface);
|
|||
#define MULTIOP_GNAME 10255
|
||||
#define MULTIOP_MAP_ICON 10258
|
||||
#define MULTIOP_MAP 10259
|
||||
#define MULTIOP_MAP_MOD 21013 // Warning, do not use sequential numbers until code is fixed.
|
||||
|
||||
#define MULTIOP_CAMPAIGN 10261
|
||||
#define MULTIOP_SKIRMISH 10263
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "lib/framework/frame.h"
|
||||
#include "lib/framework/wzapp.h"
|
||||
#include "lib/framework/strres.h"
|
||||
#include "lib/framework/physfs_ext.h"
|
||||
#include "lib/widget/button.h"
|
||||
#include "lib/widget/widget.h"
|
||||
|
||||
|
@ -275,16 +274,7 @@ void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIEL
|
|||
drawBlueBox(x,y,psWidget->width,psWidget->height); //draw box
|
||||
|
||||
iV_SetFont(font_regular); // font
|
||||
|
||||
if (mapData && CheckForMod(mapData->realFileName))
|
||||
{
|
||||
iV_SetTextColour(WZCOL_RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
||||
}
|
||||
|
||||
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
||||
|
||||
while(iV_GetTextWidth(butString) > psWidget->width -10 )
|
||||
{
|
||||
|
@ -295,7 +285,6 @@ void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIEL
|
|||
|
||||
if (mapData != NULL)
|
||||
{
|
||||
|
||||
// Display map hash, so we can see the difference between identically named maps.
|
||||
Sha256 hash = mapData->realFileHash; // levGetFileHash can be slightly expensive.
|
||||
static uint32_t lastHashTime = 0;
|
||||
|
|
|
@ -201,9 +201,8 @@ void recvOptions(NETQUEUE queue)
|
|||
setCurrentMap(NULL, 42);
|
||||
rebuildSearchPath(mod_multiplay, true); // MUST rebuild search path for the new maps we just got!
|
||||
buildMapList();
|
||||
LEVEL_DATASET *mapData = levFindDataSet(game.map, &game.hash);
|
||||
// See if we have the map or not
|
||||
if (mapData == NULL)
|
||||
if (levFindDataSet(game.map, &game.hash) == NULL)
|
||||
{
|
||||
uint32_t player = selectedPlayer;
|
||||
|
||||
|
@ -217,14 +216,6 @@ void recvOptions(NETQUEUE queue)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (CheckForMod(mapData->realFileName))
|
||||
{
|
||||
char buf[256];
|
||||
ssprintf(buf, "Warning, this is a map-mod, it could alter normal gameplay.");
|
||||
addConsoleMessage(buf, DEFAULT_JUSTIFY, NOTIFY_MESSAGE);
|
||||
game.isMapMod = true; // add alert button
|
||||
}
|
||||
// LEVEL_DATASET *mapData = levFindDataSet(game.map, &game.hash);
|
||||
loadMapPreview(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1712,16 +1712,6 @@ bool recvMapFileData(NETQUEUE queue)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LEVEL_DATASET *mapData = levFindDataSet(game.map, &game.hash);
|
||||
if (CheckForMod(mapData->realFileName))
|
||||
{
|
||||
char buf[256];
|
||||
ssprintf(buf, "Warning, this is a map-mod, it could alter normal gameplay.");
|
||||
addConsoleMessage(buf, DEFAULT_JUSTIFY, NOTIFY_MESSAGE);
|
||||
game.isMapMod = true;
|
||||
widgReveal(psWScreen, MULTIOP_MAP_MOD);
|
||||
}
|
||||
loadMapPreview(false);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ struct MULTIPLAYERGAME
|
|||
uint8_t alliance; // no/yes/AIs vs Humans
|
||||
uint8_t skDiff[MAX_PLAYERS]; // skirmish game difficulty settings. 0x0=OFF 0xff=HUMAN
|
||||
bool mapHasScavengers;
|
||||
bool isMapMod; // if a map has mods
|
||||
};
|
||||
|
||||
struct MULTISTRUCTLIMITS
|
||||
|
|
Loading…
Reference in New Issue