project-navigation
Personal tools

Author Topic: Com_Printf() questions  (Read 3788 times)

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Com_Printf() questions
« on: June 04, 2007, 01:17:08 pm »
a few questions on Com_Printf. I looked at Com_DPrintf, which just calls Com_Printf, after checking you are running in dev mode.

1. I find that format strings like "%4.1f" do not work. "%f" does.
2. It seems that i can only have 2 (or maybe 3) %f in one call
3. It seems I can't use 2 Com_Printf calls consecutively.

help.

Offline Zenerka

  • Sergeant
  • *****
  • Posts: 301
    • View Profile
Com_Printf() questions
« Reply #1 on: June 04, 2007, 01:21:49 pm »
Quote from: "blondandy"

1. I find that format strings like "%4.1f" do not work. "%f" does.
2. It seems that i can only have 2 (or maybe 3) %f in one call
3. It seems I can't use 2 Com_Printf calls consecutively.

1. What do you want to print exactly? Show me type of the data, value of the data, and format of the data you want to print.
2. In Com_Printf()? Not true, I believe.
3. "consecutively"? What do you want to do? :D

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Com_Printf() questions
« Reply #2 on: June 04, 2007, 02:27:51 pm »
in my working copy of cl_actor.c around line 3091.

http://ufoai.svn.sourceforge.net/viewvc/ufoai/ufoai/trunk/src/client/cl_actor.c?view=markup

i want to see dist, height, stdevleftright, and a load of other variables. formated to (something like) 32.1.

1. If i try to use %4.1f it does not work. (i am at work now, but i think it just crashed when i ran it).

if i tried 2. or 3. it crashed when i clicked "start campaign". it was reproducible. when i removed the printfs it worked again. (3D geoscape is cool, btw).

I am trying to work out why all hit estimates are 100% (ish). i suspect that the args sent to lookup_erf are 2 or 4 times too big, but would like to see where the mistake is.

Offline Zenerka

  • Sergeant
  • *****
  • Posts: 301
    • View Profile
Com_Printf() questions
« Reply #3 on: June 04, 2007, 02:40:26 pm »
Quote from: "blondandy"
i want to see dist, height, stdevleftright, and a load of other variables. formated to (something like) 32.1.

Com_Printf("distance: %.1f, height: %.1f, stdevleftright: %.1f, another float variable: %.1f\n", distance, height, stdevleftright, anotherfloatvariable);
Or did I get you wrong?
Quote from: "blondandy"
I am trying to work out why all hit estimates are 100% (ish). i suspect that the args sent to lookup_erf are 2 or 4 times too big, but would like to see where the mistake is.

And these hit estimates are stored in (float) hitchance?

Offline blondandy

  • Sergeant
  • *****
  • Posts: 391
    • View Profile
Com_Printf() questions
« Reply #4 on: June 04, 2007, 10:14:51 pm »
ok, i tried to reproduce the problems i had yesterday, so i could say exactly what i did that made it crash.

well. today everything works.

[so i will retreat quietly]. [thanks for helping].