MCPcopy Create free account
hub / github.com/NetHack/NetHack / mswin_status_update

Function mswin_status_update

win/win32/mswproc.c:3113–3216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3111*/
3112
3113DISABLE_WARNING_FORMAT_NONLITERAL
3114
3115void
3116mswin_status_update(int idx, genericptr_t ptr, int chg, int percent,
3117 int color, unsigned long *condmasks)
3118{
3119 long cond, *condptr = (long *) ptr;
3120 char *text = (char *) ptr;
3121 MSNHMsgUpdateStatus update_cmd_data;
3122 int ochar, ci;
3123
3124 logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n",
3125 idx, ptr, chg, percent, color, condmasks);
3126
3127 if (idx >= 0) {
3128
3129 nhassert(idx <= SIZE(_status_fields));
3130 mswin_status_field * status_field = &_status_fields[idx];
3131 nhassert(status_field->field_index == idx);
3132
3133 nhassert(idx <= SIZE(_status_strings));
3134 mswin_status_string * status_string = &_status_strings[idx];
3135
3136 if (!status_field->enabled) {
3137 nhassert(status_string->str == NULL);
3138 return;
3139 }
3140
3141 status_field->color = status_string->color = color & 0xff;
3142 status_field->attribute = status_string->attribute = (color >> 8) & 0xff;
3143
3144 switch (idx) {
3145 case BL_CONDITION: {
3146 mswin_condition_field * condition_field;
3147
3148 nhassert(status_string->str == NULL);
3149
3150 cond = *condptr;
3151
3152 for (int i = 0; i < CONDITION_COUNT; i++) {
3153 ci = cond_idx[i];
3154 condition_field = &_condition_fields[ci];
3155 status_string = &_condition_strings[ci];
3156
3157 if (condition_field->mask & cond) {
3158 status_string->str = condition_field->name;
3159 status_string->space_in_front = TRUE;
3160 status_string->color = mswin_condcolor(condition_field->mask, condmasks);
3161 status_string->attribute = mswin_condattr(condition_field->mask, condmasks);
3162 }
3163 else
3164 status_string->str = NULL;
3165 }
3166 } break;
3167 case BL_GOLD: {
3168 char buf[BUFSZ];
3169 char *p;
3170

Callers

nothing calls this directly

Calls 5

mswin_condcolorFunction · 0.85
mswin_condattrFunction · 0.85
glyph2ttycharFunction · 0.85
logDebugFunction · 0.70
mswin_hwnd_from_winidFunction · 0.70

Tested by

no test coverage detected