project-navigation
Personal tools

Author Topic: INV_EquipmentSanityCheck  (Read 3330 times)

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
INV_EquipmentSanityCheck
« on: August 26, 2010, 06:30:59 pm »
While looking at the code I found this in cl_inventory.c (INV_EquipmentSanityCheck):

Code: [Select]
for (i = 0; i < csi.numEDs; i++) {
const equipDef_t const *ed = &csi.eds[i];
/* only check definitions used for generating teams */
if (strncmp(ed->name, "alien", 5) && strncmp(ed->name, "phalanx", 7)) <---- Line 176
continue;
That condition does not make sense to me, but maybe this is no bug but just somthing I utterly fail to understand? ;)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: INV_EquipmentSanityCheck
« Reply #1 on: August 26, 2010, 06:34:57 pm »
only alien* and phalanx* equipment ids should be checked here (equipment.ufo) - stuff like civilian_soldier or whatever they are called should not get checked - but i'm not sure why ;)

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: INV_EquipmentSanityCheck
« Reply #2 on: August 26, 2010, 06:40:53 pm »
only alien* and phalanx* equipment ids should be checked here (equipment.ufo) - stuff like civilian_soldier or whatever they are called should not get checked - but i'm not sure why ;)

But a string cannot start with "alien" and "phalanx" at the same time. Isn't this AND rather an OR?

-geever

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: INV_EquipmentSanityCheck
« Reply #3 on: August 26, 2010, 06:59:02 pm »
only alien* and phalanx* equipment ids should be checked here (equipment.ufo) - stuff like civilian_soldier or whatever they are called should not get checked - but i'm not sure why ;)
I see, hope that does not cause any problems...
but not really a bug then

But a string cannot start with "alien" and "phalanx" at the same time. Isn't this AND rather an OR?
That is confusing it seems to do what it's supposed to  -- will be true when the string does not start with "alien" nor "phalanx" as both comparisions will return non zero

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: INV_EquipmentSanityCheck
« Reply #4 on: August 26, 2010, 07:20:56 pm »
That is confusing it seems to do what it's supposed to  -- will be true when the string does not start with "alien" nor "phalanx" as both comparisions will return non zero

Yeah, I always forget that it returns an index and we use it for boolean checks. My fault, sorry.
(Maybe a macro could help not getting confused on this.)  ;)

-geever

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: INV_EquipmentSanityCheck
« Reply #5 on: August 27, 2010, 01:49:12 am »
Still it might be good to check the civilian* equipments -- you never know who will change the scripts...
But once again not really a bug...

Offline squishles

  • Cannon Fodder
  • **
  • Posts: 2
    • View Profile
Re: INV_EquipmentSanityCheck
« Reply #6 on: August 27, 2010, 04:24:23 am »
Still it might be good to check the civilian* equipments -- you never know who will change the scripts...
But once again not really a bug...


is that civilian packn' heat O.o that might actually be a nifty thing to add like have a few of them with some underpowered pea shooter