1

Topic: Get CRC of map. Mapname available as string. Map not loaded

I'm currently changing a lot in the sql_score's db structure of GreYFoX's DDRace.

I'm almost finished, yet noother gave the idea to also save map crc's in the db, so if the map crc changes old race record entries get ignored/deleted if wished by a config setting.

The thing is... Right now, if I detect that the db structure is using the old pattern from a previous ddrace revision, I'll go through all old tables with tablename's race_MAPNAME_record, I take it's mapnames and put them in a table ddrace_maps (ID, MapName), and I take the old entries and put them in tables ddrace_players, ddrace_runs, ddrace_record_checkpoints.

What I would need now, is that when I iterate through all old race_MAPNAME_record tables, I can get the CRC of the file with name MAPNAME (if still available), so that I can put the CRC into the ddrace_maps table as well.

I know how I can do this if the map is currently loaded.
    CServer* pServ = (CServer *)m_pServer;
    char mapCrc[8];
    str_format(aBuf, sizeof(aBuf), "%08x", pServ->m_CurrentMapCrc);

But I don't know how to get the crc without having the map currently loaded.
Can you help me ?

2

Re: Get CRC of map. Mapname available as string. Map not loaded

I'd suggest you not to include this feature: Imagine a mapper released his map. Later, he detects a graphic bug in the map. With your system he either couldn't keep the records or he couldn't fix the graphic bug.

3 (edited by Trust.Allisone 2011-03-06 17:17:30)

Re: Get CRC of map. Mapname available as string. Map not loaded

well that's what noother first wanted, but I think like you.
So as I said in my post, there will be an option so that entries get
"ignored/deleted if wished by a config setting"

So you can choose by option if different CRC's simply won't matter, or if records on maps with different CRC should be ignored, or if they should be deleted.

Also I plan on providing a command for the admin, so that he can do that individually/manually for the current map that is beeing played

4 (edited by Trust.Allisone 2011-03-09 11:29:23)

Re: Get CRC of map. Mapname available as string. Map not loaded

It's working now
you can take a look at
https://github.com/Allisone/DDRace/tree … pInBetween
will test a bit more before I tell GreYFoX to merge

Now all old maps get NULL as CRC, I think this will work too / so far in my testing it did so.

You have 4 Commands now for that:
* /mapCRCs ---> lists all mapCRCs
* /ignoreOldRuns ---> Ignore by sth. like revision number (newest = 0 and each older CRC  += 1)
* /ignoreOldRunsByCRC
* /ignoreOldRunsByDate

What happens, is that in the _maps table in the IgnoreRunsBeforeMapCRCID column the value of the given/calculated MapCRCID is added and by this all runs/times having an older MapCRCID get ignored. I think it's pretty nice. Also note that you can revert as easy as you did set before by just calling the command with a different value. Old entries stay stored that way and it's data will be used for upcoming stats module.
On could also add a further command /deleteIgnoredRuns, but I will decide that after I added the stats module.