I wee'd too early. I'm really spoiled by high level languages. Something as simple as putting a message that says "I'm now considering Agriculture" into my log turned out to be too much for me.
So, this is what I want to do: in the beginning of the loop of bestTech, I want to log what tech is currently being considered. This is where the trouble started. There is no getter for getting the tech's name. Instead of writing that, I decided to go with the tech's quote, which should make it perfectly obvious what tech the AI is looking at as well. So merrily I went about logging the current tech's getQuote... when I ran into a problem of converting from one char type to another.
ONE CHAR TYPE TO ANOTHER? What the hell is wrong with C++!
Anyhoo, I googled, and I've read things for hours, and my brain hurts and I can't figure this out, so I thought I'd ask for help again (maybe someone other than Kael? I would hate to take away time from Fire's completion).
This is my error:
CvPlayerAI.cpp:2072: error C2664: 'CvDLLUtilityIFaceBase::logMsg' : cannot convert parameter 2 from 'const wchar *' to 'const TCHAR *'
:: === Build finished: 1 errors, 0 warnings ===
Now I've googled, and I've found out that TCHAR is MS's magical way of saying "char if it's not a unicode environment, wchar_t if it is". (Right so far? :/) I'm really not sure what logMsg does expect. A simple ascii string would make most sense, of course. I've tried a LOT of things until I've at least found one way to get it to compile:
Code:
char temp;
temp = CHAR(GC.getTechInfo((TechTypes)iI).getQuote());
gDLL->logMsg("mylog.log", &temp);
However, this ends me up with broken characters in my log, so straight CHAR conversion doesn't seem to work.
Can someone tell me off the top of their head what the conversion I'm looking for is? I've wrestled with wcstombs, but it's stronger than me. And probably not what I'm looking for anyway. Help?