MCPcopy Create free account
hub / github.com/TurningWheel/Barony / getEntityHungerInterval

Function getEntityHungerInterval

src/entity.cpp:31372–31452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31370}
31371
31372int getEntityHungerInterval(int player, Entity* my, Stat* myStats, EntityHungerIntervals hungerInterval)
31373{
31374 bool isInsectoidPlayer = false;
31375 bool isAutomatonPlayer = false;
31376 if ( player >= 0 )
31377 {
31378 if ( stats[player]->type == AUTOMATON )
31379 {
31380 isAutomatonPlayer = true;
31381 }
31382 else if ( stats[player]->playerRace == RACE_INSECTOID && stats[player]->stat_appearance == 0 )
31383 {
31384 isInsectoidPlayer = true;
31385 }
31386 }
31387 else if ( my && my->behavior == &actPlayer && myStats )
31388 {
31389 if ( myStats->type == AUTOMATON )
31390 {
31391 isAutomatonPlayer = true;
31392 }
31393 else if ( myStats->playerRace == RACE_INSECTOID && myStats->stat_appearance == 0 )
31394 {
31395 isInsectoidPlayer = true;
31396 }
31397 }
31398 else if ( myStats )
31399 {
31400 for ( int i = 0; i < MAXPLAYERS; ++i )
31401 {
31402 if ( myStats == stats[i] )
31403 {
31404 if ( myStats->type == AUTOMATON )
31405 {
31406 isAutomatonPlayer = true;
31407 }
31408 else if ( myStats->playerRace == RACE_INSECTOID && myStats->stat_appearance == 0 )
31409 {
31410 isInsectoidPlayer = true;
31411 }
31412 break;
31413 }
31414 }
31415 }
31416
31417 if ( isAutomatonPlayer )
31418 {
31419 switch ( hungerInterval )
31420 {
31421 case HUNGER_INTERVAL_OVERSATIATED:
31422 return 5000; // unreachable
31423 case HUNGER_INTERVAL_HUNGRY:
31424 return -1; // unreachable
31425 case HUNGER_INTERVAL_WEAK:
31426 return -1; // unreachable
31427 case HUNGER_INTERVAL_STARVING:
31428 return -1; // unreachable
31429 case HUNGER_INTERVAL_AUTOMATON_CRITICAL:

Callers 9

actItemFunction · 0.85
updateHungerMessagesFunction · 0.85
effectTimesMethod · 0.85
handleEffectsMethod · 0.85
statGetSTRFunction · 0.85
statGetDEXFunction · 0.85
statGetINTFunction · 0.85
statGetPERFunction · 0.85
setCalloutTextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected