Changed TileModelsFileName to std::string

This commit is contained in:
jim4 2007-03-16 05:15:20 +00:00
parent 9aa255f4e2
commit 604040c3db
5 changed files with 15 additions and 15 deletions

View file

@ -251,7 +251,7 @@ int WriteMapSetup(const char *mapsetup, CMap *map, int writeTerrain)
f->printf("\n");
f->printf("-- load tilesets\n");
f->printf("LoadTileModels(\"%s\")\n\n", map->TileModelsFileName);
f->printf("LoadTileModels(\"%s\")\n\n", map->TileModelsFileName.c_str());
if (writeTerrain) {
f->printf("-- Tiles Map\n");

View file

@ -132,7 +132,7 @@
** Tileset data for the map. See ::CTileset. This contains all
** information about the tile.
**
** CMap::TileModelsFileName[]
** CMap::TileModelsFileName
**
** Lua filename that loads all tilemodels
**
@ -290,17 +290,17 @@ private:
void InitFogOfWar(void);
public:
CMapField *Fields; /// fields on map
unsigned *Visible[PlayerMax]; /// visible bit-field
CMapField *Fields; /// fields on map
unsigned *Visible[PlayerMax]; /// visible bit-field
bool NoFogOfWar; /// fog of war disabled
bool NoFogOfWar; /// fog of war disabled
CTileset Tileset; /// tileset data
char TileModelsFileName[PATH_MAX]; /// lua filename that loads all tilemodels
CGraphic *TileGraphic; /// graphic for all the tiles
CTileset Tileset; /// tileset data
std::string TileModelsFileName; /// lua filename that loads all tilemodels
CGraphic *TileGraphic; /// graphic for all the tiles
static CGraphic *FogGraphic; /// graphic for fog of war
CMapInfo Info; /// descriptive information
CMapInfo Info; /// descriptive information
};
/*----------------------------------------------------------------------------

View file

@ -284,7 +284,7 @@ void CMap::Clean(void)
memset(this->Visible, 0, sizeof(this->Visible));
this->NoFogOfWar = false;
this->Tileset.Clear();
memset(this->TileModelsFileName, 0, sizeof(this->TileModelsFileName));
this->TileModelsFileName.clear();
this->TileGraphic = NULL;
FlagRevealMap = 0;

View file

@ -66,7 +66,7 @@ void CMap::Save(CFile *file) const
file->printf("\n--- -----------------------------------------\n");
file->printf("--- MODULE: map $Id$\n");
file->printf("LoadTileModels(\"%s\")\n\n", this->TileModelsFileName);
file->printf("LoadTileModels(\"%s\")\n\n", this->TileModelsFileName.c_str());
file->printf("StratagusMap(\n");

View file

@ -9,7 +9,7 @@
//
/**@name script_map.cpp - The map ccl functions. */
//
// (c) Copyright 1999-2005 by Lutz Sammer and Jimmy Salmon
// (c) Copyright 1999-2007 by Lutz Sammer and Jimmy Salmon
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -455,7 +455,7 @@ static int CclDefinePlayerTypes(lua_State *l)
}
/**
** Load the lua file which will define the tile models
** Load the lua file which will define the tile models
**
** @param l Lua state.
*/
@ -466,8 +466,8 @@ static int CclLoadTileModels(lua_State *l)
if (lua_gettop(l) != 1) {
LuaError(l, "incorrect argument");
}
strcpy_s(Map.TileModelsFileName, sizeof(Map.TileModelsFileName), LuaToString(l, 1));
LibraryFileName(Map.TileModelsFileName, buf, sizeof(buf));
Map.TileModelsFileName = LuaToString(l, 1);
LibraryFileName(Map.TileModelsFileName.c_str(), buf, sizeof(buf));
if (LuaLoadFile(buf) == -1) {
DebugPrint("Load failed: %s\n" _C_ LuaToString(l, 1));
}