[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Interfaces/...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Interfaces/... |
Date: |
Mon, 24 Nov 2003 07:53:11 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/11/24 07:53:11
Modified files:
. : ChangeLog
src/NetPanzer/Interfaces: MapsManager.cpp MapsManager.hpp
Removed files:
src/Lib/ArrayUtil: FileList.cpp FileList.hpp
Log message:
-eleminated the FileList class and replaced it with
std::vector<std::string>
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.37 netpanzer/ChangeLog:1.38
--- netpanzer/ChangeLog:1.37 Mon Nov 24 07:03:31 2003
+++ netpanzer/ChangeLog Mon Nov 24 07:53:11 2003
@@ -2,6 +2,7 @@
-converted the SelectionList to std::vector, also removed limit of maximum
select units while doing this.
-eleminated the String class and replaced it with std::string
+-eleminated the FileList class and replaced it with std::vector<std::string>
22-Nov-2003 by Matthias Braun
-big reorganisation. Created several real libs in the lib directory and moved
Index: netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.11
netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.12
--- netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.11 Sat Nov 22
10:43:36 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp Mon Nov 24 07:53:11 2003
@@ -20,11 +20,13 @@
#include <stdio.h>
#include <string.h>
#include <memory>
+
#include "Util/FileSystem.hpp"
+#include "Util/SplitPath.hpp"
#include "MapsManager.hpp"
#include "MapFileStruct.hpp"
-FileList MapsManager::master_maps_list;
+std::vector<std::string> MapsManager::master_maps_list;
unsigned long MapsManager::map_cycle_index;
@@ -36,13 +38,12 @@
{
}
-void MapsManager::initialize( void )
+void MapsManager::initialize()
{
- master_maps_list.initialize( 25 );
map_cycle_index = 0;
}
-void MapsManager::scanMaps( void )
+void MapsManager::scanMaps()
{
scanMaps( "maps/" );
}
@@ -53,43 +54,45 @@
for(char** file = list; *file != 0; file++) {
std::string path = map_directory;
path += *file;
+
if(path.find(".npm") != std::string::npos) {
- master_maps_list.addString(path.c_str());
+ master_maps_list.push_back(path);
}
}
FileSystem::freeList(list);
}
-void MapsManager::resetMapCycling( void )
+void MapsManager::resetMapCycling()
{
map_cycle_index = 0;
}
void MapsManager::cycleNextMapName(char *map_name )
{
- if ( (map_cycle_index + 1) < master_maps_list.containsItems() ) {
+ if ( (map_cycle_index + 1) < master_maps_list.size() ) {
map_cycle_index++;
} else {
map_cycle_index = 0;
}
- master_maps_list.getFilename( map_cycle_index, map_name );
+ _splitpath(master_maps_list[map_cycle_index].c_str(), 0, 0, map_name, 0);
}
void MapsManager::getCurrentMap(char *map_name )
{
- master_maps_list.getFilename( map_cycle_index, map_name );
+ _splitpath(master_maps_list[map_cycle_index].c_str(), 0, 0, map_name, 0);
}
void MapsManager::setCycleStartMap(const char *map_name )
{
- int list_size;
+ size_t list_size;
char cycle_map_name[256];
- list_size = master_maps_list.containsItems();
+ list_size = master_maps_list.size();
+
+ for(size_t i = 0; i < list_size; i++ ) {
+ _splitpath(master_maps_list[i].c_str(), 0, 0, cycle_map_name, 0);
- for( int i = 0; i < list_size; i++ ) {
- master_maps_list.getFilename( i, cycle_map_name );
if( strcasecmp( cycle_map_name, map_name ) == 0 ) {
map_cycle_index = i;
return;
@@ -100,13 +103,14 @@
int MapsManager::checkMapValidity(const char *map_name )
{
bool found = false;
- int list_size;
+ size_t list_size;
char cycle_map_name[256];
- list_size = master_maps_list.containsItems();
+ list_size = master_maps_list.size();
+
+ for(size_t i = 0; i < list_size; i++) {
+ _splitpath(master_maps_list[i].c_str(), 0, 0, cycle_map_name, 0);
- for( int i = 0; i < list_size; i++ ) {
- master_maps_list.getFilename( i, cycle_map_name );
if( strcasecmp( cycle_map_name, map_name ) == 0 ) {
found = true;
}
Index: netpanzer/src/NetPanzer/Interfaces/MapsManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapsManager.hpp:1.5
netpanzer/src/NetPanzer/Interfaces/MapsManager.hpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/MapsManager.hpp:1.5 Sat Nov 22
10:43:36 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapsManager.hpp Mon Nov 24 07:53:11 2003
@@ -18,14 +18,15 @@
#ifndef _MAPS_MANAGER_HPP
#define _MAPS_MANAGER_HPP
-#include "ArrayUtil/FileList.hpp"
+#include <string>
+#include <vector>
enum { _mapfile_valid, _mapfile_not_found, _wadfile_not_found };
class MapsManager
{
protected:
- static FileList master_maps_list;
+ static std::vector<std::string> master_maps_list;
static unsigned long map_cycle_index;
public: