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

Function mswin_status_init

win/win32/mswproc.c:2909–2982  ·  view source on GitHub ↗

STATUS_HILITES */ status_init() -- core calls this to notify the window port that a status display is required. The window port should perform the necessary initialization in here, allocate memory, etc. */

Source from the content-addressed store, hash-verified

2907 the necessary initialization in here, allocate memory, etc.
2908*/
2909void
2910mswin_status_init(void)
2911{
2912 logDebug("mswin_status_init()\n");
2913 int ci;
2914
2915 for (int i = 0; i < SIZE(_status_fields); i++) {
2916 mswin_status_field * status_field = &_status_fields[i];
2917 status_field->field_index = i;
2918 status_field->enabled = FALSE;
2919 }
2920
2921 for (int i = 0; i < SIZE(_condition_fields); i++) {
2922 ci = cond_idx[i];
2923 mswin_condition_field * condition_field = &_condition_fields[ci];
2924 nhassert(condition_field->mask == (1 << ci));
2925 condition_field->bit_position = ci;
2926 }
2927
2928 for (int i = 0; i < SIZE(_status_strings); i++) {
2929 mswin_status_string * status_string = &_status_strings[i];
2930 status_string->str = NULL;
2931 }
2932
2933 for (int i = 0; i < SIZE(_condition_strings); i++) {
2934 ci = cond_idx[i];
2935 mswin_status_string * status_string = &_condition_strings[ci];
2936 status_string->str = NULL;
2937 }
2938
2939 for (int lineIndex = 0; lineIndex < SIZE(_status_lines.lines); lineIndex++) {
2940 mswin_status_line * line = &_status_lines.lines[lineIndex];
2941
2942 mswin_status_fields * status_fields = &line->status_fields;
2943 status_fields->count = 0;
2944
2945 mswin_status_strings * status_strings = &line->status_strings;
2946 status_strings->count = 0;
2947
2948 for (int i = 0; i < fieldcounts[lineIndex]; i++) {
2949 int field_index = fieldorders[lineIndex][i];
2950 nhassert(field_index <= SIZE(_status_fields));
2951
2952 nhassert(status_fields->count <= SIZE(status_fields->status_fields));
2953 status_fields->status_fields[status_fields->count++] = &_status_fields[field_index];
2954
2955 nhassert(status_strings->count <= SIZE(status_strings->status_strings));
2956 status_strings->status_strings[status_strings->count++] =
2957 &_status_strings[field_index];
2958
2959 if (field_index == BL_CONDITION) {
2960 for (int j = 0; j < CONDITION_COUNT; j++) {
2961 ci = cond_idx[j];
2962 nhassert(status_strings->count <= SIZE(status_strings->status_strings));
2963 status_strings->status_strings[status_strings->count++] =
2964 &_condition_strings[ci];
2965 }
2966 }

Callers

nothing calls this directly

Calls 1

logDebugFunction · 0.70

Tested by

no test coverage detected